gpu: promote unsupported RT/UAV texture carrier formats and filter uncastable DXGI formats #3495

Open
github-bot wants to merge 1 commit from github-bot/gh-3495 into main AGit
Owner

@⁠danielibabet on GitHub · 2026-11-27 09:56 UTC · original
danielibabet:pr/carrier-texture-format → main · +160 −4 · 1 files · 1 commits · open

Fixes two D3D12 texture creation failures (\

**@⁠danielibabet** on GitHub · 2026-11-27 09:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/3495) `danielibabet:pr/carrier-texture-format` → `main` · +160 −4 · 1 files · 1 commits · open Fixes two D3D12 texture creation failures (\
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 10:43:07 +00:00
Author
Owner

@⁠oni-swr on GitHub · 2026-11-27 10:48 UTC · original

Independent WARP verification of #3495 (claim: #1633 comment 7216187558). No GPU used; no game files, dumps or shaders.

Setup

  • PR head 295dfd51c0273fa33d58251e164bbe7ae6f95f8a, base main 63bcca43c6a00a758510398fa43096ce7e4f7df0 (head's diff against base touches only crates/victory-gpu/src/resource.rs).
  • Windows 11 build 10.0.26200; rustc 1.98.1; adapter: system WARP (d3d10warp.dll 10.0.26100.9818), dxil.dll 10.0.19041.5609 from the Windows SDK.
  • VICTORY_WARP=1 VICTORY_D3D12_WARP=1, separate detached worktrees for base and head, one cargo target dir.

Commands

  • cargo test -p victory-gpu -j 4 -- --test-threads=1 on base and on head
  • cargo clippy -p victory-gpu --all-targets -j 4 -- -D warnings on head

Results

passed failed ignored
base 63bcca43 231 0 1
head 295dfd51 232 0 1

The only difference is the added resource::tests::sharedexp_and_b4g4r4a4_rt_uav_textures_promote_to_supported_carrier (passes). The ignored test is the same on both (object::tests::benchmark_private_data_release). Clippy -D warnings on head: clean.

Findings (WARP only; hardware not checked)

  1. The new test does not reach the promotion branch on WARP. WARP reports RT and typed-UAV support for formats 67 and 115 (host_supports_texture is true for both), so make_texture does not promote. The creation half of the test (with the castable asserts removed) also passes on base. Only the three castable(..) asserts fail on base, so the test shows the filter but not the promotion. The assert Format == 67 || castable.contains(&67) is also true for any texture that is not promoted. A test that forces the branch would help, for example by splitting the format choice into a function that takes the support query as an argument.

  2. When the carrier is promoted, the original format is not always kept in the castable list, which the code comment says it is. castable(carrier) leaves out 68, 69 and 89 (the new UNCASTABLE), so for those source formats the carrier's list does not contain them. I forced the branch on WARP, which rejects RT for 89 and 68/69, with a 64x64 2D RT texture:

    • 89, RT: carrier 28; takes() for the original description is false (base: texture stays 89, takes true)
    • 68 and 69, RT: carrier 49; takes() is false (base: takes true)
    • 67 and 115 keep their original in the list, as the test intends.

    A title texture in 89/68/69 that needs RT/UAV on an adapter without it would no longer share that host texture, and its views in the original format would not match. This is probably acceptable, since such views are not creatable anyway, but the comment and test do not say so.

  3. Not reproduced: WARP accepts 68, 69 and 89 in a castable list. On base, CreateCommittedResource3 succeeded with those formats in the list, so the claim in the new comment (D3D12 rejects them) is not visible on WARP. It may be adapter-specific, so it needs hardware to confirm.

  4. Minor: the carrier check ignores sample_count (no MSAA-RT bit is tested), and the clear-value hint is dropped for promoted textures (fine). The castable filter checks only the dimension bit, so it does not drop formats that are valid view targets.

The format-promotion rules otherwise look right: carriers come from castable(), so they share the element size (bytes per texel and block shape). Typeless and depth formats are skipped. The RT/UAV bits are checked against the carrier. The host_desc sRGB-UAV-to-typeless step runs before promotion.

Build note: with one shared cargo target dir, two worktrees of the same workspace can reuse each other's artifacts when file mtimes are older. I touched the head sources and re-ran so the head counts are from a real rebuild.

AI use: this check was run by Claude Sonnet 5.5 (Claude Code), for oni-swr.

**@⁠oni-swr** on GitHub · 2026-11-27 10:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/3495#issuecomment-7216319949) Independent WARP verification of #3495 (claim: #1633 comment 7216187558). No GPU used; no game files, dumps or shaders. **Setup** - PR head `295dfd51c0273fa33d58251e164bbe7ae6f95f8a`, base `main` `63bcca43c6a00a758510398fa43096ce7e4f7df0` (head's diff against base touches only `crates/victory-gpu/src/resource.rs`). - Windows 11 build 10.0.26200; rustc 1.98.1; adapter: system WARP (`d3d10warp.dll` 10.0.26100.9818), `dxil.dll` 10.0.19041.5609 from the Windows SDK. - `VICTORY_WARP=1 VICTORY_D3D12_WARP=1`, separate detached worktrees for base and head, one cargo target dir. **Commands** - `cargo test -p victory-gpu -j 4 -- --test-threads=1` on base and on head - `cargo clippy -p victory-gpu --all-targets -j 4 -- -D warnings` on head **Results** | | passed | failed | ignored | |---|---|---|---| | base `63bcca43` | 231 | 0 | 1 | | head `295dfd51` | 232 | 0 | 1 | The only difference is the added `resource::tests::sharedexp_and_b4g4r4a4_rt_uav_textures_promote_to_supported_carrier` (passes). The ignored test is the same on both (`object::tests::benchmark_private_data_release`). Clippy `-D warnings` on head: clean. **Findings (WARP only; hardware not checked)** 1. The new test does not reach the promotion branch on WARP. WARP reports RT and typed-UAV support for formats 67 and 115 (`host_supports_texture` is true for both), so `make_texture` does not promote. The creation half of the test (with the `castable` asserts removed) also passes on base. Only the three `castable(..)` asserts fail on base, so the test shows the filter but not the promotion. The assert `Format == 67 || castable.contains(&67)` is also true for any texture that is not promoted. A test that forces the branch would help, for example by splitting the format choice into a function that takes the support query as an argument. 2. When the carrier is promoted, the original format is not always kept in the castable list, which the code comment says it is. `castable(carrier)` leaves out 68, 69 and 89 (the new `UNCASTABLE`), so for those source formats the carrier's list does not contain them. I forced the branch on WARP, which rejects RT for 89 and 68/69, with a 64x64 2D RT texture: - 89, RT: carrier 28; `takes()` for the original description is **false** (base: texture stays 89, `takes` true) - 68 and 69, RT: carrier 49; `takes()` is **false** (base: `takes` true) - 67 and 115 keep their original in the list, as the test intends. A title texture in 89/68/69 that needs RT/UAV on an adapter without it would no longer share that host texture, and its views in the original format would not match. This is probably acceptable, since such views are not creatable anyway, but the comment and test do not say so. 3. Not reproduced: WARP accepts 68, 69 and 89 in a castable list. On base, `CreateCommittedResource3` succeeded with those formats in the list, so the claim in the new comment (D3D12 rejects them) is not visible on WARP. It may be adapter-specific, so it needs hardware to confirm. 4. Minor: the carrier check ignores `sample_count` (no MSAA-RT bit is tested), and the clear-value hint is dropped for promoted textures (fine). The castable filter checks only the dimension bit, so it does not drop formats that are valid view targets. The format-promotion rules otherwise look right: carriers come from `castable()`, so they share the element size (bytes per texel and block shape). Typeless and depth formats are skipped. The RT/UAV bits are checked against the carrier. The `host_desc` sRGB-UAV-to-typeless step runs before promotion. Build note: with one shared cargo target dir, two worktrees of the same workspace can reuse each other's artifacts when file mtimes are older. I touched the head sources and re-ran so the head counts are from a real rebuild. AI use: this check was run by Claude Sonnet 5.5 (Claude Code), for oni-swr.
Author
Owner

@⁠AurumCarlos on GitHub · 2026-11-27 10:53 UTC · original · reviewed

Two things beyond oni-swr's points:

  • A promoted 115 target still gets a 115 RTV. After promotion the host texture is 49/54/56, but the title's render target views stay in 115. A described RTV keeps its format, and an undescribed one gets view_format, which is the title's format whenever the host's differs (descriptor.rs:373). set_targets (draw.rs:430) and the clear at list.rs:1025 then create an RTV in a format the host can't render to, which D3D12 does not allow. That is the very case the promotion is for on NVIDIA (#2626), so the failure only moves from the texture to its first RTV. The same applies to an RTV in 67 on a host without RT support for it.
    Suggested fix: leave 115 to #2626 (merge candidate: RGBA8 carrier, translated RTV and pipeline formats, repacked copies). Then refuse RTVs the host can't render, as fits already does for typed UAVs (typed_store, descriptor/host.rs:1433). For example, in set_targets before self.targets.push, and the same before the clear:
    let desc = record.desc();
    if let Some(d) = &desc
        && !renders(d.Format.0 as u32)
    {
        once!(format = d.Format.0, "a render target view in a format the host cannot render");
        continue;
    }
    
    renders would be typed_store testing D3D12_FORMAT_SUPPORT1_RENDER_TARGET.
  • The castable filter is #2101's, without its cache. #2101 (Deilach, merge candidate) already drops the castable formats the host lacks, caches the answer per format, and traced the refusal to 89 on vkd3d-proton. Here host_supports_texture asks the driver again for every candidate on every make_texture: 21 CheckFeatureSupport calls per RGBA8-family texture (its own format plus 20 castable ones).
    Suggested fix: drop UNCASTABLE and the castable_formats filter here, rebase on #2101, and cache Support1 per format the same way ([AtomicU32; 192]) for the promotion check.
**@⁠AurumCarlos** on GitHub · 2026-11-27 10:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/3495#pullrequestreview-6087047339) · **reviewed** Two things beyond oni-swr's points: - **A promoted 115 target still gets a 115 RTV.** After promotion the host texture is 49/54/56, but the title's render target views stay in 115. A described RTV keeps its format, and an undescribed one gets `view_format`, which is the title's format whenever the host's differs (`descriptor.rs:373`). `set_targets` (`draw.rs:430`) and the clear at `list.rs:1025` then create an RTV in a format the host can't render to, which D3D12 does not allow. That is the very case the promotion is for on NVIDIA (#2626), so the failure only moves from the texture to its first RTV. The same applies to an RTV in 67 on a host without RT support for it. Suggested fix: leave 115 to #2626 (merge candidate: RGBA8 carrier, translated RTV and pipeline formats, repacked copies). Then refuse RTVs the host can't render, as `fits` already does for typed UAVs (`typed_store`, `descriptor/host.rs:1433`). For example, in `set_targets` before `self.targets.push`, and the same before the clear: ```rust let desc = record.desc(); if let Some(d) = &desc && !renders(d.Format.0 as u32) { once!(format = d.Format.0, "a render target view in a format the host cannot render"); continue; } ``` `renders` would be `typed_store` testing `D3D12_FORMAT_SUPPORT1_RENDER_TARGET`. - **The castable filter is #2101's, without its cache.** #2101 (Deilach, merge candidate) already drops the castable formats the host lacks, caches the answer per format, and traced the refusal to 89 on vkd3d-proton. Here `host_supports_texture` asks the driver again for every candidate on every `make_texture`: 21 `CheckFeatureSupport` calls per RGBA8-family texture (its own format plus 20 castable ones). Suggested fix: drop `UNCASTABLE` and the `castable_formats` filter here, rebase on #2101, and cache `Support1` per format the same way (`[AtomicU32; 192]`) for the promotion check.
Author
Owner

@⁠passerbyyhx on GitHub · 2026-11-27 19:01 UTC · original

I tested the resource and its first RTV separately on 295dfd51c0273fa33d58251e164bbe7ae6f95f8a, using synthetic 4×2 textures. On RTX 4090 Laptop (621.14), the native RT support bit was clear for both 115 and 67. With the optimized clear value the parent had no host texture in either case. The head created carriers 49 and 28. Binding a supported carrier view and clearing the background plus a subrectangle produced the expected bytes.

The original guest view remains a separate issue. In four fresh processes (guest format 115 or 67, explicit or default view), the resolved RTV still used the original format. The active D3D12 debug layer rejected all four at RTV creation (message 36), before any pixel readback. On WARP the same four original views worked and returned the expected packed pixels. For this Nvidia configuration the change fixes resource creation, but a title using its original explicit or default RTV still cannot render to that resource.

Supported-view pixel fixture. GTA-VI-3/EIGHT-20261127. AI-assisted with Codex.

**@⁠passerbyyhx** on GitHub · 2026-11-27 19:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/3495#issuecomment-7226106177) I tested the resource and its first RTV separately on `295dfd51c0273fa33d58251e164bbe7ae6f95f8a`, using synthetic 4×2 textures. On RTX 4090 Laptop (621.14), the native RT support bit was clear for both 115 and 67. With the optimized clear value the parent had no host texture in either case. The head created carriers 49 and 28. Binding a supported carrier view and clearing the background plus a subrectangle produced the expected bytes. The original guest view remains a separate issue. In four fresh processes (guest format 115 or 67, explicit or default view), the resolved RTV still used the original format. The active D3D12 debug layer rejected all four at RTV creation (message 36), before any pixel readback. On WARP the same four original views worked and returned the expected packed pixels. For this Nvidia configuration the change fixes resource creation, but a title using its original explicit or default RTV still cannot render to that resource. [Supported-view pixel fixture](https://github.com/passerbyyhx/VIctory/commit/351b27c6c26143f0709b7b6aa61bc9a23b22eef8). GTA-VI-3/EIGHT-20261127. AI-assisted with Codex.
Author
Owner

@⁠passerbyyhx on GitHub · 2026-11-27 19:14 UTC · original

Follow-up to the original RTV vs carrier comparison, on 295dfd51c0273fa33d58251e164bbe7ae6f95f8a. The original magenta/green colors had equal R and B. This time both clears have unequal R and B. Each case checks all eight raw pixels of a 4×2 texture after the GPU fence (six background pixels, two in the subrectangle). A separate CPU decoder checks their channel values.

Guest format WARP, original RTV (explicit and default) RTX 4090 Laptop, supported carrier RTV
115 B4G4R4A4 Background/interior RGBA nibbles (3,6,12,15) / (12,3,6,9), little-endian bytes 6c f3 / 36 9c. Both views matched. Carrier 49 (RG8) stored 33 66 / cc 33. This checks R/G only; this view has no blue or alpha channel.
67 RGB9E5 0x8880c100 / 0x89820020 decoded to RGB (2,0.75,0.25) / (0.25,2,0.75). Both views preserved the values above 1. Carrier 28 (RGBA8_UNORM) stored ff bf 40 ff / 40 ff bf ff. The over-one channel saturated as expected for this view.

WARP matched 56/56 pixels, including 32/32 through the four original-format views. The 4090 (driver 621.14) matched 24/24 through the two supported carrier views and the RGBA8 control. On the 4090 both original explicit/default paths again resolved to the unsupported original format; this round stopped before binding those four views, so there is no original-format Nvidia color readback. The measured bind/clear/readback paths had zero debug errors on both adapters. Each logged a separate pre-test initialization message 1419.

A pilot RGBA8 control rounded input 0.5 to 127 on this Nvidia device and 128 on WARP. The final run used 0.75 so the red/blue comparison does not depend on that midpoint.

Fixture and independent decoder. AU-20261127-08X. AI-assisted with Codex.

**@⁠passerbyyhx** on GitHub · 2026-11-27 19:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/3495#issuecomment-7226333278) Follow-up to [the original RTV vs carrier comparison](https://git.gtahub.st/github/Marvisak--VIctory/pulls/3495), on `295dfd51c0273fa33d58251e164bbe7ae6f95f8a`. The original magenta/green colors had equal R and B. This time both clears have **unequal R and B**. Each case checks all eight raw pixels of a 4×2 texture after the GPU fence (six background pixels, two in the subrectangle). A separate CPU decoder checks their channel values. | Guest format | WARP, original RTV (explicit and default) | RTX 4090 Laptop, supported carrier RTV | | --- | --- | --- | | 115 B4G4R4A4 | Background/interior RGBA nibbles `(3,6,12,15)` / `(12,3,6,9)`, little-endian bytes `6c f3` / `36 9c`. Both views matched. | Carrier 49 (RG8) stored `33 66` / `cc 33`. This checks R/G only; this view has no blue or alpha channel. | | 67 RGB9E5 | `0x8880c100` / `0x89820020` decoded to RGB `(2,0.75,0.25)` / `(0.25,2,0.75)`. Both views preserved the values above 1. | Carrier 28 (RGBA8_UNORM) stored `ff bf 40 ff` / `40 ff bf ff`. The over-one channel saturated as expected for this view. | WARP matched **56/56** pixels, including **32/32** through the four original-format views. The 4090 (driver 621.14) matched **24/24** through the two supported carrier views and the RGBA8 control. On the 4090 both original explicit/default paths again resolved to the unsupported original format; this round stopped before binding those four views, so there is no original-format Nvidia color readback. The measured bind/clear/readback paths had zero debug errors on both adapters. Each logged a separate pre-test initialization message 1419. A pilot RGBA8 control rounded input 0.5 to 127 on this Nvidia device and 128 on WARP. The final run used 0.75 so the red/blue comparison does not depend on that midpoint. [Fixture and independent decoder](https://github.com/passerbyyhx/VIctory/tree/66deac1fdd1f6fe33fe25cf3aaffe5aa457b50de/tests/fixtures/asymmetric-rtv). AU-20261127-08X. AI-assisted with Codex.
This pull request can be merged automatically.
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/3495/head:github-bot/gh-3495'
git switch 'github-bot/gh-3495'

Merge

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