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

Manually merged
github merged 1 commit from gh-pr/57/head into gh-pr/57/base 2026-11-26 03:48:38 +00:00
Owner

@⁠Yaekai on GitHub · 2026-11-23 23:59 UTC · original
Yaekai:fix/null-buffer-views → main · +4 −2 · 1 files · 1 commits · merged 2026-11-24 00:39 UTC

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.
**@⁠Yaekai** on GitHub · 2026-11-23 23:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/57) `Yaekai:fix/null-buffer-views` → `main` · +4 −2 · 1 files · 1 commits · merged 2026-11-24 00:39 UTC 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.
When a title creates a null buffer view (resource == 0, ViewDimension == BUFFER), buffer_bytes(0) returns None, so null_for() fell through to null_like() / null_view() (or a 2D texture UAV) and emitted a 2D texture descriptor into a slot where a shader expects a buffer.

Check desc[1] == 1 (D3D12_SRV_DIMENSION_BUFFER / D3D12_UAV_DIMENSION_BUFFER) in null_for() for both View::Shader and View::Unordered so null buffer views get a matching null buffer descriptor.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:48:36 +00:00
github manually merged commit 071487fb2d into gh-pr/57/base 2026-11-26 03:48:38 +00:00
Author
Owner

@⁠lordon1a on GitHub · 2026-11-24 00:21 UTC · original

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.

**@⁠lordon1a** on GitHub · 2026-11-24 00:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/57#issuecomment-7117976205) 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.
Author
Owner

@⁠MarlomMedeiros on GitHub · 2026-11-24 00:25 UTC · original

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

**@⁠MarlomMedeiros** on GitHub · 2026-11-24 00:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/57#issuecomment-7118061751) 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
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!57
No description provided.