GPU: keep bound render and depth targets alive on command lists #3128
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!3128
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3128"
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 09:18 UTC · original
fuzeofficlal:fix/gpu-keep-render-targets-on-list→main· +154 −0 · 1 files · 1 commits · openSummary
State::set_targetscreates host RTV/DSV descriptors from each target'sID3D12Resourceand immediately recordsOMSetRenderTargetsonto the host command list, without callingHostList::keepon those textures.HostList::transition(which retainsArc<HostTexture>inHostList::states) only runs later inState::prepare_forwhen a draw executes. If a title binds render or depth targets, does not draw to them on that list (for example, after a dropped draw or a subsequentOMSetRenderTargetscall), and releases the resources before submission, the hostID3D12Resourceis destroyed 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 inState::set_targets(crates/victory-gpu/src/draw.rs), holding a COM reference untilHostList::reset.draw::tests::render_and_depth_targets_stay_alive_until_list_resetverifying both:mainatID3D12CommandList::Closewith a deleted-resource error).HostList::reset(also fails onmainwithout the debug layer).Verification
VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --lib --locked -- --test-threads=1 draw::(hardware GPU &VICTORY_D3D12_WARP=1): 21 passed, 0 failed.victory-gpuunit suite on hardware GPU andVICTORY_D3D12_WARP=1(default and--features diagnosticswithVICTORY_D3D12_DEBUG=1).cargo clippy --workspace --all-targets --locked -- -D warnings&--all-features: clean.cargo test -p xtask --locked policy::tests::repository_passes_policy: passed.@smaxxey on GitHub · 2026-11-26 10:13 UTC · original
Ran this on an RTX 4060 Laptop GPU (Ada, 8 GB, driver 32.0.16.1742), Windows 11 26300, Rust 1.98.1. No game files. Head
5f8111amerged locally ontomain63bcca4.draw::tests::render_and_depth_targets_stay_alive_until_list_resetpasses on the hardware device.cargo test -p victory-gpu --lib --locked: 230 passed, 2 failed, same asmain63bcca4on this card: only the two NVIDIA failures of #1835 (descriptor::host::tests::dynamic_slots_are_held_until_released,memory::tests::lists_share_a_table_and_copies_keep_their_views), nothing new.What bites in a plain test run is part 2, the COM reference counts. Part 1's
log_messages() == Nonechecks see nothing by construction:Hostturns the debug layer on only in adiagnosticsbuild withVICTORY_D3D12_DEBUG, and this machine has no debug layer installed.Tested with Claude Code's help.
@Dukestar69 on GitHub · 2026-11-26 12:52 UTC · original · approved these changes
Verified on RTX 5090 against
origin/main(63bcca4):cargo test -p victory-gpu --lib draw:: -- --test-threads=1: 21/21 passed (includingrender_and_depth_targets_stay_alive_until_list_reset).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly keeps bound render and depth targets alive until command-list reset.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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.