Shaders: signature rows of one register in the validator's order #1022
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1022"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by ThiagoAlexsander on 2026-11-24T15:08:50Z.
36 emitted programs fail validation with
Container part 'Program Input Signature' does not match expected for module(15) or... 'Program Output Signature' ...(21), reported in #201. The validator rebuildsISG1/OSG1from the module's signature metadata and compares the bytes. The two disagree on the order of rows within one register.Cause
DXC's
DxilProgramSignatureWritersorts the rows withsort_sig: by stream, then register, then semantic name offset, not by column (lib/DxilContainer/DxilContainerAssembler.cpp). With validator 1.6 names are not deduplicated by content: each arbitrary semantic gets its own offset in element order, and system values share theirs, as the comment insignaturealready says. So rows of one register keep element order.signaturesorted them by column.The two orders differ when a register's elements are declared in another order than their columns. In
VS_RasterizeWaterIndirectHW_MeshBased_Meshlets, for example, register 5 holdsTEXCOORD3in w, declared beforeNORMAL0in xyz. The metadata listsTEXCOORD3first andOSG1listedNORMAL0first.Change
One sort key in
container::signature:(register, name offset)instead of(register, column). The comment now says how the validator orders rows.Results
victory translate --validateover the title's files (mainffe310eagainst this branch, Windows SDKdxil.dll10.0.26100), compared program by program:mainContainer part ... does not matchAll 36 now validate. No other program changes. The D3D12 runtime already created pipelines for these modules (#201), so this makes the container agree with the module rather than unblock pipelines.
Testing
rows_of_one_register_keep_element_order_not_column_orderinemit/container.rs: a w element declared before an xyz element of the same register is written first. Withmain's key it fails ([(0, 0), (0, 1), (3, 1)]against[(0, 0), (3, 1), (0, 1)]).cargo test --workspace --locked: 343 passed, 0 failed, 6 ignored (342 onmainplus the new test). That includes the GPU tests that create graphics pipelines from translated signatures.cargo clippy --workspace --all-targets --locked -- -D warnings, with and without--all-features: clean.rustfmt --edition 2024 --checkoncontainer.rs: clean.cargo xtask policy: 154 files ok.Related: #554 makes rows of one interpolation mode and notes that it uncovers some of these errors. It changes how elements get their rows, this changes the order they are written in, so the two fit together.
AI use: Claude Code (Claude Opus 5.5) traced the mismatch by comparing one failing module's metadata with its
OSG1, checked DXC's sort, wrote the change and the test, and ran everything above. I reviewed the diff and the results.🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T15:40:16Z.
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at
57e2cde:cargo test -p victory-shaderpasses, 121 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).Tested with AI assistance (Claude).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T16:28:55Z.
Review: APPROVED
Signature rows of one register now sort by name offset (element order) instead of column, matching the validator's sort_sig; comment documents the rule precisely. New container test pins TEXCOORD-before-NORMAL ordering. Local verification: macOS arm64, rustc 1.98.1, PR head merged into main
ffe310e,cargo test -p <crate> --locked. Shader execution tests (valu_tests/host) are#[cfg(all(test, windows))], so macOS covers lowering/decode/unit tests only. victory-shader: 97 passed, 0 failed.Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T16:44:07Z.
Review: APPROVED
Tested
57e2cdeeon Windows 11, RTX 5070, MSVC:cargo test -p victory-shader -- --test-threads=1passes on the head (121 passed, 1 ignored).clippy -D warnings(default and all features) are all clean.The change matches DXC.
sort_sigin DxilContainerAssembler orders by stream, then register, then theSemanticNamefield, which is the name's offset in the string table. It does not sort by column, so keying the sort onoffsets[i]reproduces it, including system values sharing their first offset. The new test checks the case that mattered: a.welement declared before the.xyzof the same register.A static measurement on a full game package, counts only, with
translate --validate --listbefore and after this PR:Program Input/Output Signature does not match: 53 → 0.Pipeline State Validation does not match. So this frees no program yet, but it removes the first blocker.The PSV part probably needs the same row order in its signature element table, if that table is built from a separately ordered list.
AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:30:26Z.
Automated triage for the maintainers. Closing because this change is already in
main, ormainhas since replaced the code it patches.Signature rows are sorted by register only with element order kept in main (emit/container.rs signature(), stable sort;
13091f6e), which is what this PR arrives at.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.
Pull request closed