GPU: rebind compute view-mark root descriptors after depth-twin conversion #2155
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2155
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2155/head"
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?
@fuzeofficlal on GitHub · 2026-11-25 06:24 UTC · original
fuzeofficlal:fix/gpu-rebind-compute-view-marks→main· +212 −2 · 2 files · 1 commits · merged 2026-11-25 21:54 UTCProblem
State::bind(crates/victory-gpu/src/draw.rs) bindsp.marks(VIEW_MARKSroot SRV andVIEW_WRITESroot UAV) before iterating overp.stages. When a compute shader's descriptor table references a 16-bit depth texture whose writable twin was written earlier,State::tablestransitions the texture viaTwin::copy, whose computeconverter()replaces the command list's compute root signature and setsneed_rebind.The subsequent
if list.take_rebind()block restoresSetComputeRootSignature(&p.root)andSetPipelineState(&p.pso)(invalidating all previously bound compute root parameters per D3D12 rules), while only per-stage root arguments are bound below it — leavingVIEW_MARKSandVIEW_WRITESunbound for the dispatch.Changes
SetComputeRootShaderResourceViewandSetComputeRootUnorderedAccessViewforp.marksimmediately afterSetComputeRootSignature(&p.root)insideif list.take_rebind().draw::tests::compute_view_marks_rebind_after_depth_twin_conversion: writes a 16-bit depth twin (format = 118), binds aview_marks = truecomputeHostPipelinereading that depth SRV (triggeringTwin::copyandtake_rebind) and writing page1of a trackedShadowbuffer, verifying zero D3D12 Debug Layer errors andcopy_back_markswriteback across RTX 5090, AMD Radeon Graphics, and D3D12 WARP.@Marvisak on GitHub · 2026-11-25 11:26 UTC · original
Automated triage for the maintainers.
Merge candidate.
The bug is real. On
main,State::bind(crates/victory-gpu/src/draw.rs) binds thep.marksroot SRV and UAV before the per-stage loop. Whenself.tablesmakes a depth texture readable viaTwin::copy, the twin's compute converter swaps the root signature. Thelist.take_rebind()branch then callsSetComputeRootSignature(&p.root)again, which clears every root argument bound before it, and only the per-stage arguments are rebound below. So a compute dispatch that marks its view writes ran withVIEW_MARKS/VIEW_WRITESunbound. The fix keeps the mark addresses from the first bind and sets them again right afterSetComputeRootSignaturein that branch. The graphics path doesn't need it, because there the root signature is not reset.The new test
compute_view_marks_rebind_after_depth_twin_conversioncovers the real path:view_markscompute pipeline that reads it, checking throughtwin::COPIESthat the conversion ran.copy_back_marks.The test is long, but every part of it is needed to reach this branch.
Shader::for_testis test-only. CI is passing (check), and the PR merges cleanly.Generated by Claude Code