GPU: rebind replaced descriptor heaps by host identity #1331
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1331"
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:30:03Z.
Summary
Compare the D3D12 descriptor heaps resolved for the current draw or dispatch against the host objects already bound. When a title heap is released and its address is reused, the new host heap is distinct because the recording still holds a reference to the old host heap. Rebind and invalidate both cached root signatures when the host heap changes.
Refs #1242, finding VIC-BT-013.
Verification
The test checks host heap replacement during recording. It does not force guest allocator address reuse or submit GPU work. AI-assisted. No game files used.
Imported from Marvisak/VIctory. Originally posted by acetonahard-code on 2026-11-24T19:21:21Z.
Tested this on a GPU with SM 6.6 support (RTX 4070 SUPER, driver 621.14, Windows 11, repo toolchain), merged into current
main(ffe310e).cargo test -p victory-gpumainmain+ this PRmain,--all-featuresmain+ this PR,--all-features--nocapture, and no "no SM 6.6 ... device; skipped" lines were printed, so no GPU test skipped for lack of a device.cargo clippy --all-targets -- -D warnings, with and without--all-features: clean.cargo fmt --checkwould rewrap one block this PR adds (draw.rs).mainisn't rustfmt-clean either, so take it or leave it.frame::tests::waits_end_on_ticks_and_count_framesfailed once and passed on a rerun. It's timing-flaky onmaintoo (2 of 10 full-suite runs here), and unrelated to this PR.I didn't test with game data.
Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T20:07:44Z.
Review: COMMENTED
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS, so this is source review plus the PR's own Windows tests.
Heap rebinding is now keyed on the host heap's COM identity (
heap.as_raw()) instead of the title's descriptor-heap address: a title that destroys and recreates a heap at the same guest address now getsSetDescriptorHeapscalled again, andhost_rootsis reset so root bindings are re-made. The old host heap is kept alive by the recording (list.keep), so dropping the title's reference cannot free it mid-list. The test drops the original heap before binding the replacement — exactly the lifetime hazard. Sound.Imported from Marvisak/VIctory. Originally posted by wbkepler on 2026-11-24T20:56:25Z.
On whether the new key can itself hit ABA: I don't think it can. Every host heap whose
as_raw()ends up inhost_heapshas just been passed tolist.keep, which holds it untilHostList::reset. On upstream the only call to that for title lists islist.rsreset, and it is immediately followed bystate.reset(pipeline), which zeroeshost_heaps. So a cached identity can't be freed and reused while it is still cached. (Thep.copy.reset()inhost.rsis a prelude copy list with noState.)Merge-order note: #1382 rewrites the same
SetDescriptorHeapsblock inState::prepare(a stack array instead of theVec). The two conflict textually but don't clash in intent, so whichever lands second just needs a rebase. The host-identity comparison here should be kept.AI-assisted review (Claude Code); checked on Windows 11 / RTX 5090.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:22:39Z.
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.