GPU: keep CPU descriptor slots until recording consumes them #2844
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!2844
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@andrewpozdnakov7-jpg on GitHub · 2026-11-25 22:02 UTC · original
andrewpozdnakov7-jpg:codex1/attachment-recording-current→main· +246 −88 · 5 files · 2 commits · openCPU-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.
@oni-swr on GitHub · 2026-11-25 22:27 UTC · original
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.
@fuzeofficlal on GitHub · 2026-11-25 22:34 UTC · original
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.@andrewpozdnakov7-jpg on GitHub · 2026-11-26 02:04 UTC · original
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]
@Marvisak on GitHub · 2026-11-26 03:25 UTC · original · edited 2026-11-26 04:23 UTC
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
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 03:42 UTC · original
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.
@kotekompotek on GitHub · 2026-11-25 22:11 UTC · original · reviewed
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.
@Dukestar69 on GitHub · 2026-11-26 09:51 UTC · original · approved these changes
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).
@fuzeofficlal on GitHub · 2026-11-26 10:53 UTC · original · approved these changes
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.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.