gpu(draw): keep depth-read and mirror shader-read states valid for D3D12 #4512
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!4512
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4511"
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?
@gnostic-snakes on GitHub · 2026-11-30 21:39 UTC · original
gnostic-snakes:fix/d3d12-depth-read-and-mirror-state→main· +983 −861 · 32 files · 14 commits · closed without mergingFixes two D3D12 debug layer message 538 resource-state mismatches observed during a 40-minute diagnostics run with VICTORY_D3D12_DEBUG=1:
1. DrawInstanced: depth buffer left in
Fixes two D3D12 debug layer message 538 state mismatches observed in a 40-minute diagnostics run with VICTORY_D3D12_DEBUG=1: 1. DrawInstanced missing DEPTH_READ (0x20) on depth targets left in NON_PIXEL|PIXEL_SHADER_RESOURCE (0xC0) (1,123,479 occurrences): - Always call list::ensure_state for self.depth in State::prepare_for instead of gating on State::last_depth_state (HostList::transition already skips no-op barriers, while compute dispatches or other passes on the same list can move self.depth to 0xC0 without clearing last_depth_state). - Set TESTED_DEPTH before early_textures in State::bind, and clear targets_synced and last_depth_state on compute dispatches so bound targets are re-synced on the next graphics draw. 2. SetGraphicsRootDescriptorTable missing NON_PIXEL_SHADER_RESOURCE (0x40) after State::mirror_light (267 occurrences): - Transition colour to SHADER_RESOURCE (0xC0) instead of PIXEL_SHADER_RESOURCE (0x80), matching the all-stage DATA_STATIC_WHILE_SET_AT_EXECUTE graphics root descriptor tables.@IRennie74 on GitHub · 2026-11-30 22:39 UTC · original
Overlaps with #4549, which removes the same
last_depth_stategate inprepare_targets(and adds a native regression for it), so the two will conflict. Themirror_lightchange here (0x80 -> 0xC0) is not in #4549 and is worth keeping whichever goes in.Two points on this version:
State::last_depth_stateis written (here, in the compute branch, and at the resets) but never read outside#[cfg(test)]code. That should become afield is never readwarning under-D warnings, currently hidden behind main's existing dead-code errors. Either keep the gate and rely on the newlast_depth_state = 0after a dispatch (that alone fixes the dispatch case), or drop the field.self.targets_synced = falseafter every dispatch re-runsensure_statefor every bound target on the next draw. That is correct, just more work per compute-to-draw switch on the recording threads. It is worth choosing one approach (cache plus invalidation, or always ask the tracker) for both depth and targets.@gnostic-snakes on GitHub · 2026-11-30 23:13 UTC · original
Verified live with a 17-minute gameplay run (diag build with VICTORY_D3D12_DEBUG=1):
@trustno1-coder on GitHub · 2026-12-01 18:39 UTC · original
Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.
Pull request closed