GPU/draw: evict CBV-backed fresh_tables on State::replay across cut lists #742
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/742"
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 fxceless/victory-fork. Originally posted by AscilCH on 2026-11-25T06:09:35Z.
Summary
Fixes a GPU use-after-free and stale-constant bug when a command list is cut at a memory wait (
crates/victory-gpu/src/draw.rs):State::tablespopulates a dynamic descriptor table containing aView::Constant(address, size), the CBV points to the currentHostList's scratch upload memory (list.scratch(size)) and registerslist.defer_fill(...)only on thatHostList.list::cutsplits the command list at a memory wait and runsState::replayon a freshHostList(H2),State::replaypreviously retained allfresh_tablesentries. IfH2reused a cached CBV table, it pointed intoH1's scratch upload buffer without registeringdefer_fillonH2.H1executes and resets (list::recycle->H1.reset()) beforeH2is released from its value wait,H1's upload buffers are dropped or returned to the scratch pool whileH2still references their GPU VAs (and any constant-buffer updates written beforeH2runs are never copied).State::fresh_tablesnow tracks(first_slot, has_cbv)andState::replayevicts all CBV-backed entries (retain(|_, &mut (_, has_cbv)| !has_cbv)), while preserving non-CBV tables and keepingself.dynamicalive until the final part's state drops.Verification
cargo test -p victory-gpu --locked -- draw::replay_tests: 1 passed, 0 failedcargo clippy -p victory-gpu --all-targets --all-features --locked: 0 new warnings (pre-existing8dd30abwarnings indraw.rs:2377andindirect.rs:1322untouched)cargo xtask policy:171 files ok(AI-assisted; synthetic unit tests only, no game data.)
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.