Skip to content

fix(gpu): transition shadow buffers before VB/IB binding - #1502

Closed
Thomas73737 wants to merge 1 commit into
Marvisak:mainfrom
Thomas73737:fix/shadow-buffer-vb-ib-state
Closed

Thomas73737 wants to merge 1 commit into
Marvisak:mainfrom
Thomas73737:fix/shadow-buffer-vb-ib-state

Conversation

@Thomas73737

Copy link
Copy Markdown

Summary

  • Track host D3D12 state for shadow buffer copies and emit buffer barriers in command list preludes.
  • Transition shadow buffers to VERTEX_AND_CONSTANT_BUFFER / INDEX_BUFFER before IASetVertexBuffers / IASetIndexBuffer.
  • Ensure buffer SRV/UAV descriptor reads transition shadow buffers to SHADER_RESOURCE / UNORDERED_ACCESS.

Why

Issue #445 reports a D3D12 debug-layer validation error where a resource in D3D12_RESOURCE_STATE_UNORDERED_ACCESS is used as a vertex buffer, followed by device removal. Shadow buffer copies previously had no tracked host state/barrier path when bound as VB/IB.

Validation

  • Not validated against game files or Windows/D3D12/WARP in this Linux sandbox.
  • cargo check -p victory-gpu timed out in this sandbox (120s, then 300s); compile not confirmed.

Caveats

Track host state for shadow buffer copies and emit barriers in list preludes. Ensure vertex/index buffer bindings and buffer SRV/UAV descriptor reads use the expected D3D12 buffer states to avoid UAV-to-VB/IB validation errors.
@Thomas73737
Thomas73737 marked this pull request as ready for review November 24, 2026 19:26
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
@Ryanarcx2

Copy link
Copy Markdown

Tested 3f204cd on an RTX 5070 Ti (driver 32.0.16.1742), Windows 11, diag build with VICTORY_D3D12_DEBUG=1, running to the first story cutscene. Compared against main at ffe310e, same machine and route:

Debug-layer message main ffe310e PR 3f204cd
UAV-state resource "invalid for use as a vertex buffer" 162 8,459 (all from DrawIndexedInstanced)
Transition barrier before-state mismatch 199 223
CreateComputeShader: wants wave lane count 64, device max 32 117 116
Shaders that do not translate 443 413

Both runs end in DXGI_ERROR_DEVICE_HUNG (TDR) during the cutscene, which runs at roughly 1.5 to 2.9 fps beforehand. The hang persisted with TdrDelay raised to 10 s on main. On this card the PR does not remove the vertex-buffer state errors, and the count goes up sharply. The wave64 refusals are unchanged either way, so they may be the larger blocker on NVIDIA (#578 / #223).

Happy to run another build.

@Marvisak

Copy link
Copy Markdown
Owner

Automated triage for the maintainers. Closing because another open pull request covers the same change.

See #334. Buffer-copy state transitions as in #334, and by its own description not validated on Windows or any D3D12 device.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

@Marvisak Marvisak closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants