GPU: emit null buffer SRV/UAV when descriptor names a buffer with null resource #57

Merged
Yaekai merged 1 commit from upstream-pr/57 into main 2026-11-24 00:39:35 +00:00
Yaekai commented 2026-11-23 23:59:05 +00:00 (Migrated from github.com)

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


Fixes a DXGI_ERROR_DEVICE_HUNG on a world mesh draw (f0c7efd2aceb2aaa, Srv s1+16: buffer None).

Cause

When the title creates a null buffer SRV or UAV (resource == 0 with ViewDimension == BUFFER, desc[1] == 1), buffer_bytes(0) returns None, so null_for() fell through to null_like() / null_view() (or D3D12_UAV_DIMENSION_TEXTURE2D) and wrote a 2D texture descriptor into a slot where the shader expects a buffer.

Fix

Check desc.is_some_and(|d| d[1] == 1) in null_for() for both View::Shader and View::Unordered so null buffer views get a matching null buffer descriptor.

Verification

  • cargo test -p victory-gpu: 36/36 passed.
  • Verified live on NVIDIA in Series S mode: mesh f0c7efd2aceb2aaa no longer hangs the GPU and the world advances ~70+ frames further.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6571407435 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/57). Originally posted by [Yaekai](https://github.com/Yaekai) on 2026-11-23T23:59:05Z. --- Fixes a `DXGI_ERROR_DEVICE_HUNG` on a world mesh draw (`f0c7efd2aceb2aaa`, `Srv s1+16: buffer None`). ### Cause When the title creates a null buffer SRV or UAV (`resource == 0` with `ViewDimension == BUFFER`, `desc[1] == 1`), `buffer_bytes(0)` returns `None`, so `null_for()` fell through to `null_like()` / `null_view()` (or `D3D12_UAV_DIMENSION_TEXTURE2D`) and wrote a **2D texture descriptor** into a slot where the shader expects a buffer. ### Fix Check `desc.is_some_and(|d| d[1] == 1)` in `null_for()` for both `View::Shader` and `View::Unordered` so null buffer views get a matching null buffer descriptor. ### Verification - `cargo test -p victory-gpu`: 36/36 passed. - Verified live on NVIDIA in Series S mode: `mesh f0c7efd2aceb2aaa` no longer hangs the GPU and the world advances ~70+ frames further.
upstream-sync closed this pull request 2026-11-24 06:51:07 +00:00
lordon1a commented 2026-11-24 06:54:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by lordon1a on 2026-11-24T00:21:03Z.


Verified 071487fb2 on Windows 11 (x86_64-pc-windows-gnullvm, rustc 1.100.0, applied cleanly to main@35b054ec0): pass (no regression; static check of the d[1] == 1 null-buffer SRV/UAV arms).

  • cargo xtask policy: 150 files ok
  • cargo test -p victory-gpu: 39 passed, 0 failed.

AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7117976205 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/57#issuecomment-7117976205). Originally posted by [lordon1a](https://github.com/lordon1a) on 2026-11-24T00:21:03Z. --- Verified `071487fb2` on Windows 11 (`x86_64-pc-windows-gnullvm`, `rustc 1.100.0`, applied cleanly to `main@35b054ec0`): **pass** (no regression; static check of the `d[1] == 1` null-buffer SRV/UAV arms). - `cargo xtask policy`: 150 files ok - `cargo test -p victory-gpu`: **39 passed, 0 failed**. AI-assisted.
MarlomMedeiros commented 2026-11-24 06:54:39 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by MarlomMedeiros on 2026-11-24T00:25:56Z.


Tested on different hardware. The world-entry device removal still happens here, and the breadcrumbs say it is not the descriptor case this patch fixes.

Hardware / system

  • GPU: NVIDIA GeForce RTX 5070, 12 GB VRAM, driver 621.35 (32.0.16.2135), VBIOS 98.05.36.00.83
  • CPU: AMD Ryzen 7 5800X3D
  • RAM: 32 GB
  • OS: Windows 11, build 10.0.26300
  • Toolchain: rustc 1.99.1; DXC 1.9.2602.17 (Windows SDK 10.0.26100)
  • Build: this PR's head 071487f, cargo build --release -p victory and cargo build --profile diag -p victory --features diagnostics
  • Title: 7952987A

What happens

DXGI_ERROR_DEVICE_HUNG (TDR) while rendering a world frame, right after entering gameplay. Auto-breadcrumbs: a graphics list stopped at command 3 of 70, op DISPATCHMESH; in-flight work before it is DispatchMesh draws (mesh 3a93976a475b8bdb, 1617bda5757a7804, 7568b4b35f3f5592) and compute dispatches (ebe4e53f031f5249 at up to 242x1x1, aaf7da7a94dc72a9, a133bf0a24aff410, 4c0ac499ad613809).

Why this hang is not the case the patch fixes

  • The null SRVs bound at those draws carry view-desc word[1] = 2 (a texture dimension), e.g. Shader(0, Some([42, 2, 5768, 0, 0, 0, 0, 0, 0, 0])): they take the texture null path before and after this change, so on this title/hardware the new branch is never exercised.
  • Lowering the shader translator's loop bound (LOOP_LIMIT 1<<20 -> 1<<12, shader cache cleared) does not change the hang either, so the draw is not being held by a data-driven iteration count.

Patch review

Reading desc word[1] == 1 for BUFFER matches how null_like interprets the dimension word, and the same field feeds the UAV dimension pick. The change looks correct for the case it describes; it just does not cover this machine's hang.

Other host rejects in the same run (possibly NVIDIA-specific, mentioning in case they matter for #54/#55):

  • host view heap capped at 1000000 (title asked 1245184, E_INVALIDARG)
  • no host texture E_INVALIDARG on 2560x1440 formats 86 and 115 (flags 5 and 1)
  • host pipeline refused E_INVALIDARG on many compute pipelines (77x)
  • untranslated shaders dropped: "a structured buffer of unknown stride", "64-bit image atomic", "v_swap_b32", "an address in an SGPR that is no root parameter", "a lane-mask join of an untracked mask"

Data: full crashes.log entries (DRED + breadcrumbs from two diag runs) and the warning log excerpt: https://gist.github.com/MarlomMedeiros/cd0a1dc2da7f0bd43a2f86d80192e063

<!-- greyfinch-sync:Marvisak/VIctory:comment:7118061751 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/57#issuecomment-7118061751). Originally posted by [MarlomMedeiros](https://github.com/MarlomMedeiros) on 2026-11-24T00:25:56Z. --- Tested on different hardware. The world-entry device removal still happens here, and the breadcrumbs say it is not the descriptor case this patch fixes. **Hardware / system** - GPU: NVIDIA GeForce RTX 5070, 12 GB VRAM, driver 621.35 (32.0.16.2135), VBIOS 98.05.36.00.83 - CPU: AMD Ryzen 7 5800X3D - RAM: 32 GB - OS: Windows 11, build 10.0.26300 - Toolchain: rustc 1.99.1; DXC 1.9.2602.17 (Windows SDK 10.0.26100) - Build: this PR's head `071487f`, `cargo build --release -p victory` and `cargo build --profile diag -p victory --features diagnostics` - Title: 7952987A **What happens** `DXGI_ERROR_DEVICE_HUNG` (TDR) while rendering a world frame, right after entering gameplay. Auto-breadcrumbs: a graphics list stopped at command 3 of 70, op `DISPATCHMESH`; in-flight work before it is DispatchMesh draws (mesh `3a93976a475b8bdb`, `1617bda5757a7804`, `7568b4b35f3f5592`) and compute dispatches (`ebe4e53f031f5249` at up to 242x1x1, `aaf7da7a94dc72a9`, `a133bf0a24aff410`, `4c0ac499ad613809`). **Why this hang is not the case the patch fixes** - The null SRVs bound at those draws carry view-desc `word[1] = 2` (a texture dimension), e.g. `Shader(0, Some([42, 2, 5768, 0, 0, 0, 0, 0, 0, 0]))`: they take the texture null path before and after this change, so on this title/hardware the new branch is never exercised. - Lowering the shader translator's loop bound (`LOOP_LIMIT` 1<<20 -> 1<<12, shader cache cleared) does not change the hang either, so the draw is not being held by a data-driven iteration count. **Patch review** Reading `desc` word[1] == 1 for BUFFER matches how `null_like` interprets the dimension word, and the same field feeds the UAV dimension pick. The change looks correct for the case it describes; it just does not cover this machine's hang. **Other host rejects in the same run** (possibly NVIDIA-specific, mentioning in case they matter for #54/#55): - `host view heap capped at 1000000` (title asked 1245184, `E_INVALIDARG`) - `no host texture` `E_INVALIDARG` on 2560x1440 formats 86 and 115 (flags 5 and 1) - `host pipeline refused` `E_INVALIDARG` on many compute pipelines (77x) - untranslated shaders dropped: "a structured buffer of unknown stride", "64-bit image atomic", "v_swap_b32", "an address in an SGPR that is no root parameter", "a lane-mask join of an untracked mask" **Data**: full `crashes.log` entries (DRED + breadcrumbs from two diag runs) and the warning log excerpt: https://gist.github.com/MarlomMedeiros/cd0a1dc2da7f0bd43a2f86d80192e063
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!57
No description provided.