Skip to content

Shaders: PSV0 and signatures laid out as the validator expects - #1208

Closed
powplusplus wants to merge 1 commit into
Marvisak:mainfrom
powplusplus:shader/psv-signature-validation
Closed

powplusplus wants to merge 1 commit into
Marvisak:mainfrom
powplusplus:shader/psv-signature-validation

Conversation

@powplusplus

Copy link
Copy Markdown

On ffe310e, dxil.dll rejects most emitted shaders with "Container part 'Pipeline State Validation' does not match expected for module" (15,054 programs in shaders.rpf), plus a few dozen signature mismatches.

translate --validate over shaders.rpf, nothing else changes in what emits:

main this
VS + PS validated 2,680 / 12,231 12,231 / 12,231
CS validated 1,441 / 1,441 1,441 / 1,441
MS validated 2,573 / 8,214 8,161 / 8,214

The 53 mesh shaders left exceed the validator's 32 KB vertex plus primitive output limit.

Tested: clippy (default and all features), cargo test -p victory-shader with three new tests.

- PSV0 gets one string per arbitrary semantic element instead of sharing
  one between elements with the same name.
- ISG1 and OSG1 sort elements by row only, so co-packed elements keep
  their order.
- Interpolation modes come from the console container's PSV0 when it has
  one, falling back to DXC's defaults.
@Zipettte

Copy link
Copy Markdown

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 084d8d2: cargo test -p victory-shader passes, 123 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

@Marvisak

Copy link
Copy Markdown
Owner

Automated triage for the maintainers. Closing because this change is already in main, or main has since replaced the code it patches.

Superseded by main: signature rows are already sorted by register only and one interpolation mode per row is already enforced (container::same_mode_per_row), and every emitted VS/PS validates. Its remaining change, unshared PSV0 strings, departs from the layout main validates with; its test's Psv literal also lacks main's gs field.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

@Marvisak Marvisak closed this Nov 25, 2026
triippywhale pushed a commit to triippywhale/victory-fork that referenced this pull request Nov 25, 2026
The modes of interpolated elements came from DXC's defaults by type
(float: linear, uint: constant), but the console's compiler may pack a
float and a uint element into one signature row, declaring both constant
in its PSV0. Mixed modes in one row are rejected by the validator
("interpolation mode that differs from another element packed into the
same row"). The modes are now read from the console container's PSV0,
keyed by row and column, falling back to the defaults without one.

Ported from Marvisak/VIctory#1208 (its interpolation-mode part and its
test), adapted to this fork's Psv (`geometry`).

(cherry picked from commit b4ee908)
(cherry picked from commit 8f45d46cc3b446db0f69cfffb961befd0cf680f6)
fiestorra added a commit to fiestorra/VIctory that referenced this pull request Nov 25, 2026
…before 1.8

`translate --validate` printed the SDK path and nothing else, and the SDK's
`dxil.dll` reports FileVersion 1.8.2502 while it is the 1.7 validator (Marvisak#1945).
That matters because the 1.7 validator rebuilds a program's PSV0 and compares
it with the module's, so a writer that deduplicates the semantic name table
(as ours does, Marvisak#1208) is rejected on every shader with a repeated semantic
name: 15,054 false PSV failures on 26,084 programs, and reports that read like
shader defects. 1.8 compares the content instead and never rebuilds it.

So the line now carries the DLL's own version from its version resource
(`VS_FIXEDFILEINFO`, read through version.dll, since the binding crate this
module uses does not expose it), and a validator before 1.8 prints a warning
naming `VICTORY_DXIL` as the way to point at a DXC 1.8 one.

Measured here: the SDK 10.0.26100 validator on this machine is 1.9 (it prints
1.9.2602.17), so the warning does not fire and the line reads

  validator    C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\dxil.dll 1.9

which is the point: two machines with the same path can now be told apart.
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.

3 participants