Shaders: match DXIL validator layout for ISG1/OSG1 signatures #124

Open
vicennpacheco wants to merge 1 commit from upstream-pr/124 into main
vicennpacheco commented 2026-11-24 21:40:02 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by vicennpacheco on 2026-11-24T21:40:02Z.


Summary

Addresses dxil.dll signature validation failures of the form:

Container part 'Program Input Signature' does not match expected for module.

(and the matching Program Output Signature error), as reported in #53.

Root causes found against dxil.dll 10.0.26100.0

In crates/victory-shader/src/emit/container.rs (signature()), three differences from DXIL's reconstructed ISG1/OSG1 triggered validation failures even when D3D12 still created the pipeline:

  1. Same-row sort order: rows were sorted by (row, col) instead of row alone. When two packed elements share a register with the higher column listed first (e.g. col = 2 before col = 0), dxil.dll keeps element order within the row.
  2. System-value name casing: system values (kind != 0) wrote e.name verbatim (e.g. SV_POSITION, SV_TARGET, SV_ISFRONTFACE), whereas dxil.dll writes DXIL's canonical mixed-case semantic names (SV_Position, SV_Target, SV_IsFrontFace, ...).
  3. Unallocated element column shift: when row == None (StartRow = -1, StartCol = -1 in signature_md), mask() and usage still shifted by e.col instead of 0.

(Note: this was reproduced and verified with synthetic shaders and dxil.dll 10.0.26100.0 without game files, so I have not tested the specific shader hash from #53 directly — hence linking #53 rather than auto-closing it.)

Tests

Tested on Windows 11, AMD Radeon Vega 8 iGPU (Ryzen 7 5825U, GCN 5 / gfx90c, AMD driver 31.0.21921.13001), Windows SDK dxil.dll 10.0.26100.0, Rust 1.98.1 (x86_64-pc-windows-msvc), without game files:

  • Added emit::container::tests::signature_keeps_same_row_order_canonical_sv_names_and_unalloc_mask
  • Added emit::barycentric_tests::signature_parts_match_dxil_validator (all 3 cases failed with the exact #53 error before the fix and pass after)
  • cargo test -p victory-shader --lib -- emit::container emit::barycentric_tests emit::tests: 23 passed, 0 failed
  • cargo clippy -p victory-shader --tests -- -D warnings: clean

(AI-assisted investigation and patch.)

<!-- greyfinch-sync:fxceless/victory-fork:issue:6591952783 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/124). Originally posted by [vicennpacheco](https://github.com/vicennpacheco) on 2026-11-24T21:40:02Z. --- ### Summary Addresses `dxil.dll` signature validation failures of the form: ```text Container part 'Program Input Signature' does not match expected for module. ``` (and the matching `Program Output Signature` error), as reported in #53. ### Root causes found against `dxil.dll` 10.0.26100.0 In `crates/victory-shader/src/emit/container.rs` (`signature()`), three differences from DXIL's reconstructed `ISG1`/`OSG1` triggered validation failures even when D3D12 still created the pipeline: 1. **Same-row sort order:** rows were sorted by `(row, col)` instead of `row` alone. When two packed elements share a register with the higher column listed first (e.g. `col = 2` before `col = 0`), `dxil.dll` keeps element order within the row. 2. **System-value name casing:** system values (`kind != 0`) wrote `e.name` verbatim (e.g. `SV_POSITION`, `SV_TARGET`, `SV_ISFRONTFACE`), whereas `dxil.dll` writes DXIL's canonical mixed-case semantic names (`SV_Position`, `SV_Target`, `SV_IsFrontFace`, ...). 3. **Unallocated element column shift:** when `row == None` (`StartRow = -1`, `StartCol = -1` in `signature_md`), `mask()` and `usage` still shifted by `e.col` instead of `0`. *(Note: this was reproduced and verified with synthetic shaders and `dxil.dll` 10.0.26100.0 without game files, so I have not tested the specific shader hash from #53 directly — hence linking #53 rather than auto-closing it.)* ### Tests Tested on Windows 11, AMD Radeon Vega 8 iGPU (Ryzen 7 5825U, GCN 5 / `gfx90c`, AMD driver `31.0.21921.13001`), Windows SDK `dxil.dll` `10.0.26100.0`, Rust `1.98.1` (`x86_64-pc-windows-msvc`), without game files: - Added `emit::container::tests::signature_keeps_same_row_order_canonical_sv_names_and_unalloc_mask` - Added `emit::barycentric_tests::signature_parts_match_dxil_validator` (all 3 cases failed with the exact `#53` error before the fix and pass after) - `cargo test -p victory-shader --lib -- emit::container emit::barycentric_tests emit::tests`: 23 passed, 0 failed - `cargo clippy -p victory-shader --tests -- -D warnings`: clean *(AI-assisted investigation and patch.)*
adriaespii commented 2026-11-24 22:07:37 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by adriaespii on 2026-11-24T21:52:02Z.


Independent test run on commit 3ed5e89 (AMD RDNA4):

  • Hardware: AMD Radeon RX 9070 (driver 32.0.32015.7029), AMD Ryzen 5 7600, Windows 11 Pro, Rust 1.98.1 (x86_64-pc-windows-msvc)
  • cargo clippy --workspace --all-targets -- -D warnings: 0 warnings
  • cargo test --workspace: 498 passed, 0 failed, 7 ignored (victory-shader: 212 passed, 0 failed, 2 ignored; victory-gpu: 110 passed, 0 failed, 1 ignored)
  • Not tested: retail shader pack / live game run (no game files on this machine)

AI use: Antigravity (Gemini 4 Neon) ran clippy/tests locally and wrote this report.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7145493292 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/124#issuecomment-7145493292). Originally posted by [adriaespii](https://github.com/adriaespii) on 2026-11-24T21:52:02Z. --- Independent test run on commit `3ed5e89` (AMD RDNA4): - **Hardware:** AMD Radeon RX 9070 (driver 32.0.32015.7029), AMD Ryzen 5 7600, Windows 11 Pro, Rust 1.98.1 (`x86_64-pc-windows-msvc`) - `cargo clippy --workspace --all-targets -- -D warnings`: 0 warnings - `cargo test --workspace`: 498 passed, 0 failed, 7 ignored (`victory-shader`: 212 passed, 0 failed, 2 ignored; `victory-gpu`: 110 passed, 0 failed, 1 ignored) - **Not tested:** retail shader pack / live game run (no game files on this machine) *AI use: Antigravity (Gemini 4 Neon) ran clippy/tests locally and wrote this report.*
arminkhaleghirod commented 2026-11-24 23:09:34 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by arminkhaleghirod on 2026-11-24T22:23:44Z.


Merged onto main 90228a7 and ran victory translate --validate over the full title (26,148 programs) on Windows 11 / RTX 4080.

Clears the 39 Program Output Signature and 33 Program Input Signature mismatches. On main those 72 programs then fall into the blanket PSV mismatch (17,359 → 17,431), so the gain only shows on top of #61. #124, #110 and #112 give identical counts here, so they look like they overlap.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7146175985 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/124#issuecomment-7146175985). Originally posted by [arminkhaleghirod](https://github.com/arminkhaleghirod) on 2026-11-24T22:23:44Z. --- Merged onto main 90228a7 and ran `victory translate --validate` over the full title (26,148 programs) on Windows 11 / RTX 4080. Clears the 39 `Program Output Signature` and 33 `Program Input Signature` mismatches. On main those 72 programs then fall into the blanket PSV mismatch (17,359 → 17,431), so the gain only shows on top of #61. #124, #110 and #112 give identical counts here, so they look like they overlap.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/124:upstream-pr/124'
git switch 'upstream-pr/124'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/124'
git switch 'upstream-pr/124'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/124'
git switch 'upstream-pr/124'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/124'
git switch 'main'
git merge --squash 'upstream-pr/124'
git switch 'main'
git merge --ff-only 'upstream-pr/124'
git switch 'main'
git merge 'upstream-pr/124'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
fxceless/victory-fork!124
No description provided.