GPU: give null texture UAVs the title's view dimension #205

Manually merged
github merged 1 commit from gh-pr/205/head into gh-pr/205/base 2026-11-26 03:54:36 +00:00
Owner

@⁠asdaasdsaddf on GitHub · 2026-11-24 01:25 UTC · original
asdaasdsaddf:fix/null-uav-dimension → main · +90 −11 · 1 files · 1 commits · merged 2026-11-24 07:55 UTC

What

When the host cannot make an unordered-access view (no host texture, a format the host does not allow, a placed texture not mirrored), null_for() in descriptor/host.rs wrote a 2D null UAV whatever dimension the title asked for. Shader views already get a null view of the title's dimension through null_like; unordered views did not.

A shader that writes a 3D texture through such a slot then has a dimension mismatch, which D3D12 leaves undefined. GPU-based validation reports it on the world's wind field:

GPU-BASED VALIDATION: Dispatch, UAV resource dimensions differs from that expected by shader:
UAV Dimension Expected: D3D12_UAV_DIMENSION_TEXTURE3D, UAV Dimension In Descriptor: D3D12_UAV_DIMENSION_TEXTURE2D,
... Shader Stage: COMPUTE ... Pipeline State: '[compute 5bb23d336331db1d]'

5bb23d336331db1d is WindNew:CS_CopyWindFieldBeforeUpdateWithSmooth; its GFX10 code is image_load / image_store with dim:SQ_RSRC_IMG_3D.

Change

  • New null_uav_desc(dimension): a null texture UAV keeps the title's view dimension (1D, 1D array, 2D array with ArraySize 1, 3D with WSize -1). Multisampled dimensions (they need a cap) and slots that name no dimension stay 2D, as before.
  • null_for() reads the dimension from View::Unordered's description and from View::Placed(true, ..)'s, and uses it for non-buffer null UAVs. Buffer null UAVs are unchanged.

Testing

  • RTX 5070 (driver on Windows 11), diagnostics build with VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_GBV=1: before, the error above was reported each time the wind shader ran; after, it no longer appears once that shader is bound and dispatching. The other GBV report seen there (pixel shaders expecting an SRV TEXTURE2D where the descriptor is TEXTURE1D) is a separate issue and is not addressed here.
  • cargo test -p victory-gpu --lib: 46 pass, including two new tests: the dimension mapping, and a null 3D UAV made on the real device leaves it alive (skipped without a host GPU).
  • Not a fix for the NVIDIA world GPU hang (DEVICE_HUNG about 1-2 minutes into the world): it still happens with this change.

🤖 Generated with Claude Code

**@⁠asdaasdsaddf** on GitHub · 2026-11-24 01:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/205) `asdaasdsaddf:fix/null-uav-dimension` → `main` · +90 −11 · 1 files · 1 commits · merged 2026-11-24 07:55 UTC ## What When the host cannot make an unordered-access view (no host texture, a format the host does not allow, a placed texture not mirrored), `null_for()` in `descriptor/host.rs` wrote a **2D** null UAV whatever dimension the title asked for. Shader views already get a null view of the title's dimension through `null_like`; unordered views did not. A shader that writes a 3D texture through such a slot then has a dimension mismatch, which D3D12 leaves undefined. GPU-based validation reports it on the world's wind field: ``` GPU-BASED VALIDATION: Dispatch, UAV resource dimensions differs from that expected by shader: UAV Dimension Expected: D3D12_UAV_DIMENSION_TEXTURE3D, UAV Dimension In Descriptor: D3D12_UAV_DIMENSION_TEXTURE2D, ... Shader Stage: COMPUTE ... Pipeline State: '[compute 5bb23d336331db1d]' ``` `5bb23d336331db1d` is `WindNew:CS_CopyWindFieldBeforeUpdateWithSmooth`; its GFX10 code is `image_load` / `image_store` with `dim:SQ_RSRC_IMG_3D`. ## Change - New `null_uav_desc(dimension)`: a null texture UAV keeps the title's view dimension (1D, 1D array, 2D array with `ArraySize` 1, 3D with `WSize` -1). Multisampled dimensions (they need a cap) and slots that name no dimension stay 2D, as before. - `null_for()` reads the dimension from `View::Unordered`'s description and from `View::Placed(true, ..)`'s, and uses it for non-buffer null UAVs. Buffer null UAVs are unchanged. ## Testing - RTX 5070 (driver on Windows 11), diagnostics build with `VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_GBV=1`: before, the error above was reported each time the wind shader ran; after, it no longer appears once that shader is bound and dispatching. The other GBV report seen there (pixel shaders expecting an SRV `TEXTURE2D` where the descriptor is `TEXTURE1D`) is a separate issue and is not addressed here. - `cargo test -p victory-gpu --lib`: 46 pass, including two new tests: the dimension mapping, and a null 3D UAV made on the real device leaves it alive (skipped without a host GPU). - Not a fix for the NVIDIA world GPU hang (`DEVICE_HUNG` about 1-2 minutes into the world): it still happens with this change. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
When the host cannot make an unordered-access view (no host texture, a
format the host does not allow, a placed texture not mirrored), null_for()
wrote a 2D null UAV whatever the title asked for. A shader that writes a
3D texture through it then has a dimension mismatch: GPU-based validation
reports it ("UAV Dimension Expected: TEXTURE3D, UAV Dimension In
Descriptor: TEXTURE2D") for the world's wind field
(WindNew:CS_CopyWindFieldBeforeUpdateWithSmooth, compute 5bb23d336331db1d,
image_load/image_store dim:SQ_RSRC_IMG_3D). Shader views already get a
null view of the title's dimension (null_like); unordered views did not.

Null texture UAVs now keep the title's dimension: 1D, 1D and 2D arrays,
3D (WSize -1). Multisampled and unnamed dimensions stay 2D. With this,
the validation error is gone on an RTX 5070.

Tests: the dimension mapping, and a null 3D UAV made on the real device
leaves it alive.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:54:34 +00:00
github manually merged commit cbb50b8016 into gh-pr/205/base 2026-11-26 03:54:36 +00:00
Author
Owner

@⁠SpaghettiMaster545 on GitHub · 2026-11-24 03:28 UTC · original

Tested in the world d2a4bae + this PR (clean merge), as a data point for #71.

  • NVIDIA GeForce RTX 5070 Ti, driver 621.24 (32.0.16.2124); Ryzen 7 9800X3D; Windows 11 10.0.26100; Rust 1.98.1. Diag build, VICTORY_D3D12_DRED=1, its own empty cache, scripted keys into story mode.
  • The world hang is unchanged: the device is removed (DEVICE_HUNG) at 63 s after start, which is within the range of plain main on this machine (59–111 s over three runs, see #400).
  • Program by program against main: nothing lost or gained in translation, as expected for a descriptor change. World frames 713 ms, as on main.

So on this card the null-UAV view dimension is not what removes the device, or it is not the only thing. I did not run GPU-based validation, so I cannot say whether this PR removes the mismatch it targets in the world.

(Claude Code, Claude Opus 5.5: ran the title and summarised the log.)

**@⁠SpaghettiMaster545** on GitHub · 2026-11-24 03:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/205#issuecomment-7121126469) **Tested in the world** `d2a4bae` + this PR (clean merge), as a data point for #71. - NVIDIA GeForce RTX 5070 Ti, driver 621.24 (32.0.16.2124); Ryzen 7 9800X3D; Windows 11 10.0.26100; Rust 1.98.1. Diag build, `VICTORY_D3D12_DRED=1`, its own empty cache, scripted keys into story mode. - The world hang is unchanged: the device is removed (`DEVICE_HUNG`) at 63 s after start, which is within the range of plain `main` on this machine (59–111 s over three runs, see #400). - Program by program against `main`: nothing lost or gained in translation, as expected for a descriptor change. World frames 713 ms, as on `main`. So on this card the null-UAV view dimension is not what removes the device, or it is not the only thing. I did not run GPU-based validation, so I cannot say whether this PR removes the mismatch it targets in the world. (Claude Code, Claude Opus 5.5: ran the title and summarised the log.)
Author
Owner

@⁠QemmHD on GitHub · 2026-11-24 05:11 UTC · original

Tested cbb50b8 on main d2a4bae, native Windows 11, RTX 4070 SUPER, driver 621.24.

  • cargo test --workspace --locked: 266 passed, 0 failed, 4 ignored; no new warnings. Both new tests pass on hardware.
  • With null_for changed back to null_uav_desc(None), both tests still pass: null_3d_uav_is_accepted_by_the_device only creates the descriptor, so the wiring itself isn't covered.
  • On this card a cs_6_6 RWTexture3D read through a null 2D UAV returns 0 and keeps the device, and so do 8 other null-kind or dimension mismatches (10/10, one process each; QemmHD/VIctory repro/392-null-view-kinds, e93b30a). So on Ada this fixes a GPU-based-validation report, not a device removal. The dimension values match d3d12.h.

No game data used.

AI-assisted (Claude Code, Claude Opus 5.5).
Discord: bigpeppa.

**@⁠QemmHD** on GitHub · 2026-11-24 05:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/205#issuecomment-7122711762) Tested `cbb50b8` on `main` `d2a4bae`, native Windows 11, RTX 4070 SUPER, driver 621.24. - `cargo test --workspace --locked`: 266 passed, 0 failed, 4 ignored; no new warnings. Both new tests pass on hardware. - With `null_for` changed back to `null_uav_desc(None)`, both tests still pass: `null_3d_uav_is_accepted_by_the_device` only creates the descriptor, so the wiring itself isn't covered. - On this card a `cs_6_6` `RWTexture3D` read through a null 2D UAV returns 0 and keeps the device, and so do 8 other null-kind or dimension mismatches (10/10, one process each; [QemmHD/VIctory `repro/392-null-view-kinds`](https://github.com/QemmHD/VIctory/tree/repro/392-null-view-kinds), `e93b30a`). So on Ada this fixes a GPU-based-validation report, not a device removal. The dimension values match d3d12.h. No game data used. AI-assisted (Claude Code, Claude Opus 5.5). Discord: bigpeppa.
Author
Owner

@⁠ghost on GitHub · 2026-11-24 05:51 UTC · original

Small asset-policy note on head cbb50b8: the doc comment at crates/victory-gpu/src/descriptor/host.rs:788 names one of the title's compute shader entry points. docs/asset-policy.md keeps strings taken from the game out of the source, so could the comment describe it as "the world's wind-field compute shader" without the name? The fix itself looks good.

Read-only review, nothing built. AI-assisted (Claude Code); the claim above was checked against this head and main at d2a4bae. Context: the triage in #366.

**@⁠ghost** on GitHub · 2026-11-24 05:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/205#issuecomment-7123334132) Small asset-policy note on head `cbb50b8`: the doc comment at `crates/victory-gpu/src/descriptor/host.rs:788` names one of the title's compute shader entry points. `docs/asset-policy.md` keeps strings taken from the game out of the source, so could the comment describe it as "the world's wind-field compute shader" without the name? The fix itself looks good. _Read-only review, nothing built. AI-assisted (Claude Code); the claim above was checked against this head and `main` at `d2a4bae`. Context: the triage in #366._
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!205
No description provided.