Repository navigation
Conversation
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 <noreply@anthropic.com>
|
Check on Linux, not Windows: pass. Head
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. |
|
Measured on the full retail shader pack (26,503 containers) with
|
mercuryVM
left a comment
There was a problem hiding this comment.
Tested 9152a1b on Windows 11, RTX 5070, MSVC: the workspace passes (195 outside victory-shader; victory-shader --lib single-threaded: 70). victory translate <title exe> --validate --pipelines gives the same counts before and after: 12 of 12 programs emitted, 12 validated, 12 pipelines. None of the 12 mixes modes in a row.
Splitting rows by interpolation mode fixes the validator error, and the algorithm is fine: the first mode keeps its row, and each later (row, mode) gets one shared new row. One linkage question before I'd approve:
- The row moves are done separately for each stage, on that stage's own inputs and outputs. A PS input element that moves to a new row stays at its original row on the VS side, because VS outputs carry no interpolation mode (
interp == 0stays put). - D3D12 checks at PSO creation that the PS input signature is compatible with the previous stage's outputs, by register and component, not only by semantic. That mismatch could make real VS+PS pipelines fail to create.
translate --pipelinescan't catch this: for a pixel program it builds the VS withhost::stub_vs(&ps)(apps/victory/src/translate.rs:441), which is derived from the PS's own (already moved) signature, so it always links.
Could you check one real VS/PS pair from the title where the PS moves a row, with the actual VS output signature? Or move the same elements in the producing stage's outputs (keyed by semantic), so both sides agree. If D3D12 turns out to link these by semantic alone in DXIL, a note saying so would settle it.
AI-assisted (Claude Code).
alexander-src
left a comment
There was a problem hiding this comment.
Tested 9152a1b merged onto main (8e79c80 and ffe310e, clean merge) on Windows 11 (10.0.26200.0), NVIDIA GeForce RTX 5090 (driver 621.24), WARP, Rust 1.98.1, dxil.dll 10.0.26100.0.
cargo clippy --workspace --all-targets --locked -- -D warnings: passcargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passcargo test -p victory-shader --locked -- --test-threads=1(on8e79c80): 90 passed, 0 failed, 1 ignored
Empirical answer to @mercuryVM's VS/PS linkage question (blocking)
Confirmed with a synthetic VS+PS test validated through dxil.dll 10.0.26100.0 and run through Host::pipeline + Host::draw on both RTX 5090 and WARP: D3D12 rejects VS/PS pairs whose (row, col) disagree at CreateGraphicsPipelineState, even when semantics match.
Setup:
PSdeclaresSV_Position(row 0),TEXCOORD0(f32, row 1 col 0,interp=2linear),TEXCOORD1(f32, row 1 col 1,interp=1constant).separate_interpolationmovesTEXCOORD1to row 2 col 1.VSoutputsSV_Position(row 0),TEXCOORD0(f32, row 1 col 0,interp=2=0.25), andTEXCOORD1(f32, col 1 =0.75) in three variants:row 1, interp=2(exactemit/mod.rsVS default when both outputs aref32, soseparate_interpolationleaves VS unchanged)row 2, interp=2(same row as moved PS, differentinterp)row 2, interp=1(same row andinterpas moved PS)
Results (all four containers validated cleanly with dxil.dll):
| Pair | RTX 5090 (621.24) |
WARP |
|---|---|---|
VS (row 1, interp 2) + PS (row 2, interp 1) |
CreateGraphicsPipelineState -> E_INVALIDARG ("The parameter is incorrect.") |
CreateGraphicsPipelineState -> E_INVALIDARG ("The parameter is incorrect.") |
VS (row 2, interp 2) + PS (row 2, interp 1) |
PSO ok, rendered [0.25, 0.75, 0.5, 1.0] |
PSO ok, rendered [0.25, 0.75, 0.5, 1.0] |
VS (row 2, interp 1) + PS (row 2, interp 1) |
PSO ok, rendered [0.25, 0.75, 0.5, 1.0] |
PSO ok, rendered [0.25, 0.75, 0.5, 1.0] |
Why this will hit real VS+PS and MS+PS pairs at runtime (while victory translate --pipelines misses it via host::stub_vs(&ps)):
- In
crates/victory-shader/src/emit/mod.rs:232-243, VS/MS outputs only get default modes (f32->2, integer ->1), whereas PS inputs havee.interpoverridden by barycentrics during lowering (flat,centroid,noperspective,sample) and can carry PS-onlySV_IsFrontFace(kind=13,interp=1). Any row mixing modes only on the PS side moves in the PS and stays put in the VS/MS. - Even when both stages split the same row (e.g.,
f32+u32),separate_interpolationpicksnext = max(row) + 1per stage. Whenever a VS/MS exports extra trailing rows the PS does not declare, the two stages assign different destination rows and PSO creation fails withE_INVALIDARG.
Note that the second row of the table also shows D3D12 allows VS interp=2 to link with PS interp=1 as long as (row, col) stay identical — which is why keeping rows in place (like #306's harmonize_row_interp, when the mixed sibling is unread) preserves stage linkage, whereas moving rows in one stage breaks it unless both stages agree on the exact layout at PSO link time.
No game files used in the linkage probe. AI-assisted (Antigravity) analysis and test authoring; all builds, validation, and GPU/WARP runs executed on this machine.
|
@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 |
catminou4
left a comment
There was a problem hiding this comment.
Sound fix for a real DXIL constraint (one interpolation mode per signature row). separate_interpolation keeps each row's first-seen mode in place and moves later modes to fresh rows (next starts above the max existing row, so no collisions), reusing one new row per (old row, mode) pair — the test shows B and D (both constant) sharing row 2 while A/E stay on row 0. Elements with mode 0 or no row are untouched, which is correct since they carry no interpolation semantics.
Calling it from Shader::finish for both inputs and outputs is the right place: lowering already happened, and DXIL links stages by semantic, so only the ISG1/OSG1 signature blobs change — the comment says exactly this and it's accurate.
Verified locally: test-merge with current main (ffe310e) clean; cargo test -p victory-shader --locked (macOS arm64, rustc 1.98.1) → 97 passed / 0 failed / 1 ignored, including the new rows_of_mixed_interpolation_are_separated unit test (runs on macOS, not Windows-gated).
|
@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 |
|
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. |
The console packs signature elements of different interpolation modes into one row, for example a constant
SV_IsFrontFaceor uint beside a linearTEXCOORD. The DXIL validator rejects this with "signature element ... has interpolation mode that differs from another element packed into the same row".Change
container::separate_interpolation, run on the inputs and outputs inShader::finishbefore 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.Results
victory translate --validate shaders.rpf, before → after: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 newrows_of_mixed_interpolation_are_separated. Clippy and rustfmt are clean.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