Shaders: one interpolation mode per pixel input row #722

Closed
KyleS98 wants to merge 1 commit from upstream-pr/722 into main
KyleS98 commented 2026-11-25 05:42:44 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by KyleS98 on 2026-11-25T05:42:44Z.


DXIL gives every element packed into a signature row one interpolation mode, and the validator refuses a pixel program whose row mixes two:

signature element TEXCOORD at location (7,1) size (1,1) has interpolation mode that differs from another element packed into the same row.

The console's compiler packs pixel inputs by register alone, since its shader code does the interpolation itself. So a row can hold a flat element beside an interpolated one, or an element nothing reads, left at its default mode, beside one that is read another way.

Change

  • shader::harmonize_input_rows (pixel programs, in Shader::finish): an element no code reads takes the mode of the row's read elements. An integer element is only ever made constant. In a row nothing reads, a row that holds an integer becomes constant.
  • Lower::mixed_row: a row read in two modes, or interpolated beside a flat read or an integer element, is declared constant, and its interpolations weigh the vertices with SV_Barycentrics. That is the existing path for rows read per vertex (Lower::per_vertex). Rows that use a single mode are untouched.
  • VICTORY_FIX_HARMONIZE=0 and VICTORY_FIX_MIXED=0 turn the two parts off, for comparisons.

Measurements

victory translate --validate over the retail shader pack with VICTORY_HOST_WAVE=32 on 310c6eb, using the same binary with the change off and on:

off on
vertex + pixel programs validated 14,065 14,087
programs with the mixed-mode row error 70 45
programs emitted 14,176 14,176

Three programs move from the mixed-mode error to the existing "Program Input Signature does not match" error, so they still fail validation. The remaining 45 were not looked into individually.

Testing

  • 4 new unit tests (emit::shader::row_tests). cargo test -p victory-shader gives 218 passed, 0 failed.
  • In-game: an earlier version of this change ran on an RTX 3090 Ti through the prologue together with other changes. I have not isolated a visible difference from this change alone on 310c6eb.

AI-assisted (Claude Code, Claude Opus 5.5). Counts only; no game data attached.

🤖 Generated with Claude Code

<!-- greyfinch-sync:fxceless/victory-fork:issue:6598064545 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/722). Originally posted by [KyleS98](https://github.com/KyleS98) on 2026-11-25T05:42:44Z. --- DXIL gives every element packed into a signature row one interpolation mode, and the validator refuses a pixel program whose row mixes two: > `signature element TEXCOORD at location (7,1) size (1,1) has interpolation mode that differs from another element packed into the same row.` The console's compiler packs pixel inputs by register alone, since its shader code does the interpolation itself. So a row can hold a flat element beside an interpolated one, or an element nothing reads, left at its default mode, beside one that is read another way. ### Change - **`shader::harmonize_input_rows`** (pixel programs, in `Shader::finish`): an element no code reads takes the mode of the row's read elements. An integer element is only ever made constant. In a row nothing reads, a row that holds an integer becomes constant. - **`Lower::mixed_row`**: a row read in two modes, or interpolated beside a flat read or an integer element, is declared constant, and its interpolations weigh the vertices with `SV_Barycentrics`. That is the existing path for rows read per vertex (`Lower::per_vertex`). Rows that use a single mode are untouched. - `VICTORY_FIX_HARMONIZE=0` and `VICTORY_FIX_MIXED=0` turn the two parts off, for comparisons. ### Measurements `victory translate --validate` over the retail shader pack with `VICTORY_HOST_WAVE=32` on 310c6eb, using the same binary with the change off and on: | | off | on | |---|---|---| | vertex + pixel programs validated | 14,065 | **14,087** | | programs with the mixed-mode row error | 70 | **45** | | programs emitted | 14,176 | 14,176 | Three programs move from the mixed-mode error to the existing "Program Input Signature does not match" error, so they still fail validation. The remaining 45 were not looked into individually. ### Testing - 4 new unit tests (`emit::shader::row_tests`). `cargo test -p victory-shader` gives 218 passed, 0 failed. - In-game: an earlier version of this change ran on an RTX 3090 Ti through the prologue together with other changes. I have not isolated a visible difference from this change alone on 310c6eb. AI-assisted (Claude Code, Claude Opus 5.5). Counts only; no game data attached. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
JRamos1993 commented 2026-11-25 06:06:41 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by JRamos1993 on 2026-11-25T05:54:51Z.


Offline check on the retail shader pack: +22 programs validate and nothing is lost, but #699 validates the same 22 plus 120 more.

Setup: RTX 5090, Windows 11. victory translate --validate --list over the title's full shader pack, main 310c6eb against this head merged onto it. I added a local DXIL hash on each validated line.

  • This PR: 25,382 → 25,404 validated. All 22 are pixel programs, none lost, and no other program's DXIL changes.
  • #699 (signature row order plus one interpolation mode per row): 25,382 → 25,524. Its 142 include all 22 of these, plus the vertex and mesh programs with the same row problem and the element-order mismatches.

So on this pack, #699 alone does what this does and more. Details: https://github.com/fxceless/victory-fork/pull/699

AI use: Claude Code with Claude Opus 5.5 ran the pack and wrote this. Nothing from the title is in it.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7154258991 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/722#issuecomment-7154258991). Originally posted by [JRamos1993](https://github.com/JRamos1993) on 2026-11-25T05:54:51Z. --- **Offline check on the retail shader pack: +22 programs validate and nothing is lost, but #699 validates the same 22 plus 120 more.** **Setup:** RTX 5090, Windows 11. `victory translate --validate --list` over the title's full shader pack, `main` `310c6eb` against this head merged onto it. I added a local DXIL hash on each validated line. - **This PR:** 25,382 → 25,404 validated. All 22 are pixel programs, none lost, and no other program's DXIL changes. - **#699** (signature row order plus one interpolation mode per row): 25,382 → 25,524. Its 142 include all 22 of these, plus the vertex and mesh programs with the same row problem and the element-order mismatches. So on this pack, #699 alone does what this does and more. Details: https://github.com/fxceless/victory-fork/pull/699 AI use: Claude Code with Claude Opus 5.5 ran the pack and wrote this. Nothing from the title is in it.
upstream-sync closed this pull request 2026-11-25 07:06:01 +00:00
KyleS98 commented 2026-11-25 07:06:15 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by KyleS98 on 2026-11-25T06:13:18Z.


Thanks @JRamos1993, confirmed on my side too, so I'm closing this in favour of #699 by @Praisser.

On 310c6eb + #699, I measured the one part of this PR that #699 leaves out on purpose: Lower::mixed_row, which makes a row whose read elements disagree constant and interpolates it by hand. I used the same binary with it off and on, victory translate --validate over the retail pack with VICTORY_HOST_WAVE=32:

#699 #699 + mixed_row
vertex + pixel validated 14,173 14,173
mesh validated 8,691 8,691
programs with the mixed-mode row error 0 0

#699 leaves no mixed-mode rows on this pack, so mixed_row has nothing left to fix, and #699 covers everything this PR did plus the element order and the vertex/mesh outputs.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:fxceless/victory-fork:comment:7154567130 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/722#issuecomment-7154567130). Originally posted by [KyleS98](https://github.com/KyleS98) on 2026-11-25T06:13:18Z. --- Thanks @JRamos1993, confirmed on my side too, so I'm closing this in favour of #699 by @Praisser. On 310c6eb + #699, I measured the one part of this PR that #699 leaves out on purpose: `Lower::mixed_row`, which makes a row whose *read* elements disagree constant and interpolates it by hand. I used the same binary with it off and on, `victory translate --validate` over the retail pack with `VICTORY_HOST_WAVE=32`: | | #699 | #699 + mixed_row | |---|---|---| | vertex + pixel validated | 14,173 | 14,173 | | mesh validated | 8,691 | 8,691 | | programs with the mixed-mode row error | 0 | 0 | #699 leaves no mixed-mode rows on this pack, so `mixed_row` has nothing left to fix, and #699 covers everything this PR did plus the element order and the vertex/mesh outputs. AI-assisted (Claude Code, Claude Opus 5.5).

Pull request closed

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
fxceless/victory-fork!722
No description provided.