Shader: fix biased 16-bit image samples and DXIL validator failures #306

Closed
github-bot wants to merge 3 commits from gh-pr/306/head into gh-pr/306/base
Owner

@⁠wbkepler on GitHub · 2026-11-24 02:12 UTC · original
wbkepler:shader/validator-and-16bit-sample-fixes → main · +566 −59 · 6 files · 3 commits · closed without merging

Summary

Fixes 5 shader emission and DXIL container/validator issues in victory-shader (+176 newly validated shaders, 100% of emitted VS/PS/CS validating cleanly):

  • Biased 16-bit image samples (emit/lower.rs):
    • Enables a16 biased image samples (image_sample_b) by separating full 32-bit prefix VGPRs (offsets, bias, comparison reference) from a16-packed tail operands (gradients, coordinates, explicit LOD) matching GFX10 MIMG hardware layout.
  • Conservative depth SV_Position (emit/mod.rs):
    • Sets SV_Position interpolation to linear_noperspective_centroid (5) in pixel shaders outputting conservative depth (SV_DepthLessEqual/SV_DepthGreaterEqual).
  • Row interpolation consistency (emit/mod.rs, emit/lower.rs):
    • Adds harmonize_row_interp() so packed elements in the same signature row share one interpolation mode (propagating Constant for integer/SV_IsFrontFace rows and inheriting read modes for unread PS siblings).
  • Signature ordering (emit/container.rs):
    • Stably sorts ISG1/OSG1 signature rows by register only (preserving element-ID order within a row to match DXIL validator expectations).
  • Compute implicit-derivative sampling (emit/shader.rs):
    • Tracks SM 6.6 compute-shader implicit-derivative sampling to emit dx.valver = 1.8 and PSVRuntimeInfo3 (52 bytes with EntryFunctionName).

Verification

  • cargo clippy --workspace --all-targets — passed (zero new warnings)
  • cargo clippy -p victory --features diagnostics --all-targets — passed
  • cargo test --workspace — passed (victory-shader: 74/74 including 5 new dxil.dll validation and D3D12 compute PSO tests)
  • cargo xtask policy — passed (151 files ok)
**@⁠wbkepler** on GitHub · 2026-11-24 02:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/306) `wbkepler:shader/validator-and-16bit-sample-fixes` → `main` · +566 −59 · 6 files · 3 commits · closed without merging ## Summary Fixes 5 shader emission and DXIL container/validator issues in `victory-shader` (+176 newly validated shaders, 100% of emitted VS/PS/CS validating cleanly): - **Biased 16-bit image samples (`emit/lower.rs`)**: - Enables `a16` biased image samples (`image_sample_b`) by separating full 32-bit prefix VGPRs (offsets, bias, comparison reference) from `a16`-packed tail operands (gradients, coordinates, explicit LOD) matching GFX10 MIMG hardware layout. - **Conservative depth `SV_Position` (`emit/mod.rs`)**: - Sets `SV_Position` interpolation to `linear_noperspective_centroid` (`5`) in pixel shaders outputting conservative depth (`SV_DepthLessEqual`/`SV_DepthGreaterEqual`). - **Row interpolation consistency (`emit/mod.rs`, `emit/lower.rs`)**: - Adds `harmonize_row_interp()` so packed elements in the same signature row share one interpolation mode (propagating `Constant` for integer/`SV_IsFrontFace` rows and inheriting read modes for unread PS siblings). - **Signature ordering (`emit/container.rs`)**: - Stably sorts `ISG1`/`OSG1` signature rows by register only (preserving element-ID order within a row to match DXIL validator expectations). - **Compute implicit-derivative sampling (`emit/shader.rs`)**: - Tracks SM 6.6 compute-shader implicit-derivative sampling to emit `dx.valver = 1.8` and `PSVRuntimeInfo3` (52 bytes with `EntryFunctionName`). ## Verification - `cargo clippy --workspace --all-targets` — passed (zero new warnings) - `cargo clippy -p victory --features diagnostics --all-targets` — passed - `cargo test --workspace` — passed (`victory-shader`: 74/74 including 5 new `dxil.dll` validation and D3D12 compute PSO tests) - `cargo xtask policy` — passed (151 files ok)
Fixes 5 shader emission and DXIL container/validator issues in `victory-shader`,
raising validated shaders across the test corpus from 21,983 to 22,159 (+176;
100% of emitted VS/PS/CS shaders now validate cleanly):

1. Biased 16-bit image samples (`emit/lower.rs`):
   - Remove the `a16` rejection on `image_sample_b` and separate 32-bit prefix
     operands (offsets, bias, comparison reference) from `a16`-packed tail
     operands (gradients, coordinates, explicit LOD) starting at `regs[first]`,
     matching GFX10 MIMG hardware operand layout.

2. Conservative depth `SV_Position` interpolation (`emit/mod.rs`):
   - Declare `SV_Position` with `linear_noperspective_centroid` (5) instead of
     `linear_noperspective` (4) in pixel shaders outputting `SV_DepthLessEqual`
     or `SV_DepthGreaterEqual` (kinds 18/19).

3. Per-row interpolation mode consistency (`emit/mod.rs`, `emit/lower.rs`):
   - Add `harmonize_row_interp()` so elements sharing a signature row always
     declare the same interpolation mode: rows containing integer attributes or
     `SV_IsFrontFace` propagate `nointerpolation` (1) to sibling elements, and
     after pixel-shader lowering unread siblings inherit the actual read mode
     of sibling elements in the same row.

4. Container signature row ordering (`emit/container.rs`):
   - Sort `ISG1`/`OSG1` rows stably by register only (`row`) rather than
     `(row, col)`, preserving DXIL element-ID order within a row so the
     container signature matches DXIL validator expectations byte for byte.

5. SM 6.6 compute-shader implicit derivatives (`emit/shader.rs`, `emit/container.rs`, `emit/lower.rs`):
   - Track compute shaders emitting implicit-derivative sampling ops and emit
     `dx.valver = 1.8` with `PSVRuntimeInfo3` (52 bytes, carrying
     `EntryFunctionName`), enabling validation and D3D12 compute PSO creation.

Adds 5 unit + `dxil.dll` validation (+ D3D12 compute PSO) tests in `emit::tests`.
With a16 the bias of `image_sample_b` keeps its own address dword but
holds an f16 in the low half (as LLVM's AMDGPU lowering builds it), so
reading the dword as f32 silently dropped the bias. Unpack the low half
and convert it like the other 16-bit addresses.

Derivatives are only 16-bit in the `_g16` opcodes; under a16 alone they
stay one 32-bit dword each and only the coordinates and LOD are packed.
Fix the decoder's address dword count (2D `image_sample_d ... a16` is
five dwords) and read the gradients as full dwords, starting the packed
coordinates after them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
PSV0 shared one string-table copy of a repeated semantic name (TEXCOORD0
and TEXCOORD1 pointing at the same "TEXCOORD"). DXC's PSV writer writes
one copy per element, and validators before 1.8 compare PSV0 byte for
byte, so any signature repeating a name was rejected there ("Pipeline
State Validation does not match"); 1.8 compares the strings and accepted
both. Checked against dxil.dll 1.7, 1.8 and 1.9.

Validator::version() reads IDxcVersionInfo; the compute-derivative test
skips dxil.dll validation when the validator predates 1.8, which rejects
dx.valver 1.8 outright. Translated shaders never go through dxil.dll.

Reported by @alexdeliu.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:58:38 +00:00
github-bot closed this pull request 2026-11-26 03:58:38 +00:00
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 03:14 UTC · original

Review note on the a16 address layout, two points where this differs from LLVM's AMDGPU backend:

  1. The bias. The test here builds image_sample_b ... a16 with "a 32-bit f32 bias", and the lowering reads the bias dword whole. SITargetLowering::lowerImage has:
// Special handling of bias when A16 is on. Bias is of type half but
// occupies full 32-bit.
SDValue Bias = DAG.getBuildVector(MVT::v2f16, DL, {Op.getOperand(ArgOffset + I), DAG.getPOISON(MVT::f16)});

and asserts "Bias needs to be converted to 16 bit in A16 mode". So with a16 the bias is an f16 in the low half of its own dword; read as an f32 it is a denormal near zero, and the sample silently loses its bias. The test passes because it encodes the same assumption.

  1. Derivatives. With a16 the derivatives are taken as packed 16-bit values. On GFX10.3 they are 16-bit only in the _g16 opcodes; LLVM's gfx10_asm_mimg.s has image_sample_d ... dim:SQ_RSRC_IMG_2D a16 with five address dwords (four 32-bit derivatives plus the packed coordinates).

#160 and #318 read the bias as f16; #73 and #136 as f32, like this one. I got point 2 wrong myself in #160 and fixed it there.

From the documents and synthetic tests only; I have no copy of the title and have not run this on console hardware.

**@⁠r4tedx** on GitHub · 2026-11-24 03:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/306#issuecomment-7120901272) Review note on the a16 address layout, two points where this differs from LLVM's AMDGPU backend: 1. **The bias.** The test here builds `image_sample_b ... a16` with "a 32-bit f32 bias", and the lowering reads the bias dword whole. `SITargetLowering::lowerImage` has: ```cpp // Special handling of bias when A16 is on. Bias is of type half but // occupies full 32-bit. SDValue Bias = DAG.getBuildVector(MVT::v2f16, DL, {Op.getOperand(ArgOffset + I), DAG.getPOISON(MVT::f16)}); ``` and asserts "Bias needs to be converted to 16 bit in A16 mode". So with a16 the bias is an f16 in the low half of its own dword; read as an f32 it is a denormal near zero, and the sample silently loses its bias. The test passes because it encodes the same assumption. 2. **Derivatives.** With a16 the derivatives are taken as packed 16-bit values. On GFX10.3 they are 16-bit only in the `_g16` opcodes; LLVM's `gfx10_asm_mimg.s` has `image_sample_d ... dim:SQ_RSRC_IMG_2D a16` with five address dwords (four 32-bit derivatives plus the packed coordinates). #160 and #318 read the bias as f16; #73 and #136 as f32, like this one. I got point 2 wrong myself in #160 and fixed it there. From the documents and synthetic tests only; I have no copy of the title and have not run this on console hardware.
Author
Owner

@⁠wbkepler on GitHub · 2026-11-24 03:40 UTC · original

Thanks @⁠r4tedx, you're right on both points. Fixed in a8430f2:

  1. Bias with a16: the bias keeps its own address dword, but it is now read as an f16 from the low half (masked, then legacyF16ToF32) instead of as an f32. The synthetic image_sample_b ... a16 test now puts f16 -1.0 in the low half and junk in the high half, so the test no longer bakes in the f32 assumption.
  2. Derivatives: outside the _g16 opcodes, a16 leaves each derivative as a full 32-bit dword. Only the coordinates and LOD are packed. The decoder's address dword count now follows this (2D image_sample_d ... a16 = 5 dwords, _g16 packs one dword per direction), and the lowering reads the gradients as full f32 dwords, with the packed coordinates starting after them. There is a new decoder unit test for these counts.

The workspace clippy, tests and cargo xtask policy pass.

**@⁠wbkepler** on GitHub · 2026-11-24 03:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/306#issuecomment-7121317875) Thanks @⁠r4tedx, you're right on both points. Fixed in a8430f2: 1. **Bias with a16:** the bias keeps its own address dword, but it is now read as an f16 from the low half (masked, then `legacyF16ToF32`) instead of as an f32. The synthetic `image_sample_b ... a16` test now puts f16 -1.0 in the low half and junk in the high half, so the test no longer bakes in the f32 assumption. 2. **Derivatives:** outside the `_g16` opcodes, a16 leaves each derivative as a full 32-bit dword. Only the coordinates and LOD are packed. The decoder's address dword count now follows this (2D `image_sample_d ... a16` = 5 dwords, `_g16` packs one dword per direction), and the lowering reads the gradients as full f32 dwords, with the packed coordinates starting after them. There is a new decoder unit test for these counts. The workspace clippy, tests and `cargo xtask policy` pass.
Author
Owner

@⁠iurysf on GitHub · 2026-11-24 06:02 UTC · original

Measured offline against main d2a4bae: victory translate --list --validate over the title's shaders.rpf + executable (26,096 programs), dxil.dll 1.9.2602.17 (DXC v1.9.2602).

validated rejected by the validator "incompatible with the shader stage" (cs)
main 21,983 185 23
main + this PR 22,159 53 0
main + this PR + #309 + #385 (clean merge) 22,320 53 0
  • No program that validated on main is rejected with this PR, alone or stacked.
  • The 53 left are all mesh vertex plus primitive output size is greater than 32768.
  • The incompatible with the shader stage rejections grow to 34 with #309 and 45 with #385 alone (newly emitted compute programs with implicit-derivative sample). This PR clears them all, so it's worth landing before or with those two.
  • I hit the same root cause independently. A minimal HLSL compute shader with Texture2D.Sample compiled by dxc with -T cs_6_6 -validator-version 1.6 or 1.7 fails with exactly this error, and it passes with 1.8. So dx.valver 1.8 for compute derivatives is the right fix.
**@⁠iurysf** on GitHub · 2026-11-24 06:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/306#issuecomment-7123513862) Measured offline against main `d2a4bae`: `victory translate --list --validate` over the title's `shaders.rpf` + executable (26,096 programs), dxil.dll 1.9.2602.17 (DXC v1.9.2602). | | validated | rejected by the validator | "incompatible with the shader stage" (cs) | |---|---:|---:|---:| | main | 21,983 | 185 | 23 | | main + this PR | 22,159 | **53** | **0** | | main + this PR + #309 + #385 (clean merge) | 22,320 | 53 | 0 | - No program that validated on main is rejected with this PR, alone or stacked. - The 53 left are all mesh `vertex plus primitive output size is greater than 32768`. - The `incompatible with the shader stage` rejections grow to 34 with #309 and 45 with #385 alone (newly emitted compute programs with implicit-derivative `sample`). This PR clears them all, so it's worth landing before or with those two. - I hit the same root cause independently. A minimal HLSL compute shader with `Texture2D.Sample` compiled by dxc with `-T cs_6_6 -validator-version 1.6` or `1.7` fails with exactly this error, and it passes with `1.8`. So `dx.valver` 1.8 for compute derivatives is the right fix.
Author
Owner

@⁠slint6614-dev on GitHub · 2026-11-24 07:23 UTC · original

Measured on the full retail shader pack (26,503 containers) with victory translate --validate, against main d2a4bae:

VS/PS validated CS validated MS validated cargo test -p victory-shader
main 12172 1670 8129 ok
#569 12208 1670 8129 ok
#73 12208 1670 8129 ok
#318 12208 1670 8129 ok
#306 12316 1693 8138 ok

All four clear the 108 "biased image sample with 16-bit coordinates" programs identically. #73 and #318 also clear the 27 image_sample_d_cl refusals, but those programs then stop on another reason (emitted count unchanged). #306 additionally clears 15 of the 16 validator error kinds (only the mesh 32 KiB output size remains, see #459); it overlaps #554/#565/#381. Windows 11, dxil.dll from SDK 10.0.26100.

**@⁠slint6614-dev** on GitHub · 2026-11-24 07:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/306#issuecomment-7124942792) Measured on the full retail shader pack (26,503 containers) with `victory translate --validate`, against main d2a4bae: | | VS/PS validated | CS validated | MS validated | `cargo test -p victory-shader` | |---|---|---|---|---| | main | 12172 | 1670 | 8129 | ok | | #569 | 12208 | 1670 | 8129 | ok | | #73 | 12208 | 1670 | 8129 | ok | | #318 | 12208 | 1670 | 8129 | ok | | #306 | 12316 | 1693 | 8138 | ok | All four clear the 108 "biased image sample with 16-bit coordinates" programs identically. #73 and #318 also clear the 27 `image_sample_d_cl` refusals, but those programs then stop on another reason (emitted count unchanged). #306 additionally clears 15 of the 16 validator error kinds (only the mesh 32 KiB output size remains, see #459); it overlaps #554/#565/#381. Windows 11, dxil.dll from SDK 10.0.26100.
Author
Owner

@⁠ordis-labs on GitHub · 2026-11-24 15:00 UTC · original

Rebased this onto current main (ffe310e) locally to measure it there, since it no longer merges cleanly. Three things needed:

  1. emit/mod.rs: main now has #565's conservative-depth rule as a separate block after the interpolation loop, and this PR has the same rule inside the loop. I kept this PR's version plus harmonize_row_interp(interpolated) and dropped main's block. Same result for SV_Position.
  2. emit/lower.rs: #634 (image_sample_o) added addr_val(self, 0) in the old two-argument form. With this PR's addr_val(l, start, k) that becomes addr_val(self, 0, 0), which is identical to main's addr_val(l, k).
  3. The test helper in emit/mod.rs (~line 806): resource::track takes Some(&st) since ffe310e, so structure goes first.

Results on ffe310e (translate --list --validate over the 1.0.2.1 shaders.rpf, SDK 10.0.26100 dxil.dll, outcomes matched program by program against main):

  • +153 programs validate, 0 lost. 44 are "a biased image sample with 16-bit coordinates". The rest were validator signature errors that harmonize_row_interp fixes (TEXCOORD/NORMAL/COLOR/SV_IsFrontFace locations, input/output signature mismatches) plus 24 "incompatible operation".
  • Every emitted vertex/pixel program validates: 12,275/12,275 (main: 12,155 of 12,231).
  • cargo test -p victory-shader: 111 passed. The 15 failures also fail on main on this machine (Windows 10, no SM 6.6 device for the GPU tests).

Windows 10 19045, RX 6700 XT. Tested and written up with Claude's help.

**@⁠ordis-labs** on GitHub · 2026-11-24 15:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/306#issuecomment-7135314515) Rebased this onto current main (`ffe310e`) locally to measure it there, since it no longer merges cleanly. Three things needed: 1. `emit/mod.rs`: main now has #565's conservative-depth rule as a separate block after the interpolation loop, and this PR has the same rule inside the loop. I kept this PR's version plus `harmonize_row_interp(interpolated)` and dropped main's block. Same result for `SV_Position`. 2. `emit/lower.rs`: #634 (`image_sample_o`) added `addr_val(self, 0)` in the old two-argument form. With this PR's `addr_val(l, start, k)` that becomes `addr_val(self, 0, 0)`, which is identical to main's `addr_val(l, k)`. 3. The test helper in `emit/mod.rs` (~line 806): `resource::track` takes `Some(&st)` since `ffe310e`, so `structure` goes first. Results on `ffe310e` (`translate --list --validate` over the 1.0.2.1 `shaders.rpf`, SDK 10.0.26100 `dxil.dll`, outcomes matched program by program against main): - **+153 programs validate, 0 lost.** 44 are "a biased image sample with 16-bit coordinates". The rest were validator signature errors that `harmonize_row_interp` fixes (`TEXCOORD`/`NORMAL`/`COLOR`/`SV_IsFrontFace` locations, input/output signature mismatches) plus 24 "incompatible operation". - Every emitted vertex/pixel program validates: 12,275/12,275 (main: 12,155 of 12,231). - `cargo test -p victory-shader`: 111 passed. The 15 failures also fail on main on this machine (Windows 10, no SM 6.6 device for the GPU tests). Windows 10 19045, RX 6700 XT. Tested and written up with Claude's help.
Author
Owner

@⁠marquezinii on GitHub · 2026-11-24 17:19 UTC · original

I ran the a16 samples on a GPU and read back the mip level each lane got. The checks above are DXIL validation and offline counts, so this is the runtime side. Setup: RTX 5070 (desktop, driver 621.40, the only adapter in the machine), Windows 11 26300, Rust 1.98.1, this PR's head 9342153.

Test commit on top of this branch: bc7fe21. It adds emit/image_a16_tests.rs and a mipmapped texture view to the test harness (View::Mips). Three wave32 compute programs run image_sample_l, _d and _b with a16 on a 16x4 RGBA32F texture. Every texel of mip m holds m, the filter is point, and each lane stores the level it sampled. Lanes load their address dwords from a raw buffer, so the packed halves and the junk (0x5A5A) in the high halves the hardware ignores are set bit for bit. The texture is not square, so a gradient read on the wrong axis lands two levels off.

case ffe310e this PR
image_sample_l a16: f16 LOD in the low half, junk above it pass pass
image_sample_d a16: four f32 gradients, then packed (u, v). Lane l asks for level l % 5 in gradient component (l / 5) % 4 fail: got [2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, ...], want [0, 1, 2, 3, 4, 0, 1, ...] pass
image_sample_b a16: f16 bias in the low half, junk above it. Implicit derivatives come from 2x2 quads spaced one texel of level 0-2 apart, with biases -2 to +4 refused in lower pass
  • Hardware adapter and WARP give the same results.
  • The three tests passed in 11 runs out of 11.
  • dxil.dll from the SDK validates all three shaders.
  • cargo test -p victory-shader with the commit: 129 passed, 0 failed, 1 ignored.

This checks the translation end to end against the layout this PR implements (the f16 bias in its own dword; 32-bit derivatives outside _g16, as in r4tedx's review). It is not a comparison with console hardware. Not covered: _g16, _cl and _o forms, sample_b in a pixel shader, and the signature and container changes in this PR.

The commit only adds tests, so cherry-pick it if it's useful.

**@⁠marquezinii** on GitHub · 2026-11-24 17:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/306#issuecomment-7139028597) I ran the a16 samples on a GPU and read back the mip level each lane got. The checks above are DXIL validation and offline counts, so this is the runtime side. Setup: RTX 5070 (desktop, driver 621.40, the only adapter in the machine), Windows 11 26300, Rust 1.98.1, this PR's head `9342153`. Test commit on top of this branch: [`bc7fe21`](https://github.com/marquezinii/VIctory/commit/bc7fe217c116a5829d0cc1137fb49844108761b4). It adds `emit/image_a16_tests.rs` and a mipmapped texture view to the test harness (`View::Mips`). Three wave32 compute programs run `image_sample_l`, `_d` and `_b` with `a16` on a 16x4 RGBA32F texture. Every texel of mip `m` holds `m`, the filter is point, and each lane stores the level it sampled. Lanes load their address dwords from a raw buffer, so the packed halves and the junk (`0x5A5A`) in the high halves the hardware ignores are set bit for bit. The texture is not square, so a gradient read on the wrong axis lands two levels off. | case | `ffe310e` | this PR | |---|---|---| | `image_sample_l` a16: f16 LOD in the low half, junk above it | pass | pass | | `image_sample_d` a16: four f32 gradients, then packed (u, v). Lane `l` asks for level `l % 5` in gradient component `(l / 5) % 4` | **fail**: got `[2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, ...]`, want `[0, 1, 2, 3, 4, 0, 1, ...]` | pass | | `image_sample_b` a16: f16 bias in the low half, junk above it. Implicit derivatives come from 2x2 quads spaced one texel of level 0-2 apart, with biases -2 to +4 | refused in `lower` | pass | - Hardware adapter and WARP give the same results. - The three tests passed in 11 runs out of 11. - `dxil.dll` from the SDK validates all three shaders. - `cargo test -p victory-shader` with the commit: 129 passed, 0 failed, 1 ignored. This checks the translation end to end against the layout this PR implements (the f16 bias in its own dword; 32-bit derivatives outside `_g16`, as in r4tedx's review). It is not a comparison with console hardware. Not covered: `_g16`, `_cl` and `_o` forms, `sample_b` in a pixel shader, and the signature and container changes in this PR. The commit only adds tests, so cherry-pick it if it's useful.
Author
Owner

@⁠alexdeliu on GitHub · 2026-11-24 17:23 UTC · original

Merged onto main @ ffe310eb (PR head 93421530), two of the new tests fail in dxil.dll validation on this host. Both fail the same way on a retry:

  • compute_shader_implicit_sample_uses_valver_1_8_and_validates: Validator version in metadata (1.8) is not supported; maximum: (1.7). The test needs a newer dxil.dll than the one here, so it may want to skip when the validator is older.
  • row_interp_harmonizes_packed_elements_and_validates: Container part 'Pipeline State Validation' does not match expected for module.

main itself validates fine with the same dxil.dll.

Checked with CI's steps (both clippy runs with -D warnings, cargo test --workspace) on Windows 11, AMD RX 9070. Every open PR: https://gist.github.com/alexdeliu/ef9ef0ebc1776ff104b5aa8eaea18e87

**@⁠alexdeliu** on GitHub · 2026-11-24 17:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/306#issuecomment-7139123672) Merged onto `main` @ `ffe310eb` (PR head `93421530`), two of the new tests fail in `dxil.dll` validation on this host. Both fail the same way on a retry: - `compute_shader_implicit_sample_uses_valver_1_8_and_validates`: `Validator version in metadata (1.8) is not supported; maximum: (1.7).` The test needs a newer `dxil.dll` than the one here, so it may want to skip when the validator is older. - `row_interp_harmonizes_packed_elements_and_validates`: `Container part 'Pipeline State Validation' does not match expected for module.` `main` itself validates fine with the same `dxil.dll`. <sub>Checked with CI's steps (both clippy runs with `-D warnings`, `cargo test --workspace`) on Windows 11, AMD RX 9070. Every open PR: https://gist.github.com/alexdeliu/ef9ef0ebc1776ff104b5aa8eaea18e87</sub>
Author
Owner

@⁠justlovett0 on GitHub · 2026-11-24 18:48 UTC · original

Verified + integrated. Stack: main ffe310e + #175/#994/#747/#302/#193/#704/#309/#953/#1067/#986/#1260/#1267/#1254/#1276/#189 (wave64 emulation), RTX 3080 10 GB / Win10 21H2 (19044.7846) / driver 621.24 (32.0.16.2124). Re-census of captured runtime containers; world stable ~9 min, 0 device removals.

Biased 16-bit image samples + conservative depth merged (runtime emit kept; a mod.rs test-module conflict resolved to our tests). Compute emission 493/560. Note: image_gather4_l (9 of our runtime refusals) is not cleared by this PR — that needs the gather lowering (#160/#694).

AI use: Qwen Code; local measurements. No game data posted.

**@⁠justlovett0** on GitHub · 2026-11-24 18:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/306#issuecomment-7141179706) **Verified + integrated.** Stack: main `ffe310e` + #175/#994/#747/#302/#193/#704/#309/#953/#1067/#986/#1260/#1267/#1254/#1276/#189 (wave64 emulation), RTX 3080 10 GB / Win10 21H2 (19044.7846) / driver 621.24 (32.0.16.2124). Re-census of captured runtime containers; world stable ~9 min, 0 device removals. Biased 16-bit image samples + conservative depth merged (runtime emit kept; a mod.rs test-module conflict resolved to our tests). Compute emission 493/560. Note: `image_gather4_l` (9 of our runtime refusals) is **not** cleared by this PR — that needs the gather lowering (#160/#694). AI use: Qwen Code; local measurements. No game data posted.
Author
Owner

@⁠wbkepler on GitHub · 2026-11-24 20:36 UTC · original

Thanks @⁠alexdeliu, I reproduced both failures with a 1.7 dxil.dll (via VICTORY_DXIL). They are fixed in e3067ae.

  • PSV0 mismatch: this was a real emitter bug. It already existed on main, but none of main's tests hit it. When a semantic name repeats (for example TEXCOORD0 and TEXCOORD1), PSV0 kept a single copy of the name in its string table. DXC's PSV writer writes one copy per element. Validators before 1.8 compare PSV0 byte for byte, so they rejected any signature that repeats a name. 1.8 compares the strings themselves, which is why it passed here. PSV0 now writes one copy per element.
  • valver 1.8: a 1.7 validator rejects dx.valver 1.8 modules outright. I added Validator::version(), which reads IDxcVersionInfo. The compute-derivative test now skips only the dxil.dll step when the validator is older than 1.8, and the pipeline-creation check still runs. At runtime nothing changes: translated shaders never go through dxil.dll because they carry our own container hash. An old dxil.dll only affects the offline translate --validate.

Verified: the full victory-shader suite, clippy and the policy check pass with the SDK 1.8 validator. The row_interp, signature, sample-frequency and repeated-name PSV cases also validate with 1.7, 1.8 and 1.9 validators.

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

**@⁠wbkepler** on GitHub · 2026-11-24 20:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/306#issuecomment-7143812697) Thanks @⁠alexdeliu, I reproduced both failures with a 1.7 `dxil.dll` (via `VICTORY_DXIL`). They are fixed in e3067ae. - **PSV0 mismatch:** this was a real emitter bug. It already existed on main, but none of main's tests hit it. When a semantic name repeats (for example `TEXCOORD0` and `TEXCOORD1`), PSV0 kept a single copy of the name in its string table. DXC's PSV writer writes one copy per element. Validators before 1.8 compare PSV0 byte for byte, so they rejected any signature that repeats a name. 1.8 compares the strings themselves, which is why it passed here. PSV0 now writes one copy per element. - **valver 1.8:** a 1.7 validator rejects `dx.valver` 1.8 modules outright. I added `Validator::version()`, which reads `IDxcVersionInfo`. The compute-derivative test now skips only the dxil.dll step when the validator is older than 1.8, and the pipeline-creation check still runs. At runtime nothing changes: translated shaders never go through dxil.dll because they carry our own container hash. An old dxil.dll only affects the offline `translate --validate`. Verified: the full `victory-shader` suite, clippy and the policy check pass with the SDK 1.8 validator. The `row_interp`, signature, sample-frequency and repeated-name PSV cases also validate with 1.7, 1.8 and 1.9 validators. _AI-assisted (Claude Code); checked on Windows 11 / RTX 5090._
Author
Owner

@⁠SAitken91 on GitHub · 2026-11-24 20:37 UTC · original

Measured this against my #569 (same biased-a16 fix) on the retail shaders.rpf, each merged alone onto main ffe310e, victory translate --validate, Windows SDK dxil.dll:

VS/PS emitted / validated CS validated MS validated
main 12231 / 12155 1417 8152
+ #569 12275 / 12191 1417 8152
+ #306 9342153 12275 / 12275 1441 8161

Both unblock the same 44 programs (a biased image sample with 16-bit coordinates 108 → 0), but #306 also clears every remaining validator failure on this pack except the 53 mesh vertex plus primitive output size > 32768 — including the interpolation-row ones, while keeping rows in place (the reason I closed #554 in its favour). So #306 covers #569; if this lands, #569 isn't needed.

**@⁠SAitken91** on GitHub · 2026-11-24 20:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/306#issuecomment-7143825694) Measured this against my #569 (same biased-a16 fix) on the retail `shaders.rpf`, each merged alone onto `main` `ffe310e`, `victory translate --validate`, Windows SDK `dxil.dll`: | | VS/PS emitted / validated | CS validated | MS validated | |---|---|---|---| | `main` | 12231 / 12155 | 1417 | 8152 | | + #569 | 12275 / 12191 | 1417 | 8152 | | + #306 `9342153` | 12275 / **12275** | **1441** | **8161** | Both unblock the same 44 programs (`a biased image sample with 16-bit coordinates` 108 → 0), but #306 also clears every remaining validator failure on this pack except the 53 mesh `vertex plus primitive output size > 32768` — including the interpolation-row ones, while keeping rows in place (the reason I closed #554 in its favour). So #306 covers #569; if this lands, #569 isn't needed.
Author
Owner

@⁠alexdeliu on GitHub · 2026-11-24 22:22 UTC · original

Rechecked e3067ae on the RX 9070 (RDNA4) with the stock Windows SDK 10.0.26100 dxil.dll (1.7.2308): cargo test --workspace --locked gives 348 passed, 0 failed, 6 ignored. Both PSV0 failures I reported are gone, and compute_shader_implicit_sample_uses_valver_1_8_and_validates and signature_part_preserves_element_order_within_row_and_validates pass. Thanks!

Note: the branch is still on ffe310e. Merging current main (70564ae) conflicts in emit/lower.rs and emit/shader.rs.

**@⁠alexdeliu** on GitHub · 2026-11-24 22:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/306#issuecomment-7146143724) Rechecked `e3067ae` on the RX 9070 (RDNA4) with the stock Windows SDK 10.0.26100 `dxil.dll` (1.7.2308): `cargo test --workspace --locked` gives 348 passed, 0 failed, 6 ignored. Both PSV0 failures I reported are gone, and `compute_shader_implicit_sample_uses_valver_1_8_and_validates` and `signature_part_preserves_element_order_within_row_and_validates` pass. Thanks! Note: the branch is still on `ffe310e`. Merging current main (`70564ae`) conflicts in `emit/lower.rs` and `emit/shader.rs`.

Pull request closed

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!306
No description provided.