Skip to content

Shaders: one interpolation mode per pixel input row - #722

Closed
KyleS98 wants to merge 1 commit into
fxceless:mainfrom
KyleS98:fix/pixel-input-row-interpolation
Closed

KyleS98 wants to merge 1 commit into
fxceless:mainfrom
KyleS98:fix/pixel-input-row-interpolation

Conversation

@KyleS98

@KyleS98 KyleS98 commented Nov 25, 2026

Copy link
Copy Markdown

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

DXIL gives every element packed into a signature row one interpolation
mode; the validator refuses a pixel program whose row mixes two
("signature element ... 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,
so a row can hold a flat element beside an interpolated one, or an
element no code reads, left at its default mode, beside one that is
read another way.

- shader::harmonize_input_rows: an element nothing reads takes the mode
  of the row's read elements (an integer element only ever constant); in
  a row nothing reads, a row holding an integer is made 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, as rows read
  per vertex already are (Lower::per_vertex).

On the retail shader pack with VICTORY_HOST_WAVE=32, the same binary
with the change off and on: 14,065 -> 14,087 vertex and pixel programs
validated, 70 -> 45 programs with the mixed-mode error, emitted counts
unchanged. VICTORY_FIX_HARMONIZE=0 and VICTORY_FIX_MIXED=0 turn the two
parts off.

Four unit tests for harmonize_input_rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017rHNfuPpCyeMjHxWTEyhiQ
@JRamos1993

Copy link
Copy Markdown

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.

So on this pack, #699 alone does what this does and more. Details: #699

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

@KyleS98

KyleS98 commented Nov 25, 2026

Copy link
Copy Markdown
Author

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants