Shaders: write every PSV0 semantic name again, as DXC does (fixes #12) #61

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

@⁠srcamarda on GitHub · 2026-11-24 21:01 UTC · original
srcamarda:fix/mesh-psv-semantic-strings → main · +55 −14 · 1 files · 1 commits · open

Fixes #12.

Cause

container::psv shared one string-table entry between elements with the same semantic name (it looked the name up in the table before adding it). DXC writes one entry per named arbitrary element, in element order and repeats included; system values and unnamed elements point at offset 0.

Validators before 1.8 compare PSV0 byte for byte with the part they would write, so they refused ours with the message from #12:

error: Container part 'Pipeline State Validation' does not match expected for module.

Validator 1.8 (the Windows SDK 10.0.26100 one, which Validator::default_path picks) compares by content and accepts both layouts. That is why the suite never showed it.

It is not specific to mesh shaders. Vertex and geometry shaders with repeated names fail the same way: under 1.7, emit::rect::tests::rectangles_are_drawn_whole and the_rectangle_stage_is_a_geometry_shader fail on main.

How it was checked

Reference shaders compiled with the SDK's dxc.exe (-validator-version 1.6): a mesh shader with TEXCOORD0/1 vertex outputs and a TEXCOORD2 primitive output, and a vertex shader with repeated TEXCOORDs. Then a copy of each with the names merged the way psv merged them:

Validator DXC's layout merged names
1.8.2502.11 accepted accepted
1.7.2308 accepted refused
1.6.2112 accepted refused

Change

  • Every named arbitrary element gets its own entry, as DXC writes them; find goes (it could also match the tail of another name, NORMAL inside BINORMAL).
  • New test psv_names_repeat_as_dxc_writes_them checks the string table and each element's offset.

Before and after

The PSV0 string table and each element's name offset (inputs, then outputs), from psv() on main and on this branch, next to what DXC writes for the same signature (SDK dxc.exe 10.0.26100, -validator-version 1.6).

Pixel shader, colour and depth out (SV_Position, TEXCOORD0 in; SV_Target, SV_Depth out):

strings name offsets
DXC \0TEXCOORD\0\0\0 0, 1, 0, 0
main \0TEXCOORD\0\0\0 0, 1, 0, 0
this PR \0TEXCOORD\0\0\0 0, 1, 0, 0

No change: both outputs are system values, so they point at offset 0, and no name repeats. This shape was never refused.

Vertex shader with repeated names (TEXCOORD0, TEXCOORD1 in; SV_Position, TEXCOORD0, TEXCOORD1, COLOR0 out):

strings name offsets
DXC \0TEXCOORD\0TEXCOORD\0TEXCOORD\0TEXCOORD\0COLOR\0\0 1, 10, 0, 19, 28, 37
main \0TEXCOORD\0COLOR\0 1, 1, 0, 1, 1, 10
this PR \0TEXCOORD\0TEXCOORD\0TEXCOORD\0TEXCOORD\0COLOR\0\0 1, 10, 0, 19, 28, 37

main points all four TEXCOORDs at one entry. This branch writes one entry per element, as DXC does, and matches it byte for byte. Validators 1.6 and 1.7 refuse the main layout.

Tests

  • cargo test -p victory-shader: 211 passed with VICTORY_DXIL set to validators 1.6, 1.7 and 1.8. On main it is 208 passed / 2 failed under 1.7.
  • cargo test --workspace: all pass. cargo clippy -p victory-shader --all-targets: clean.
  • Not run: the three character pre-skin mesh shaders from #12 (no game data here).

AI-assisted (Claude Code). No game data used.

🤖 Generated with Claude Code

**@⁠srcamarda** on GitHub · 2026-11-24 21:01 UTC · [original](https://github.com/fxceless/victory-fork/pull/61) `srcamarda:fix/mesh-psv-semantic-strings` → `main` · +55 −14 · 1 files · 1 commits · open Fixes #12. ## Cause `container::psv` shared one string-table entry between elements with the same semantic name (it looked the name up in the table before adding it). DXC writes one entry per named arbitrary element, in element order and repeats included; system values and unnamed elements point at offset 0. Validators before 1.8 compare `PSV0` byte for byte with the part they would write, so they refused ours with the message from #12: ``` error: Container part 'Pipeline State Validation' does not match expected for module. ``` Validator 1.8 (the Windows SDK 10.0.26100 one, which `Validator::default_path` picks) compares by content and accepts both layouts. That is why the suite never showed it. It is not specific to mesh shaders. Vertex and geometry shaders with repeated names fail the same way: under 1.7, `emit::rect::tests::rectangles_are_drawn_whole` and `the_rectangle_stage_is_a_geometry_shader` fail on `main`. ## How it was checked Reference shaders compiled with the SDK's `dxc.exe` (`-validator-version 1.6`): a mesh shader with `TEXCOORD0/1` vertex outputs and a `TEXCOORD2` primitive output, and a vertex shader with repeated `TEXCOORD`s. Then a copy of each with the names merged the way `psv` merged them: | Validator | DXC's layout | merged names | |---|---|---| | 1.8.2502.11 | accepted | accepted | | 1.7.2308 | accepted | **refused** | | 1.6.2112 | accepted | **refused** | ## Change - Every named arbitrary element gets its own entry, as DXC writes them; `find` goes (it could also match the tail of another name, `NORMAL` inside `BINORMAL`). - New test `psv_names_repeat_as_dxc_writes_them` checks the string table and each element's offset. ## Before and after The `PSV0` string table and each element's name offset (inputs, then outputs), from `psv()` on `main` and on this branch, next to what DXC writes for the same signature (SDK `dxc.exe` 10.0.26100, `-validator-version 1.6`). **Pixel shader, colour and depth out** (`SV_Position`, `TEXCOORD0` in; `SV_Target`, `SV_Depth` out): | | strings | name offsets | |---|---|---| | DXC | `\0TEXCOORD\0\0\0` | `0, 1, 0, 0` | | `main` | `\0TEXCOORD\0\0\0` | `0, 1, 0, 0` | | this PR | `\0TEXCOORD\0\0\0` | `0, 1, 0, 0` | No change: both outputs are system values, so they point at offset 0, and no name repeats. This shape was never refused. **Vertex shader with repeated names** (`TEXCOORD0`, `TEXCOORD1` in; `SV_Position`, `TEXCOORD0`, `TEXCOORD1`, `COLOR0` out): | | strings | name offsets | |---|---|---| | DXC | `\0TEXCOORD\0TEXCOORD\0TEXCOORD\0TEXCOORD\0COLOR\0\0` | `1, 10, 0, 19, 28, 37` | | `main` | `\0TEXCOORD\0COLOR\0` | `1, 1, 0, 1, 1, 10` | | this PR | `\0TEXCOORD\0TEXCOORD\0TEXCOORD\0TEXCOORD\0COLOR\0\0` | `1, 10, 0, 19, 28, 37` | `main` points all four `TEXCOORD`s at one entry. This branch writes one entry per element, as DXC does, and matches it byte for byte. Validators 1.6 and 1.7 refuse the `main` layout. ## Tests - `cargo test -p victory-shader`: 211 passed with `VICTORY_DXIL` set to validators 1.6, 1.7 and 1.8. On `main` it is 208 passed / 2 failed under 1.7. - `cargo test --workspace`: all pass. `cargo clippy -p victory-shader --all-targets`: clean. - Not run: the three character pre-skin mesh shaders from #12 (no game data here). AI-assisted (Claude Code). No game data used. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
PSV0 shared one string-table entry between elements with the same
semantic name. DXC writes one entry per named arbitrary element, in
element order and repeats included. Validators before 1.8 compare the
part byte for byte and refused ours ("Container part 'Pipeline State
Validation' does not match expected for module"); 1.8 compares by
content and took either, which is why the newest SDK never showed it.
This is not specific to mesh shaders: vertex and geometry shaders with
repeated names failed the same way (the rect tests under 1.7).

Fixes #12.

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

@⁠rostaddotcc on GitHub · 2026-11-24 21:16 UTC · original

Verified on a Linux host at 8bac552 (CachyOS, RX 7900 XT/RDNA3, x86-64, no Windows target needed for this crate):

  • cargo test -p victory-shader — 171 passed, 0 failed, 2 ignored (1.8 s).
  • cargo xtask policy — 169 files ok.
  • cargo xwin build --release -p victory --target x86_64-pc-windows-msvc — clean.

So the shader library this touches is green on a non-Windows platform as well, which matters for #53/#12 being platform-independent: the PSV0 name handling is not in a Windows-only path.

One request: the PR says "one PSV0 name entry per element". Could the description quote what the container emits before/after for a two-element signature with a colour and a depth output? On this side I can only see the byte counts, so a before/after pair in the description is the cheapest way for a reader to check the claim without rebuilding.

**@⁠rostaddotcc** on GitHub · 2026-11-24 21:16 UTC · [original](https://github.com/fxceless/victory-fork/pull/61#issuecomment-7144714999) Verified on a Linux host at `8bac552` (CachyOS, RX 7900 XT/RDNA3, x86-64, no Windows target needed for this crate): - `cargo test -p victory-shader` — **171 passed, 0 failed, 2 ignored** (1.8 s). - `cargo xtask policy` — 169 files ok. - `cargo xwin build --release -p victory --target x86_64-pc-windows-msvc` — clean. So the shader library this touches is green on a non-Windows platform as well, which matters for #53/#12 being platform-independent: the PSV0 name handling is not in a Windows-only path. One request: the PR says "one PSV0 name entry per element". Could the description quote what the container emits before/after for a two-element signature with a colour and a depth output? On this side I can only see the byte counts, so a before/after pair in the description is the cheapest way for a reader to check the claim without rebuilding.
Author
Owner

@⁠srcamarda on GitHub · 2026-11-24 21:17 UTC · original

Checked against the title's shaders. I ran victory translate --validate over the title's own shader archive, comparing this branch with main (4e17478). The 1.7 validator is 1.7.2308; the 1.8 validator is the Windows SDK 10.0.26100 one (1.8.2502.11). Counts only; no game data attached.

Programs validated main + 1.7 this PR + 1.7 main + 1.8 this PR + 1.8
vertex and pixel (14,156 emitted) 2,694 14,045 14,045 14,045
compute (2,668 emitted) 2,668 2,668 2,668 2,668
mesh (8,762 emitted) 2,649 8,657 8,657 8,657
refused with "Pipeline State Validation does not match" 17,359 0 0 0
  • Under 1.7, main has about 70% of the emitted vertex/pixel and mesh programs refused on PSV0. With this PR none are, and 1.7 accepts the same programs as 1.8.
  • Under 1.8 nothing changes: the set of validated programs is identical before and after (25,370 lines from --list), and so are the remaining failures.
  • The ~200 programs that still fail have the same reasons on both validators, unrelated to this change:
    • 71 mesh programs over the 32,768-byte output limit;
    • 72 with ISG1/OSG1 mismatches;
    • about 60 with elements of different interpolation modes packed into one row.

AI-assisted (Claude Code).

**@⁠srcamarda** on GitHub · 2026-11-24 21:17 UTC · [original](https://github.com/fxceless/victory-fork/pull/61#issuecomment-7144724025) **Checked against the title's shaders.** I ran `victory translate --validate` over the title's own shader archive, comparing this branch with `main` (`4e17478`). The 1.7 validator is 1.7.2308; the 1.8 validator is the Windows SDK 10.0.26100 one (1.8.2502.11). Counts only; no game data attached. | Programs validated | `main` + 1.7 | this PR + 1.7 | `main` + 1.8 | this PR + 1.8 | |---|---:|---:|---:|---:| | vertex and pixel (14,156 emitted) | **2,694** | 14,045 | 14,045 | 14,045 | | compute (2,668 emitted) | 2,668 | 2,668 | 2,668 | 2,668 | | mesh (8,762 emitted) | **2,649** | 8,657 | 8,657 | 8,657 | | refused with "Pipeline State Validation does not match" | **17,359** | 0 | 0 | 0 | - Under 1.7, `main` has about 70% of the emitted vertex/pixel and mesh programs refused on `PSV0`. With this PR none are, and 1.7 accepts the same programs as 1.8. - Under 1.8 nothing changes: the set of validated programs is identical before and after (25,370 lines from `--list`), and so are the remaining failures. - The ~200 programs that still fail have the same reasons on both validators, unrelated to this change: - 71 mesh programs over the 32,768-byte output limit; - 72 with `ISG1`/`OSG1` mismatches; - about 60 with elements of different interpolation modes packed into one row. AI-assisted (Claude Code).
Author
Owner

@⁠adriaespii on GitHub · 2026-11-24 21:23 UTC · original

Independent test run on commit 8bac552 (AMD RDNA4):

  • Hardware: AMD Radeon RX 9070 (driver 32.0.32015.7029), AMD Ryzen 5 7600, Windows 11 Pro, Rust 1.98.1 (x86_64-pc-windows-msvc)
  • cargo clippy --workspace --all-targets -- -D warnings: 0 warnings
  • cargo test --workspace: 497 passed, 0 failed, 7 ignored (victory-shader: 211 passed, 0 failed, 2 ignored; victory-gpu: 110 passed, 0 failed, 1 ignored)
  • Not tested: retail shader pack / live game run (no game files on this machine)

AI use: Antigravity (Gemini 4 Neon) ran clippy/tests locally and wrote this report.

**@⁠adriaespii** on GitHub · 2026-11-24 21:23 UTC · [original](https://github.com/fxceless/victory-fork/pull/61#issuecomment-7144858816) Independent test run on commit `8bac552` (AMD RDNA4): - **Hardware:** AMD Radeon RX 9070 (driver 32.0.32015.7029), AMD Ryzen 5 7600, Windows 11 Pro, Rust 1.98.1 (`x86_64-pc-windows-msvc`) - `cargo clippy --workspace --all-targets -- -D warnings`: 0 warnings - `cargo test --workspace`: 497 passed, 0 failed, 7 ignored (`victory-shader`: 211 passed, 0 failed, 2 ignored; `victory-gpu`: 110 passed, 0 failed, 1 ignored) - **Not tested:** retail shader pack / live game run (no game files on this machine) *AI use: Antigravity (Gemini 4 Neon) ran clippy/tests locally and wrote this report.*
Author
Owner

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

Merged onto main 90228a7 and ran victory translate --validate over the full title (26,148 programs) on Windows 11 / RTX 4080.

Big one:

  • Programs that pass the validator: 2,706 → 14,057
  • Total failure lines: 17,907 → 548. The blanket Pipeline State Validation does not match (17,359 on main) is gone.

With it out of the way, real errors show that it was hiding. The biggest new one: 71 × vertex plus primitive output size is greater than 32768. The rest are the known emit failures and the interpolation-mode/signature errors. Since the PSV mismatch hides other PRs' validator results on main, it'd help to land this one first.

**@⁠arminkhaleghirod** on GitHub · 2026-11-24 22:23 UTC · [original](https://github.com/fxceless/victory-fork/pull/61#issuecomment-7146175615) Merged onto main 90228a7 and ran `victory translate --validate` over the full title (26,148 programs) on Windows 11 / RTX 4080. Big one: - Programs that pass the validator: **2,706 → 14,057** - Total failure lines: **17,907 → 548**. The blanket `Pipeline State Validation does not match` (17,359 on main) is gone. With it out of the way, real errors show that it was hiding. The biggest new one: 71 × `vertex plus primitive output size is greater than 32768`. The rest are the known emit failures and the interpolation-mode/signature errors. Since the PSV mismatch hides other PRs' validator results on main, it'd help to land this one first.
Author
Owner

@⁠DovisLe on GitHub · 2026-11-24 23:43 UTC · original

Tested on a Radeon 860M (RDNA 3.5), Windows 11, with 8bac552 merged onto the current main (2119b0e). The merge is clean. cargo test -p victory-shader --locked --lib was run under two validators, picked with VICTORY_DXIL:

validator main this PR on main
1.8.2502.11 (Windows SDK 10.0.26100) 210 passed, 0 failed 211 passed, 0 failed
1.7.2308 (Microsoft's DXC v1.7.2308 release, signed dxil.dll) 208 passed, 2 failed 211 passed, 0 failed

On main under 1.7, emit::rect::tests::rectangles_are_drawn_whole and the_rectangle_stage_is_a_geometry_shader fail with #12's message:

error: Container part 'Pipeline State Validation' does not match expected for module.

This matches the PR's table. I didn't test 1.6, and I didn't run any title's shaders: no game files were used.

AI-assisted (Claude).

**@⁠DovisLe** on GitHub · 2026-11-24 23:43 UTC · [original](https://github.com/fxceless/victory-fork/pull/61#issuecomment-7147727466) Tested on a **Radeon 860M (RDNA 3.5)**, Windows 11, with `8bac552` merged onto the current `main` (`2119b0e`). The merge is clean. `cargo test -p victory-shader --locked --lib` was run under two validators, picked with `VICTORY_DXIL`: | validator | `main` | this PR on `main` | |---|---|---| | 1.8.2502.11 (Windows SDK 10.0.26100) | 210 passed, 0 failed | 211 passed, 0 failed | | 1.7.2308 (Microsoft's DXC v1.7.2308 release, signed `dxil.dll`) | **208 passed, 2 failed** | 211 passed, 0 failed | On `main` under 1.7, `emit::rect::tests::rectangles_are_drawn_whole` and `the_rectangle_stage_is_a_geometry_shader` fail with #12's message: ``` error: Container part 'Pipeline State Validation' does not match expected for module. ``` This matches the PR's table. I didn't test 1.6, and I didn't run any title's shaders: no game files were used. AI-assisted (Claude).
Author
Owner

@⁠srcamarda on GitHub · 2026-11-25 01:59 UTC · original

@⁠rostaddotcc Thanks for checking. I added a "Before and after" section to the description. It compares psv() on main, on this branch, and DXC for two signatures.

A signature with colour and depth outputs is the same before and after. SV_Target and SV_Depth are system values, so their name offset is 0, and nothing repeats. The change only shows when a name repeats. Take a vertex shader with TEXCOORD0/TEXCOORD1 in and out:

  • main points all four TEXCOORDs at one string entry.
  • This branch writes \0TEXCOORD\0TEXCOORD\0TEXCOORD\0TEXCOORD\0COLOR\0\0 with offsets 1, 10, 0, 19, 28, 37, which matches DXC byte for byte.

AI-assisted (Claude Code). No game data used.

**@⁠srcamarda** on GitHub · 2026-11-25 01:59 UTC · [original](https://github.com/fxceless/victory-fork/pull/61#issuecomment-7150197001) @⁠rostaddotcc Thanks for checking. I added a "Before and after" section to the description. It compares `psv()` on `main`, on this branch, and DXC for two signatures. A signature with colour and depth outputs is the same before and after. `SV_Target` and `SV_Depth` are system values, so their name offset is 0, and nothing repeats. The change only shows when a name repeats. Take a vertex shader with `TEXCOORD0`/`TEXCOORD1` in and out: - `main` points all four `TEXCOORD`s at one string entry. - This branch writes `\0TEXCOORD\0TEXCOORD\0TEXCOORD\0TEXCOORD\0COLOR\0\0` with offsets `1, 10, 0, 19, 28, 37`, which matches DXC byte for byte. AI-assisted (Claude Code). No game data used.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-61'
git switch 'github-bot/gh-61'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-61'
git switch 'github-bot/gh-61'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-61'
git switch 'main'
git merge --squash 'github-bot/gh-61'
git switch 'main'
git merge --ff-only 'github-bot/gh-61'
git switch 'main'
git merge 'github-bot/gh-61'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.