Skip to content

GPU: unordered views only in formats the host stores to (NVIDIA device removal on B5G5R5A1) - #1843

Open
KevinPratap wants to merge 1 commit into
Marvisak:mainfrom
KevinPratap:gpu/typed-uav-format-support
Open

KevinPratap wants to merge 1 commit into
Marvisak:mainfrom
KevinPratap:gpu/typed-uav-format-support

Conversation

@KevinPratap

Copy link
Copy Markdown
Contributor

Problem

On NVIDIA (RTX 4050 Laptop, driver 621.24), current main removes the device a few seconds into the menus. The D3D12 debug layer names the call:

ID3D12Device::CreateUnorderedAccessView: The format (0x56, B5G5R5A1_UNORM) cannot be used with a Typed Unordered Access View.
RemoveDevice: ... DXGI_ERROR_INVALID_CALL

fits() asks typed_store() only when a view is cast to another format family. An unordered view in the texture's own format skips the check. AMD supports typed stores to this format; NVIDIA does not.

Fix

Every unordered view now needs typed stores in its final format (stores()). Without them the view is null: its writes are dropped, and that's logged once.

Verified

  • The same run on that laptop: before, the device was removed after about 35 s; after, no removal, and it keeps running through the menus. The new warning fired once, for format 86.
  • New test unordered_views_need_typed_stores passes.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings is clean.

Only crates/victory-gpu/src/descriptor/host.rs changes.

AI-assisted.

🤖 Generated with Claude Code

fits() checked typed-store support only for views cast to another family, so an unordered view in the texture's own format went to CreateUnorderedAccessView regardless. On an RTX 4050 Laptop, main removed the device a few seconds into the menus: the D3D12 debug layer reports 'The format (0x56, B5G5R5A1_UNORM) cannot be used with a Typed Unordered Access View' and DXGI_ERROR_INVALID_CALL. Every unordered view now needs typed stores in its final format; without them it is null (its writes dropped, logged once). With this the same run kept going through the menus with no device removal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@upipibi

upipibi commented Nov 24, 2026

Copy link
Copy Markdown

Overlap for the reviewers: the same B5G5R5A1_UNORM typed-UAV removal on NVIDIA (#1753 / #1754) has open fixes on the view side in descriptor/host.rs (#1763, #1775, #1780, #1801) and on the texture side in resource.rs (#1787, #1832). From reading the file lists; nothing built.

AI-assisted (Claude Code).

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.

Unordered views only in formats the host stores to (NVIDIA D3D12): same capability gate as #1775/#1787/#1801/#1832 — fifth leg, check consistency.

@0xSAW

0xSAW commented Nov 25, 2026

Copy link
Copy Markdown

Tested commit 3502e6c on NVIDIA GeForce RTX 2060 6GB (Turing / TU106, Driver 566.14, Windows 11 x64).

Can confirm this completely resolves the D3D12 device removal crash on Turing:

Context & Reproduction

On main prior to this PR, running with VICTORY_D3D12_DEBUG=1 consistently produced a device removal immediately after the first command list submission:

Results with PR #1843

  1. Unit Test: crates/victory-gpu/src/descriptor/host.rs::tests::unordered_views_need_typed_stores passed cleanly.
  2. Runtime Verification: Built binary with the diag profile (features = ["diagnostics"]) and executed with VICTORY_D3D12_DEBUG=1 and VICTORY_D3D12_DRED=1:
    • The D3D12 debug layer reported 0 errors / 0 warnings regarding unsupported UAV formats.
    • The device is no longer removed on B5G5R5A1_UNORM allocation.
    • Command list submission and descriptor allocation proceed successfully past the GPU initialization stage.
      (The execution later encountered an unrelated CPU-side 0xc0000005 null-pointer write in image loading, which is expected on this branch and unrelated to D3D12/GPU views).

LGTM! Thanks for the fix, @KevinPratap.

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Proposed close: duplicate of #1763. The new stores helper in fits (crates/victory-gpu/src/descriptor/host.rs) refuses an unordered view in a format without typed stores, in all three arms. That fixes the B5G5R5A1_UNORM device removal in #1753. #1763 makes the same change to the same function, merges cleanly and was triaged first. Its tests make a real host texture and check the castable case. unordered_views_need_typed_stores here only compares stores with typed_store, so it does not exercise fits.

If this PR covers a case #1763 misses, say which one and this verdict can be revisited.

CI: no check runs on the head commit.

This pull request will be closed in 48 hours unless the author pushes a change or a maintainer removes the triage: proposed close label.


Generated by Claude Code

@KainanP

KainanP commented Nov 25, 2026

Copy link
Copy Markdown

RTX 4060 Laptop (610.47), merged onto main 13f91ca (test-only conflict, kept both): B5G5R5A1 UAV half fixed (views refused), B4G4R4A4 target half still removes the device; no new failures. With #1832 too: same, and also fixes the UAV half on Intel UHD. Details and the side-by-side table with the other #1753 PRs: #1753 (comment). Tested with the help of an AI assistant (Claude Code).

@krcenov

krcenov commented Nov 25, 2026

Copy link
Copy Markdown

Tested #1843 + #1832 together on 940d32f: RTX 3070, driver 32.0.16.1714, Windows 10 22H2 (19045), with a local Agility SDK 1.620.2 export (needed on Windows 10, see #2563). No more device removal from the B5G5R5A1 typed UAV. It ran ~5 min 40 s at a steady 30 fps until an unrelated GPU hang at world load. Debug layer on (VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_DRED=1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants