GPU: indirect argument buffers back to the common state after execution #1507

Closed
github-bot wants to merge 1 commit from gh-pr/1507/head into gh-pr/1507/base
Owner

@⁠Bladureau on GitHub · 2026-11-24 18:36 UTC · original
Bladureau:fix/indirect-args-common-state → main · +6 −3 · 1 files · 1 commits · closed without merging

What

indirect::done now moves the argument buffer from INDIRECT_ARGUMENT to
COMMON, not to UNORDERED_ACCESS.

Why

Title buffers' host copies are created in COMMON (host.rs) and rely on
implicit promotion and decay: nothing else in the crate transitions them.
The indirect path is the exception. After ExecuteIndirect, done() left
the buffer explicitly in UNORDERED_ACCESS for the rest of the list, so it
could no longer be promoted. The same title buffer also holds vertex data, so
a later IASetVertexBuffers in that list found it in a state that does not
allow vertex reads. With the debug layer on:

D3D12 ERROR: ID3D12CommandQueue1::ExecuteCommandLists: Using IASetVertexBuffers
on Command List (...): Resource state (0x8: D3D12_RESOURCE_STATE_UNORDERED_ACCESS)
of resource (...:'title buffer 0x1c9b0000+0xae00000') (subresource: 0) is invalid
for use as a vertex buffer. [id=538]

Back in COMMON, the list's later uses promote the buffer again, as they do
everywhere else.

Results

These are diagnostics builds on an RTX 4060 Laptop, with VICTORY_D3D12_DEBUG=1
and VICTORY_D3D12_DRED=1, through the first mission's intro:

Run This change id=538 (IASetVertexBuffers) id=527 (barrier before-state)
1 no 125 137
2 yes 0 99
3 (control, warm cache) no 18 31

All of these errors are on the same buffer, so the counts follow how long
each run lasted.

What this does not fix

  • The id=527 errors remain. indirect::bound still assumes the buffer is
    in UNORDERED_ACCESS before its UNORDERED_ACCESS → INDIRECT_ARGUMENT
    transition. 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::transition does for textures. I left
    that out of this PR.
  • The world's GPU hang on this machine is not fixed. The control run
    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 ignored
  • cargo clippy -p victory-gpu --all-targets: clean
  • Live runs as in the table above

🤖 Generated with Claude Code

**@⁠Bladureau** on GitHub · 2026-11-24 18:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/1507) `Bladureau:fix/indirect-args-common-state` → `main` · +6 −3 · 1 files · 1 commits · closed without merging ## What `indirect::done` now moves the argument buffer from `INDIRECT_ARGUMENT` to `COMMON`, not to `UNORDERED_ACCESS`. ## Why Title buffers' host copies are created in `COMMON` (`host.rs`) and rely on implicit promotion and decay: nothing else in the crate transitions them. The indirect path is the exception. After `ExecuteIndirect`, `done()` left the buffer explicitly in `UNORDERED_ACCESS` for the rest of the list, so it could no longer be promoted. The same title buffer also holds vertex data, so a later `IASetVertexBuffers` in that list found it in a state that does not allow vertex reads. With the debug layer on: ``` D3D12 ERROR: ID3D12CommandQueue1::ExecuteCommandLists: Using IASetVertexBuffers on Command List (...): Resource state (0x8: D3D12_RESOURCE_STATE_UNORDERED_ACCESS) of resource (...:'title buffer 0x1c9b0000+0xae00000') (subresource: 0) is invalid for use as a vertex buffer. [id=538] ``` Back in `COMMON`, the list's later uses promote the buffer again, as they do everywhere else. ## Results These are diagnostics builds on an RTX 4060 Laptop, with `VICTORY_D3D12_DEBUG=1` and `VICTORY_D3D12_DRED=1`, through the first mission's intro: | Run | This change | id=538 (`IASetVertexBuffers`) | id=527 (barrier before-state) | |-----|-------------|-------------------------------|-------------------------------| | 1 | no | 125 | 137 | | 2 | yes | **0** | 99 | | 3 (control, warm cache) | no | 18 | 31 | All of these errors are on the same buffer, so the counts follow how long each run lasted. ## What this does not fix * **The id=527 errors remain.** `indirect::bound` still assumes the buffer is in `UNORDERED_ACCESS` before its `UNORDERED_ACCESS → INDIRECT_ARGUMENT` transition. 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::transition` does for textures. I left that out of this PR. * **The world's GPU hang on this machine is not fixed.** The control run 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 ignored * `cargo clippy -p victory-gpu --all-targets`: clean * Live runs as in the table above 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Title buffers' host copies live in the common state and rely on implicit
promotion and decay. indirect::done left the argument buffer in unordered
access for the rest of the list, so a later vertex read of the same title
buffer found it in a state that does not allow it (debug layer id=538).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:34:28 +00:00
github-bot closed this pull request 2026-11-26 04:34:28 +00:00
Author
Owner

@⁠Bladureau on GitHub · 2026-11-24 18:48 UTC · original

Follow-up: #1527 fixes the id=527 errors that this PR leaves (indirect::bound's before-state). It is stacked on this branch.

**@⁠Bladureau** on GitHub · 2026-11-24 18:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/1507#issuecomment-7141171646) Follow-up: #1527 fixes the id=527 errors that this PR leaves (`indirect::bound`'s before-state). It is stacked on this branch.
Author
Owner

@⁠Bladureau on GitHub · 2026-11-24 19:58 UTC · original

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: #334

**@⁠Bladureau** on GitHub · 2026-11-24 19:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/1507#issuecomment-7142861433) 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://git.gtahub.st/github/Marvisak--VIctory/pulls/334

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/Marvisak--VIctory!1507
No description provided.