victory-shader: emit zero for padding halves in f16 pixel input interpolation #1291
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!1291
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1291/head"
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?
@bartikele on GitHub · 2026-11-24 17:10 UTC · original
bartikele:shader-packed-input-padding-half→main· +80 −1 · 2 files · 1 commits · closed without mergingIn
Lower::interp, when lowering an_f16interpolation of a 16-bit pixel input andhalf(...)returnsNone(a padding half with no matchingSigElement, e.g. the 4th half of a 3-component packedf16input), emit0(self.s.m.i32(0)) instead of failing witha packed input half no element holds.This matches the existing
mode == 1(flat dword) branch inLower::interp, which already uses.unwrap_or(z)for padding halves.Adds unit test
emit::tests::reading_a_packed_input_padding_half_yields_zero(includingdxil.dllvalidation).Tested with:
cargo clippy -p victory-shader --all-targets --locked -- -D warningscargo test -p victory-shader --locked@geiyiliyabumo on GitHub · 2026-11-24 17:30 UTC · original
Independent verification of \
94dbc0a\ on Windows 11 / AMD Radeon RX 9060 XT (RDNA4, \gfx1200) / Rust 1.98.1 MSVC:eading_a_packed_input_padding_half_yields_zero\ with live \dxil.dll\ validation)
Clean, minimal 1-line fix in \emit/lower.rs:5543\ with a targeted end-to-end \dxil.dll-validated test.
AI-assisted; synthetic tests only, no game files.
@Halfect on GitHub · 2026-11-24 17:49 UTC · original
Heads-up on the overlap: this is the same failure site and motivation as #621 (
fix/packed-input-explicit-row2, stacked on #592), so the two PRs collide atlower.rs:5543. The difference is the semantics of the zero, and it matters for correctness.What this PR does: every
Nonefromhalf()in the_f16branch becomes zero — regardless of why the half is missing.What #592 + #621 do instead, and why: #592's body documents why a blanket zero was rejected there ("Why not just read 0"): the diagnostic showed a large share of the failing reads are halves 4–7 next to a 4-channel first row, i.e. the second row's real data that the metadata left out (
row2 == row). Reading those as zero silently replaces real interpolated values. fiestorra's probe on the retail pack quantified the split (comment on #592): of 1,048 failing half-reads, 828 have a named second row that is shorter than the read (the case your test fixture exercises, and the one #621 zeroes), but 220 have no partner row in the metadata at all — under this PR those 220 read zero instead of the adjacent row that #592's inferred pairing supplies, which is exactly the silent-data-loss case #592 argued against.So the stacked pair covers both shapes with the distinction preserved: #592 supplies the omitted second row, and #621 reads zero only for undeclared trailing halves of an explicitly named second row (packing padding), keeping the inferred-partner case strict. #621 carries a synthetic regression for that distinction, plus a DXV-accepted hardware readback (RTX 4090/Wine) and an independent Windows run with a 19-minute live world test.
If the maintainer prefers this simpler one-liner, it would be good to make the trade-off explicit in the body: it re-opens the 220-read class that #592 closes, with zeros where the neighboring row holds real data. Otherwise this duplicates #621 and probably closes in favor of the stack. AI-assisted (Kimi).
@muhammed-aksoy on GitHub · 2026-11-24 17:54 UTC · original
I tested
94dbc0atogether with #1285 (e34f8c3) onffe310e. Windowscargo test --locked -p victory-shader -- --test-threads=1passed 124 tests with zero failures and one ignored at local merge6d40e1b, with the Windows SDK DXIL validator configured. This covers the padding-half test alongside the SDWA fixtures. AI-assisted.@adamdotpy on GitHub · 2026-11-24 19:07 UTC · original
Reviewed at head
94dbc0a(worktree on the PR head, isolated target dir, Windows 11 / Rust 1.98.1). Findings, ranked:1. The change is right and now consistent with the flat path. In the
v_interp_*lowering (lower.rs:5543), the packed-f16 path readhalf(self, h + high)?and refused with "a packed input half no element holds" when the signature row doesn't provide that half. That half is padding of apack2attribute, and the input assembler zero-fills undeclared components — the samemode == 1flat path right below already did.unwrap_or(zero)for both halves. The PR makes the f16 path do the same (unwrap_or_else(|| i32(0))), so packed and flat interpolation now agree instead of one refusing.2. Verified here. The new
reading_a_packed_input_padding_half_yields_zerobuilds a PS with a packed f16 input (mask 0b0011,pack2), interpolatesattr0.yhigh half (v_interp_p1ll_f16/v_interp_p2_f16) and exports — emit succeeds and the DXIL passesdxil.dllvalidation when present (it ran here, no skip).cargo test -p victory-shader --lib padding_half1 passed; full lib 121 passed / 0 failed / 1 ignored.3. Checks:
cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warningsclean;cargo build --release -p victorybuilds;rustfmt --edition 2024 --check—lower.rsshows only main's 3 pre-existing hunks,mod.rshas one new hunk in the added test code (mod.rs:811; main's 671 is pre-existing). Cosmetic only, CI has no fmt job.4. Note, not a defect: the test pins that emit succeeds and validates, not the emitted zero on the GPU — the zero-fill behavior itself is asserted by inspection of the
unwrap_or_elsearm. Arun_cases-style readback of the interpolated padding half would pin it on hardware if you want that; the flat path's existing behavior is the precedent either way. This turns a refusal into a translation for shaders reading padding halves, which matches how undeclared attribute components read on the console.Nothing found that would block this.
@sinan-cmyk on GitHub · 2026-11-24 19:50 UTC · original
Offline measurement on a retail dump, and the shader tests on Ada
Result: +117 programs over
main, 0 lost.Offline. I merged head
94dbc0aontomainffe310e(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 21,724 onmain, 21,841 with this PR.mainAll 117 are among the programs that #1402 gains through #176. This PR and the packed-half PRs measured in #1247 (#176, #621, #592, 117 programs each) look like one set.
Tests: with the same merge,
cargo test --locked -p victory-shader --libpassed 121, failed 0. The bitcode benchmark is ignored, as onmain, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, withVICTORY_WARPunset.No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
@sinan-cmyk on GitHub · 2026-11-24 21:18 UTC · original
Stacked on #1402: no change
Result: 0 gained, 0 lost, and no failure reason changes on top of #1402. On
mainthis PR gained 117 programs. #1402 already gains the same 117 through #176.The merge with #1402 conflicts in one hunk of
emit/mod.rs, where both sides only add tests. I kept both.cargo test --locked -p victory-shader --libon the merge: 138 passed, 0 failed.Method:
victory translate --validate --listonshaders.rpf(1.0.2.1), dxil.dll 1.8.2502.11, compared program by program (25,889 programs), against #1402 at2310409. AI-assisted (Claude Code). No shader names or data are included, per the asset policy.@Marvisak on GitHub · 2026-11-25 00:36 UTC · original
Automated triage for the maintainers. Closing because by our reading the change is incorrect or would break something that works today.
Turns the refusal 'a packed input half no element holds' into a silent 0. With main's corrected first-fit packing rule no title pixel shader reads a padding half (4,773 of 4,773 map), so the change only hides a wrong packing model; the padding's real content is whatever the previous stage exported, not 0.
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