Skip to content

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

Open
sanchaton wants to merge 1 commit into
ProjectLeonidaL:mainfrom
sanchaton:pr/r7-validator
Open

sanchaton wants to merge 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.

… 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.
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.

1 participant