GPU: dynamic descriptor slots go back only to the heap that took them #3611
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3611"
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 Ingenioeren on 2026-11-27T21:03:16Z.
What
Give each host descriptor heap a monotonic identity (
NEXT_ID). Record it with every dynamic range held byState, and return slots only when the receiving host heap has that identity. Update root views, unordered-access clears, fresh tables, and releases through the runtime's own view heap.Add
draw::tests::old_state_reset_does_not_free_a_replacement_heaps_dynamic_slots. It holds a slot from heap A in an old State, unregisters and destroys A, installs heap B at exactly the same title-heap address, and gives B's same slot to a new State. Resetting the old State must leave B's slot occupied; resetting B's State must return it. The test uses the existing host-device and descriptor-heap helpers, with deterministic address reuse.Why
An address identifies a location, but a new heap can occupy that location after the old one is destroyed. A stale State previously freed the replacement heap's live slots on reset/drop, allowing two live lists to share dynamic slots and overwrite one another's descriptors.
Ported from fxceless/victory-fork@52ac4ec (cccw), fork PR #1324. Source: GPL-3.0-or-later fork commit 52ac4ec0f8a03f103c146e60228e53612759d435, fork PR #1324. Adapted to current main with a State-level address-reuse regression.
How tested
All commands ran locally on Windows 11 with an AMD Radeon RX 6750 XT (RDNA2, native AMD D3D12 driver), without game files.
origin/maincode at63bcca4and rancargo test --locked --offline -p victory-gpu: 231 passed, 1 failed, 1 ignored. The new regression was the only failure: after the old State reset, allocation returnedSome(4)instead ofNone, proving that B's occupied slot had been freed. No pre-existing test failures were observed.cargo test --locked --offline -p victory-gpu: 232 passed, 0 failed, 1 ignored; doc tests: 0 passed, 0 failed. The same regression passed. The existing ignored test is the synthetic private-data release benchmark.cargo clippy --locked --offline -p victory-gpu --all-targets -- -D warnings: passed.cargo fmt --check: failed on pre-existing formatting differences. Repeated the same command in an untouched archive of63bcca4: both runs report 925 formatting hunks across 66 files. The formatting changes requested are identical; one hunk's surrounding context reflects the updated release signature. No new formatting failures were introduced, and no formatting checks were disabled.git add -- crates/victory-gpu/src/descriptor.rs crates/victory-gpu/src/descriptor/host.rs crates/victory-gpu/src/draw.rs, then rancargo run --locked --offline -p xtask -- policy --staged: passed,asset policy: 3 files ok.git diff --check: passed.Not tested
No game run or game files were used. In-game reachability and rendering behavior were not tested. The D3D12 host-backed regression ran and failed before the fix, then passed after it; it did not take the no-device early return.
Fixes #3606
AI assistance: prepared with OpenAI Codex under Claude Code's direction, reviewed by Ingenioeren.
Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-27T22:03:45Z.
Independent verification of
26b63a03eacf1e4921daeb071a8e5f7119fb6cd1againstmainat63bcca43c6a00a758510398fa43096ce7e4f7df0. Clean merge. Native Windows x64, D3D12 WARP only, with both WARP switches set, SDKdxil.dll, andvictory-gpudiagnostics enabled. Tests (passed / failed / ignored) were 246 / 0 / 1 on base and 247 / 0 / 1 on head. The backported regression freed the replacement heap’s occupied slot on base and passed on head. Clippy passed with all targets, all features, and-D warnings. Command-list releases check the allocating heap’s identity, and page-table pairs return to their owning heap. Review found no slot leaks or blocking defects.AI-assisted (Codex, gpt-6.2-sol).
Imported from Marvisak/VIctory. Originally posted by ColorMeBoom on 2026-11-28T00:24:30Z.
Hardware run on RDNA1, to go with the RX 6750 XT run in the description: RX 5700 XT (Navi 10, RDNA1, driver 32.0.21045.29003, Windows 11 26200), head
26b63a0on63bcca4.draw::tests::old_state_reset_does_not_free_a_replacement_heaps_dynamic_slotspasses.victory-gpu --lib: 232 passed, 0 failed, 1 ignored (main: 231 passed, 0 failed, 1 ignored).AI use: Claude Code (Claude Opus 5.5).
Imported from Marvisak/VIctory. Originally posted by akimfomin on 2026-11-28T01:25:20Z.
XCL #1899 covers another ownership boundary: a fresh D3D12 queue can occupy a raw pointer that held an older queue. Your monotonic heap ID fixes the analogous reuse condition at a different layer. A negative test worth adding is a stale range from retired heap A with the same index/count as a live range in heap B, followed by a real return from B. Assert B's free count changes only on the second return.
Imported from Marvisak/VIctory. Originally posted by ColorMeBoom on 2026-11-28T01:29:32Z.
@akimfomin The PR's test already covers that negative case. In
old_state_reset_does_not_free_a_replacement_heaps_dynamic_slots, the old State holds heap A's range(first, 1). After A is destroyed and B takes the same address, B allocates the same(first, 1)into a new State, then every other slot is filled. The staleold.resetmust then leave B's allocator full (dynamic(1) == None). Onlynew.reset, the real return from B, frees it (dynamic(1) == Some(first)). It measures this through allocation rather than a free count, and the effect is the same.It passes on an RX 5700 XT along with the rest of
victory-gpu(232 passed, 0 failed, run).AI use: Claude Code (Claude Opus 5.5).
Imported from Marvisak/VIctory. Originally posted by Ingenioeren on 2026-11-28T09:21:56Z.
Thanks.
old_state_reset_does_not_free_a_replacement_heaps_dynamic_slotsindraw.rsis that negative test: the stale list from heap A and the live list from heap B hold the same address, index and count. Resetting the stale one must leave B's slot taken (dynamic(1) == Nonewith B full), and only B's own reset gives it back (dynamic(1) == Some(first)).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.