GPU/Shader: declare wave64 wave size and strip unsupported video-texture flags #1281

Open
kss306 wants to merge 1 commit from upstream-pr/1281 into main
kss306 commented 2026-11-24 17:06:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kss306 on 2026-11-24T17:06:52Z.


What

Three fixes found by running GTA VI on an NVIDIA RTX 4080 Super (wave32-only device) with the D3D12 debug layer and DRED enabled.


1. Strip unsupported flags from NV12 and B4G4R4A4_UNORM textures (victory-gpu)

Xbox D3D12.X permits creating NV12 (format 86) textures with ALLOW_RENDER_TARGET | ALLOW_UNORDERED_ACCESS, and B4G4R4A4_UNORM (format 115) textures with ALLOW_RENDER_TARGET. PC D3D12 returns E_INVALIDARG for both combinations.

Without this fix the Bink2 video texture is never created. The intro cutscene plays audio for ~10 s but shows no image, then aborts early. With this fix the texture is created as a shader resource and the cutscene runs for its full duration. Character video is still missing (Bink2 needs UAV write access to decode frames — a separate issue).

2 + 3. Declare wave_size = 64 for wave64 compute and mesh shaders (victory-shader)

Xbox RDNA2 runs most compute and mesh shaders in wave64 mode (64 lanes/wavefront). NVIDIA GPUs run exclusively in wave32. The shader translator already declared wave_size = Some(64) for compute shaders with explicit cross-lane operations, but not for wave64 shaders without them. Those shaders were executed on NVIDIA hardware where their exec-mask handling enters an infinite loop, hanging the GPU for 7+ seconds and triggering Windows TDR (device removed).

Diagnosis: D3D12 debug layer reported Shader wants wave lane count of 64 but maximum wave lane count for device is 32 for the refused pipelines; DRED reported DXGI_ERROR_DEVICE_HUNG: TDR mechanism has been triggered as the removal reason.

Fix: declare wave_size = Some(64) for all wave64 compute shaders (not only those with cross-lane ops), and add the same declaration for wave64 mesh shaders (the mesh-shader branch had no wave_size handling at all). D3D12 refuses these pipelines cleanly at creation time instead of letting the GPU hang.


Results (RTX 4080 Super, GTA VI Xbox Series X)

Before After
Intro cutscene aborts early, no image plays to completion
World entry TDR crash within 10 s no crash
Complete 6-minute intro sequence never finished plays through without crash
In-game never reached reached (black screen — see below)
Settings menu in-game — opens without issues
In-game 3D rendering — black (wave64 shaders refused — existing issue)

The complete startup sequence — intro cutscene, world loading, and initial in-game state — now runs for its full ~6 minutes without a crash or TDR. The player reaches the in-game state.

The black world is the pre-existing rendering issue: the refused wave64 shaders include lighting, culling and shadow compute work. Wave64→wave32 translation is the next step, not part of this PR.


Testing

Built with cargo build --profile diag --features diagnostics and run with VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_DRED=1. No regression in cargo test --workspace.

AI-assisted (Kiro/Claude).

<!-- greyfinch-sync:Marvisak/VIctory:issue:6587222680 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1281). Originally posted by [kss306](https://github.com/kss306) on 2026-11-24T17:06:52Z. --- ## What Three fixes found by running GTA VI on an NVIDIA RTX 4080 Super (wave32-only device) with the D3D12 debug layer and DRED enabled. --- ### 1. Strip unsupported flags from NV12 and B4G4R4A4_UNORM textures (victory-gpu) Xbox D3D12.X permits creating NV12 (format 86) textures with ALLOW_RENDER_TARGET | ALLOW_UNORDERED_ACCESS, and B4G4R4A4_UNORM (format 115) textures with ALLOW_RENDER_TARGET. PC D3D12 returns E_INVALIDARG for both combinations. Without this fix the Bink2 video texture is never created. The intro cutscene plays audio for ~10 s but shows no image, then aborts early. With this fix the texture is created as a shader resource and the cutscene runs for its full duration. Character video is still missing (Bink2 needs UAV write access to decode frames — a separate issue). ### 2 + 3. Declare wave_size = 64 for wave64 compute and mesh shaders (victory-shader) Xbox RDNA2 runs most compute and mesh shaders in wave64 mode (64 lanes/wavefront). NVIDIA GPUs run exclusively in wave32. The shader translator already declared wave_size = Some(64) for compute shaders with explicit cross-lane operations, but **not** for wave64 shaders without them. Those shaders were executed on NVIDIA hardware where their exec-mask handling enters an infinite loop, hanging the GPU for 7+ seconds and triggering Windows TDR (device removed). Diagnosis: D3D12 debug layer reported Shader wants wave lane count of 64 but maximum wave lane count for device is 32 for the refused pipelines; DRED reported DXGI_ERROR_DEVICE_HUNG: TDR mechanism has been triggered as the removal reason. Fix: declare wave_size = Some(64) for **all** wave64 compute shaders (not only those with cross-lane ops), and add the same declaration for wave64 mesh shaders (the mesh-shader branch had no wave_size handling at all). D3D12 refuses these pipelines cleanly at creation time instead of letting the GPU hang. --- ## Results (RTX 4080 Super, GTA VI Xbox Series X) | | Before | After | |---|---|---| | Intro cutscene | aborts early, no image | plays to completion | | World entry | TDR crash within 10 s | **no crash** | | Complete 6-minute intro sequence | never finished | **plays through without crash** | | In-game | never reached | reached (black screen — see below) | | Settings menu in-game | — | opens without issues | | In-game 3D rendering | — | black (wave64 shaders refused — existing issue) | The complete startup sequence — intro cutscene, world loading, and initial in-game state — now runs for its full ~6 minutes without a crash or TDR. The player reaches the in-game state. The black world is the pre-existing rendering issue: the refused wave64 shaders include lighting, culling and shadow compute work. Wave64→wave32 translation is the next step, not part of this PR. --- ## Testing Built with cargo build --profile diag --features diagnostics and run with VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_DRED=1. No regression in cargo test --workspace. AI-assisted (Kiro/Claude).
kss306 commented 2026-11-24 18:05:35 +00:00 (Migrated from github.com)
<!-- greyfinch-sync:Marvisak/VIctory:comment:7138796943 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1281#issuecomment-7138796943). Originally posted by [kss306](https://github.com/kss306) on 2026-11-24T17:10:27Z. --- https://github.com/user-attachments/assets/f6a8363d-02dc-4916-8b54-7f6301d1e453
geiyiliyabumo commented 2026-11-24 18:05:45 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T17:26:25Z.


Independent verification and code review of \5db86f2\ 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: 50 passed, 0 failed, 1 ignored
  • \cargo test -p victory-shader --lib valu_tests\ (RX 9060 XT & WARP): 13 passed, 0 failed
  • \cargo clippy\ (-D warnings, default & --all-features) and \cargo xtask policy: clean

Two issues found in the diff:

  1. Wrong DXGI format constant for NV12 (\crates/victory-gpu/src/resource.rs:834): The match arm strips \RENDER_TARGET | UNORDERED\ on format \86\ with the comment \NV12 (86), but \DXGI_FORMAT_B5G5R5A1_UNORM = 86\ (already listed as a 2-byte color format at
    esource.rs:127), whereas **\DXGI_FORMAT_NV12 = 103**! As written, \NV12\ textures are not stripped at all, while \B5G5R5A1_UNORM\ loses RTV/UAV flags.
  2. Wave32-only host regression risk (\crates/victory-shader/src/emit/lower.rs:413): Unconditionally setting \s.wave_size = Some(64)\ for every \x.native.wave64\ compute/mesh shader (even shaders without cross-lane ops or single-wave LDS) will cause D3D12 PSO creation to reject those shaders on wave32-only GPUs (NVIDIA / WARP) where they previously executed fine; worth adding a targeted unit test for both the \wave_size\ condition and the format flag stripping.

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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7139196623 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1281#issuecomment-7139196623). Originally posted by [geiyiliyabumo](https://github.com/geiyiliyabumo) on 2026-11-24T17:26:25Z. --- Independent verification and code review of \5db86f2\ 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\: **50 passed, 0 failed, 1 ignored** - \cargo test -p victory-shader --lib valu_tests\ (RX 9060 XT & WARP): **13 passed, 0 failed** - \cargo clippy\ (\-D warnings\, default & \--all-features\) and \cargo xtask policy\: clean **Two issues found in the diff:** 1. **Wrong DXGI format constant for NV12 (\crates/victory-gpu/src/resource.rs:834\)**: The match arm strips \RENDER_TARGET | UNORDERED\ on format \86\ with the comment \NV12 (86)\, but \DXGI_FORMAT_B5G5R5A1_UNORM = 86\ (already listed as a 2-byte color format at \ esource.rs:127\), whereas **\DXGI_FORMAT_NV12 = 103\**! As written, \NV12\ textures are not stripped at all, while \B5G5R5A1_UNORM\ loses RTV/UAV flags. 2. **Wave32-only host regression risk (\crates/victory-shader/src/emit/lower.rs:413\)**: Unconditionally setting \s.wave_size = Some(64)\ for every \x.native.wave64\ compute/mesh shader (even shaders without cross-lane ops or single-wave LDS) will cause D3D12 PSO creation to reject those shaders on wave32-only GPUs (NVIDIA / WARP) where they previously executed fine; worth adding a targeted unit test for both the \wave_size\ condition and the format flag stripping. *AI-assisted; synthetic tests only, no game files.*
hamdog0203 commented 2026-11-24 18:05:47 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by hamdog0203 on 2026-11-24T17:29:13Z.


I audited and tested this PR (5db86f2) on Windows 11 with an NVIDIA GeForce RTX 4060 (wave32-only), WARP, and dxil.dll.

While the existing test suite passes (cargo clippy --workspace --all-targets --locked -- -D warnings, --all-features, victory-gpu: 50 passed / 1 ignored, victory-shader: 120 passed / 1 ignored; diff_tests skipped without VICTORY_CONSOLE_DXC), targeted checks against the modified paths show four issues:

  1. DXGI_FORMAT_NV12 is 103, not 86 (crates/victory-gpu/src/resource.rs)
    • Format 86 in DXGI is DXGI_FORMAT_B5G5R5A1_UNORM, while DXGI_FORMAT_NV12 is 103 (103 is not matched by match d.format { 86 => ..., 115 => ... }, and format_size() in resource.rs / texture::format() in victory-formats do not map 103 either).
  2. Stripping RENDER_TARGET still passes clear_value to CreateCommittedResource
    • In host_texture(), clear_value is still passed as pOptimizedClearValue after RENDER_TARGET (1) is cleared.
    • Tested on RTX 4060 with host_texture(): format 115 (B4G4R4A4_UNORM) with flags = 1 succeeds when clear is null (true), but fails (false) when a non-null clear_value is passed, since D3D12 rejects pOptimizedClearValue != NULL without ALLOW_RENDER_TARGET / ALLOW_DEPTH_STENCIL.
  3. dxil.dll rejects WaveSize on mesh shaders (crates/victory-shader/src/emit/lower.rs)
    • Setting s.wave_size = Some(64) under StageIo::Ms causes dxil.dll validation to fail even for a minimal s_endpgm wave64 mesh shader:
      Function: main: error: WaveSize only allowed on compute or node shaders / Validation failed.
  4. Unconditionally setting wave_size = Some(64) on all wave64 compute shaders rejects wave-independent shaders on wave32 GPUs and WARP
    • On 5db86f2, even a minimal s_endpgm wave64 compute shader (threads: [64, 1, 1], no cross-lane ops, no lane-mask data reads, no LDS) passes dxil.dll (Ok(())), and then fails CreateComputePipelineState on both RTX 4060 and WARP with Err("The parameter is incorrect.") (E_INVALIDARG).
    • Because structure.rs removes EXEC for normal control flow, ordinary wave64 shaders without lane-layout or intra-wave LDS dependencies can run in wave32 mode; if specific shaders still hang on NVIDIA due to an undetected mask/wave dependency, catching those patterns in console_lanes would avoid breaking all wave-independent wave64 compute pipelines on wave32 GPUs.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7139266926 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1281#issuecomment-7139266926). Originally posted by [hamdog0203](https://github.com/hamdog0203) on 2026-11-24T17:29:13Z. --- I audited and tested this PR (`5db86f2`) on Windows 11 with an NVIDIA GeForce RTX 4060 (wave32-only), WARP, and `dxil.dll`. While the existing test suite passes (`cargo clippy --workspace --all-targets --locked -- -D warnings`, `--all-features`, `victory-gpu`: 50 passed / 1 ignored, `victory-shader`: 120 passed / 1 ignored; `diff_tests` skipped without `VICTORY_CONSOLE_DXC`), targeted checks against the modified paths show four issues: 1. **`DXGI_FORMAT_NV12` is `103`, not `86` (`crates/victory-gpu/src/resource.rs`)** - Format `86` in DXGI is `DXGI_FORMAT_B5G5R5A1_UNORM`, while `DXGI_FORMAT_NV12` is `103` (`103` is not matched by `match d.format { 86 => ..., 115 => ... }`, and `format_size()` in `resource.rs` / `texture::format()` in `victory-formats` do not map `103` either). 2. **Stripping `RENDER_TARGET` still passes `clear_value` to `CreateCommittedResource`** - In `host_texture()`, `clear_value` is still passed as `pOptimizedClearValue` after `RENDER_TARGET` (`1`) is cleared. - Tested on RTX 4060 with `host_texture()`: format `115` (`B4G4R4A4_UNORM`) with `flags = 1` succeeds when `clear` is null (`true`), but fails (`false`) when a non-null `clear_value` is passed, since D3D12 rejects `pOptimizedClearValue != NULL` without `ALLOW_RENDER_TARGET` / `ALLOW_DEPTH_STENCIL`. 3. **`dxil.dll` rejects `WaveSize` on mesh shaders (`crates/victory-shader/src/emit/lower.rs`)** - Setting `s.wave_size = Some(64)` under `StageIo::Ms` causes `dxil.dll` validation to fail even for a minimal `s_endpgm` `wave64` mesh shader: `Function: main: error: WaveSize only allowed on compute or node shaders` / `Validation failed.` 4. **Unconditionally setting `wave_size = Some(64)` on all `wave64` compute shaders rejects wave-independent shaders on wave32 GPUs and WARP** - On `5db86f2`, even a minimal `s_endpgm` `wave64` compute shader (`threads: [64, 1, 1]`, no cross-lane ops, no lane-mask data reads, no LDS) passes `dxil.dll` (`Ok(())`), and then fails `CreateComputePipelineState` on both RTX 4060 and WARP with `Err("The parameter is incorrect.")` (`E_INVALIDARG`). - Because `structure.rs` removes `EXEC` for normal control flow, ordinary `wave64` shaders without lane-layout or intra-wave LDS dependencies can run in wave32 mode; if specific shaders still hang on NVIDIA due to an undetected mask/wave dependency, catching those patterns in `console_lanes` would avoid breaking all wave-independent `wave64` compute pipelines on wave32 GPUs.
kss306 commented 2026-11-24 18:05:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kss306 on 2026-11-24T17:38:17Z.


Thank you both (@geiyiliyabumo, @hamdog0203) — all four issues were valid. Updated in 72e794b:


1. Wrong format constant for B5G5R5A1_UNORM (
esource.rs) — fixed

You are correct: DXGI format 86 is DXGI_FORMAT_B5G5R5A1_UNORM, not NV12 (103). The original comment was wrong. The behaviour was still useful — B5G5R5A1_UNORM does not support typed UAV on PC, so stripping ALLOW_UNORDERED_ACCESS is correct — but the comment has been corrected. Format 115 (B4G4R4A4_UNORM) is unaffected.

2. clear_value passed after RENDER_TARGET stripped (
esource.rs) — fixed

Good catch. pOptimizedClearValue is now nulled out when RENDER_TARGET was stripped, so D3D12 no longer sees a non-null clear value on a resource without that flag.

3. WaveSize on mesh shaders is invalid DXIL (lower.rs) — fixed

The mesh-shader branch no longer sets s.wave_size. As hamdog0203 identified, DXIL rejects WaveSize outside compute/node shaders. The comment now explains why we deliberately omit it: the translator already rejects mesh shaders with cross-lane ops, so a successfully translated wave64 mesh shader has no lane-layout dependency and can run in wave32 mode.

4. Unconditional wave_size = Some(64) on all wave64 compute shaders — reverted

Reverted to the original console_lanes || one_wave && s.lds_dwords > 0 condition. Wave-independent wave64 shaders no longer get a forced wave-size declaration on wave32 hosts.

Note on the TDR that motivated this PR: on RTX 4080 Super a compute shader with 3840 threads and no detected cross-lane ops caused DXGI_ERROR_DEVICE_HUNG at world entry. That shader passed console_lanes undetected; improving console_lanes to catch that pattern is a follow-up, not part of this PR.


Tests after update (72e794b), RTX 4080 Super, Rust 1.98.1 MSVC, debug build:

cargo test -p victory-shader --lib → 120 passed; 0 failed; 1 ignored cargo test -p victory-gpu --lib → 50 passed; 0 failed; 1 ignored cargo clippy --workspace → clean

AI-assisted (Kiro/Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7139487254 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1281#issuecomment-7139487254). Originally posted by [kss306](https://github.com/kss306) on 2026-11-24T17:38:17Z. --- Thank you both (@geiyiliyabumo, @hamdog0203) — all four issues were valid. Updated in 72e794b: --- **1. Wrong format constant for B5G5R5A1_UNORM ( esource.rs) — fixed** You are correct: DXGI format 86 is DXGI_FORMAT_B5G5R5A1_UNORM, not NV12 (103). The original comment was wrong. The *behaviour* was still useful — B5G5R5A1_UNORM does not support typed UAV on PC, so stripping ALLOW_UNORDERED_ACCESS is correct — but the comment has been corrected. Format 115 (B4G4R4A4_UNORM) is unaffected. **2. clear_value passed after RENDER_TARGET stripped ( esource.rs) — fixed** Good catch. pOptimizedClearValue is now nulled out when RENDER_TARGET was stripped, so D3D12 no longer sees a non-null clear value on a resource without that flag. **3. WaveSize on mesh shaders is invalid DXIL (lower.rs) — fixed** The mesh-shader branch no longer sets s.wave_size. As hamdog0203 identified, DXIL rejects WaveSize outside compute/node shaders. The comment now explains why we deliberately omit it: the translator already rejects mesh shaders with cross-lane ops, so a successfully translated wave64 mesh shader has no lane-layout dependency and can run in wave32 mode. **4. Unconditional wave_size = Some(64) on all wave64 compute shaders — reverted** Reverted to the original console_lanes || one_wave && s.lds_dwords > 0 condition. Wave-independent wave64 shaders no longer get a forced wave-size declaration on wave32 hosts. Note on the TDR that motivated this PR: on RTX 4080 Super a compute shader with 3840 threads and no detected cross-lane ops caused DXGI_ERROR_DEVICE_HUNG at world entry. That shader passed console_lanes undetected; improving console_lanes to catch that pattern is a follow-up, not part of this PR. --- **Tests after update (72e794b), RTX 4080 Super, Rust 1.98.1 MSVC, debug build:** ` cargo test -p victory-shader --lib → 120 passed; 0 failed; 1 ignored cargo test -p victory-gpu --lib → 50 passed; 0 failed; 1 ignored cargo clippy --workspace → clean ` AI-assisted (Kiro/Claude).
Aniseto commented 2026-11-24 18:05:58 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Aniseto on 2026-11-24T17:11:46Z.


Ran the two crates this touches at 72e794b (re-run after the head moved from 5db86f2). The PR adds no test of its own, so this is a regression check:

Environment: Windows 11 Pro build 26200 x64, Intel Core i5-12400F, 64 GB RAM, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only) driver 32.0.16.2124, Rust 1.98.1 (pinned by rust-toolchain.toml), MSVC 14.44.35207, DXC 1.9.2609.5, debug build.

cargo test -p victory-shader
120 passed; 0 failed; 1 ignored      (exit 0)

cargo test -p victory-gpu
50 passed; 0 failed; 1 ignored      (exit 0)

Both still match main on this machine (ffe310e), so existing behaviour is undisturbed. It is worth noting for this PR: this host is wave32-only (WaveLaneCountMin = Max = 32), so every console wave64 program here takes the emulated path, which is exactly the case a wave-size declaration affects. The suites show no regression in that path, but a title run would be the real check and I have no game data.

Not tested: the title (no game data here), RDNA2/RDNA4 and Intel GPUs, release build.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash 1017 - checked out the PR's head commit in a detached worktree, built it, ran both crates, wrote this report; no game data was used.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7138830033 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1281#issuecomment-7138830033). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-11-24T17:11:46Z. --- Ran the two crates this touches at `72e794b` (re-run after the head moved from `5db86f2`). The PR adds no test of its own, so this is a regression check: Environment: Windows 11 Pro build 26200 x64, Intel Core i5-12400F, 64 GB RAM, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only) driver 32.0.16.2124, Rust 1.98.1 (pinned by `rust-toolchain.toml`), MSVC 14.44.35207, DXC 1.9.2609.5, debug build. ``` cargo test -p victory-shader 120 passed; 0 failed; 1 ignored (exit 0) cargo test -p victory-gpu 50 passed; 0 failed; 1 ignored (exit 0) ``` Both still match `main` on this machine (`ffe310e`), so existing behaviour is undisturbed. It is worth noting for this PR: this host is wave32-only (WaveLaneCountMin = Max = 32), so every console wave64 program here takes the emulated path, which is exactly the case a wave-size declaration affects. The suites show no regression in that path, but a title run would be the real check and I have no game data. Not tested: the title (no game data here), RDNA2/RDNA4 and Intel GPUs, release build. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash 1017** - checked out the PR's head commit in a detached worktree, built it, ran both crates, wrote this report; no game data was used.
geiyiliyabumo commented 2026-11-24 19:04:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T18:09:46Z.


Re-verified \72e794b\ 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: 50 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

Thanks for addressing all four items cleanly! One tiny optional polish on
esource.rs:860: gating \clear_value\ on \d.flags & (RENDER_TARGET | DEPTH) != 0\ (rather than !strip_rtv) would also guard any other texture whose title flags lack RTV/DSV.

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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7140247720 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1281#issuecomment-7140247720). Originally posted by [geiyiliyabumo](https://github.com/geiyiliyabumo) on 2026-11-24T18:09:46Z. --- Re-verified \72e794b\ 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\: **50 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 Thanks for addressing all four items cleanly! One tiny optional polish on \ esource.rs:860\: gating \clear_value\ on \d.flags & (RENDER_TARGET | DEPTH) != 0\ (rather than \!strip_rtv\) would also guard any other texture whose title flags lack RTV/DSV. *AI-assisted; synthetic tests only, no game files.*
adamdotpy commented 2026-11-24 20:03:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by adamdotpy on 2026-11-24T19:49:02Z.


Reviewed at head 72e794b (worktree on the PR head, isolated target dir, Windows 11 / Rust 1.98.1). Findings, ranked:

1. The resource-flag stripping is correct and the format numbers check out. In host_texture (victory-gpu/src/resource.rs:826), B5G5R5A1_UNORM (DXGI 86) and B4G4R4A4_UNORM (DXGI 115) — the standard enum values, matching how this crate uses raw DXGI numbers (pc_format maps 118/119/120, etc.) — now strip RENDER_TARGET (86 and 115) and UNORDERED (86), the combinations PC D3D12 rejects with E_INVALIDARG even though Xbox allows them as RT/UAV. The clear-value handling is the part that easy to get wrong and is handled right: when RENDER_TARGET is stripped, pOptimizedClearValue is nulled too, because D3D12 rejects a non-null clear value on a resource without ALLOW_RENDER_TARGET/ALLOW_DEPTH_STENCIL — without that, the "fix" would just move the E_INVALIDARG. The depth-format path below is untouched and still runs after.

2. The shader-side part is comment-only and accurate. lower.rs adds no behavior: the existing wave_size declaration for lane-order-dependent/one-wave-LDS compute shaders stays, and the new comments correctly note that DXIL forbids WaveSize on mesh shaders (validator would reject), so mesh shaders run at host wave width — safe because the translator already refuses mesh shaders with cross-lane ops.

3. Verified here. cargo test -p victory-gpu 50 passed / 0 failed / 1 ignored; cargo test -p victory-shader --lib 120 passed / 0 failed / 1 ignored; cargo clippy -p victory-gpu -p victory-shader --all-targets --all-features --locked -- -D warnings clean; cargo build --release -p victory builds; rustfmt --edition 2024 --check on both files shows only the pre-existing hunks main has (resource.rs:867 → 888 shifted by the addition; lower.rs's 3 unchanged).

4. Gap, not a defect: the flag stripping has no test — host_texture needs a live device, and the strip logic isn't extracted into a pure function. If you want it pinned, pulling the (format, flags) -> flags decision into a small pure helper would make it unit-testable (86 → strip RT|UAV, 115 → strip RT, others unchanged, clear value nulled iff RT stripped). Worth doing, not blocking.

Nothing found that would block this.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7142629937 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1281#issuecomment-7142629937). Originally posted by [adamdotpy](https://github.com/adamdotpy) on 2026-11-24T19:49:02Z. --- Reviewed at head `72e794b` (worktree on the PR head, isolated target dir, Windows 11 / Rust 1.98.1). Findings, ranked: **1. The resource-flag stripping is correct and the format numbers check out.** In `host_texture` (`victory-gpu/src/resource.rs:826`), `B5G5R5A1_UNORM` (DXGI 86) and `B4G4R4A4_UNORM` (DXGI 115) — the standard enum values, matching how this crate uses raw DXGI numbers (`pc_format` maps 118/119/120, etc.) — now strip `RENDER_TARGET` (86 and 115) and `UNORDERED` (86), the combinations PC D3D12 rejects with E_INVALIDARG even though Xbox allows them as RT/UAV. The clear-value handling is the part that easy to get wrong and is handled right: when `RENDER_TARGET` is stripped, `pOptimizedClearValue` is nulled too, because D3D12 rejects a non-null clear value on a resource without `ALLOW_RENDER_TARGET`/`ALLOW_DEPTH_STENCIL` — without that, the "fix" would just move the E_INVALIDARG. The depth-format path below is untouched and still runs after. **2. The shader-side part is comment-only and accurate.** `lower.rs` adds no behavior: the existing `wave_size` declaration for lane-order-dependent/one-wave-LDS compute shaders stays, and the new comments correctly note that DXIL forbids `WaveSize` on mesh shaders (validator would reject), so mesh shaders run at host wave width — safe because the translator already refuses mesh shaders with cross-lane ops. **3. Verified here.** `cargo test -p victory-gpu` 50 passed / 0 failed / 1 ignored; `cargo test -p victory-shader --lib` 120 passed / 0 failed / 1 ignored; `cargo clippy -p victory-gpu -p victory-shader --all-targets --all-features --locked -- -D warnings` clean; `cargo build --release -p victory` builds; `rustfmt --edition 2024 --check` on both files shows only the pre-existing hunks main has (resource.rs:867 → 888 shifted by the addition; lower.rs's 3 unchanged). **4. Gap, not a defect:** the flag stripping has no test — `host_texture` needs a live device, and the strip logic isn't extracted into a pure function. If you want it pinned, pulling the `(format, flags) -> flags` decision into a small pure helper would make it unit-testable (86 → strip RT|UAV, 115 → strip RT, others unchanged, clear value nulled iff RT stripped). Worth doing, not blocking. Nothing found that would block this.
Marvisak commented 2026-11-25 03:03:34 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T02:33:44Z.


Automated triage for the maintainers. As it stands this does not build on current main. main has split texture creation into host_desc and make_texture in crates/victory-gpu/src/resource.rs. The flag stripping lands in host_desc, but make_texture uses strip_rtv for the clear value, and strip_rtv does not exist there. Please rebase and carry the decision through, for example by nulling the clear value whenever the host description has neither RENDER_TARGET nor DEPTH. Further points: (1) Since the review round the lower.rs part only adds comments, so please update the title and description, which still describe forcing wave_size = 64. (2) Format 86 (B5G5R5A1_UNORM) loses RENDER_TARGET too, although your own comment says PC accepts it as a render target. Stripping a flag the title asked for also makes its later RTV/UAV views on that texture fail quietly. Please ask the device (CheckFeatureSupport with D3D12_FEATURE_FORMAT_SUPPORT, as typed_store in descriptor/host.rs already does) and strip only what it refuses, then say what happens to the title's views. (3) A short unit test of the flag decision would pin it.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7150881903 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1281#issuecomment-7150881903). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T02:33:44Z. --- <!-- victory-triage v1 head=72e794b6294c96f1b6faa8e408968f57b1643688 verdict=needs-work at=2026-11-25T02:20:29Z --> Automated triage for the maintainers. As it stands this does not build on current `main`. `main` has split texture creation into `host_desc` and `make_texture` in `crates/victory-gpu/src/resource.rs`. The flag stripping lands in `host_desc`, but `make_texture` uses `strip_rtv` for the clear value, and `strip_rtv` does not exist there. Please rebase and carry the decision through, for example by nulling the clear value whenever the host description has neither RENDER_TARGET nor DEPTH. Further points: (1) Since the review round the `lower.rs` part only adds comments, so please update the title and description, which still describe forcing `wave_size = 64`. (2) Format 86 (B5G5R5A1_UNORM) loses RENDER_TARGET too, although your own comment says PC accepts it as a render target. Stripping a flag the title asked for also makes its later RTV/UAV views on that texture fail quietly. Please ask the device (`CheckFeatureSupport` with `D3D12_FEATURE_FORMAT_SUPPORT`, as `typed_store` in `descriptor/host.rs` already does) and strip only what it refuses, then say what happens to the title's views. (3) A short unit test of the flag decision would pin it. --- _Generated by [Claude Code](https://claude.ai/code)_
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/1281:upstream-pr/1281'
git switch 'upstream-pr/1281'

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