GPU: snapshot RTV and DSV descriptors across command-list cuts #3217
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!3217
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3217"
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-26 13:31 UTC · original
fuzeofficlal:fix/gpu-cut-snapshot-targets→main· +749 −18 · 1 files · 1 commits · openSummary
Snapshot resolved render-target and depth-stencil view descriptors at
OMSetRenderTargetscall time so mid-list segment cuts (Wait32BitValueX/Wait64BitValueX->State::cut) replay the originally bound targets instead of re-reading guest CPU descriptor heap memory.Problem
In D3D12,
OMSetRenderTargetssnapshots CPU-only RTV and DSV descriptors when the command is recorded; a title is allowed to immediately overwrite those CPU descriptor slots for later passes or release transient CPU RTV/DSV descriptor heaps right after the call.Previously,
Fixed::targetsincrates/victory-gpu/src/draw.rsstored only the raw guest CPU descriptor handle addresses (Option<(Vec<u64>, u64)>), andState::cutre-invokedState::set_targetswith those handles when starting a new host command-list segment. As a result, a legal command list that overwrote or freed its CPU RTV/DSV descriptors before a mid-listWait32BitValueX/Wait64BitValueX:Fix
Fixed::targetswith snapshottedTargetsstoring each boundTarget<D>(resourcepointer and resolvedD3D12_RENDER_TARGET_VIEW_DESC/D3D12_DEPTH_STENCIL_VIEW_DESC).State::bind_targetsshared byState::set_targetsandState::cut, preserving the snapshot across multiple consecutive cuts without re-reading guest CPU descriptor heap memory.crates/victory-gpu/src/draw.rscovering:LESSdepth test), and explicitTexture2DArrayslice view descriptors across one and two consecutiveWait64BitValueXcuts.Wait64BitValueXcut, plus explicit unbinding (0targets, null depth) before a cut.Verification
main(Segment 1 misses the snapshotted render target after CPU descriptor overwrite or transient heap release) and pass after the fix.cargo test --locked -p victory-gpu --lib cut_preserves_ -- --nocapture --test-threads=1(RTX 5090 default, RTX 5090--features diagnostics+VICTORY_D3D12_DEBUG=1, and WARPVICTORY_D3D12_WARP=1+VICTORY_D3D12_DEBUG=1): 2 passed, 0 failed across all three configurations.victory-gpu --libsuite passed on RTX 5090 default (231 passed), RTX 5090 diagnostics + Debug Layer (245 passed), and WARP + Debug Layer (245 passed).cargo clippy --workspace --all-targets --locked -- -D warningsand--all-features: clean.git diff --check,rustfmt --edition 2024 --checkon modified hunks, andcargo run --locked -p xtask -- policy: clean (191 files ok).@Dukestar69 on GitHub · 2026-11-26 13:52 UTC · original · approved these changes
Verified on RTX 5090 & WARP against
origin/main(63bcca4):cargo test -p victory-gpu --lib draw:: -- --test-threads=1: 22/22 passed on RTX 5090 and WARP (includingcut_preserves_snapshotted_targets_after_cpu_descriptor_overwriteandcut_preserves_targets_after_cpu_descriptor_heaps_released_and_handles_unbind).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly snapshots RTV and DSV descriptors across command-list cuts so subsequent CPU descriptor overwrites or heap releases do not corrupt bound targets.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@oni-swr on GitHub · 2026-11-26 14:05 UTC · original
WARP test report: head
bb003dd4(parent and control base: main63bcca43)VICTORY_WARP=1,VICTORY_D3D12_WARP=1,cargo test -j 4 -p victory-gpu --features diagnostics --lib, rustc 1.98.1, Windows 11,dxil.dllfrom the Windows SDK 10.0.26100.0.draw::tests::cut_preserves_snapshotted_targets_after_cpu_descriptor_overwriteanddraw::tests::cut_preserves_targets_after_cpu_descriptor_heaps_released_and_handles_unbindboth pass. The wholevictory-gpulib suite passes: 249 passed (248 plus the probe), 0 failed, 1 ignored.draw.rscode with this PR's test module. Both new tests fail, each with a wrong texel read back from the render target:Segment 1 must still draw into snapshotted rt_a after rtv_slot was overwrittenandSegment 1 must still draw into rt after transient CPU RTV/DSV heaps were released(left 4294901760, right 4278190335).AI-assisted: verification by Claude Code (Claude Sonnet 5.5).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.