GPU: dynamic descriptor slots go back only to the heap that took them #3611

Open
github-bot wants to merge 1 commit from github-bot/gh-3611 into main AGit
Owner

@⁠Ingenioeren on GitHub · 2026-11-27 21:03 UTC · original
Ingenioeren:fix/3606-dynamic-heap-identity → main · +104 −22 · 3 files · 1 commits · open

What

Give each host descriptor heap a monotonic identity (NEXT_ID). Record it with every dynamic range held by State, 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.

  • Before applying the fix, added the regression to unchanged origin/main code at 63bcca4 and ran cargo 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 returned Some(4) instead of None, proving that B's occupied slot had been freed. No pre-existing test failures were observed.
  • After applying the fix, 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 of 63bcca4: 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.
  • Staged the three changed Rust files with git add -- crates/victory-gpu/src/descriptor.rs crates/victory-gpu/src/descriptor/host.rs crates/victory-gpu/src/draw.rs, then ran cargo 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.

**@⁠Ingenioeren** on GitHub · 2026-11-27 21:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/3611) `Ingenioeren:fix/3606-dynamic-heap-identity` → `main` · +104 −22 · 3 files · 1 commits · open ## What Give each host descriptor heap a monotonic identity (`NEXT_ID`). Record it with every dynamic range held by `State`, 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](https://github.com/fxceless/victory-fork/commit/52ac4ec0f8a03f103c146e60228e53612759d435), [fork PR #1324](https://github.com/fxceless/victory-fork/pull/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. - Before applying the fix, added the regression to unchanged `origin/main` code at `63bcca4` and ran `cargo 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 returned `Some(4)` instead of `None`, proving that B's occupied slot had been freed. No pre-existing test failures were observed. - After applying the fix, `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 of `63bcca4`: 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. - Staged the three changed Rust files with `git add -- crates/victory-gpu/src/descriptor.rs crates/victory-gpu/src/descriptor/host.rs crates/victory-gpu/src/draw.rs`, then ran `cargo 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.
A State can outlive the title heap it took dynamic descriptor slots from.
If a later heap is registered at the same address, resetting the old State
used to free the replacement's slots while another list still held them.

Give each host heap a monotonic identity and record it with every dynamic
range. Release only ranges bearing the receiving heap's identity. Cover
address reuse with a regression that resets the old State and verifies
that the replacement keeps its slot until its own State is reset.

Ported from fxceless/victory-fork@52ac4ec (cccw), fork PR #1324.

Fixes #3606

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 21:07:41 +00:00
Author
Owner

@⁠oni-swr on GitHub · 2026-11-27 22:03 UTC · original

Independent verification of 26b63a03eacf1e4921daeb071a8e5f7119fb6cd1 against main at 63bcca43c6a00a758510398fa43096ce7e4f7df0. Clean merge. Native Windows x64, D3D12 WARP only, with both WARP switches set, SDK dxil.dll, and victory-gpu diagnostics 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).

**@⁠oni-swr** on GitHub · 2026-11-27 22:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/3611#issuecomment-7228993627) Independent verification of `26b63a03eacf1e4921daeb071a8e5f7119fb6cd1` against `main` at `63bcca43c6a00a758510398fa43096ce7e4f7df0`. Clean merge. Native Windows x64, D3D12 WARP only, with both WARP switches set, SDK `dxil.dll`, and `victory-gpu` diagnostics 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).
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3611/head:github-bot/gh-3611'
git switch 'github-bot/gh-3611'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3611'
git switch 'github-bot/gh-3611'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3611'
git switch 'github-bot/gh-3611'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3611'
git switch 'main'
git merge --squash 'github-bot/gh-3611'
git switch 'main'
git merge --ff-only 'github-bot/gh-3611'
git switch 'main'
git merge 'github-bot/gh-3611'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!3611
No description provided.