Shaders: pair packed fp16 pixel inputs with unlisted signature rows #176
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/176"
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 Yaekai on 2026-11-24T01:07:20Z.
In
crates/victory-shader/src/emit/lower.rs, pixel shader inputs withfp16andpack2set sometimes leavePsInput.row2 == PsInput.roweven when a second 16-bit signature row is packed into the trailing channels of the same hardware attribute (for example,row 0withrow2 == 0packing unlistedrow 1, orrow 3withrow2 == 3packing unlistedrow 6). Previously,interp()treatedrow2 == rowas having no partner (None), causingemit: a packed input half no element holds.This mirrors the existing
half_outputspairing logic for pixel inputs via a newhalf_inputshelper:half && kind == 0) signature rows not named asi.rowby anyPsInputand not explicitly claimed asi.row2(wherei.row2 != i.row).fp16PsInputin row order: usesi.row2wheni.row2 != i.row, and otherwise pairspack2entries with the next available unlisted 16-bit signature row> i.row.packed_half_inputs_pair_unlisted_rowscovering explicitrow2preservation and unlisted-row fallback.Verification
cargo test -p victory-shader— 70/70 passed.rustfmt --edition 2024 --check crates/victory-shader/src/emit/lower.rs— clean.victory translate --validateonshaders.rpf(26,084 programs): reducedemit: a packed input half no element holdsfrom 172 → 6, increasing complete VS/PS shaders from 12,316 → 12,433 emitted (+117) and 12,208 → 12,325dxil.dll-validated (+117, 100% validation pass rate, 0 new validator errors).Imported from Marvisak/VIctory. Originally posted by raffclar on 2026-11-24T01:10:48Z.
Review: COMMENTED
No description provided.
Imported from Marvisak/VIctory. Originally posted by raffclar on 2026-11-24T01:13:51Z.
Review: COMMENTED
No description provided.
Imported from Marvisak/VIctory. Originally posted by raffclar on 2026-11-24T01:14:31Z.
Review: COMMENTED
No description provided.
Imported from Marvisak/VIctory. Originally posted by raffclar on 2026-11-24T01:15:08Z.
Review: COMMENTED
No description provided.
Imported from Marvisak/VIctory. Originally posted by DaviTostes on 2026-11-24T01:19:36Z.
Tested
a823dfbon Arch Linux x86_64, rustc 1.98.1: pass.cargo test -p victory-shader: 57 passed, 0 failed (2 test binaries), including the 1 test this PR adds.victory-gpuE0425.No game data used.
Imported from Marvisak/VIctory. Originally posted by Yaekai on 2026-11-24T01:47:40Z.
Thanks for the review @raffclar! Addressed all three points in
f0e7745:row2 == row: added comments explaining that in the console'sPsInputtable,row2repeatsrowwhen no distinct partner row is named.halvesbyi.rowkeeping the firstfp16entry (matching the previous.find()behaviour) so duplicates neither overwrite earlier entries nor consume an extra free partner row.r > i.row && r < next_fp16(the nextfp16input row) so an earlier unpairedfp16input cannot steal a laterfp16input's partner, while still allowing 32-bitPsInputrows in between (e.g.row 3pairing with unlistedrow 6across 32-bit rows 4–5).Added unit test coverage for both duplicate rows and the
next_fp16bound (cargo test -p victory-shader: 70/70 passed) and re-verifiedvictory translate --validateonshaders.rpf(still 172 → 6, +117 VS/PS emitted &dxil.dll-validated, 0 new validator errors).Imported from Marvisak/VIctory. Originally posted by raffclar on 2026-11-24T01:10:48Z.
Code review location:
crates/victory-shader/src/emit/lower.rs; line 352Do you really mean row2 == row == "no partner given" in the console format? Just needs clarifying this is pretty hard to read. Maybe a small STE100 comment on a line before the method chaining
Imported from Marvisak/VIctory. Originally posted by raffclar on 2026-11-24T01:13:51Z.
Code review location:
crates/victory-shader/src/emit/lower.rs; line 363Also what about dupes. The old code used the first one and now this uses the last for dupes. Also each duplicate takes up a free row so later input can run out of partners.
Imported from Marvisak/VIctory. Originally posted by raffclar on 2026-11-24T01:14:31Z.
Code review location:
crates/victory-shader/src/emit/lower.rs; line 358You should only use a free row that comes before the next named input row
Imported from Marvisak/VIctory. Originally posted by raffclar on 2026-11-24T01:15:08Z.
Code review location:
crates/victory-shader/src/emit/lower.rs; line 358Otherwise an earlier input can take a free row that really belongs to a later input. Causes wrong row to be read or fails
Imported from Marvisak/VIctory. Originally posted by slint6614-dev on 2026-11-24T08:43:52Z.
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 Halfect on 2026-11-24T13:59:09Z.
Review: COMMENTED
CPU-only re-check of
f0e7745, merged onto current mainffe310elocally. No GPU execution and no game data used.Merge state. GitHub shows the PR as dirty; the only conflict with
ffe310eis in the test module ofemit/lower.rs, where this PR and main both appended tests at the end. Keeping both sides resolves it; production code merges cleanly. The PR adds noresource::trackcall, so it is not affected by #801.Verification on the merged tree (Windows, rustc 1.98.1):
packed_half_inputs_pair_unlisted_rows: passed.diff_tests,valu_tests,waterfall_tests,stub_pipeline_is_created): 98 passed, 0 failed, 1 ignored.cargo clippy --locked -p victory-shader --lib --tests -- -D warnings: clean.cargo xtask policy: 154 files ok.@raffclar's three threads are addressed at this head (they show as outdated but were never resolved):
rowinrow2when no distinct partner is named.seen.insert(i.row)keeps the first fp16 entry per row, matching the old.find()behaviour, so a duplicate row neither overwrites nor consumes an extra free partner row; the second half of the test covers exactly this.rwithi.row < r < next_fp16, so an earlier unpaired input cannot take a row that belongs to a later fp16 input; the test asserts row 0 does not steal row 3 from row 2.One behavioural check I ran while reading: for a non-
pack2fp16 input with an explicitrow2 != row, the old code passedSome(row2)through while this head storesNone. This is a no-op in practice: the only consumer of the partner ispacked_half, and it is reached only whenpack2is set (the!pack2arm uses(attribute.row, h / 2)and never reads the partner).Context for the maintainer's choice between this and #592+#621: the full-pack measurement by @slint6614-dev shows this PR and #592 are result-identical (+117 validated, 6 remaining explicit-
row2stops). Those 6 are the explicit-second-row padding case handled by #621, which is orthogonal to the pairing rule here and can be rebased onto whichever base lands first.AI-assisted (Kimi); the builds and test runs are from this machine.
Imported from Marvisak/VIctory. Originally posted by justlovett0 on 2026-11-24T18:48:30Z.
Verified + integrated. Stack: main
ffe310e+ #175/#994/#747/#302/#193/#704/#309/#953/#1067/#986/#1260/#1267/#1254/#1276/#189 (wave64 emulation), RTX 3080 10 GB / Win10 21H2 (19044.7846) / driver 621.24 (32.0.16.2124). Re-census of captured runtime containers; world stable ~9 min, 0 device removals.Packed fp16 pixel-input pairing merged (runtime kept; a lower.rs test-module conflict resolved to our tests). No regressions; compute emission 493/560.
AI use: Qwen Code; local measurements. No game data posted.
Pull request closed