GPU: keep bound render and depth targets alive on command lists #2542
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!2542
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2542"
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-29 14:02 UTC · original
fuzeofficlal:fix/gpu-keep-render-targets-on-list→main· +158 −2 · 1 files · 1 commits · merged 2026-11-30 14:12 UTCSummary
BoundTargets::restore(called by bothState::set_targetsandState::replay) creates host RTV/DSV descriptors from each target'sID3D12Resourceand recordsOMSetRenderTargetsdirectly onto the host command list without retaining those textures viaHostList::keep.HostList::transitiononly runs later inState::prepare_forwhen a draw executes. If a title binds render or depth targets, switches targets (replacingState.host_targets) or drops draws without drawing to them, and releases the title resources before submission, the hostID3D12Resourcecan be destroyed (for example whenVICTORY_BURY_LAG=0or afterbury_lag()other submissions drain) while still referenced by the recorded command list. Under the D3D12 debug layer,ID3D12CommandList::Closefails with a deleted-resource error.Fix
list.keep(texture)for each bound render target and depth target insideBoundTargets::restore(crates/victory-gpu/src/draw.rs), covering bothState::set_targetsandState::replayafter segment cuts/internal passes so the host command list holds a COM reference untilHostList::reset.draw::tests::render_and_depth_targets_stay_alive_until_list_resetverifying both zero D3D12 debug layer errors after releasing targets beforeClose/Executeand exact COM refcount retention (+1 across target switch, -1 onHostList::reset).Verification
VICTORY_D3D12_DEBUG=1 cargo test --locked -p victory-gpu --lib draw::tests::render_and_depth_targets_stay_alive_until_list_reset— passed on RTX 5090 (default andVICTORY_BURY_LAG=0) and WARP (VICTORY_D3D12_WARP=1 VICTORY_BURY_LAG=0).cargo clippy --locked -p victory-gpu --tests— 0 warnings indraw.rs.cargo run --quiet --locked -p xtask -- policy --staged— passed.