Skip to content

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

Merged
Marvisak merged 1 commit into
Marvisak:mainfrom
Yaekai:fix/null-buffer-views
Nov 24, 2026
Merged

Marvisak merged 1 commit into
Marvisak:mainfrom
Yaekai:fix/null-buffer-views

Conversation

@Yaekai

@Yaekai Yaekai commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

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.

…l resource

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.
@lordon1a

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown

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

@Marvisak
Marvisak merged commit eda38aa into Marvisak:main Nov 24, 2026
zebraso added a commit to zebraso/VIctory that referenced this pull request Nov 24, 2026
…PipelineStateX (console caches): E_NOTIMPL, cleared out, named
suirentakamura referenced this pull request in suirentakamura/victory-suiren Nov 24, 2026
GPU: emit null buffer SRV/UAV when descriptor names a buffer with null resource
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants