Shaders: PSV0 names every arbitrary element, as DXC does #3323
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3323"
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?
Imported from Marvisak/VIctory. Originally posted by Moon0755 on 2026-11-26T17:58:19Z.
Part of #1945 (the writer half).
What
container::psvlooked a semantic name up in the string table before adding it, so a name used by two elements (TEXCOORDon an input and on an output) was written once and both elements pointed at it. Now every element with an arbitrary semantic and a non-empty name appends its own entry; system values and empty names still point at offset 0.findhas no caller left and is removed.container.rsonly;lower.rsis untouched.Why
DXC does not share entries.
SetPSVSigElementappends the name for each arbitrary element without searching (source). Validators before 1.8 rebuild the whole part from the module andmemcmpit (v1.6.2112, v1.7.2308), so a shared entry givesContainer part 'Pipeline State Validation' does not match expected for module. From 1.8 the check is by content and accepts both layouts, which is why CI never showed it. #1945 has the numbers for the validators that do reject it.Evidence
dxc.exe1.9.2602.17,-T vs_6_6 -E main -validator-version 1.6, a vertex shader withPOSITION,TEXCOORD0in andSV_Position,TEXCOORD0out: the string table is\0POSITION\0TEXCOORD\0TEXCOORD\0and the fourth element's name offset is0x13. The new testpsv_appends_repeated_semantic_names_like_dxccompares the first 164 bytes ofpsv()(everything before the input-to-output table) with that output.repository_passes_policy ... ok.NORMAL,BINORMAL, threeTEXCOORDandCOLOR; a geometry shader with twoTEXCOORDin and out; a vertex shader withBINORMAL,NORMAL,WORLD_COLOR,COLORin andNORMALout. In all three the table is one entry per named element, in element order, nothing shared.victory-shaderon three adapters, each one test up on unmodified63bcca4with the same tests failing as there: WARP 299 passed, 4 failed (298 and 4 before); AMD integrated Radeon 296 and 7 (295 and 7); NVIDIA RTX 2060 300 and 3 (299 and 3). The validator on this machine is the 1.9 one, so this shows the new layout is accepted, not that the old one was refused.Other pull requests
main; the part about the string table is not inmain(63bcca4still callsfind). The fork has it as fxceless/victory-fork#61. The idea is theirs; this is the one change with a test against DXC's bytes.NORMALinsideBINORMAL); with one entry per element there is no lookup, so that case cannot occur either. Its testpsv_string_table_matches_whole_entriesexpects the outputNORMALat offset 10, shared with the input; DXC, for that signature, writes\0BINORMAL\0NORMAL\0WORLD_COLOR\0COLOR\0NORMAL\0and puts it at 35. If #3088 goes in first I will rebase this onto it. I tried that locally on its headd7a9515: withfind_stringremoved and that one test's table and offset set to DXC's, its two tests and the new one pass.Not checked
psv()sets every bit on purpose (#1985).Synthetic tests only; no game files.
— Gemini & Fable
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T18:07:37Z.
Review: APPROVED
Reviewed the diff and verified locally on Windows 11 x64 (
dxil.dllvalidation enabled):find()scan.cargo test -p victory-shader --lib emit::container:: -- --test-threads=1: 2 passed, 0 failed (includingpsv_appends_repeated_semantic_names_like_dxc).cargo test -p victory-shader --lib emit::tests:: -- --test-threads=1: 17 passed, 0 failed.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T18:26:17Z.
I verified the legacy-validator result directly on Windows. The existing synthetic shader test
emit::tests::elements_sharing_a_row_keep_their_orderemits twoTEXCOORDelements, then validates the full container. I ran the same test on63bcca4and exact PR headba7f9e6, with the loaded DLL path and version observed in each test process.63bcca4ba7f9e6dxil.dll101.7.2308.12Pipeline State Validationpart mismatchdxil.dll1.9.2609.5The new
psv_appends_repeated_semantic_names_like_dxcgolden test also passes on the exact head. This reproduces the #1945 writer defect on a synthetic shader and verifies that the change fixes what the older validator rejects. Microsoft's signed 1.7.2308 release · AI-assisted with Codex.Imported from Marvisak/VIctory. Originally posted by borosf on 2026-11-26T19:03:27Z.
Independent local verification on Windows 11 x64, Intel Arc B580 12 GB (12 cores), at this PR's head
ba7f9e6:Result: victory-shader lib: 301 passed / 2 failed (both known baseline); the new psv_appends_repeated_semantic_names_like_dxc test passed.
Both clippy runs exit 0 (-D warnings, both feature sets). The B580 baseline failures pristine main also hits are: victory-gpu descriptor::host::tests::dynamic_slots_are_held_until_released + memory::tests::lists_share_a_table_and_copies_keep_their_views (#1744/#1829); victory-shader emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros + emit::valu_tests::fspx_programs_run_with_the_hardwares_dot_products. No PR regressions.
Synthetic tests only; no game data used. Full log kept locally. — borosf
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T20:14:54Z.
Review: APPROVED
Looks good to me — appending each non-empty
Arbitrary(kind == 0) semantic name without deduplicating matches DXC'sPSV0string-table writer while keeping empty names and system values at offset0.Verified locally on Windows 11 with head
ba7f9e61cleanly merged ontomain(63bcca43):crates/victory-shader/src/emit/container.rs:243-250and436-510: the golden bytes match SDK DXCPSV0header, string table, index table, and 16-byte element records, and the added lines matchrustfmt --edition 2024.cargo run -p xtask -- policy(191 files ok) andcargo clippy --locked -p victory-shader --all-targets -- -D warnings(both default and--all-features) pass.cargo test --locked -p victory-shader --lib emit::container:2 passed; 0 failed(0.00s).cargo test --locked -p victory-shader --lib emit::tests:17 passed; 0 failedunder bothVICTORY_WARP=0andVICTORY_WARP=1(withWindows Kits\10\bin\10.0.26100.0\x64\dxil.dllpresent).Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-27T04:44:26Z.
I checked the repeated-name encoding with a separate raster readback on an RTX 5080 and Windows’ built-in WARP. The generated pixel shader reads independent gradients through
TEXCOORD0andTEXCOORD1. I kept its 1,352-byte DXIL program fixed and reproduced the semantic-name tables from the actual writers on63bcca43andba7f9e61. The PR writer’s container matched Microsoft DXC byte for byte. SDK validator 1.9.2602.17 accepted both encodings.Those counts held for both the parent and PR encodings. Each of the 12 draws also preserved all 2,494 guard pixels. The largest absolute component error against analytical interpolation was 2.39e-7. The result establishes that the PR preserves these gradients on both adapters. This fixture gave the same image with the parent encoding too.
I also translated an original GFX10 pixel shader with three
TEXCOORDinputs packed into one register and a fourth usingnoperspectivein another. Across 12 draws on the RTX 5080 and built-in WARP (DXC reference, parent and PR at two clip-W settings), both translated versions matched DXC bit for bit. 0/9,794 covered pixels differed and 0/2,494 guard pixels changed per draw. Microsoft's 1.7 validator rejected the parent's shared-name layout with0x80aa0013and accepted the PR's layout. The 1.9 validator accepted both. Standalone source and run instructionsView 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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.