victory-gpu: keep depth-twin UAVs in concrete UAV formats and support default views #1933

Open
github-bot wants to merge 4 commits from github-bot/gh-1933 into main AGit
Owner

@⁠mgunes1311-lab on GitHub · 2026-11-25 01:10 UTC · original
mgunes1311-lab:gpu-twin-uav-formats → main · +326 −22 · 1 files · 4 commits · open

Summary

Fixes D3D12 UAV format validation and default/1D view handling in victory_gpu::twin::uav when creating unordered access views on writable depth-texture twins:

  1. Prevent D3D12 device removal on depth-typed and typeless UAV descriptions: twin::uav checked family(view) == own, where own is DXGI_FORMAT_R32_TYPELESS (39), DXGI_FORMAT_R16_TYPELESS (53), or DXGI_FORMAT_R8_TYPELESS (60). Because D32_FLOAT (40), D16_UNORM (55), and the *_TYPELESS formats themselves belong to those families, twin::uav passed them directly into ID3D12Device::CreateUnorderedAccessView, which rejects depth and typeless UAV formats and puts the host D3D12 device into DEVICE_REMOVED. uav_format now maps depth, typeless, and DXGI_FORMAT_UNKNOWN (0, inheriting the title resource's format) views to the plane's concrete UAV format (R32_FLOAT, R16_UNORM, or R8_UINT), preserves explicit UAV-capable formats in the plane's family (R32_UINT, R32_SINT, R16_FLOAT, R16_UINT, R8_UNORM, etc.), and classifies planar stencil formats (X32_TYPELESS_G8X24_UINT, X24_TYPELESS_G8_UINT) as integer.
  2. Support null (pDesc == nullptr) and 1D / 1D-array depth UAVs: twin::uav previously bailed out on words = None and rejected TEXTURE1D (2) / TEXTURE1DARRAY (3). It now synthesizes default mip-0 plane-0 view words (covering all slices on array resources) when words is None and handles 1D / 1D-array UAV dimensions on plane 0.

Verification

  • VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --all-features --target x86_64-pc-windows-msvc --locked -- twin (unit tests for format/default-descriptor mapping + end-to-end D3D12 compute dispatch writing through D32_FLOAT, R32_TYPELESS, DXGI_FORMAT_UNKNOWN, 1D D16_UNORM, and null-pDesc 2D-array D16_UNORM depth UAVs and reading back the copied host depth subresources)
  • cargo clippy --workspace --all-targets --target x86_64-pc-windows-msvc --locked -- -D warnings (default and --all-features)
  • cargo doc --workspace --no-deps --target x86_64-pc-windows-msvc --locked
  • cargo run -p xtask --target x86_64-pc-windows-msvc --locked -- policy --staged & cargo test -p xtask --target x86_64-pc-windows-msvc --locked
**@⁠mgunes1311-lab** on GitHub · 2026-11-25 01:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/1933) `mgunes1311-lab:gpu-twin-uav-formats` → `main` · +326 −22 · 1 files · 4 commits · open ## Summary Fixes D3D12 UAV format validation and default/1D view handling in `victory_gpu::twin::uav` when creating unordered access views on writable depth-texture twins: 1. **Prevent D3D12 device removal on depth-typed and typeless UAV descriptions:** `twin::uav` checked `family(view) == own`, where `own` is `DXGI_FORMAT_R32_TYPELESS` (`39`), `DXGI_FORMAT_R16_TYPELESS` (`53`), or `DXGI_FORMAT_R8_TYPELESS` (`60`). Because `D32_FLOAT` (`40`), `D16_UNORM` (`55`), and the `*_TYPELESS` formats themselves belong to those families, `twin::uav` passed them directly into `ID3D12Device::CreateUnorderedAccessView`, which rejects depth and typeless UAV formats and puts the host D3D12 device into `DEVICE_REMOVED`. `uav_format` now maps depth, typeless, and `DXGI_FORMAT_UNKNOWN` (`0`, inheriting the title resource's format) views to the plane's concrete UAV format (`R32_FLOAT`, `R16_UNORM`, or `R8_UINT`), preserves explicit UAV-capable formats in the plane's family (`R32_UINT`, `R32_SINT`, `R16_FLOAT`, `R16_UINT`, `R8_UNORM`, etc.), and classifies planar stencil formats (`X32_TYPELESS_G8X24_UINT`, `X24_TYPELESS_G8_UINT`) as integer. 2. **Support null (`pDesc == nullptr`) and 1D / 1D-array depth UAVs:** `twin::uav` previously bailed out on `words = None` and rejected `TEXTURE1D` (`2`) / `TEXTURE1DARRAY` (`3`). It now synthesizes default mip-0 plane-0 view words (covering all slices on array resources) when `words` is `None` and handles 1D / 1D-array UAV dimensions on plane 0. ## Verification - `VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --all-features --target x86_64-pc-windows-msvc --locked -- twin` (unit tests for format/default-descriptor mapping + end-to-end D3D12 compute dispatch writing through `D32_FLOAT`, `R32_TYPELESS`, `DXGI_FORMAT_UNKNOWN`, 1D `D16_UNORM`, and null-`pDesc` 2D-array `D16_UNORM` depth UAVs and reading back the copied host depth subresources) - `cargo clippy --workspace --all-targets --target x86_64-pc-windows-msvc --locked -- -D warnings` (default and `--all-features`) - `cargo doc --workspace --no-deps --target x86_64-pc-windows-msvc --locked` - `cargo run -p xtask --target x86_64-pc-windows-msvc --locked -- policy --staged` & `cargo test -p xtask --target x86_64-pc-windows-msvc --locked`
`twin::uav` previously accepted any view format in the twin plane's DXGI
family (`family(view) == own`) and required an explicit 2D or 2D-array
description (`words?`):

1. Depth (`D32_FLOAT` = 40, `D16_UNORM` = 55) and typeless (`R32_TYPELESS` = 39,
   `R16_TYPELESS` = 53, `R8_TYPELESS` = 60) formats belong to the twin plane's
   own family, so `family(view) == own` passed them straight into D3D12
   `CreateUnorderedAccessView`, which rejects depth and typeless UAV formats
   and removes the host device. Map typeless, depth, and `DXGI_FORMAT_UNKNOWN`
   (`0`) view formats to the plane's concrete UAV format (`R32_FLOAT`,
   `R16_UNORM`, or `R8_UINT`), while preserving explicit typed UAV formats
   (`R32_UINT`, `R16_FLOAT`, `R16_UINT`, `R8_UNORM`, etc.) and recognizing
   planar stencil formats (`22`, `47`) as integer.
2. Support null UAV descriptions (`words = None` -> mip 0, plane 0, full array
   span) and 1D / 1D-array depth UAV dimensions (`2`, `3`) instead of dropping
   the view.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:49:15 +00:00
Author
Owner

@⁠upipibi on GitHub · 2026-11-25 01:44 UTC · original

Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at c2a3624. victory-shader: 243 passed, with only #1744's 3 NVIDIA failures. victory-gpu: 141 passed, 2 failed, with only the two NVIDIA heap-cap failures main also has. Same as main on this hardware. Not run: a title.

AI-assisted (Claude Code).

**@⁠upipibi** on GitHub · 2026-11-25 01:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/1933#issuecomment-7149907190) Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at `c2a3624`. `victory-shader`: 243 passed, with only #1744's 3 NVIDIA failures. `victory-gpu`: 141 passed, 2 failed, with only the two NVIDIA heap-cap failures `main` also has. Same as `main` on this hardware. Not run: a title. AI-assisted (Claude Code).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 08:19 UTC · original · edited 2026-11-25 18:25 UTC

Automated triage for the maintainers.

Merge candidate. In twin::uav (crates/victory-gpu/src/twin.rs), main keeps the title's view format whenever family(view) == own. resource::family maps D32_FLOAT (40) to 39 and D16_UNORM (55) to 53, so a depth-typed or typeless format can reach CreateUnorderedAccessView today, and D3D12 does not accept those for UAVs. The new uav_format excludes 39/40/53/55/60 and resolves UNKNOWN through pc_format(console). I checked its fallbacks against the plane formats from plane_formats. default_uav_words fills in the null-description case with the D3D12 UAV layout (1D: mip, then first slice and size for arrays; 2D arrays: size in word 4). 1D views correctly use plane 0.

Small notes, none blocking:

  • The null-description path skips the default_view check that the non-depth path in descriptor/host.rs runs.
  • The GPU test leaks three 1 MiB allocations.
  • Adding 22/47 to integer() turns a stencil-typed view on the depth plane into R32_UINT.

CI: check passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 08:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/1933#issuecomment-7156874954) · edited 2026-11-25 18:25 UTC <!-- victory-triage v1 head=e5750d906995699a25e5036ca12175c1f9769603 verdict=merge-candidate at=2026-11-25T18:24:55Z --> Automated triage for the maintainers. **Merge candidate.** In `twin::uav` (`crates/victory-gpu/src/twin.rs`), `main` keeps the title's view format whenever `family(view) == own`. `resource::family` maps `D32_FLOAT` (40) to 39 and `D16_UNORM` (55) to 53, so a depth-typed or typeless format can reach `CreateUnorderedAccessView` today, and D3D12 does not accept those for UAVs. The new `uav_format` excludes 39/40/53/55/60 and resolves `UNKNOWN` through `pc_format(console)`. I checked its fallbacks against the plane formats from `plane_formats`. `default_uav_words` fills in the null-description case with the D3D12 UAV layout (1D: mip, then first slice and size for arrays; 2D arrays: size in word 4). 1D views correctly use plane 0. Small notes, none blocking: - The null-description path skips the `default_view` check that the non-depth path in `descriptor/host.rs` runs. - The GPU test leaks three 1 MiB allocations. - Adding 22/47 to `integer()` turns a stencil-typed view on the depth plane into `R32_UINT`. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠mgunes1311-lab on GitHub · 2026-11-25 16:52 UTC · original

Merged main (67e8ae1) to resolve the test conflict in crates/victory-gpu/src/twin.rs alongside 98c654b and 315cea1.

**@⁠mgunes1311-lab** on GitHub · 2026-11-25 16:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/1933#issuecomment-7168656090) Merged `main` (`67e8ae1`) to resolve the test conflict in `crates/victory-gpu/src/twin.rs` alongside `98c654b` and `315cea1`.
Author
Owner

@⁠mgunes1311-lab on GitHub · 2026-11-25 16:55 UTC · original

Merged main (67e8ae1) to resolve the test conflict in crates/victory-gpu/src/twin.rs alongside 98c654b and 315cea1.

**@⁠mgunes1311-lab** on GitHub · 2026-11-25 16:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/1933#issuecomment-7168741668) Merged `main` (`67e8ae1`) to resolve the test conflict in `crates/victory-gpu/src/twin.rs` alongside `98c654b` and `315cea1`.
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 02:10 UTC · original · reviewed

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

Depth-twin UAVs kept in concrete UAV formats: format-concrete UAV fix for depth twins — pairs with #1964's 24-bit depth twins.

**@⁠catminou4** on GitHub · 2026-11-25 02:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/1933#pullrequestreview-6050611923) · **reviewed** Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff. Depth-twin UAVs kept in concrete UAV formats: format-concrete UAV fix for depth twins — pairs with #1964's 24-bit depth twins.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 18:48 UTC · original · approved these changes

Reviewed e5750d906995 merged cleanly onto 63bcca43.

The changes in crates/victory-gpu/src/twin.rs cleanly prevent device removal on depth-typed/typeless/default depth-twin UAVs and extend support to 1D/1D-array views:

  • uav_format (twin.rs:306-321) & integer (twin.rs:324-329): Correctly resolves DXGI_FORMAT_UNKNOWN (0) through the resource's console format and pc_format, rejects typeless (39, 53, 60) and depth (40, 55) members even when they match the twin plane's family, and falls back to concrete UAV-capable formats (R16_UNORM/R16_UINT, R32_FLOAT/R32_UINT, R8_UINT), with planar stencil formats (22 | 47) classified as integer.
  • default_uav_words (twin.rs:285-298) & 1D view handling (twin.rs:247-275): Word layout matches D3D12_UNORDERED_ACCESS_VIEW_DESC across Texture1D, Texture1DArray, Texture2D, and Texture2DArray (slices > 1 selects array views with ArraySize at word 4), and leaving plane_word = None for 1D/1D-array views avoids clobbering FirstArraySlice at word 3.

Hardware & D3D12 Debug Layer verification (RTX 5090 + Microsoft WARP, VICTORY_D3D12_DEBUG=1):

  • cargo xtask policy and cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default and --all-features) pass cleanly.
  • cargo test --locked -p victory-gpu twin::tests:: -- --test-threads=1 passed 4/4 on both RTX 5090 and WARP under VICTORY_D3D12_DEBUG=1.
  • Verified an additional Debug Layer probe creating 25 concrete UAVs across D32_FLOAT_S8X24_UINT (20), R32G8X24_TYPELESS (19), D16S8 (118), and 1D/1D-array D32_FLOAT (40) (default None, explicit plane 0 & plane 1 with typeless/depth/stencil/concrete formats, 1D-array with non-zero FirstArraySlice, plus out-of-range plane 2 cleanly returning None): GetDeviceRemovedReason().is_ok() and host.log_messages() == None on both RTX 5090 and WARP.
  • Also verified a clean co-merge with #1803 (7c609deb480f) on 63bcca43 with twin::tests:: and list::tests:: passing under VICTORY_D3D12_DEBUG=1 on both adapters.

LGTM.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 18:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/1933#pullrequestreview-6079160573) · **approved these changes** Reviewed `e5750d906995` merged cleanly onto `63bcca43`. The changes in `crates/victory-gpu/src/twin.rs` cleanly prevent device removal on depth-typed/typeless/default depth-twin UAVs and extend support to 1D/1D-array views: - **`uav_format` (`twin.rs:306-321`) & `integer` (`twin.rs:324-329`)**: Correctly resolves `DXGI_FORMAT_UNKNOWN (0)` through the resource's console format and `pc_format`, rejects typeless (`39`, `53`, `60`) and depth (`40`, `55`) members even when they match the twin plane's family, and falls back to concrete UAV-capable formats (`R16_UNORM`/`R16_UINT`, `R32_FLOAT`/`R32_UINT`, `R8_UINT`), with planar stencil formats (`22 | 47`) classified as integer. - **`default_uav_words` (`twin.rs:285-298`) & 1D view handling (`twin.rs:247-275`)**: Word layout matches `D3D12_UNORDERED_ACCESS_VIEW_DESC` across `Texture1D`, `Texture1DArray`, `Texture2D`, and `Texture2DArray` (`slices > 1` selects array views with `ArraySize` at word 4), and leaving `plane_word = None` for 1D/1D-array views avoids clobbering `FirstArraySlice` at word 3. **Hardware & D3D12 Debug Layer verification** (RTX 5090 + Microsoft WARP, `VICTORY_D3D12_DEBUG=1`): - `cargo xtask policy` and `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` (default and `--all-features`) pass cleanly. - `cargo test --locked -p victory-gpu twin::tests:: -- --test-threads=1` passed 4/4 on both RTX 5090 and WARP under `VICTORY_D3D12_DEBUG=1`. - Verified an additional Debug Layer probe creating 25 concrete UAVs across `D32_FLOAT_S8X24_UINT (20)`, `R32G8X24_TYPELESS (19)`, `D16S8 (118)`, and 1D/1D-array `D32_FLOAT (40)` (default `None`, explicit plane 0 & plane 1 with typeless/depth/stencil/concrete formats, 1D-array with non-zero `FirstArraySlice`, plus out-of-range plane 2 cleanly returning `None`): `GetDeviceRemovedReason().is_ok()` and `host.log_messages() == None` on both RTX 5090 and WARP. - Also verified a clean co-merge with `#1803` (`7c609deb480f`) on `63bcca43` with `twin::tests::` and `list::tests::` passing under `VICTORY_D3D12_DEBUG=1` on both adapters. LGTM.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1933/head:github-bot/gh-1933'
git switch 'github-bot/gh-1933'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1933'
git switch 'github-bot/gh-1933'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1933'
git switch 'github-bot/gh-1933'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1933'
git switch 'main'
git merge --squash 'github-bot/gh-1933'
git switch 'main'
git merge --ff-only 'github-bot/gh-1933'
git switch 'main'
git merge 'github-bot/gh-1933'
git push origin 'main'
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!1933
No description provided.