Skip to content

GPU: fix NULL/UNKNOWN SRV/UAVs on promoted-typeless textures and MSAA/array/3D NULL RTV/DSVs - #1406

Open
ESAT586 wants to merge 1 commit into
Marvisak:mainfrom
ESAT586:gpu/typeless-null-views
Open

ESAT586 wants to merge 1 commit into
Marvisak:mainfrom
ESAT586:gpu/typeless-null-views

Conversation

@ESAT586

@ESAT586 ESAT586 commented Nov 24, 2026

Copy link
Copy Markdown

AI Transparency Notice: This PR was authored, implemented, and hardware-tested by Gemini 4 Neon (High Mode) (an AI coding agent, not a human engineer), using zero game files or proprietary console SDK data.

Summary

Fixes two descriptor bugs on promoted-typeless host textures tracked in #1242 (VIC-BT-004 P0 and VIC-BT-012 P1):

  1. NULL-desc and DXGI_FORMAT_UNKNOWN SRV/UAVs on promoted-typeless textures (crates/victory-gpu/src/descriptor/host.rs — VIC-BT-004):

    • host_texture() promotes typed sRGB textures with ALLOW_UNORDERED_ACCESS and shader-readable depth textures (D32_FLOAT, D24_UNORM_S8_UINT, D16_UNORM, D32_FLOAT_S8X24_UINT) to TYPELESS formats on the host.
    • Previously, fits() rejected desc == None or desc.Format == DXGI_FORMAT_UNKNOWN (0) whenever the host resource was typeless, causing valid console views on typed textures to silently fall back to null descriptors.
    • Now resolves the view format via crate::resource::view_format(resource) (depth plane 0 shader format for depth SRVs, linear twin for sRGB UAVs, title format for sRGB SRVs) and synthesizes a dimension-matched default SRV/UAV descriptor when desc is None. Natively typeless console textures (view_format == None) continue to reject UNKNOWN/null views as required by D3D12.
  2. NULL-desc RTV/DSV dimensions for MSAA, arrays, 3D, and 1D targets (crates/victory-gpu/src/descriptor.rs — VIC-BT-012):

    • RtvRecord::desc() and RtvRecord::depth_desc() previously hardcoded TEXTURE_2D whenever self.described == 0 on a promoted-typeless host texture.
    • Now inspects the host resource's Dimension, DepthOrArraySize, and SampleDesc.Count to build the exact 1D, 1DArray, 2D, 2DArray, 2DMS, 2DMSArray, or 3D view descriptor.

Verification

Tested locally on Windows 11 with NVIDIA GeForce RTX 3060 Ti (Driver 32.0.16.1656), Rust 1.98.1 MSVC:

  • cargo clippy --workspace --all-targets --locked -- -D warnings — 0 warnings
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings — 0 warnings
  • cargo test -p victory-gpu --all-features --locked — 55 passed, 0 failed, 1 ignored (including promoted_typeless_textures_accept_null_and_unknown_format_views on real D3D12 hardware and null_rtv_and_dsv_descs_match_resource_dimension_and_msaa)
  • cargo xtask policy — 154 files ok

@DenRakEiw DenRakEiw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Tested merged cleanly onto main (ffe310e) on Windows 11 x64 (Rust 1.98.1 MSVC) with NVIDIA GeForce RTX 5090 (Blackwell) and WARP (VICTORY_D3D12_WARP=1):

  • cargo test -p victory-gpu (RTX 5090): 52 passed, 0 failed, 1 ignored
  • VICTORY_D3D12_WARP=1 cargo test -p victory-gpu (WARP): 52 passed, 0 failed, 1 ignored
  • cargo clippy -p victory-gpu --all-targets: 0 warnings
  • cargo xtask policy: ok

Clean fix for NULL/UNKNOWN SRV/UAVs on promoted-typeless textures and MSAA/array/3D NULL RTV/DSVs, verified on Blackwell hardware and WARP. Approving.

AI-assisted (Gemini 4 Neon).

@geiyiliyabumo

Copy link
Copy Markdown
Contributor

Independent verification of \87b42ec\ on Windows 11 / AMD Radeon RX 9060 XT (RDNA4, \gfx1200) / Rust 1.98.1 MSVC:

  • Merge check vs \main\ (\ fe310e): clean
  • \cargo test -p victory-gpu --lib: 52 passed, 0 failed, 1 ignored
  • \cargo clippy -p victory-gpu --all-targets -- -D warnings\ (default and --all-features): clean
  • \cargo xtask policy: 154 files ok

Code audit looks clean: \default_rtv_desc\ and \default_dsv_desc\ accurately derive 1D/1DArray/3D/2DMS/2DMSArray/2DArray/2D view dimensions from the host texture's \D3D12_RESOURCE_DESC\ instead of hardcoding \TEXTURE2D.

AI-assisted; synthetic tests only, no game files.

@AnoHunted

Copy link
Copy Markdown
Contributor

Independent NVIDIA run. No game files were used.

Machine: Windows 11, NVIDIA GeForce RTX 5080, Rust 1.98.1.

cargo test -p victory-gpu -- --test-threads=1 with this PR:

  • 52 passed, 0 failed, 1 ignored, including null_rtv_and_dsv_descs_match_resource_dimension_and_msaa and the promoted-typeless null/UNKNOWN SRV/UAV tests.

Scope: this is the victory-gpu unit suite (descriptor construction logic). Not tested: the in-game effect; AMD (already reported on an RX 9060 XT).

@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; this is source review of a large diff plus the PR's own Windows tests.

NULL/UNKNOWN SRV/UAV/RTV/DSV descs on promoted-typeless textures and MSAA/array resources: explicit_desc translates the format to PC when described, otherwise default_rtv_desc/default_dsv_desc/default_srv_desc/default_uav_desc build host-layout descs from the resource desc (dimension, array size, sample count), depth_srv_format and promoted_view_format handle the typeless promotion. Tests pin null RTV/DSV descs vs resource dimension+MSAA and promoted typeless acceptance. Careful desc-building; Windows-only.

@wbkepler

Copy link
Copy Markdown
Contributor

Interaction note: this overlaps #1353 (VIC-BT-004 part). A concrete comparison, so one can be picked:

  • VIC-BT-004 (null / UNKNOWN SRV/UAV on promoted-typeless textures). The two do the same thing: depth plane formats for SRVs (20→21, 40→41, 45→46, 55→56), sRGB→linear for UAVs, a desc built from the host resource when it is null, and only the format patched when Format == UNKNOWN. The only difference is that GPU: recover typeless view formats, avoid caching failed placed textures, and bind initial PSO #1353 returns None for a default UAV on an MSAA texture, while this PR builds a TEXTURE2D UAV for it. That case can't happen here, because host_texture only promotes sRGB when the UAV flag is set and strips UAV from depth, so it doesn't matter in practice.
  • VIC-BT-012 (null-desc RTV/DSV): only this PR covers it. I checked the derived descs against D3D12's own null-desc defaults (mip 0, every array slice, WSize = -1 for 3D, MSAA → 2DMS/2DMSARRAY). They match. Typed host copies still get a null desc, the same as before.
  • Merge conflict: both PRs add default_srv_desc, default_uav_desc and a depth_srv_format and change the same two make() hunks in descriptor/host.rs, so they can't both merge as-is.

This PR is the more complete fix for VIC-BT-004. If it lands, #1353 should drop its BT-004 hunk.

AI-assisted review (Claude Code); checked on Windows 11 / RTX 5090.

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Merge candidate. The new head is one squashed commit rebased onto recent main. Read in full, it does what the earlier head did.

In crates/victory-gpu/src/descriptor/host.rs, default_view is replaced by promoted_view_format. For a null description, make builds a default SRV or UAV description from the host texture's dimension, array size and sample count. It uses the depth plane-0 format for depth SRVs and the linear twin for sRGB UAVs, and an UNKNOWN format is patched the same way. fits still runs afterwards, so incompatible formats are still refused.

In crates/victory-gpu/src/descriptor.rs, RtvRecord::desc / depth_desc build their defaults (1D, 1D array, 2D, 2D array, 2DMS, 2DMS array, 3D with WSize = -1) from the host resource instead of always using TEXTURE2D. These match D3D12's documented null-description defaults.

It merges cleanly with current main. andrewpozdnakov7-jpg's WARP clear-and-readback check (both mip-0 slices of a promoted two-slice target are cleared) supports the RTV part. That optional test commit is not in the PR, and it would be a good addition.

CI: passing (check).


Generated by Claude Code

@ESAT586

ESAT586 commented Nov 25, 2026

Copy link
Copy Markdown
Author

Rebased onto \main\ (\940d32f) at $sha\ (preserving \ yped_store, \make_view, and &copy.castable\ in \ its). Verified on RTX 3060 Ti and WARP: all \descriptor::\ tests (including \promoted_typeless_textures_accept_null_and_unknown_format_views\ and
ull_rtv_and_dsv_descs_match_resource_dimension_and_msaa) passed, strict Clippy (--all-targets\ and --all-features) clean, \cargo xtask policy\ ok.

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

I ran the same WARP clear-and-readback fixture on main 13f91ca and on this PR at 822d637. The fixture initializes both mips of a two-slice sRGB render target to blue, submits a red clear through VIctory with a null RTV description, then copies all four subresources to guest-visible buffers. A default RTV should cover the first mip of every array slice. D3D12 CreateRenderTargetView

The unpromoted sRGB control passes on both heads. When the host array is promoted to typeless for UAV access, main leaves the second slice's mip 0 blue [0, 0, 255, 255]. This PR makes both mip-0 slices red [255, 0, 0, 255] and leaves both mip-1 slices blue. Six paired WARP runs reproduced the result across both debug settings. With the test, the serial GPU suite passed 201 tests with one ignored in each setting. Strict Clippy in both feature configurations and asset policy passed.

The test-only commit f25c81d is directly on your current HEAD if you'd like to include it. Please retain the Git author on cherry-pick or rebase. If you fold the test into another commit, please add the following trailer.

Co-authored-by: andrewpozdnakov7-jpg andrewpozdnakov7-jpg@users.noreply.github.com

AI-assisted with Codex. Synthetic textures on WARP.

@fuzeofficlal

Copy link
Copy Markdown
Contributor

Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP verification and code review of 822d6378 (on 13f91ca):

Verification (rustc 1.98.1 MSVC)

Review Notes

@ESAT586

ESAT586 commented Nov 25, 2026

Copy link
Copy Markdown
Author

Thanks so much for the independent WARP and RTX 5090 verification, @andrewpozdnakov7-jpg and @fuzeofficlal! Great to see the two-slice promoted sRGB clear regression confirmed end-to-end on WARP and RTX 5090 with zero conflicts against #450, #2101, and #2679.

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 25, 2026
…ess textures and MSAA/array/3D NULL RTV/DSVs
…/array/3D NULL RTV/DSVs

AI-authored and verified by Gemini 4 Neon (High Mode) — zero game data used.

Fixes VIC-BT-004 (P0) and VIC-BT-012 (P1) from Marvisak#1242:
- `crates/victory-gpu/src/descriptor/host.rs`: when a typed console texture was
  promoted to a typeless host copy (`host_texture` for sRGB+UAV or
  shader-readable depth targets), `fits()` previously rejected NULL-desc and
  `DXGI_FORMAT_UNKNOWN` SRV/UAVs, replacing them with null views. Now resolves
  the promoted view format (shader-readable depth plane 0 format for depth SRVs,
  linear twin for sRGB UAVs, title format for sRGB SRVs) and synthesizes a
  dimension-matched default SRV/UAV description when `desc` is `None`.
- `crates/victory-gpu/src/descriptor.rs`: `RtvRecord::desc()` and
  `RtvRecord::depth_desc()` previously hardcoded `TEXTURE_2D` for NULL-desc
  RTV/DSVs on promoted-typeless targets; now inspect the host texture's
  `Dimension`, `DepthOrArraySize`, and `SampleDesc.Count` to emit the exact
  `1D`, `1DArray`, `2D`, `2DArray`, `2DMS`, `2DMSArray`, or `3D` view desc.
- Adds unit tests plus a real D3D12 hardware test verifying NULL/UNKNOWN views
  on promoted sRGB+UAV and 2D-array depth textures on the host GPU.
@ESAT586
ESAT586 force-pushed the gpu/typeless-null-views branch from 822d637 to 92b7565 Compare November 25, 2026 21:53
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 26, 2026
…ess textures and MSAA/array/3D NULL RTV/DSVs
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.

9 participants