GPU: release buffer-pass copies with their descriptor heap #1273

Open
UwUCammie wants to merge 1 commit from upstream-pr/1276 into main
UwUCammie commented 2026-11-26 09:09:11 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by UwUCammie on 2026-11-26T09:09:11Z.


Dropping a shader-visible view heap left its buffer copies in both heap-pass caches. Both tables use the address of the host heap as the key. That kept the copies alive and allowed a later heap allocated at that address to inherit the old ranges.

Remove both entries when the view heap drops. Release the copies after unlocking the tables so GPU resource destruction stays outside the critical sections. Command lists that still use a copy keep their own reference.

The new test puts a real GPU buffer copy in both caches and releases the descriptor heap. It failed before the fix. The lifetime test, descriptor tests and heap-pass tests all passed on an RX 7900 XT with RADV 26.3.1 under Wine (13 tests).

<!-- greyfinch-sync:fxceless/victory-fork:issue:6623257298 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1276). Originally posted by [UwUCammie](https://github.com/UwUCammie) on 2026-11-26T09:09:11Z. --- Dropping a shader-visible view heap left its buffer copies in both heap-pass caches. Both tables use the address of the host heap as the key. That kept the copies alive and allowed a later heap allocated at that address to inherit the old ranges. Remove both entries when the view heap drops. Release the copies after unlocking the tables so GPU resource destruction stays outside the critical sections. Command lists that still use a copy keep their own reference. The new test puts a real GPU buffer copy in both caches and releases the descriptor heap. It failed before the fix. The lifetime test, descriptor tests and heap-pass tests all passed on an RX 7900 XT with RADV 26.3.1 under Wine (13 tests).
Proudnoob4 commented 2026-11-26 16:06:38 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Proudnoob4 on 2026-11-26T15:13:52Z.


RTX 4080 / Win10 verification (989e5c6)

Ported #1276 (impl Drop for HostHeap -> crate::draw::forget_heap_ranges(self)) onto our VIctory-NVIDIA tree (RANGES hoisted out of heap_buffer_pass):

  • Unit test: draw::tests::dropping_a_descriptor_heap_releases_buffer_pass_cache passed (weak.upgrade().is_none() immediately on drop(heap)).
  • 10-minute live GTA 6 run (RTX 4080 / i5-13600K / Win10, Series S 0.6667): 0/230 black frames, 4,582 draws/frame, zero crashes or descriptor/shadow lifetime issues.
<!-- greyfinch-sync:fxceless/victory-fork:comment:7195970813 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1276#issuecomment-7195970813). Originally posted by [Proudnoob4](https://github.com/Proudnoob4) on 2026-11-26T15:13:52Z. --- ### RTX 4080 / Win10 verification (`989e5c6`) Ported `#1276` (`impl Drop for HostHeap` -> `crate::draw::forget_heap_ranges(self)`) onto our `VIctory-NVIDIA` tree (`RANGES` hoisted out of `heap_buffer_pass`): - **Unit test:** `draw::tests::dropping_a_descriptor_heap_releases_buffer_pass_cache` passed (`weak.upgrade().is_none()` immediately on `drop(heap)`). - **10-minute live GTA 6 run (RTX 4080 / i5-13600K / Win10, Series S `0.6667`):** `0/230` black frames, `4,582` draws/frame, zero crashes or descriptor/shadow lifetime issues.
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/1276:upstream-pr/1276'
git switch 'upstream-pr/1276'

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/1276'
git switch 'upstream-pr/1276'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1276'
git switch 'upstream-pr/1276'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1276'
git switch 'main'
git merge --squash 'upstream-pr/1276'
git switch 'main'
git merge --ff-only 'upstream-pr/1276'
git switch 'main'
git merge 'upstream-pr/1276'
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
fxceless/victory-fork!1273
No description provided.