Shaders: signature rows of one register follow their name offsets #2793
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2793
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2793"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Moon0755 on GitHub · 2026-11-25 20:42 UTC · original
Moon0755:fix/signature-row-name-offset→main· +79 −2 · 2 files · 1 commits · openFollow-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
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 #1022 proposed. Test: `packed_signature_rows_follow_system_value_name_order`, both declaration orders through dxil.dll. Co-Authored-By: Claude Fable 5.2 <[email protected]>@kotekompotek on GitHub · 2026-11-25 20:44 UTC · original
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.
@fuzeofficlal on GitHub · 2026-11-25 21:10 UTC · original
Reviewed and verified
e1099890on Windows 11 (Windows SDK10.0.26100.0dxil.dll) againstmain(13f91ca).(elements[i].row.unwrap_or(u32::MAX), offsets[i])aligns with DXC'ssort_sigordering so shared system-value names (e.g.SV_ClipDistance0/1) stay ordered before user semantics (TEXCOORD) packed into the same register.packed_signature_rows_follow_system_value_name_order(validated withdxil.dllfor both control and reordered cases) +container::: 2/2 passed.cargo clippy --locked -p victory-shader --all-targets -- -D warnings(default &--features host): 0 warnings;cargo xtask policy: 184 files ok; cleangit merge-treevs13f91ca,#2798, and#2796.@Marvisak on GitHub · 2026-11-25 23:22 UTC · original
Automated triage for the maintainers.
This PR changes the row sort key in
container::signature(crates/victory-shader/src/emit/container.rs) from register alone to(register, name offset). A repeated system value such asSV_ClipDistance1reuses an earlier name offset, so it has to come before a user element packed into the same register, which matches DXC'ssort_sigordering. The newpacked_signature_rows_follow_system_value_name_ordertest runs both declaration orders throughdxil.dll, and the linked fork runs show it failing without the change and passing with it. CI passes.This is a recommendation for a maintainer to look, not an approval.
Generated by Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.