GPU: replace stale descriptors on null CBV writes #1298
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1298"
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 EatCodeSleep2 on 2026-11-24T17:14:36Z.
Summary
Write a null constant-buffer record when the title passes a null CBV description. This overwrites the previous record and uses the existing typed-null CBV path on the host, including for transient descriptor tables. A zero-address view never needs a scratch upload.
Refs #1242, finding VIC-BT-016. D3D12 CreateConstantBufferView
Verification
The regression checks the guest descriptor update. It does not read back a null CBV in a shader. AI-assisted. No game files used.
Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T17:24:41Z.
Independent verification of \
df8f906\ on Windows 11 / AMD Radeon RX 9060 XT (RDNA4, \gfx1200) / Rust 1.98.1 MSVC:Code audit looks clean and minimal: recording \View::Constant(0, 0)\ on null \CreateConstantBufferView\ clears stale entries while both \descriptor/host.rs\ (\View::Constant(0, _) => None) and \draw.rs\ (\if address != 0) route address-0 CBVs cleanly to typed null descriptors.
AI-assisted; synthetic tests only, no game files.
upstream-sync referenced this pull request2026-11-24 19:03:41 +00:00
Imported from Marvisak/VIctory. Originally posted by adamdotpy on 2026-11-24T18:44:55Z.
Reviewed at head
df8f906(worktree on the PR head, isolated target dir, Windows 11 / Rust 1.98.1). Findings, ranked:1. The bug and the fix are both right.
create_cbvwith a nulldesc(the title unbinding a CBV) used to skiprecord, so the heap slot kept the previousView::Constant— a stale descriptor. Now a null desc recordsView::Constant(0, 0)(words(desc).unwrap_or_default()), which every consumer treats as null:makereturnsNoneforView::Constant(0, _)(host.rs:631), somake_at/null_forwrite a typed null CBV (zero location, theConstantarm ofnull_for); the root-table fill indraw.rs:744guardsaddress != 0so a null CBV goes throughmake_at→ null instead of scratch-allocating a copy of address 0; the remainingView::Constantconsumer (draw.rs:1180) is debug formatting and is unaffected (size 0 < 16). I checked all fourView::Constantsites — no stale path left.2. Red/green proven here. Reverting just the
create_cbvhunk in the worktree makes the newa_null_cbv_overwrites_the_previous_descriptorfail (slot still readsConstant(0x1000, 256)after the null write); ondf8f906it passes withConstant(0, 0). So the branch changes exactly the null-overwrite case.3. Checks on
df8f906:cargo test -p victory-gpu51 passed / 0 failed / 1 ignored (new test included);cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warningsclean;cargo build --release -p victorybuilds;rustfmt --edition 2024 --checkon all three changed files shows exactly the same hunksmainhas (host.rs shifted by the +2 lines) — no new fmt diffs.4. Note, not a defect: a non-null desc with
BufferLocation == 0and nonzero size now also lands in theConstant(0, _)null arm ofmake(previously it would tryshadow::find(0, size)and fail to null anyway). Address 0 is not a valid title CBV, so treating it as null is the safer reading; the recorded view keeps the real size for diagnostics.Nothing found that would block this.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:21:44Z.
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-gpu/src/draw.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
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.