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

Open
KevinPratap wants to merge 1 commit from upstream-pr/1843 into main
KevinPratap commented 2026-11-24 23:16:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by KevinPratap on 2026-11-24T23:16:30Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:issue:6593352778 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1843). Originally posted by [KevinPratap](https://github.com/KevinPratap) on 2026-11-24T23:16:30Z. --- ## 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](https://claude.com/claude-code)
catminou4 commented 2026-11-25 00:06:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T23:47:39Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:Marvisak/VIctory:review:6049282009 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1843#pullrequestreview-6049282009). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T23:47:39Z. **Review:** COMMENTED --- 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.
upipibi commented 2026-11-25 00:06:45 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-24T23:16:59Z.


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).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7147222626 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1843#issuecomment-7147222626). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-24T23:16:59Z. --- 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).
0xSAW commented 2026-11-25 02:06:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xSAW on 2026-11-25T01:44:28Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149900503 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1843#issuecomment-7149900503). Originally posted by [0xSAW](https://github.com/0xSAW) on 2026-11-25T01:44:28Z. --- 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.
Marvisak commented 2026-11-25 07:03:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T06:18:11Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7154650940 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1843#issuecomment-7154650940). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T06:18:11Z. --- <!-- victory-triage v1 head=3502e6c54ae71c0fb2fc2fe9fbfd3023293dc00b verdict=proposed-close at=2026-11-25T06:37:30Z --> 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](https://claude.ai/code)_
KainanP commented 2026-11-25 20:06:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by KainanP on 2026-11-25T19:35:59Z.


RTX 4060 Laptop (610.47), merged onto main 13f91cae (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: https://github.com/Marvisak/VIctory/issues/1753#issuecomment-7172510623. Tested with the help of an AI assistant (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7172518778 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1843#issuecomment-7172518778). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-25T19:35:59Z. --- RTX 4060 Laptop (610.47), merged onto main 13f91cae (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: https://github.com/Marvisak/VIctory/issues/1753#issuecomment-7172510623. Tested with the help of an AI assistant (Claude Code).
krcenov commented 2026-11-25 22:04:36 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by krcenov on 2026-11-25T21:52:19Z.


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).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7175645723 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1843#issuecomment-7175645723). Originally posted by [krcenov](https://github.com/krcenov) on 2026-11-25T21:52:19Z. --- 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).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1843:upstream-pr/1843'
git switch 'upstream-pr/1843'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1843'
git switch 'upstream-pr/1843'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1843'
git switch 'upstream-pr/1843'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1843'
git switch 'main'
git merge --squash 'upstream-pr/1843'
git switch 'main'
git merge --ff-only 'upstream-pr/1843'
git switch 'main'
git merge 'upstream-pr/1843'
git push origin 'main'
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!1841
No description provided.