Descriptor: accept the console's unbounded sampler heap #1643

Closed
github-bot wants to merge 1 commit from github-bot/gh-1643 into main AGit
Owner

@⁠Shad0wrend on GitHub · 2026-11-28 22:54 UTC · original
Shad0wrend:console/unbounded-sampler-heap → main · +33 −6 · 1 files · 1 commits · closed without merging

What

The GDK defines D3D12XBOX_DESCRIPTOR_HEAP_TYPE_SAMPLER_UNBOUNDED (heap type 4): a shader-visible sampler heap with a limited set of border colours. The layer rejected it — increment(4) returned 0, so GetDescriptorHandleIncrementSize returned 0 and CreateDescriptorHeap returned E_INVALIDARG — so sampler bindings that use a bindless/unbounded heap were lost.

  • increment now gives type 4 the same 16-byte stride as an ordinary sampler heap.
  • Heap::samplers() and both shader-visible checks treat type 4 as a sampler heap, so writes are mirrored into a host sampler heap and handles/indexing use the right stride.

Validation

  • cargo test --release --locked -p victory -p victory-gpu -p victory-hle — green (29 + 2 + 551 + 199 + 1 tests, 0 failures). New test unbounded_sampler_heaps_use_the_sampler_stride checks the stride, heap creation, sampler classification and handle arithmetic; all 13 descriptor tests pass.
  • cargo clippy --release -p victory-gpu --all-targets --locked -- -D warnings with pre-existing upstream lints allowed — clean.
  • cargo run --release --quiet -p xtask -- policy --staged — 1 file ok.

No game paths, logs or binaries are included.

**@⁠Shad0wrend** on GitHub · 2026-11-28 22:54 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1643) `Shad0wrend:console/unbounded-sampler-heap` → `main` · +33 −6 · 1 files · 1 commits · closed without merging ## What The GDK defines `D3D12XBOX_DESCRIPTOR_HEAP_TYPE_SAMPLER_UNBOUNDED` (heap type 4): a shader-visible sampler heap with a limited set of border colours. The layer rejected it — `increment(4)` returned 0, so `GetDescriptorHandleIncrementSize` returned 0 and `CreateDescriptorHeap` returned `E_INVALIDARG` — so sampler bindings that use a bindless/unbounded heap were lost. - `increment` now gives type 4 the same 16-byte stride as an ordinary sampler heap. - `Heap::samplers()` and both shader-visible checks treat type 4 as a sampler heap, so writes are mirrored into a host sampler heap and handles/indexing use the right stride. ## Validation - `cargo test --release --locked -p victory -p victory-gpu -p victory-hle` — green (29 + 2 + 551 + 199 + 1 tests, 0 failures). New test `unbounded_sampler_heaps_use_the_sampler_stride` checks the stride, heap creation, sampler classification and handle arithmetic; all 13 descriptor tests pass. - `cargo clippy --release -p victory-gpu --all-targets --locked -- -D warnings` with pre-existing upstream lints allowed — clean. - `cargo run --release --quiet -p xtask -- policy --staged` — 1 file ok. No game paths, logs or binaries are included.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 22:57:35 +00:00
Author
Owner

@⁠babuakhil on GitHub · 2026-11-28 23:23 UTC · original

Checked on NVIDIA: Windows 11, RTX 3060, Rust 1.98.1 (pinned), applied on current main (d4b5d51); cherry-picks cleanly. Clippy reports nothing in descriptor.rs (the crate's other 2 errors are on main already), all 13 descriptor::tests pass including unbounded_sampler_heaps_use_the_sampler_stride, and cargo test -p victory-gpu --lib passed 551/551 in one run and had one watch::tests failure in the other, a test that fails now and then on main too.

The host heap is made from samplers() as D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, and every other heap-kind check (draw.rs included) goes through samplers(), so type 4 is covered everywhere.

Before and after, from a throwaway test (not part of this PR) that creates shader-visible heaps and asks for the host heap on the RTX 3060:

heap main this PR
increment_size(4) 0 16
type 4, 8 / 2048 / 2049 samplers create fails, E_INVALIDARG created, host heap made, handle(3) at start + 48
type 4, 4096 / 65536 samplers create fails created, host heap not made

So it fixes what it says. One thing to keep in mind, not caused by this PR: the host heap behind a large sampler heap fails here. On main, an ordinary sampler heap (type 1) gets its host heap at 4000 samplers and not at 4095, 4096 or 65536; type 4 now hits the same limit, which comes from this driver. When that happens HostHeap::new_with logs no host descriptor heap and the title's samplers in that heap aren't mirrored. Since an unbounded heap is presumably the kind a title makes large, it may be worth a louder message, or a note in the code, for when the console count goes over what the host allows.

**@⁠babuakhil** on GitHub · 2026-11-28 23:23 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1643#issuecomment-7247394031) Checked on NVIDIA: Windows 11, RTX 3060, Rust 1.98.1 (pinned), applied on current `main` (`d4b5d51`); cherry-picks cleanly. Clippy reports nothing in `descriptor.rs` (the crate's other 2 errors are on `main` already), all 13 `descriptor::tests` pass including `unbounded_sampler_heaps_use_the_sampler_stride`, and `cargo test -p victory-gpu --lib` passed 551/551 in one run and had one `watch::tests` failure in the other, a test that fails now and then on `main` too. The host heap is made from `samplers()` as `D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER`, and every other heap-kind check (`draw.rs` included) goes through `samplers()`, so type 4 is covered everywhere. **Before and after**, from a throwaway test (not part of this PR) that creates shader-visible heaps and asks for the host heap on the RTX 3060: | heap | `main` | this PR | |---|---|---| | `increment_size(4)` | 0 | 16 | | type 4, 8 / 2048 / 2049 samplers | `create` fails, `E_INVALIDARG` | created, host heap made, `handle(3)` at `start + 48` | | type 4, 4096 / 65536 samplers | `create` fails | created, **host heap not made** | So it fixes what it says. One thing to keep in mind, not caused by this PR: the host heap behind a large sampler heap fails here. On `main`, an ordinary sampler heap (type 1) gets its host heap at 4000 samplers and not at 4095, 4096 or 65536; type 4 now hits the same limit, which comes from this driver. When that happens `HostHeap::new_with` logs `no host descriptor heap` and the title's samplers in that heap aren't mirrored. Since an unbounded heap is presumably the kind a title makes large, it may be worth a louder message, or a note in the code, for when the console count goes over what the host allows.
github-bot force-pushed github-bot/gh-1643 from 6bc28d465b to 74f539b1e9 2026-11-29 00:39:31 +00:00 Compare
github-bot closed this pull request 2026-11-29 01:40:29 +00:00
Author
Owner

@⁠Shad0wrend on GitHub · 2026-11-29 01:39 UTC · original

Closing per maintainer request; not pursuing these changes.

**@⁠Shad0wrend** on GitHub · 2026-11-29 01:39 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1643#issuecomment-7248931526) Closing per maintainer request; not pursuing these changes.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!1643
No description provided.