Repository navigation
GPU: a list that binds no view heap gets ours before the root signature (#2894) - #2896
BastienRodz wants to merge 2 commits into
Conversation
Marvisak#1778 made the sampler heap we bind when the title binds none SAMPLERS_OURS = usize::MAX. Our view heap for title memory, MEMORY_HEAP (memory::OURS), is usize::MAX too, and host_state_lost marks the host list's heaps unknown with [usize::MAX; 2]. A draw or dispatch that wants both of ours (the title binds no heap, its shaders use title memory or root views) then wants exactly that marker, so bind_heaps found nothing to change: after a cut at a Wait32/64BitValueX the new host list starts with no heaps and none were set before the root signature, which indexes both directly (SetDescriptorHeaps must come first: the debug layer's 1419, INVALID_CALL on NVIDIA); after external::record the heaps of the other recorder stayed bound. Before Marvisak#1778 such a list wanted [usize::MAX, 0]. SAMPLERS_OURS is now usize::MAX - 1, which neither a title heap nor the marker takes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fuzeofficlal
left a comment
There was a problem hiding this comment.
Verified head fbf3a5be (stacked on #2882) cleanly on top of origin/main (842b0cb7) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + D3D12 WARP + VICTORY_D3D12_DEBUG=1).
Code Review
- Builds cleanly on
#2882's sentinel fix (SAMPLERS_OURS = usize::MAX - 1): changingState::wantedto returnMEMORY_HEAPwhenmemory_heap || title[0] == 0and relaxingbind_heapsto bind our view heap wheneverwant[0] == MEMORY_HEAPensuresSetDescriptorHeapsprecedesSetGraphicsRootSignature/SetComputeRootSignatureeven when a list binds no view heap, and interacts cleanly withState::cut()/host_state_lost(). - Minor suggestion (non-blocking):
a_list_without_a_view_heap_gets_ourscurrently assertsState::wantedonly; an end-to-end test binding a root signature withVICTORY_D3D12_DEBUG=1on a list with no title view heap would guard the D3D12 call sequence directly. (Also note merge dependency on#2882.)
Local Verification
cargo test --locked -p victory-gpu --features diagnostics draw::tests: 22/22 passed on RTX 5090 withVICTORY_D3D12_DEBUG=1and 22/22 passed on WARP withVICTORY_D3D12_DEBUG=1.cargo clippy --locked -p victory-gpu --tests -- -D warnings: clean.cargo xtask policy:191 files ok.
Looks good.
kotekompotek
left a comment
There was a problem hiding this comment.
Correct extension of #2882's logic: a list whose shaders read neither title memory nor root views binds no title view heap, but its signature still declares view indexing — binding ours (MEMORY_HEAP) keeps the D3D12 rule that removed devices on NVIDIA (id 1419). Using want[0] == MEMORY_HEAP for the heap insertion is consistent with the new predicate. LGTM.
|
Tested on Windows 10 22H2 (19045), NVIDIA RTX 5070 (driver 32.0.16.1742), diagnostics build with
Not tested: a world run with the two PRs; AMD. |
|
I prepared an end-to-end test for the heap-binding review suggestion in a7867ad, directly on The test records D3D12 compute work using VIctory's heap binding and list-cut state. The root signature declares both directly indexed heaps. The shader copies a word from the fallback view heap to a mapped output buffer. The test covers a fresh list and a new segment, both with and without the title-memory flag. It uses the Windows D3D compiler and synthetic inputs.
The local D3D12 debug interface returned If you take the test, please preserve its Git author on cherry-pick. If you fold it into your commit, please include |
Every root signature we make indexes both heaps directly (CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED | SAMPLER_HEAP_DIRECTLY_INDEXED), and the SM 6.6 spec has SetDescriptorHeaps pass "the corresponding heaps" before such a signature is set. Marvisak#1778 made bind_heaps bind a sampler heap of ours when the title binds none, but the view half still bound ours only when the shaders read title memory or root views: a list with no view heap whose shaders read only constants set the signature with no view heap bound (State::wanted([0, 0], false) == [0, SAMPLERS_OURS]). Such a list now gets our view heap (crate::memory::heap) as well, which root views and the write-mark table already use when the title binds none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thank you for writing this; an executed readback is the right kind of evidence. Before taking it, I ran it on GitHub's
So on that WARP the fallback view reads Because of that I'm leaving the PR with its unit test and @wilu222's debug-layer runs (id 1419 on |
fbf3a5b to
26b7532
Compare
|
I checked the DLLs actually loaded by the test. My failing baseline used the app-local WARP redistributable, I repeated the same binaries with that Agility Core and the system So the difference I reported is specific to the WARP runtime. Your CI result and the debug-layer evidence are consistent with that. |
|
Thanks for pinning it down. That explains both results: the readback discriminates on the WARP redistributable (1.0.22) and not on the system WARP or I've added your result, with the versions, to the PR description as executed evidence next to @wilu222's debug-layer runs. I'm keeping the test itself out, since in most runners it would pass on |
|
Automated triage for the maintainers. Merge candidate. CI: passing. Generated by Claude Code |
Dukestar69
left a comment
There was a problem hiding this comment.
Tested locally merged onto origin/main (63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP):
- Diff review: Binding
MEMORY_HEAPwhentitle[0] == 0inState::wanted/bind_heapsand shiftingSAMPLERS_OURStousize::MAX - 1(so[MEMORY_HEAP, SAMPLERS_OURS]cannot collide withhost_state_lost's[usize::MAX; 2]sentinel) cleanly fixes #2894 and ensures heaps are always rebound after a segment cut. cargo test -p victory-gpu draw::tests -- --test-threads=1(RTX 5090 & WARP): 22 passed, 0 failed on both (includingheaps_are_bound_again_after_the_host_state_is_lostanda_list_without_a_view_heap_gets_ours).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
…fore the root signature (Marvisak#2894)
Stacked on #2882. The first commit (
00d163a) is #2882; this PR's change is the second (fbf3a5b). Without #2882, a list that binds no heap of either kind would want[usize::MAX, usize::MAX], the lost-state marker #2882 separatesSAMPLERS_OURSfrom. Merge #2882 first.What's wrong
Every root signature the host makes indexes both heaps directly (
pipeline/host.rs). SM 6.6 Dynamic Resources: "SetDescriptorHeaps must be called, passing the corresponding heaps, before a call to SetGraphicsRootSignature or SetComputeRootSignature that uses either CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED or SAMPLER_HEAP_DIRECTLY_INDEXED flags."#1778 binds a sampler heap of ours when the title binds none. Its doc comment says "ours for a kind it binds none of", but the view heap was ours only when shaders read title memory or root views. A list that binds no view heap and runs shaders reading only constants wanted
[0, SAMPLERS_OURS]. Its root signature was set with no view heap bound: the debug layer's id 1419, whose sampler half removed the device on NVIDIA in #1754.What the fix does
State::wantedgives a list that binds no view heap ours (MEMORY_HEAP), as it already does for samplers.bind_heapsbinds our heap whenever it is the one wanted.root_viewand the write-mark table already use that heap when the title binds no view heap, so what is bound now matches what they use.Tests
New
draw::tests::a_list_without_a_view_heap_gets_ourschecks[0, 0]→[MEMORY_HEAP, SAMPLERS_OURS]and[0, 0x20]→[MEMORY_HEAP, 0x20], and that a title view heap stays. It needs no device.[0, 18446744073709551615].a_list_without_a_sampler_heap_gets_oursand GPU: heaps are bound again after a cut when ours stand in for both kinds (#2881) #2882'sheaps_are_bound_again_after_the_host_state_is_lostpass too.The
draw::,list::,descriptor::,bindless::,twin::andmemory::tests were run one per process under Wine and vkd3d-proton, against #2882's head and against this one. The results are identical except for the new test (38 ok, 23 failed with it; the failures are the same Wine host failures on both).cargo clippy --workspace --all-targets --locked -- -D warningsis clean.Executed evidence from the thread:
VICTORY_D3D12_DEBUG=1): the debug layer's id 1419 shows onmainabout 4 s after start, and not at all with GPU: heaps are bound again after a cut when ours stand in for both kinds (#2881) #2882 and this PR.d3d10warp.dll1.0.22,mainleaves the output sentinel in place and this PR reads the value. With the system WARP 10.0.19041 and on GitHub'swindows-latest, it reads the value on both trees, so the test does not discriminate everywhere.Not tested
On Windows hardware or in game. How often a title draws with no view heap bound is not measured.
#411 avoids the requirement another way, by deriving the signature's flags from the shaders. If it lands, this becomes unnecessary.
Fixes #2894
No game data. Found and written with AI assistance (Claude Code), reviewed and run locally.
🤖 Generated with Claude Code