Shaders: signature rows of one register in the validator's order #1022

Closed
github-bot wants to merge 1 commit from gh-pr/1022/head into gh-pr/1022/base
Owner

@⁠ThiagoAlexsander on GitHub · 2026-11-24 15:08 UTC · original
ThiagoAlexsander:shader/signature-row-order → main · +41 −2 · 1 files · 1 commits · closed without merging

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 rebuilds ISG1/OSG1 from the module's signature metadata and compares the bytes. The two disagree on the order of rows within one register.

Cause

DXC's DxilProgramSignatureWriter sorts the rows with sort_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 in signature already says. So rows of one register keep element order. signature sorted 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 holds TEXCOORD3 in w, declared before NORMAL0 in xyz. The metadata lists TEXCOORD3 first and OSG1 listed NORMAL0 first.

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 --validate over the title's files (main ffe310e against this branch, Windows SDK dxil.dll 10.0.26100), compared program by program:

main this branch
vertex/pixel validated 12,167 12,199
mesh validated 8,152 8,156
Container part ... does not match 36 0

All 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

  • New rows_of_one_register_keep_element_order_not_column_order in emit/container.rs: a w element declared before an xyz element of the same register is written first. With main'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 on main plus 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 --check on container.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

**@⁠ThiagoAlexsander** on GitHub · 2026-11-24 15:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/1022) `ThiagoAlexsander:shader/signature-row-order` → `main` · +41 −2 · 1 files · 1 commits · closed without merging 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 rebuilds `ISG1`/`OSG1` from the module's signature metadata and compares the bytes. The two disagree on the order of rows within one register. ## Cause DXC's `DxilProgramSignatureWriter` sorts the rows with `sort_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 in `signature` already says. So rows of one register keep element order. `signature` sorted 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 holds `TEXCOORD3` in w, declared before `NORMAL0` in xyz. The metadata lists `TEXCOORD3` first and `OSG1` listed `NORMAL0` first. ## 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 --validate` over the title's files (`main` `ffe310e` against this branch, Windows SDK `dxil.dll` 10.0.26100), compared program by program: | | `main` | this branch | |---|---|---| | vertex/pixel validated | 12,167 | 12,199 | | mesh validated | 8,152 | 8,156 | | `Container part ... does not match` | 36 | 0 | All 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 - New `rows_of_one_register_keep_element_order_not_column_order` in `emit/container.rs`: a w element declared before an xyz element of the same register is written first. With `main`'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 on `main` plus 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 --check` on `container.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](https://claude.com/claude-code)
The validator rebuilds ISG1/OSG1 from the module's signatures and
compares bytes. It sorts rows by register, then by semantic name offset
(DXC's sort_sig), not by column: with validator 1.6 every arbitrary
semantic has its own name, so rows of one register keep element order.
We sorted them by column, and a register whose elements come in another
order (a w channel declared before the xyz of the same register) failed
with "Container part 'Program Input/Output Signature' does not match
expected for module".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:17:27 +00:00
github-bot closed this pull request 2026-11-26 04:17:27 +00:00
Author
Owner

@⁠Zipettte on GitHub · 2026-11-24 15:40 UTC · original

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-shader passes, 121 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

**@⁠Zipettte** on GitHub · 2026-11-24 15:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/1022#issuecomment-7136416379) 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-shader` passes, 121 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:30 UTC · original

Automated triage for the maintainers. Closing because this change is already in main, or main has 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.

**@⁠Marvisak** on GitHub · 2026-11-25 00:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/1022#issuecomment-7148579522) Automated triage for the maintainers. Closing because this change is already in `main`, or `main` has 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

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1022
No description provided.