GPU: keep CPU descriptor slots until recording consumes them #2842
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2844"
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 andrewpozdnakov7-jpg on 2026-11-25T22:02:53Z.
CPU-only descriptors are read when the command list records the bind or clear. The global descriptor rings can wrap between creating a view and recording it, so another recording thread can substitute a different texture into the pending command.
Keep a slot reserved until its recording call returns. Render-target binds hold each slot through
OMSetRenderTargets. Render-target, depth, and unordered-access clears hold their CPU descriptor through the clear call. If all pooled slots are busy, a short-lived CPU-only heap lets recording continue.The same two-texture WARP scenario on
5c7489fleaves the left pixel black and clears the right pixel red. With this change the left pixel is red and the right pixel stays blue. Six paired runs across both D3D12 debug settings. The full serial GPU suite passed 242 tests with one ignored in each setting. Strict GPU Clippy in both feature configurations and asset policy passed.CPU descriptor recording specification · Coordination claim
Please retain my Git author on cherry-pick or rebase. If you fold the fix or test into another commit, please add this trailer.
Co-authored-by: andrewpozdnakov7-jpg [email protected]
AI-assisted with Codex. Synthetic textures on Windows/WARP.
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T22:11:39Z.
Review: COMMENTED
Right lifetime fix — a bare CPU handle from the RTV/DSV ring can be recycled by another view before OMSetRenderTargets records it; holding the View guard in scope through the call closes that. The MAX_TARGETS cap also handles >8 target sets gracefully now. Heads-up: this changes the same rtv()/dsv() signatures as #2834 (Option there vs Option here) — whichever lands second needs the other's shape.
Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T22:27:56Z.
Independent synthetic Windows WARP check for
fdc876bbagainst currentmain(f3578e38). I confirmed Microsoft Basic Render Driver (vendor0x1414, device0x008c, software flag0x2) withVICTORY_D3D12_WARP=1, diagnostics enabled, and the SDKdxil.dllconfigured.main. After another thread made 1,024 views, the pending clear still changed the left pixel to red and left the right pixel blue.mainreproduced the bug. Left stayed black and right turned red.208080e5usinggit merge-tree. The combination conflicts indraw.rs,host.rs, andlist.rs.AI-assisted with Codex (gpt-6.2-sol). Claude Code (claude-opus-5-5) prepared the initial WARP guard and comparison worktrees. Synthetic data only.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T22:34:23Z.
Verified
fdc876bbon Windows 11 (RTX 5090 + WARP) againstmain(f3578e3):cargo xtask policy(190 files ok),cargo clippy --locked -p victory-gpu --all-targets(default &--features diagnostics, 0 warnings).--features diagnostics):host::tests31/31 (includingpending_rtv_survives_other_recorders),draw::tests20/20,list::tests4/4,queue::tests5/5 passed.--features diagnostics, full crate): 242 passed, 0 failed, 1 ignored.CpuViewsholds itsavailablemutex only aroundpop/push(never across D3D12 calls),OMSetRenderTargetskeeps all slot guards alive until after the D3D12 call returns, and clear paths release slots cleanly on drop.pending_rtv_survives_other_recordersis gated behind#[cfg(feature = "diagnostics")]even though it doesn't use diagnostics-only APIs, so defaultcargo testskips it.for _ in 0..1024 { let _view = host.rtv(...); }loop drops eachCpuViewimmediately on every iteration, exercising serial reuse rather than >1024 live concurrent views hitting theStandaloneheap fallback.Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T02:04:37Z.
I checked the signature overlap with #2834. The verified fork composition includes exact heads
fdc876band208080eand current main63bcca43c6a00a758510398fa43096ce7e4f7df0. Both original Git commits are preserved.The resolution checks the format's attachment permission before reserving a slot. Valid views keep the
CpuViewguard until the bind or clear has been recorded. The existing depth-bounds fixture uses the guarded handle too.The two-texture RTV regression, the unsupported attachment format regression, and both depth-bounds tests passed together. Full Windows/WARP GPU diagnostics passed (250 passed, 1 ignored), along with strict GPU Clippy with and without diagnostics and asset policy.
If the combination is taken, please keep the original Git authors. If our change is folded into another commit, please add:
Co-authored-by: andrewpozdnakov7-jpg [email protected]
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T03:25:10Z.
Automated triage for the maintainers.
Merge candidate. Thanks for merging
main.render_with_depth_boundsinpipeline/depth_bounds_test.rsnow keeps theCpuViewfromhost.dsv(..)alive for the whole function and passes.handleto both calls, and the otherrtv/dsv/cpu_viewcallers in the merged tree keep their guards long enough. The fix itself is unchanged. This still overlaps #2834 indraw.rs/host.rs/list.rs, so whichever lands second needs a small rebase.CI: passing.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T03:42:22Z.
I merged current
main63bcca4into this branch in 48ae096. The depth-bounds fixture holds theCpuViewwhile it records both the depth clear and the target bind.The plain merge failed
cargo check -p victory-gpu --testswith two E0308 errors in that fixture. On the updated head, strict GPU Clippy passed in both configurations. The two depth-bounds tests and the recording-race regression pass on Windows/WARP. The actual depth readback for fresh, excluded, included and reset was[0.25, 0.5, 0.25, 0.25]. The full diagnostics suite passed 247 tests with one ignored in both runs. The asset policy passed.The tested #2834 composition has the same fixture adjustment. Its attachment-guard resolution is available for the merge order the maintainers choose.
Please retain the Git author if you move the fix, or include this trailer if you fold in the patch or regression:
Co-authored-by: andrewpozdnakov7-jpg [email protected]
AI-assisted with Codex.
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T09:51:26Z.
Review: APPROVED
Verified on RTX 5090 against
origin/main(63bcca4):cargo test -p victory-gpu --lib descriptor:: -- --test-threads=1 --skip dynamic_slots_are_held_until_released: 21/21 passed.cargo test -p victory-gpu --lib draw:: -- --test-threads=1: 20/20 passed.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly keeps CPU descriptor slots alive until command-list recording consumes them.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T10:53:00Z.
Review: APPROVED
Verified
48ae0960locally on Windows 11 (RTX 5090 and WARP, withVICTORY_D3D12_DEBUG=1):cargo xtask policyandcargo clippy -p victory-gpu --tests -- -D warnings(default and--all-features): clean.host::tests::pending_rtv_survives_other_recorders(--features diagnostics),draw::tests(20/20),pipeline::depth_bounds_test(2/2), andqueue::tests(5/5) all passed on RTX 5090, RTX 5090 +VICTORY_D3D12_DEBUG=1, and WARP +VICTORY_D3D12_DEBUG=1.ClearRenderTargetViewwith a standalone fallback descriptor, and verifying all 1,024 pooled slots return on drop) underVICTORY_D3D12_DEBUG=1on both RTX 5090 and WARP.Lifetimes are held cleanly across every recording site (
set_targets,clear_unordered,clear_rtv,clear_dsv, and tests),set_targetsproperly caps atD3D12_SIMULTANEOUS_RENDER_TARGET_COUNTand only recordsself.targets/self.depthonce the view is created, andclear_unorderedacquirescpu_viewbefore taking a dynamic slot. Looks ready to merge.Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-26T20:55:51Z.
NEW-284 verification on current head, Windows 11, toolchain 1.98.1,
--test-threads=1. Hardware: AMD Radeon 780M (RDNA3 iGPU). WARP:VICTORY_WARP=1for victory-shader,VICTORY_D3D12_WARP=1with--features diagnosticsfor victory-gpu.cargo test -p victory-shader -p victory-gpu --locked --no-fail-fast: no failures on the 780M; on WARP only the four synthetic_tests failures main63bcca4also has (fixed by #2225). victory-gpu on WARP: 247 passed, 0 failed (main: 246).pending_rtv_survives_other_recordersis behindfeature = "diagnostics", so the default suite skips it; with--features diagnosticsit passes on the 780M and on WARP.AI-assisted (Claude).
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-27T03:20:30Z.
WARP verification of head
48ae0960(NEW-284 claim: #1633)Environment: Windows 10 22H2, WARP software adapter (
VICTORY_WARP=1 VICTORY_D3D12_WARP=1), rust 1.98.1 msvc. Important local caveat: both adapters on this machine cap at SM 6.2, so SM-6.6 pipeline execution is impossible here for upstream code equally (proven: upstream's own SM-6.6 pipeline tests fail at creation on unmodified main63bcca43). victory-gpu runs use--features diagnostics— WARP selection is feature-gated there — and--test-threads=1serial.victory-gpu: 244 passed / 3 failed / 1 ignored vs baseline 243/3/1 — zero regressions; failure set bit-identical to main.
host::tests::pending_rtv_survives_other_recorders: PASS — the real end-to-end scenario (pending RTV surviving a full lap of the old descriptor ring, verified through actual clears and pixel readbacks) executes for real on WARP since it uses plain D3D12 RTV operations, not SM 6.6 pipelinesVICTORY_D3D12_DEBUG=1(debug layer active): again 244/3/1, new test PASS, zero regressions — matches the author's both-debug-configs claimVerdict: verification supports — strongest of the three; fully verified end-to-end in both debug configurations.
Imported from Marvisak/VIctory. Originally posted by pes7 on 2026-11-27T16:37:51Z.
A heads-up from the tested merge set in #3409. This PR still merges cleanly onto
main(63bcca4), so there is nothing to rebase now. It does conflict with #450 indraw.rs,host.rs,list.rsandqueue.rs(crates/victory-gpu/src/).Whichever of the two lands second will need a rebase onto the other. #450 is in #3409's set, so this PR is left out of it for now. If you push a version on top of #450 (or say which order you'd prefer), I'll run it through the same build, test and title checks there.
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T16:49:19Z.
I resolved the four conflicts in the heads from the merge-set report. The merge commit keeps both original parents, #2844 at
48ae096and #450 at6d96d4a, with63bcca4in its history. Combined commit97343c7The host reserves a CPU descriptor for each live or typed-null RTV until the output-merger bind returns. The typed null occupies its original slot. State transitions and capture track the live textures.
[0.25, 0.5, 0.25, 0.25]for the fresh, excluded, included and reset cases.The combined commit is ready for pes7 to check in the merge set. Maintainers can choose the upstream merge order. Please retain the original Git authors on cherry-pick or rebase. If folding my integration changes into another commit, please use
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.AI-assisted with OpenAI Codex. Synthetic Windows/WARP verification.
Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-27T17:33:25Z.
Hardware run of the combined commit 97343c7 (#2844 + #450), Windows 11, Radeon 780M (RDNA3 iGPU), toolchain 1.98.1:
cargo test -p victory-gpu --features diagnosticson the 780M: 249 passed, 0 failed, 1 ignored (the same count as WARP).typed_null_rtv_keeps_the_next_color_slot,pending_rtv_survives_other_recorders,a_missing_resource_has_no_default_view_format: 0/10 failures over 10 runs on the 780M.Note for anyone re-running: the first two are behind
feature = "diagnostics", so a plaincargo test -p victory-gpuon hardware skips them silently.AI-assisted (Claude).
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.