GPU: remap out-of-range descriptor tables on capped host view heaps #33

Closed
Yaekai wants to merge 1 commit from upstream-pr/33 into main
Yaekai commented 2026-11-23 23:28:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Yaekai on 2026-11-23T23:28:05Z.


Fixes a DXGI_ERROR_DEVICE_HUNG on GPUs whose shader-visible CBV/SRV/UAV heap is capped at 1,000,000 descriptors (e.g. NVIDIA).

Cause

  • HostHeap::new caps self.count at 934,464 (1,000,000 - 65,536) and places dynamic scratch slots in [934,464..1,000,000).
  • GTA VI's transient descriptor ring sits past 934,464 (around 962,055–962,570), landing inside the dynamic scratch range.
  • State::tables only remapped tables containing a Cbv, so any shader stage whose table had only SRVs/UAVs (such as the legal/loading UI pixel shaders) was skipped by mirror() (index >= self.count) and sampled a random descriptor from the dynamic scratch region, hanging the GPU.

Fix

  • Added HostHeap::is_sampler() and HostHeap::in_range(index).
  • Remapped non-sampler descriptor tables with any entry past HostHeap::in_range(index) into dynamic slots in State::tables, alongside CBV tables.

Verification

  • cargo test -p victory-gpu: 36/36 passed.
  • Verified live on an NVIDIA GPU: previously hung immediately on the legal/loading UI draw (DXGI_ERROR_DEVICE_HUNG), now renders cleanly past the intro and legal screens with no D3D12 errors on those draws.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6570996095 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/33). Originally posted by [Yaekai](https://github.com/Yaekai) on 2026-11-23T23:28:05Z. --- Fixes a `DXGI_ERROR_DEVICE_HUNG` on GPUs whose shader-visible CBV/SRV/UAV heap is capped at 1,000,000 descriptors (e.g. NVIDIA). ### Cause - `HostHeap::new` caps `self.count` at `934,464` (`1,000,000 - 65,536`) and places dynamic scratch slots in `[934,464..1,000,000)`. - GTA VI's transient descriptor ring sits past `934,464` (around `962,055–962,570`), landing inside the dynamic scratch range. - `State::tables` only remapped tables containing a `Cbv`, so any shader stage whose table had only SRVs/UAVs (such as the legal/loading UI pixel shaders) was skipped by `mirror()` (`index >= self.count`) and sampled a random descriptor from the dynamic scratch region, hanging the GPU. ### Fix - Added `HostHeap::is_sampler()` and `HostHeap::in_range(index)`. - Remapped non-sampler descriptor tables with any entry past `HostHeap::in_range(index)` into dynamic slots in `State::tables`, alongside CBV tables. ### Verification - `cargo test -p victory-gpu`: 36/36 passed. - Verified live on an NVIDIA GPU: previously hung immediately on the legal/loading UI draw (`DXGI_ERROR_DEVICE_HUNG`), now renders cleanly past the intro and legal screens with no D3D12 errors on those draws.
upstream-sync closed this pull request 2026-11-24 06:50:59 +00:00
Sunkiller-qc commented 2026-11-24 06:54:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Sunkiller-qc on 2026-11-23T23:46:46Z.


Thanks for tracking this down. The same fix landed in #21 (merged as 3827767): State::tables now remaps any table entry at or past host.count(). Your branch still merges into main, but the result runs both checks back to back (draw.rs:630 here and draw.rs:632 from #21). The is_sampler() guard doesn't change anything there, since only view heaps get capped in HostHeap::new. Unless I'm missing a case #21 doesn't cover, this one could probably be closed. Static review, not built or run.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7117353643 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/33#issuecomment-7117353643). Originally posted by [Sunkiller-qc](https://github.com/Sunkiller-qc) on 2026-11-23T23:46:46Z. --- Thanks for tracking this down. The same fix landed in #21 (merged as 3827767): `State::tables` now remaps any table entry at or past `host.count()`. Your branch still merges into main, but the result runs both checks back to back (`draw.rs:630` here and `draw.rs:632` from #21). The `is_sampler()` guard doesn't change anything there, since only view heaps get capped in `HostHeap::new`. Unless I'm missing a case #21 doesn't cover, this one could probably be closed. Static review, not built or run.
Yaekai commented 2026-11-24 06:54:34 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Yaekai on 2026-11-23T23:59:34Z.


Closing as superseded by merged #21.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7117583542 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/33#issuecomment-7117583542). Originally posted by [Yaekai](https://github.com/Yaekai) on 2026-11-23T23:59:34Z. --- Closing as superseded by merged #21.

Pull request closed

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
Marvisak/VIctory!33
No description provided.