fix(gpu): retire eligible dynamic descriptor resources after fence completion #332

Open
brainbudt wants to merge 1 commit from upstream-pr/332 into main
brainbudt commented 2026-11-26 17:26:04 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by brainbudt on 2026-11-26T17:26:04Z.


Problem

Releasing a dynamic descriptor range returns its indices to the allocator while its slots can continue holding D3D12 resources. A synthetic texture retained one extra COM reference after release, preventing the idle texture sweep (which requires a single remaining COM reference) from reclaiming it.

Change

Add opt-in VICTORY_RECLAIM_DYNAMIC=1 to retire explicitly dimensioned texture SRVs and bounded root buffer SRVs/UAVs when their recording is destroyed (replayable recordings keep their reservations until reset or discard). Reclamation checks the direct queue's actual completed fence value via a read-only Host accessor, writes a matching null descriptor, clears any raw twin, and transfers the resource to deferred retirement before publishing the slot for reuse. Unconfirmed fences or unavailable staging slots preserve the defensive hold.

Scope

Addresses #266. Defaults to off; gameplay VRAM impact remains to be measured on hardware.

Verification

  • Windows MSVC workspace cargo check --tests passed (including victory-gpu with diagnostics); cargo xtask policy passed for all 265 files.
  • Both new D3D12 tests passed under Windows x64 CrossOver across 4 configurations (default, opt-in reclaim, deferred retirement, disabled staging) plus both existing dynamic allocator regressions.
  • Real D3D12 queue-fence wait/signal probe verified that destroying a recording preserves the COM reference while pending and releases it after completion.

Reviewed with mistral-loop: APPROVE (2 rounds, mistral-large-4-0 + deepseek-v4-1-flash-1017).
Created with gpt-6.2-astra in Codex (orchestrated with Gemini 4 Neon in T3 Code).

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:6631924813 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/332). Originally posted by [brainbudt](https://github.com/brainbudt) on 2026-11-26T17:26:04Z. --- ## Problem Releasing a dynamic descriptor range returns its indices to the allocator while its slots can continue holding D3D12 resources. A synthetic texture retained one extra COM reference after release, preventing the idle texture sweep (which requires a single remaining COM reference) from reclaiming it. ## Change Add opt-in `VICTORY_RECLAIM_DYNAMIC=1` to retire explicitly dimensioned texture SRVs and bounded root buffer SRVs/UAVs when their recording is destroyed (replayable recordings keep their reservations until reset or discard). Reclamation checks the direct queue's actual completed fence value via a read-only `Host` accessor, writes a matching null descriptor, clears any raw twin, and transfers the resource to deferred retirement before publishing the slot for reuse. Unconfirmed fences or unavailable staging slots preserve the defensive hold. ## Scope Addresses #266. Defaults to off; gameplay VRAM impact remains to be measured on hardware. ## Verification - Windows MSVC workspace `cargo check --tests` passed (including `victory-gpu` with `diagnostics`); `cargo xtask policy` passed for all 265 files. - Both new D3D12 tests passed under Windows x64 CrossOver across 4 configurations (default, opt-in reclaim, deferred retirement, disabled staging) plus both existing dynamic allocator regressions. - Real D3D12 queue-fence wait/signal probe verified that destroying a recording preserves the COM reference while pending and releases it after completion. --- Reviewed with mistral-loop: APPROVE (2 rounds, `mistral-large-4-0` + `deepseek-v4-1-flash-1017`). Created with gpt-6.2-astra in Codex (orchestrated with Gemini 4 Neon in T3 Code).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/332:upstream-pr/332'
git switch 'upstream-pr/332'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/332'
git switch 'upstream-pr/332'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/332'
git switch 'upstream-pr/332'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/332'
git switch 'main'
git merge --squash 'upstream-pr/332'
git switch 'main'
git merge --ff-only 'upstream-pr/332'
git switch 'main'
git merge 'upstream-pr/332'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
avatarmanz/VIctory-7900XTX!332
No description provided.