Shaders: one interpolation mode per signature row #554

Closed
github-bot wants to merge 1 commit from gh-pr/554/head into gh-pr/554/base
Owner

@⁠SAitken91 on GitHub · 2026-11-24 04:49 UTC · original
SAitken91:shader/separate-interpolation-rows → main · +74 −0 · 2 files · 1 commits · closed without merging

The console packs signature elements of different interpolation modes into one row, for example a constant SV_IsFrontFace or uint beside a linear TEXCOORD. The DXIL validator rejects this with "signature element ... has interpolation mode that differs from another element packed into the same row".

Change

  • New container::separate_interpolation, run on the inputs and outputs in Shader::finish before any signature is written. The first mode seen in a row keeps the row. Each later mode moves to a new free row, and that row's elements of the same mode share it.
  • Code addresses elements by id and stages link by semantic, so only the signatures change (metadata, ISG1/OSG1, PSV0).
  • Elements without a mode (0) are left in place. Programs without mixed rows are unchanged.

Results

victory translate --validate shaders.rpf, before → after:

validated
vertex/pixel 12172 → 12214
mesh 8129 → 8130

No interpolation-row errors remain. A few programs now report the "Container part 'Program Input/Output Signature' does not match" errors already in the list, which the packing error had hidden.

Testing

  • cargo test -p victory-shader: 70 passed, including the new rows_of_mixed_interpolation_are_separated. Clippy and rustfmt are clean.
  • Not exercised at runtime in the world. Only validation has been checked.

This is independent of #539 (64-bit image atomics), and the two can merge in either order.

Written with the help of Claude (AI).

🤖 Generated with Claude Code

**@⁠SAitken91** on GitHub · 2026-11-24 04:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/554) `SAitken91:shader/separate-interpolation-rows` → `main` · +74 −0 · 2 files · 1 commits · closed without merging The console packs signature elements of different interpolation modes into one row, for example a constant `SV_IsFrontFace` or uint beside a linear `TEXCOORD`. The DXIL validator rejects this with "signature element ... has interpolation mode that differs from another element packed into the same row". ## Change - New `container::separate_interpolation`, run on the inputs and outputs in `Shader::finish` before any signature is written. The first mode seen in a row keeps the row. Each later mode moves to a new free row, and that row's elements of the same mode share it. - Code addresses elements by id and stages link by semantic, so only the signatures change (metadata, ISG1/OSG1, PSV0). - Elements without a mode (0) are left in place. Programs without mixed rows are unchanged. ## Results `victory translate --validate shaders.rpf`, before → after: | | validated | |---|---| | vertex/pixel | 12172 → 12214 | | mesh | 8129 → 8130 | No interpolation-row errors remain. A few programs now report the "Container part 'Program Input/Output Signature' does not match" errors already in the list, which the packing error had hidden. ## Testing - `cargo test -p victory-shader`: 70 passed, including the new `rows_of_mixed_interpolation_are_separated`. Clippy and rustfmt are clean. - **Not exercised at runtime in the world.** Only validation has been checked. This is independent of #539 (64-bit image atomics), and the two can merge in either order. Written with the help of Claude (AI). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The console packs elements of different interpolation modes into one
signature row (a constant SV_IsFrontFace or uint beside a linear
TEXCOORD), which the DXIL validator rejects: "signature element ... has
interpolation mode that differs from another element packed into the
same row". Before the signatures are written, each later mode of a row
now moves to a free row of its own, shared by that row's elements of
the mode. Code addresses elements by id and stages link by semantic, so
only the signatures (metadata, ISG1/OSG1, PSV0) change. Elements without
a mode are left in place, and programs without such rows are unchanged.

translate --validate on shaders.rpf: vertex/pixel 12172 -> 12214
validated, mesh 8129 -> 8130; no interpolation-row errors remain. A few
programs now report the signature-mismatch errors already in the list,
which the packing error had hidden.

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

@⁠KoLolX3 on GitHub · 2026-11-24 05:32 UTC · original

Check on Linux, not Windows: pass. Head 9152a1bee merged onto main d2a4bae1f (clean merge).

  • Native tests of the seven crates that build on Linux (core, formats, game, loader, pe, pipeline, shader): PR 93 passed, 7 failed, main 92 passed, 7 failed.
  • Windows cross type-check of the whole workspace (cargo xwin check --workspace --target x86_64-pc-windows-msvc, covers victory-gpu, victory-hle and the app): PR ok, main ok.
  • Tests this PR adds: 1, of which 1 ran in the native run (the pass count rose by 1).
  • rustfmt: unformatted hunks, PR 168, main 168.
  • Failing on main here as well (not this PR): 7 tests in victory-loader and victory-pe that parse their own test binary as a PE image, which is an ELF file on Linux.
  • Not run: victory-gpu / victory-hle tests and the game itself.

On: AMD Ryzen 7 5700, 62 GB RAM, Artix Linux 7.3.4-artix1-2, rustc 1.98.1 (the repo's pinned toolchain), cargo-xwin 0.24.1. No game data. Automated check only: the code itself was not reviewed.

**@⁠KoLolX3** on GitHub · 2026-11-24 05:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/554#issuecomment-7123050128) Check on Linux, not Windows: **pass**. Head `9152a1bee` merged onto `main` `d2a4bae1f` (clean merge). - Native tests of the seven crates that build on Linux (`core`, `formats`, `game`, `loader`, `pe`, `pipeline`, `shader`): PR `93 passed, 7 failed`, `main` `92 passed, 7 failed`. - Windows cross type-check of the whole workspace (`cargo xwin check --workspace --target x86_64-pc-windows-msvc`, covers `victory-gpu`, `victory-hle` and the app): PR ok, `main` ok. - Tests this PR adds: 1, of which 1 ran in the native run (the pass count rose by 1). - rustfmt: unformatted hunks, PR 168, `main` 168. - Failing on `main` here as well (not this PR): 7 tests in `victory-loader` and `victory-pe` that parse their own test binary as a PE image, which is an ELF file on Linux. - Not run: `victory-gpu` / `victory-hle` tests and the game itself. On: AMD Ryzen 7 5700, 62 GB RAM, Artix Linux 7.3.4-artix1-2, rustc 1.98.1 (the repo's pinned toolchain), cargo-xwin 0.24.1. No game data. Automated check only: the code itself was not reviewed.
Author
Owner

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

Measured on the full retail shader pack (26,503 containers) with victory translate --validate, against main d2a4bae (emitted / validated). Windows 11, dxil.dll from SDK 10.0.26100.

VS/PS MS validator failures changed
main 12272 / 12172 8191 / 8129
#554 12272 / 12214 8191 / 8130 clears all 49 "interpolation mode that differs from another element packed into the same row"; "Program Input Signature does not match" 21 → 23, "Program Output Signature does not match" 25 → 29
#565 12272 / 12186 8191 / 8129 clears the 14 "Interpolation mode for PS input position must be linear_noperspective_centroid…"
#381 12272 / 12172 8191 / 8129 none on this pack
#306 12316 / 12316 8191 / 8138 clears both kinds above and the signature mismatches (all VS/PS that emit validate)

cargo test -p victory-shader passes on all four.

**@⁠slint6614-dev** on GitHub · 2026-11-24 07:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/554#issuecomment-7125369664) Measured on the full retail shader pack (26,503 containers) with `victory translate --validate`, against main d2a4bae (emitted / validated). Windows 11, dxil.dll from SDK 10.0.26100. | | VS/PS | MS | validator failures changed | |---|---|---|---| | main | 12272 / 12172 | 8191 / 8129 | | | #554 | 12272 / 12214 | 8191 / 8130 | clears all 49 "interpolation mode that differs from another element packed into the same row"; "Program Input Signature does not match" 21 → 23, "Program Output Signature does not match" 25 → 29 | | #565 | 12272 / 12186 | 8191 / 8129 | clears the 14 "Interpolation mode for PS input position must be linear_noperspective_centroid…" | | #381 | 12272 / 12172 | 8191 / 8129 | none on this pack | | #306 | 12316 / 12316 | 8191 / 8138 | clears both kinds above and the signature mismatches (all VS/PS that emit validate) | `cargo test -p victory-shader` passes on all four.
Author
Owner

@⁠SAitken91 on GitHub · 2026-11-24 10:46 UTC · original

@⁠alexander-src thank you — that's decisive, and it breaks the premise of this PR ("stages link by semantic"): moving rows in one stage changes (row, col) and CreateGraphicsPipelineState rejects the pair, which translate --pipelines can't see because it pairs the PS with a stub VS. Your second table row (VS interp 2 + PS interp 1 at the same row links fine) points to the safer approach #306 takes: keep rows in place and harmonize the mode. I'm converting this to a draft so it isn't merged as is; it would need both stages to derive the same layout, which a per-stage max(row) + 1 can't guarantee.

**@⁠SAitken91** on GitHub · 2026-11-24 10:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/554#issuecomment-7129226322) @⁠alexander-src thank you — that's decisive, and it breaks the premise of this PR ("stages link by semantic"): moving rows in one stage changes `(row, col)` and `CreateGraphicsPipelineState` rejects the pair, which `translate --pipelines` can't see because it pairs the PS with a stub VS. Your second table row (VS interp 2 + PS interp 1 at the same row links fine) points to the safer approach #306 takes: keep rows in place and harmonize the mode. I'm converting this to a draft so it isn't merged as is; it would need both stages to derive the same layout, which a per-stage `max(row) + 1` can't guarantee.
Author
Owner

@⁠SAitken91 on GitHub · 2026-11-24 12:42 UTC · original

@⁠catminou4 thanks for the review — note the blocker above, though: @⁠alexander-src showed on an RTX 5090 and WARP that D3D12 rejects VS/PS pairs whose (row, col) differ (CreateGraphicsPipelineState → E_INVALIDARG). This PR moves rows per stage (next = max(row) + 1 in each), so a PS can end up with rows its VS doesn't have, which the validator and translate --pipelines (stub VS) can't catch. That's why it's a draft; #306's approach (keep rows, harmonize the mode) avoids it.

**@⁠SAitken91** on GitHub · 2026-11-24 12:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/554#issuecomment-7131804142) @⁠catminou4 thanks for the review — note the blocker above, though: @⁠alexander-src showed on an RTX 5090 and WARP that D3D12 rejects VS/PS pairs whose `(row, col)` differ (`CreateGraphicsPipelineState` → `E_INVALIDARG`). This PR moves rows per stage (`next = max(row) + 1` in each), so a PS can end up with rows its VS doesn't have, which the validator and `translate --pipelines` (stub VS) can't catch. That's why it's a draft; #306's approach (keep rows, harmonize the mode) avoids it.
Author
Owner

@⁠SAitken91 on GitHub · 2026-11-24 14:56 UTC · original

Closing in favour of #306, which keeps signature rows in place and harmonizes the interpolation mode instead, so VS/PS (row, col) stay identical and pipelines link (per @⁠alexander-src's RTX 5090/WARP results above). Thanks to everyone who tested and reviewed this.

**@⁠SAitken91** on GitHub · 2026-11-24 14:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/554#issuecomment-7135200742) Closing in favour of #306, which keeps signature rows in place and harmonizes the interpolation mode instead, so VS/PS (row, col) stay identical and pipelines link (per @⁠alexander-src's RTX 5090/WARP results above). Thanks to everyone who tested and reviewed this.

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