GPU: replace stale descriptors on null CBV writes #1298
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!1298
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@EatCodeSleep2 on GitHub · 2026-11-24 17:14 UTC · original
EatCodeSleep2:fix/null-constant-buffer-descriptors-1242→main· +17 −5 · 3 files · 1 commits · openSummary
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.
@geiyiliyabumo on GitHub · 2026-11-24 17:24 UTC · original
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.
@adamdotpy on GitHub · 2026-11-24 18:44 UTC · original
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.
@Marvisak on GitHub · 2026-11-25 01:21 UTC · original
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
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.