Shaders: read explicit packed input padding as zero #621
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/621"
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 Halfect on 2026-11-24T05:44:42Z.
Stacked on #592 at
35bf153; only7e5c7c8is new here. Once #592 merges, this is a one-commit follow-up.What
The six programs left by #592 explicitly name a second packed-input row (
row2 != row), but their input signature declares fewer halves in that row than the interpolation reads. Those trailing halves are packing padding.packed_input_halfnow distinguishes that case from a missing half under an inferred partner:Adds a synthetic regression test with four halves in the first row and two in the explicit second row. It checks the real second-row channel, both zero-padding positions, and that the same gap still fails with an inferred partner.
Offline title measurement
Local v1.0.2.1 shader archive,
translate --validate --list --jobs 1, comparing #59235bf153with this head7e5c7c8:Across 25,889 matched program labels, this revision has 0 DXIL validation gains and 0 losses. The six programs that previously gained validation against the older #592
7139712now stop earlier at the unrelateda scalar memory read as dataerror in both runs. That earlier failure masks this case at title level, so the synthetic regression is the direct behavioral check for this revision; the earlier +6 result is not claimed for this head.Checks
cargo test -p victory-shader: 91 passed, 0 failed, 1 benchmark ignored.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 152 files ok.Offline translation and DXIL validation only; no title executable, world run, shader contents, or extracted data. AI-assisted (Kimi).
Imported from Marvisak/VIctory. Originally posted by LAKSHYA-cmd-tech on 2026-11-24T05:59:59Z.
Review: APPROVED
Tested on Windows 11 with Rust 1.98.1 (x86_64-pc-windows-msvc).
Imported from Marvisak/VIctory. Originally posted by slint6614-dev on 2026-11-24T08:43:50Z.
Measured on the full retail shader pack (26,503 containers) with
victory translate --validate --pipelines(pipelines created on an AMD RX 9070, Adrenalin, Windows 11; dxil.dll from SDK 10.0.26100), against main1f858b0. Counts are emitted / validated / pipelines.#621 clears all 172 (+123 validated pixel programs); #176 and #592 give identical results (+117, 6 left). CS and MS unchanged in all three.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T10:19:47Z.
Review: COMMENTED
Conflicts with current main (
ffe310e) inlower.rs— needs a rebase.Static review: the safety line is right — padding reads as zero only for an explicit second row (
row2 != rowin the metadata); an inferred partner still errors, so inference can't silently turn real data into zeroes.half_input_partnerspicks the next unnamed 16-bit row in row order, skipping rows already named by entries or other packed pairs, and the two tests cover both the inference and the explicit-padding cases. One thing to double-check on rebase:packed_input_halfreturningOk(None)now feeds thef16 && explicit_second_rowzero path in the caller — make sure theNonefrom a non-f16 packed read can't reach that branch (the caller gates onpack2 && f16, so it looks fine).Rebase and I'll run the suite.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T11:03:14Z.
Review: APPROVED
Rebased onto current main (
ffe310e) — merges cleanly now, andcargo test -p victory-shader --lockedon the merged tree (macOS arm64, rustc 1.98.1) → 98 passed / 0 failed / 1 ignored.The substance is unchanged from my earlier static review: padding reads as zero only for an explicit second row (
row2 != row); inferred partners still error, so inference can't turn real data into zeroes.half_input_partnerspicks the next unnamed 16-bit row in row order, skipping rows named by entries or other packed pairs. Both tests (partner inference, explicit padding) still cover the change. Thef16 && explicit_second_rowzero path in the caller is gated on f16 as intended.Imported from Marvisak/VIctory. Originally posted by Halfect on 2026-11-24T10:31:11Z.
Rebased onto the updated #592
35bf153and pushed7e5c7c8after your review. Agit merge-tree --write-treecheck against current mainffe310ealso resolves cleanly.The non-f16 path cannot reach the new zero fallback:
packed_input_halfis called only underpack2 && f16, and the fallback itself is gated byf16 && explicit_second_row.Rebased checks: 91 passed, 0 failed, 1 ignored; Clippy,
cargo xtask policy(152 files), and the release build passed. The updated full-archive A/B is 0 gained / 0 lost because the previous six cases now stop earlier at the unrelateda scalar memory read as data; the PR body records that explicitly. Ready for another test run.Imported from Marvisak/VIctory. Originally posted by MichaelSmithAI on 2026-11-24T10:42:52Z.
Retested
7e5c7c8on its exact parent35bf153with the source-built pixel padding control. Microsoft DXV accepted the emitted pixel shader, and its DXIL was byte-identical to the priorfb6a9c1fixture output.On the RTX 4090 through Wine 11.22 and vkd3d-proton 3.1, the translated shader and independent DXC HLSL reference both returned
[0.125, -2.5, +0, +0]in all 64 pixels. The neighboring row carries[8, 16, 32, 64]to distinguish zero padding from reading that row. Both replays completed successfully. This is a source-built check of explicit row padding. The full-archive comparison and the six scalar-read refusals are covered by your separate run.Imported from Marvisak/VIctory. Originally posted by Halfect on 2026-11-24T13:23:54Z.
Thanks @MichaelSmithAI for the source-built retest on
7e5c7c8— good to have the DXV acceptance and the matching[0.125, -2.5, +0, +0]replays confirmed on both the translated shader and the DXC reference. Nothing further from my side on this head; ready for review.Imported from Marvisak/VIctory. Originally posted by Yaekai on 2026-11-24T16:41:45Z.
Independent verification on Windows 11 + NVIDIA RTX 3070 (Rust 1.98.1) at head
7e5c7c8:cargo test -p victory-shader --lib -- --skip valu_tests --skip waterfall_tests: 78 passed, 0 failed.cargo clippy -p victory-shader -- -D warnings: 0 warnings.1.0.2.1,--console series-s, 19-min world run): no regressions. Ready to merge once rebased onmain!Imported from Marvisak/VIctory. Originally posted by Halfect on 2026-11-24T16:50:17Z.
Thanks @Yaekai for the independent run — tests, clippy, and a 19-minute live world run with no regressions is a strong check.
On the rebase: this branch is stacked on #592 by design (its diff touches the explicit-second-row case that #592's inferred pairing leaves behind), so it can't move directly onto
mainwithout #592'shalf_input_partners. The moment #592 lands I'll rebase ontomainand it becomes the one-commit follow-up the body describes. Agit merge-tree --write-treecheck of the stack against currentmain(ffe310e) already resolves cleanly.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:26:12Z.
Automated triage for the maintainers. Closing because this change is already in
main, ormainhas since replaced the code it patches.Stacked on #592; the 'padding' halves it reads as zero were an artifact of the row-pair rule. Main's first-fit rule maps every half read to a declared channel (4,773 of 4,773 pack2 pixel shaders).
If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed