GPU: snapshot RTV and DSV descriptors across command-list cuts #3215
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T13:31:12Z.
Summary
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).Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T13:52:46Z.
Review: APPROVED
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).
Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-26T14:05:01Z.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.