Skip to content

R-7: write signature rows in the order the DXIL validator expects - #64

Merged
ShinniUwU merged 1 commit into
ProjectLeonidaL:mainfrom
sanchaton:pr/r7-validator
Nov 27, 2026
Merged

ShinniUwU merged 1 commit into
ProjectLeonidaL:mainfrom
sanchaton:pr/r7-validator

Conversation

@sanchaton

Copy link
Copy Markdown
Contributor

What changed

R-7 (partial): container::signature sorted the rows of one register by column, while the DXIL validator expects them in element order, as the console's containers list them (for example TEXCOORD16 in column 3 before TANGENT0 in column 0). Rows are now sorted by register only, with a stable sort that keeps element order, so no register or mask changes. 72 programs refused with "Container part 'Program Input/Output Signature' does not match" (33 pixel, 26 vertex, 13 mesh) now validate; their pipelines were never created before, so their draws were lost.

Not fixed here: 70 programs pack elements of different interpolation modes into one register. Moving an element in one program alone is not safe, because D3D12 links a stage's outputs to the next stage's inputs by register and mask too (the debug layer's SHADER_LINKAGE_REGISTERINDEX and REGISTERMASK checks), so both sides of a link would have to move the same way.

How it was tested

  • Not run in game: tests and a shader census only. The draws these pipelines bring back have not been checked in game yet; no frame-rate change is claimed.

Checks run on this branch:

  • cargo test --workspace --locked: no failure (leonida-shader 218 passed, 3 ignored; run with -j 2 -- --test-threads=4)
  • cargo clippy --workspace --all-targets --locked -- -D warnings
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
  • cargo xtask policy

New unit test: rows_of_one_register_keep_element_order.

leonida translate --list --validate --jobs 2 with a release build, on the 216 programs the validator refused:

Validator message Before After
Container part 'Program Input/Output Signature' does not match 72 0
interpolation mode that differs 70 70
vertex plus primitive output size > 32768 (mesh) 71 71
out of bound coord must be undef (pixel) 3 3

A full census over every program was run on the previous base (2f952dc) and showed no other change; it was not repeated after the rebase on f3c94ca, where container.rs and shader.rs did not change.

AI

  • AI-assisted: investigation of the stage linkage rules, fix, unit test, census and review.

@ShinniUwU

Copy link
Copy Markdown
Contributor

#56 and #60 are merged, so this conflicts in docs/fork-notes.md again. Please rebase on main. The plan is to merge this one first, then #66, then #65.

@sanchaton

Copy link
Copy Markdown
Contributor Author

Rebased on main (now 04187b0 on top of 8fbb66b). The only conflict was the top of "Newest" in docs/fork-notes.md: the signature row note is first and every note from main is kept, no line removed. The code change is the one you reviewed. On the rebased branch: cargo clippy (with and without --all-features) is clean, cargo test --workspace --locked has no failure (leonida-shader 222 passed, 3 ignored), and cargo xtask policy passes.

… expects

Rows of one register were sorted by column; the validator expects them in element order, as the console containers list them. The rows are now sorted by register only (a stable sort), so no register or mask changes. 72 programs refused with Container part Program Input/Output Signature does not match now validate.
ShinniUwU added a commit to sanchaton/leonida-legacy that referenced this pull request Nov 27, 2026
@ShinniUwU
ShinniUwU merged commit 63fb0e8 into ProjectLeonidaL:main Nov 27, 2026
1 check passed
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.

2 participants