fix(gpu): resolve D3D12 error 538 in buffer comparisons #1
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by jeremygold02 on 2026-11-26T06:59:19Z.
Problem
The host appends its GPU buffer-comparison command list to the title's command lists. A title list can leave a buffer implicitly promoted to
COPY_DEST. The comparison reads that buffer as a shader resource while it is still in the copy-destination state, triggering Direct3D 12 debug-layer error 538.Buffers can decay to
COMMONwhen the work from anExecuteCommandListscall completes. Command lists submitted together share that boundary. Microsoft Learn: Resource state decay to commonChange
ExecuteCommandListscall on the same queue, after the title's lists and before signaling the existing fence.Test setup
Verification
Built a clean Windows diagnostics checkpoint containing this fix with
cargo build --offline --locked --target-dir target --jobs 2 --profile diag -p victory --features diagnostics. Ran both NVIDIA launcher presets withVICTORY_D3D12_DEBUG=1.Both validation runs used the integrated local checkpoint. This PR contains only the buffer-comparison change in
crates/victory-gpu/src/host.rs. Frame-rate impact was outside the scope of these checks.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by LucaruluDev on 2026-11-26T10:55:12Z.
I reviewed this PR against the D3D12 resource state promotion and decay rules, and the separate ExecuteCommandLists submission appears consistent with the documented behavior.
One observation: moving the comparison submission also appears to change the scope of the VICTORY_TIMELINE and VICTORY_CARD_SPANS diagnostics, as their end markers now precede the comparison.
Was this change intentional?
I also noticed that the existing tests do not appear to cover the original resource-state transition scenario. Would a standalone synthetic regression test be a useful follow-up contribution?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by jeremygold02 on 2026-11-26T14:45:41Z.
Thanks for catching this, @LucaruluDev. The separate queue call was intentional for resource-state decay. The narrower timing scope was a side effect I missed.
I opened PR #3 to put both end markers after the comparison while keeping the separate call and the existing fence.
A standalone debug-layer regression test would be a useful follow-up. If you're still interested, I'd welcome a fixture that compares the same buffer write/read sequence with one queue call versus two and checks for error 538.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by LucaruluDev on 2026-11-26T14:53:16Z.
Thanks for the follow-up and for addressing the timing issue! I'm still interested in the standalone regression test. I'll look into it and share the results if I can get a reliable reproduction.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by LucaruluDev on 2026-11-26T17:29:12Z.
I finished the standalone regression fixture and successfully reproduced error 538 on both WARP and an RTX 5070.
Results on both adapters:
All six cases completed their fence successfully.
The fixture uses synthetic buffer copies without shaders, reproducing the resource-state issue independently of VIctory's specific shader path.
Would you prefer a standalone fixture or integration into the existing test suite?
Update: The standalone fixture is now publicly available:
https://github.com/LucaruluDev/d3d12-buffer-state-decay
The repository includes the C++17 source, WARP reproduction instructions, an explicit-barrier control, archived results from WARP and RTX 5070, and debug-layer diagnostics.
The reproduction is independent of VIctory and uses only synthetic buffer copies on a DIRECT queue. Its coverage is limited to the buffer-copy path.
Released under the MIT license.