Repository navigation
Conversation
Validator 1.6 orders the rows of one register by semantic name offset
(DXC's `sort_sig`: stream, register, name). `signature` kept element
order, which is the same order except where a system value repeats: its
later elements share the first one's name, so they sort before an
arbitrary semantic declared between them. With SV_ClipDistance1 packed
into a row after a TEXCOORD, the validator refused the container
("Container part 'Program Output Signature' does not match expected for
module").
The key is the one Marvisak#1022 proposed.
Test: `packed_signature_rows_follow_system_value_name_order`, both
declaration orders through dxil.dll.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Subtle but right: validator 1.6 orders packed rows sharing a register by semantic-name offset, and the system-value name dedup means clip1 can reuse clip0's earlier offset - so a register-only sort misorders them relative to an intervening user element. The (row, name-offset) key matches, and the test builds the exact packing that exposes it against the real validator. |
|
Reviewed and verified
|
…heir name offsets
|
Automated triage for the maintainers. This PR changes the row sort key in This is a recommendation for a maintainer to look, not an approval. Generated by Claude Code |
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified against origin/main (63bcca4) on Windows 11 + NVIDIA GeForce RTX 5090:
- Ordering single-register signature rows by their name offsets passes all
emit::testsandemit::shadertests cleanly. cargo test -p victory-shader emit::tests: 18/18 passed (includingpacked_signature_rows_follow_system_value_name_order).cargo clippy -p victory-shader --all-targets -- -D warnings: 0 warnings.cargo xtask policy: 192 files ok.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
…heir name offsets
Follow-up to #1022, which was closed as already in
main. One case is not.Problem
container::signaturesorts the rows by register and keeps element order within a register (a stable sort). DXC orders them withsort_sig: stream, then register, then semantic name offset (lib/DxilContainer/DxilContainerAssembler.cpp). With validator 1.6 each arbitrary semantic gets its own name in element order and a system value's elements share one name, so the two orders are the same until a system value repeats. Its later elements carry the offset of the first one, written before the names of everything declared in between, and DXC puts them first.So with
SV_ClipDistance1packed into a row after aTEXCOORD,OSG1hasTEXCOORDfirst, the validator's rebuilt part hasSV_ClipDistance1first, and the container is refused:#1022 changed the key from
(register, column)to(register, name offset);mainarrived atregisteralone with element order kept, and the triage note there says the two are the same. They differ in this case only.Fix
The key #1022 proposed:
(register, name offset). One line.Test
emit::tests::packed_signature_rows_follow_system_value_name_orderbuilds the same vertex shader twice throughShaderand validates both withdxil.dll: withSV_ClipDistance1declared before theTEXCOORDit shares a row with (a control: both orders agree), and after it.Verification
GitHub Actions on
windows-latest, on the fork, with the jobs narrowed tovictory-shaderandxtask; the validator ran in both (the control prints that it validated):270 passed; 1 failed;271 passed; 0 failed; 3 ignored.Not checked: the title's shaders. The case is synthetic; I do not know whether a program of the title declares its elements in this order, nor whether any of the signature mismatches still listed in #201 are this one.
Credit
The sort key is ThiagoAlexsander's from #1022. The case that tells it from a stable sort came out of comparing
emit/container.rswith DXC's assembler; Devin wrote the test and ran both arms.— Devin & Fable