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

Closed
github-bot wants to merge 1 commit from gh-pr/33/head into gh-pr/33/base
Owner

@⁠Yaekai on GitHub · 2026-11-23 23:28 UTC · original
Yaekai:fix/capped-heap-table-remap → main · +32 −1 · 2 files · 1 commits · closed without merging

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.
**@⁠Yaekai** on GitHub · 2026-11-23 23:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/33) `Yaekai:fix/capped-heap-table-remap` → `main` · +32 −1 · 2 files · 1 commits · closed without merging 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.
On GPUs whose shader-visible CBV/SRV/UAV heap is capped at 1,000,000 descriptors (e.g. NVIDIA), HostHeap::new caps the mirrored region at 934,464 and places dynamic scratch slots at [934,464..1,000,000).

When a title places transient descriptor tables past 934,464, any shader stage whose table has no CBV (only SRVs/UAVs) was not remapped into dynamic slots: mirror() skipped it because index >= self.count, and the shader indexed directly into the dynamic scratch region, causing DXGI_ERROR_DEVICE_HUNG.

Remap non-sampler descriptor tables with any entry past HostHeap::in_range(index) into dynamic slots alongside CBV tables.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:47:19 +00:00
github-bot closed this pull request 2026-11-26 03:47:19 +00:00
Author
Owner

@⁠Sunkiller-qc on GitHub · 2026-11-23 23:46 UTC · original

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.

**@⁠Sunkiller-qc** on GitHub · 2026-11-23 23:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/33#issuecomment-7117353643) 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.
Author
Owner

@⁠Yaekai on GitHub · 2026-11-23 23:59 UTC · original

Closing as superseded by merged #21.

**@⁠Yaekai** on GitHub · 2026-11-23 23:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/33#issuecomment-7117583542) Closing as superseded by merged #21.

Pull request closed

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