GPU: indirect argument buffers back to the common state after execution #1506
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1507"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by Bladureau on 2026-11-24T18:36:39Z.
What
indirect::donenow moves the argument buffer fromINDIRECT_ARGUMENTtoCOMMON, not toUNORDERED_ACCESS.Why
Title buffers' host copies are created in
COMMON(host.rs) and rely onimplicit promotion and decay: nothing else in the crate transitions them.
The indirect path is the exception. After
ExecuteIndirect,done()leftthe buffer explicitly in
UNORDERED_ACCESSfor the rest of the list, so itcould no longer be promoted. The same title buffer also holds vertex data, so
a later
IASetVertexBuffersin that list found it in a state that does notallow vertex reads. With the debug layer on:
Back in
COMMON, the list's later uses promote the buffer again, as they doeverywhere else.
Results
These are diagnostics builds on an RTX 4060 Laptop, with
VICTORY_D3D12_DEBUG=1and
VICTORY_D3D12_DRED=1, through the first mission's intro:IASetVertexBuffers)All of these errors are on the same buffer, so the counts follow how long
each run lasted.
What this does not fix
indirect::boundstill assumes the buffer isin
UNORDERED_ACCESSbefore itsUNORDERED_ACCESS → INDIRECT_ARGUMENTtransition. If the list has already promoted the buffer to a read state
(vertex data), that before-state is wrong. Fixing it needs per-list state
tracking for buffers, like
HostList::transitiondoes for textures. I leftthat out of this PR.
shows this change is not what triggers it: the hang comes at a different
point each run, with or without the change. See the NVIDIA test report, #1508.
Testing
cargo test -p victory-gpu: 50 passed, 1 ignoredcargo clippy -p victory-gpu --all-targets: clean🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-24T18:36:51Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Imported from Marvisak/VIctory. Originally posted by Bladureau on 2026-11-24T18:48:09Z.
Follow-up: #1527 fixes the id=527 errors that this PR leaves (
indirect::bound's before-state). It is stacked on this branch.Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T19:46:04Z.
Review: APPROVED
Tested
f77bd04on Windows 11, RTX 5070, MSVC: builds,cargo test --workspace --no-fail-fast612 passed, 0 failed (on our fork main).COMMONand rely on promotion.doneleaving the buffer explicitly inUNORDERED_ACCESSmeant a laterIASetVertexBuffersor SRV read of the same buffer in that list found it in a state that state promotion can't move out of.ExecuteIndirectin the same list still works.boundruns its clamp dispatch through a root UAV on that buffer before its explicitUNORDERED_ACCESS → INDIRECT_ARGUMENTbarrier, and that dispatch promotes the buffer fromCOMMONtoUNORDERED_ACCESS.VICTORY_D3D12_DEBUG=1, would have caught the old state error.Merged into our fork's main.
AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by Bladureau on 2026-11-24T19:58:19Z.
Closing in favour of #334, which fixes the same debug-layer errors (ids 527 and 538) more completely: it also tracks shader writes and table views, and has a debug-layer test. On this RTX 4060 Laptop, #334 with #578 gives 0 of each in the title: https://github.com/Marvisak/VIctory/pull/334#issuecomment-7142860514
Pull request closed