Track host state of buffer copies so compute-written data can be drawn #479

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

@⁠cmyk-ux on GitHub · 2026-11-24 03:51 UTC · original
cmyk-ux:fix/shadow-buffer-states → main · +239 −22 · 3 files · 1 commits · closed without merging

A title buffer's host copy (shadow) is written by shaders through unordered access and read as vertex, index, constant, shader resource and indirect argument data. The host never moved it between those states: the title's own transitions on buffers are dropped (the copy is not the buffer the barrier names; only a UAV barrier is recorded), and every use relied on the copy being promoted from the common state.

When a compute pass wrote a copy and a later draw bound it as vertex data, the copy was still in UNORDERED_ACCESS and the debug layer reported IASetVertexBuffers on a resource in state 0x8 (expected VERTEX_AND_CONSTANT_BUFFER), followed on the 3070 by a device removal during a 32-list submission (issue #445).

HostList now tracks each copy's state per list:

  • vertex, index, root view and table (SRV/UAV/CBV) uses and indirect arguments move the copy to the state they need, with a transition barrier when it is in another one; read states combine, unordered access excludes them, and the uses of one draw or dispatch are settled together (a buffer both read and written by one dispatch ends in unordered access);
  • close() returns every copy to the common state, so each list starts with its copies there whatever an earlier list of the submission did and whatever order the lists were recorded in;
  • the indirect argument clamp uses the same tracking instead of assuming the copy is in unordered access.
**@⁠cmyk-ux** on GitHub · 2026-11-24 03:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/479) `cmyk-ux:fix/shadow-buffer-states` → `main` · +239 −22 · 3 files · 1 commits · closed without merging A title buffer's host copy (shadow) is written by shaders through unordered access and read as vertex, index, constant, shader resource and indirect argument data. The host never moved it between those states: the title's own transitions on buffers are dropped (the copy is not the buffer the barrier names; only a UAV barrier is recorded), and every use relied on the copy being promoted from the common state. When a compute pass wrote a copy and a later draw bound it as vertex data, the copy was still in UNORDERED_ACCESS and the debug layer reported IASetVertexBuffers on a resource in state 0x8 (expected VERTEX_AND_CONSTANT_BUFFER), followed on the 3070 by a device removal during a 32-list submission (issue #445). HostList now tracks each copy's state per list: - vertex, index, root view and table (SRV/UAV/CBV) uses and indirect arguments move the copy to the state they need, with a transition barrier when it is in another one; read states combine, unordered access excludes them, and the uses of one draw or dispatch are settled together (a buffer both read and written by one dispatch ends in unordered access); - close() returns every copy to the common state, so each list starts with its copies there whatever an earlier list of the submission did and whatever order the lists were recorded in; - the indirect argument clamp uses the same tracking instead of assuming the copy is in unordered access.
A title buffer's host copy (shadow) is written by shaders through
unordered access and read as vertex, index, constant, shader resource
and indirect argument data. The host never moved it between those
states: the title's own transitions on buffers are dropped (the copy is
not the buffer the barrier names; only a UAV barrier is recorded), and
every use relied on the copy being promoted from the common state.

When a compute pass wrote a copy and a later draw bound it as vertex
data, the copy was still in UNORDERED_ACCESS and the debug layer
reported IASetVertexBuffers on a resource in state 0x8 (expected
VERTEX_AND_CONSTANT_BUFFER), followed on the 3070 by a device removal
during a 32-list submission (issue #445).

HostList now tracks each copy's state per list:
- vertex, index, root view and table (SRV/UAV/CBV) uses and indirect
  arguments move the copy to the state they need, with a transition
  barrier when it is in another one; read states combine, unordered
  access excludes them, and the uses of one draw or dispatch are
  settled together (a buffer both read and written by one dispatch ends
  in unordered access);
- close() returns every copy to the common state, so each list starts
  with its copies there whatever an earlier list of the submission did
  and whatever order the lists were recorded in;
- the indirect argument clamp uses the same tracking instead of
  assuming the copy is in unordered access.

Not compiled or run in the authoring environment (no Windows toolchain
or GPU): the state arithmetic has unit tests, the recording needs a run
with the debug layer on.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SLhKF933PgnpHpBqWx7S2M
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:05:28 +00:00
github-bot closed this pull request 2026-11-26 04:05:28 +00:00

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!479
No description provided.