fix(gpu): resolve D3D12 error 538 in buffer comparisons #1
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!1
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@jeremygold02 on GitHub · 2026-11-26 06:59 UTC · original
jeremygold02:codex/d3d12-buffer-compare-state-decay→main· +11 −5 · 1 files · 1 commits · merged 2026-11-26 14:09 UTCProblem
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.@LucaruluDev on GitHub · 2026-11-26 10:55 UTC · original
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?
@jeremygold02 on GitHub · 2026-11-26 14:45 UTC · original
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.
@LucaruluDev on GitHub · 2026-11-26 14:53 UTC · original
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.
@LucaruluDev on GitHub · 2026-11-26 17:29 UTC · original
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?