Shaders: second rows of packed 16-bit pixel inputs #592

Closed
SAitken91 wants to merge 1 commit from upstream-pr/592 into main
SAitken91 commented 2026-11-24 05:15:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by SAitken91 on 2026-11-24T05:15:19Z.


Pixel inputs that pack two 16-bit rows per dword (pack2) failed when their metadata leaves the second row out (row2 = row). With no second row, reading any of its halves failed with "a packed input half no element holds". That blocked 172 programs in shaders.rpf, mostly ped and mirror-reflection pixel shaders.

Change

  • New half_input_partners. It finds the missing second row the way the output side already does (half_outputs): the next 16-bit row of the input signature that no input entry names, taken in row order. Rows the metadata does give are taken first, so they aren't handed out twice.
  • The partner is used only when pack2 is set and row2 = row. An explicit row2 is used as before.

Why not just read 0

I tried that first, and it would have validated more programs. A diagnostic showed the failing reads were halves 4–7 with a 4-channel first row, which is the second row's data, not padding. Reading 0 would have hidden real values, so I didn't do it.

Results

victory translate --validate shaders.rpf: vertex/pixel validated 12172 → 12289. 6 programs whose metadata does name a second row still stop at this error. That looks like a separate case, and it's left as is.

Testing

  • cargo test -p victory-shader: 70 passed, including the new packed_pixel_inputs_find_their_second_row. Clippy and rustfmt are clean.
  • Not exercised at runtime. The pairing rule assumes the pixel signature lists 16-bit rows in the order the vertex side packs them, as the output side already assumes.

This is independent of #539, #554, #563, #565, #569 and #571.

Written with the help of Claude (AI).

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6575168464 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/592). Originally posted by [SAitken91](https://github.com/SAitken91) on 2026-11-24T05:15:19Z. --- Pixel inputs that pack two 16-bit rows per dword (`pack2`) failed when their metadata leaves the second row out (`row2` = `row`). With no second row, reading any of its halves failed with "a packed input half no element holds". That blocked 172 programs in shaders.rpf, mostly ped and mirror-reflection pixel shaders. ## Change - New `half_input_partners`. It finds the missing second row the way the output side already does (`half_outputs`): the next 16-bit row of the input signature that no input entry names, taken in row order. Rows the metadata does give are taken first, so they aren't handed out twice. - The partner is used only when `pack2` is set and `row2` = `row`. An explicit `row2` is used as before. ## Why not just read 0 I tried that first, and it would have validated more programs. A diagnostic showed the failing reads were halves 4–7 with a 4-channel first row, which is the second row's data, not padding. Reading 0 would have hidden real values, so I didn't do it. ## Results `victory translate --validate shaders.rpf`: vertex/pixel validated 12172 → 12289. 6 programs whose metadata does name a second row still stop at this error. That looks like a separate case, and it's left as is. ## Testing - `cargo test -p victory-shader`: 70 passed, including the new `packed_pixel_inputs_find_their_second_row`. Clippy and rustfmt are clean. - **Not exercised at runtime.** The pairing rule assumes the pixel signature lists 16-bit rows in the order the vertex side packs them, as the output side already assumes. This is independent of #539, #554, #563, #565, #569 and #571. Written with the help of Claude (AI). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
LAKSHYA-cmd-tech commented 2026-11-24 06:53:53 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by LAKSHYA-cmd-tech on 2026-11-24T05:20:20Z.

Review: APPROVED


Tested and verified on Windows 11 x64 (D3D12 WARP + Hardware).

  • Tested unit test packed_pixel_inputs_find_their_second_row, validating that row pairing logic correctly identifies the partner 16-bit signature element for packed inputs when
    ow2 == row.
  • Confirms fix resolves the 172 blocked shaders in shaders.rpf that emitted  packed input half no element holds.
  • cargo test -p victory-shader: 70 passed, 0 failed.
  • cargo clippy -p victory-shader --lib -- -D warnings: 0 warnings.
  • cargo xtask policy: 151 files clean.
<!-- greyfinch-sync:Marvisak/VIctory:review:6034104598 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/592#pullrequestreview-6034104598). Originally posted by [LAKSHYA-cmd-tech](https://github.com/LAKSHYA-cmd-tech) on 2026-11-24T05:20:20Z. **Review:** APPROVED --- Tested and verified on Windows 11 x64 (D3D12 WARP + Hardware). - Tested unit test packed_pixel_inputs_find_their_second_row, validating that row pairing logic correctly identifies the partner 16-bit signature element for packed inputs when ow2 == row. - Confirms fix resolves the 172 blocked shaders in shaders.rpf that emitted  packed input half no element holds. - cargo test -p victory-shader: 70 passed, 0 failed. - cargo clippy -p victory-shader --lib -- -D warnings: 0 warnings. - cargo xtask policy: 151 files clean.
Halfect commented 2026-11-24 06:56:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Halfect on 2026-11-24T05:33:56Z.


I have the same local v1.0.2.1 shader archive and will investigate the 6 remaining explicit-row2 cases as a follow-up to this PR, rather than changing this branch. I’ll first reproduce them on 7139712 and inspect only the signature metadata and failing half indices needed to distinguish the case.

If the cause is separable, I’ll add a focused synthetic regression test and open a small follow-up PR stacked on this head. I’ll report counts and metadata only, without shader contents or extracted data. AI-assisted (Kimi).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7123066612 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/592#issuecomment-7123066612). Originally posted by [Halfect](https://github.com/Halfect) on 2026-11-24T05:33:56Z. --- I have the same local v1.0.2.1 shader archive and will investigate the **6 remaining explicit-`row2` cases** as a follow-up to this PR, rather than changing this branch. I’ll first reproduce them on `7139712` and inspect only the signature metadata and failing half indices needed to distinguish the case. If the cause is separable, I’ll add a focused synthetic regression test and open a small follow-up PR stacked on this head. I’ll report counts and metadata only, without shader contents or extracted data. AI-assisted (Kimi).
Halfect commented 2026-11-24 06:56:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Halfect on 2026-11-24T05:44:56Z.


Opened the follow-up as #621, stacked on this head: https://github.com/Marvisak/VIctory/pull/621

The explicit-row2 padding fix turns all 6 remaining failures into validated modules: VS/PS emitted 12,389 → 12,395, validated 12,289 → 12,295, with 6 gained and 0 lost across 25,889 matched labels. The inferred-partner case remains strict, and the new synthetic test covers that distinction. AI-assisted (Kimi).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7123236525 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/592#issuecomment-7123236525). Originally posted by [Halfect](https://github.com/Halfect) on 2026-11-24T05:44:56Z. --- Opened the follow-up as **#621**, stacked on this head: https://github.com/Marvisak/VIctory/pull/621 The explicit-`row2` padding fix turns all 6 remaining failures into validated modules: VS/PS emitted **12,389 → 12,395**, validated **12,289 → 12,295**, with **6 gained and 0 lost** across 25,889 matched labels. The inferred-partner case remains strict, and the new synthetic test covers that distinction. AI-assisted (Kimi).
fuzeofficlal commented 2026-11-24 06:56:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-24T05:48:18Z.


Hardware readback on 7139712 with a synthetic full-screen draw. The VS supplies three distinct TEXCOORD rows, and the translated PS reads both halves of packed channels 0 and 2. The VS and emitted PS passed the Windows SDK DXIL validator (1.8.2502.11).

Build Implicit row2 = row Explicit row2 = 2
d2a4bae Translation refused with a packed input half no element holds 16/16 pixels matched [0.125, 0.25, -5, -4]
7139712 16/16 pixels matched the adjacent row, [0.125, 0.25, 1.25, 2.5] 16/16 pixels matched [0.125, 0.25, -5, -4]

The results matched on the RTX 5090 (32.0.16.1656) and Radeon iGPU (32.0.21042.62). This covers the inferred pairing and the explicit control for this constant-varying fixture. The explicit padding cases are tracked in #621.

The same fixture also passed on #176 at f0e7745 after the triage comparison. Both adapters matched 16/16 pixels for the inferred row and the explicit control.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7123290560 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/592#issuecomment-7123290560). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-24T05:48:18Z. --- Hardware readback on `7139712` with a synthetic full-screen draw. The VS supplies three distinct `TEXCOORD` rows, and the translated PS reads both halves of packed channels 0 and 2. The VS and emitted PS passed the Windows SDK DXIL validator (1.8.2502.11). | Build | Implicit `row2 = row` | Explicit `row2 = 2` | | --- | --- | --- | | `d2a4bae` | Translation refused with `a packed input half no element holds` | 16/16 pixels matched `[0.125, 0.25, -5, -4]` | | `7139712` | 16/16 pixels matched the adjacent row, `[0.125, 0.25, 1.25, 2.5]` | 16/16 pixels matched `[0.125, 0.25, -5, -4]` | The results matched on the RTX 5090 (32.0.16.1656) and Radeon iGPU (32.0.21042.62). This covers the inferred pairing and the explicit control for this constant-varying fixture. The explicit padding cases are tracked in #621. The same fixture also passed on #176 at `f0e7745` after the [triage comparison](https://github.com/Marvisak/VIctory/issues/366#issuecomment-7123259058). Both adapters matched 16/16 pixels for the inferred row and the explicit control.
iurysf commented 2026-11-24 06:56:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by iurysf on 2026-11-24T06:17:01Z.


Tested offline against main d2a4bae with victory translate --list --validate over the title's shaders.rpf + executable (26,096 programs), dxil.dll 1.9.2602.17:

  • Translation failures: 3,733 on main -> 3,616 with this PR (-117, all pixel). "a packed input half no element holds" drops 172 -> 6. The freed programs mostly stop next at "a lane mask read as data" (206 -> 227) and "a 64-bit image atomic" (653 -> 663).
  • Emitted: vertex+pixel 12,284 -> 12,401 (+117, all validated), matching your count; compute and mesh unchanged.
  • Validation: 185 modules rejected on both; no program that validated on main fails now.

AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7123773648 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/592#issuecomment-7123773648). Originally posted by [iurysf](https://github.com/iurysf) on 2026-11-24T06:17:01Z. --- Tested offline against main `d2a4bae` with `victory translate --list --validate` over the title's `shaders.rpf` + executable (26,096 programs), dxil.dll 1.9.2602.17: - Translation failures: 3,733 on main -> 3,616 with this PR (-117, all pixel). "a packed input half no element holds" drops 172 -> 6. The freed programs mostly stop next at "a lane mask read as data" (206 -> 227) and "a 64-bit image atomic" (653 -> 663). - Emitted: vertex+pixel 12,284 -> 12,401 (+117, all validated), matching your count; compute and mesh unchanged. - Validation: 185 modules rejected on both; no program that validated on main fails now. AI-assisted.
slint6614-dev commented 2026-11-24 09:06:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by slint6614-dev on 2026-11-24T08:43:55Z.


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 main 1f858b0. Counts are emitted / validated / pipelines.

VS/PS "packed input half no element holds"
main 12272 / 12172 / 12272 172
#621 12395 / 12295 / 12395 0
#176 12389 / 12289 / 12389 6
#592 12389 / 12289 / 12389 6

#621 clears all 172 (+123 validated pixel programs); #176 and #592 give identical results (+117, 6 left). CS and MS unchanged in all three.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7126492468 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/592#issuecomment-7126492468). Originally posted by [slint6614-dev](https://github.com/slint6614-dev) on 2026-11-24T08:43:55Z. --- 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 main 1f858b0. Counts are emitted / validated / pipelines. | | VS/PS | "packed input half no element holds" | |---|---|---| | main | 12272 / 12172 / 12272 | 172 | | #621 | 12395 / **12295** / 12395 | 0 | | #176 | 12389 / 12289 / 12389 | 6 | | #592 | 12389 / 12289 / 12389 | 6 | #621 clears all 172 (+123 validated pixel programs); #176 and #592 give identical results (+117, 6 left). CS and MS unchanged in all three.
catminou4 commented 2026-11-24 12:04:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T11:04:57Z.


Heads-up on the stack: #621 is stacked on this PR — its body says "Stacked on #592 at 35bf153; only 7e5c7c8 is new here", and since its base is main with 2 commits, merging #621 as-is would land both this change and the explicit-padding follow-up together.

I reviewed and approved #621 after rebasing it onto current main locally: merges cleanly, cargo test -p victory-shader --locked → 98 passed / 0 failed (macOS arm64). The combined diff keeps this PR's pairing logic (packed_input_half/half_input_partners) intact.

Also noting #176 (Yaekai) is an independent implementation of the same root fix (pairing pack2 fp16 inputs whose metadata leaves row2 == row), with several reviews already. So the maintainer has two routes: merge #592+#621 as a stack, or compare against #176. Either way this PR's content is covered by my #621 approval if the stack lands first.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7129630933 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/592#issuecomment-7129630933). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T11:04:57Z. --- Heads-up on the stack: **#621 is stacked on this PR** — its body says "Stacked on #592 at 35bf153; only 7e5c7c8 is new here", and since its base is `main` with 2 commits, merging #621 as-is would land both this change and the explicit-padding follow-up together. I reviewed and approved #621 after rebasing it onto current main locally: merges cleanly, `cargo test -p victory-shader --locked` → 98 passed / 0 failed (macOS arm64). The combined diff keeps this PR's pairing logic (`packed_input_half`/`half_input_partners`) intact. Also noting **#176** (Yaekai) is an independent implementation of the same root fix (pairing `pack2` fp16 inputs whose metadata leaves `row2 == row`), with several reviews already. So the maintainer has two routes: merge #592+#621 as a stack, or compare against #176. Either way this PR's content is covered by my #621 approval if the stack lands first.
dpalacios69 commented 2026-11-24 16:05:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by dpalacios69 on 2026-11-24T15:07:56Z.


Independent check on Linux, merged onto current main (ffe310e) in a scratch branch: textually clean, cargo test -p victory-shader --locked passes (97 passed, 0 failed, 1 ignored, the new test included), cargo clippy -p victory-shader --lib has no warnings. --all-targets shows only the two unused-import warnings in emit/mod.rs that main already has on Linux. No GPU run. AI-assisted; no game data.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7135510020 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/592#issuecomment-7135510020). Originally posted by [dpalacios69](https://github.com/dpalacios69) on 2026-11-24T15:07:56Z. --- Independent check on Linux, merged onto current `main` (`ffe310e`) in a scratch branch: textually clean, `cargo test -p victory-shader --locked` passes (97 passed, 0 failed, 1 ignored, the new test included), `cargo clippy -p victory-shader --lib` has no warnings. `--all-targets` shows only the two unused-import warnings in `emit/mod.rs` that `main` already has on Linux. No GPU run. AI-assisted; no game data.
pablogonz12 commented 2026-11-24 17:04:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pablogonz12 on 2026-11-24T16:20:46Z.


Measured on Linux (RX 9070 XT, RADV/Mesa 26.3.1, GE-Proton11-14, vkd3d-proton master), head 35bf153 merged onto our tree:

  • full archive under Wine (26,503 containers): vertex+pixel 13144 -> 13271 (+127), compute 2228 and mesh 8395 unchanged; "a packed input half no element holds" 166 -> 0.
  • the released programs fail later (a lane mask read as data 281 -> 310 and similar), which looks like the expected next class, not a regression.
  • offline world set (751) unchanged at 684; all 684 SPIR-V valid (dxil-spirv + spirv-val); cargo test -p victory-shader --lib 114 pass, only the known failure.
    Not tested: in-game on this branch; native Windows.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7137516420 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/592#issuecomment-7137516420). Originally posted by [pablogonz12](https://github.com/pablogonz12) on 2026-11-24T16:20:46Z. --- Measured on Linux (RX 9070 XT, RADV/Mesa 26.3.1, GE-Proton11-14, vkd3d-proton master), head 35bf153 merged onto our tree: - full archive under Wine (26,503 containers): vertex+pixel 13144 -> 13271 (+127), compute 2228 and mesh 8395 unchanged; "a packed input half no element holds" 166 -> 0. - the released programs fail later (`a lane mask read as data` 281 -> 310 and similar), which looks like the expected next class, not a regression. - offline world set (751) unchanged at 684; all 684 SPIR-V valid (dxil-spirv + spirv-val); `cargo test -p victory-shader --lib` 114 pass, only the known failure. Not tested: in-game on this branch; native Windows.
fiestorra commented 2026-11-24 17:04:27 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fiestorra on 2026-11-24T16:28:09Z.


An independent count of what this blocks, measured on main ffe310e with my own copy of package 1.0.2.1 (title build b99f876b74d4a77f03af5f878223b27bd647b5c35a79d5decd9f716504239e93), on a second machine. Command: victory translate <shaders.rpf> --validate --list.

  • 166 distinct pixel programs carry this reason (167 report lines: 1 program's report prints across two physical lines, which repeat a count by lines without meaning 167 programs). No other stage is affected.
  • By family: 49 PS_MirrorPedTextured_Eight, 45 PS_PedTextured_Eight_Decals, 28 PS_PedTexturedCutOutTint_Zero, 12 PS_DeferredPedTexturedNC_Packed, 10 PS_PedAlphaPrepass_Fire, 10 PS_PedAlphaTransmission_Fire, 10 PS_Textured_Eight_Fire, 1 PS_DeferredTexturedStdFireColor, 1 PS_DeferredTexturedStdFireNC. Your "mostly ped and mirror-reflection pixel shaders" matches the top of this list.
  • I do not get 172, and I can't close the 6-program difference. Two candidates: the line-vs-program counting above, and main having moved since you measured. Worth settling before a fix lands so the before/after number means the same thing twice.

What the code path allows, reading emit/lower.rs: the reason is produced at exactly one place, lower.rs:5543, reached only through the _f16 branch (lower.rs:5511, lower.rs:5541-5543), and every None comes from packed_half (lower.rs:291-307) or from the non-packed branch at lower.rs:5522. That gives four routes:

  1. half index >= na but < a_halves — padding inside the first row's own extent.
  2. row2 == row, so no partner row is offered (lower.rs:5508).
  3. half index >= extent(b) — the named partner row declares fewer channels than the interpolation reads.
  4. fp16 set, pack2 clear, and the attribute asks for the upper half (lower.rs:5522, high decoded at gfx10/fields.rs:565).

Routes 2 and 3 are what #176, #592 and #621 describe, and I read #176 and #592 as the same pairing fix described twice (half_inputs and half_input_partners), so I don't know which one is intended. Route 1 with an inferred partner is the one #592's "why not just read 0" argument is about. Route 4 I don't see in any of the three. I cannot tell how my 166 split across the routes without printing each program's declared rows and channels.

One thing that may help whoever implements #621: this same function already reads a missing half as zero for a flat input. In the mode == 1 branch, lower.rs:5547-5549 builds self.s.m.i32(0) and applies half(self, h)?.unwrap_or(z) for both halves, while the _f16 branch refuses the identical None. So "the padding reads as zero" is already the behaviour of one of the two paths, and the difference between them is only which one the program asks for. Also measured on the same run: the neighbouring refusals of this function never fire on this package — a 16-bit read of a 32-bit input, 32-bit interpolation of a 16-bit input, one input interpolated two ways, an input the signature lacks, a non-provoking vertex value and pull-model interpolation are all 0 — while the first half of an interpolation (lower.rs:5555) is 29, which is a separate gap.

If any of #176, #592 or #621 lands, I can run the same census before and after on a clean worktree and report which families unlock and how many, the way I did for #878.

Written with an AI assistant.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7137713284 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/592#issuecomment-7137713284). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-24T16:28:09Z. --- An independent count of what this blocks, measured on main `ffe310e` with my own copy of package 1.0.2.1 (title build `b99f876b74d4a77f03af5f878223b27bd647b5c35a79d5decd9f716504239e93`), on a second machine. Command: `victory translate <shaders.rpf> --validate --list`. - **166 distinct pixel programs** carry this reason (167 report lines: 1 program's report prints across two physical lines, which repeat a count by lines without meaning 167 programs). No other stage is affected. - By family: 49 `PS_MirrorPedTextured_Eight`, 45 `PS_PedTextured_Eight_Decals`, 28 `PS_PedTexturedCutOutTint_Zero`, 12 `PS_DeferredPedTexturedNC_Packed`, 10 `PS_PedAlphaPrepass_Fire`, 10 `PS_PedAlphaTransmission_Fire`, 10 `PS_Textured_Eight_Fire`, 1 `PS_DeferredTexturedStdFireColor`, 1 `PS_DeferredTexturedStdFireNC`. Your "mostly ped and mirror-reflection pixel shaders" matches the top of this list. - I do not get 172, and I can't close the 6-program difference. Two candidates: the line-vs-program counting above, and main having moved since you measured. Worth settling before a fix lands so the before/after number means the same thing twice. What the code path allows, reading `emit/lower.rs`: the reason is produced at exactly one place, `lower.rs:5543`, reached only through the `_f16` branch (`lower.rs:5511`, `lower.rs:5541-5543`), and every `None` comes from `packed_half` (`lower.rs:291-307`) or from the non-packed branch at `lower.rs:5522`. That gives four routes: 1. half index `>= na` but `< a_halves` — padding inside the first row's own extent. 2. `row2 == row`, so no partner row is offered (`lower.rs:5508`). 3. half index `>= extent(b)` — the named partner row declares fewer channels than the interpolation reads. 4. `fp16` set, `pack2` clear, and the attribute asks for the upper half (`lower.rs:5522`, `high` decoded at `gfx10/fields.rs:565`). Routes 2 and 3 are what #176, #592 and #621 describe, and I read #176 and #592 as the same pairing fix described twice (`half_inputs` and `half_input_partners`), so I don't know which one is intended. Route 1 with an inferred partner is the one #592's "why not just read 0" argument is about. Route 4 I don't see in any of the three. I cannot tell how my 166 split across the routes without printing each program's declared rows and channels. One thing that may help whoever implements #621: this same function already reads a missing half as zero for a flat input. In the `mode == 1` branch, `lower.rs:5547-5549` builds `self.s.m.i32(0)` and applies `half(self, h)?.unwrap_or(z)` for both halves, while the `_f16` branch refuses the identical `None`. So "the padding reads as zero" is already the behaviour of one of the two paths, and the difference between them is only which one the program asks for. Also measured on the same run: the neighbouring refusals of this function never fire on this package — `a 16-bit read of a 32-bit input`, `32-bit interpolation of a 16-bit input`, `one input interpolated two ways`, `an input the signature lacks`, `a non-provoking vertex value` and `pull-model interpolation` are all 0 — while `the first half of an interpolation` (`lower.rs:5555`) is 29, which is a separate gap. If any of #176, #592 or #621 lands, I can run the same census before and after on a clean worktree and report which families unlock and how many, the way I did for #878. Written with an AI assistant.
fiestorra commented 2026-11-24 17:04:39 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fiestorra on 2026-11-24T16:41:17Z.


Following up on my count with a probe that says which missing-half case each read actually hits. The probe is local and small: a guarded eprintln! at the one failure site (emit/lower.rs:5543, enabled by an environment variable) that prints the row, channel, high flag, the half index being asked for, pack2, the partner row, and the extent of both rows as the signature was built. Same commit (ffe310e), same copy of the package, nothing else changed. As a control I re-ran the whole pack with the probe in place: the census's own totals are byte-for-byte the same as without it (emit 3436, I/O 207, resources 360, validator 162, this reason 166), so the probe is not changing what gets refused.

First, a correction to my own note. The 167th line is not a wrapped report. The census ends with one line per reason, shaped <count> <label>: <reason> (e.g. <one example program>), and that line itself matches a search for the reason text. The census publishes its own table: it states 166 for this reason, which is the figure I gave. Per-reason numbers are best read from that footer; counting lines for a reason comes out one higher for every reason.

With the probe, the 166 programs make 1048 failing half-reads, and they land on exactly two of the four routes I listed:

  • 828 — the partner is a real second row: the metadata names one, and the read asks for a half beyond what that row covers. That is the case #621 describes.
  • 220 — partner = None: the metadata names no second row for that input at all. That is the case the inferred pairing in this PR and in #176 supplies.

Nothing landed on the other two routes. No read asked for a half in the padding of its own row (want >= na and want < a_halves), no read referenced an input row missing from the built signature, and no read was the upper half of an fp16 input without pack2. So on this package there are only two shapes, and by reads the named-but-short partner is about four times as common as the absent partner.

Two limits, stated plainly. These are reads, not programs: a program makes several such reads, and the lowering has no program name in scope, so I cannot say how the 166 split between the two cases or which families sit on which side. And this is a pre-fix number. My reading of the three changes is that once this PR lands, the 220 should disappear and the 828 should be what is left standing - which would make the remaining question exactly #621's. I can measure that on the merged result the same way I did for #878 and #877, on a clean worktree, before and after.

Written with an AI assistant.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7138052917 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/592#issuecomment-7138052917). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-24T16:41:17Z. --- Following up on my count with a probe that says which missing-half case each read actually hits. The probe is local and small: a guarded `eprintln!` at the one failure site (`emit/lower.rs:5543`, enabled by an environment variable) that prints the row, channel, `high` flag, the half index being asked for, `pack2`, the partner row, and the extent of both rows as the signature was built. Same commit (`ffe310e`), same copy of the package, nothing else changed. As a control I re-ran the whole pack with the probe in place: the census's own totals are byte-for-byte the same as without it (emit 3436, `I/O` 207, resources 360, validator 162, this reason 166), so the probe is not changing what gets refused. First, a correction to my own note. The 167th line is not a wrapped report. The census ends with one line per reason, shaped `<count> <label>: <reason> (e.g. <one example program>)`, and that line itself matches a search for the reason text. The census publishes its own table: it states **166** for this reason, which is the figure I gave. Per-reason numbers are best read from that footer; counting lines for a reason comes out one higher for every reason. With the probe, the 166 programs make **1048 failing half-reads**, and they land on exactly two of the four routes I listed: - **828** — the partner is a real second row: the metadata names one, and the read asks for a half beyond what that row covers. That is the case #621 describes. - **220** — `partner = None`: the metadata names no second row for that input at all. That is the case the inferred pairing in this PR and in #176 supplies. Nothing landed on the other two routes. No read asked for a half in the padding of its own row (`want >= na` and `want < a_halves`), no read referenced an input row missing from the built signature, and no read was the upper half of an `fp16` input without `pack2`. So on this package there are only two shapes, and by reads the named-but-short partner is about four times as common as the absent partner. Two limits, stated plainly. These are reads, not programs: a program makes several such reads, and the lowering has no program name in scope, so I cannot say how the 166 split between the two cases or which families sit on which side. And this is a pre-fix number. My reading of the three changes is that once this PR lands, the 220 should disappear and the 828 should be what is left standing - which would make the remaining question exactly #621's. I can measure that on the merged result the same way I did for #878 and #877, on a clean worktree, before and after. Written with an AI assistant.
Halfect commented 2026-11-24 18:03:34 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Halfect on 2026-11-24T17:27:00Z.

Review: COMMENTED


Independent verification of 35bf153 merged onto current main ffe310e (clean merge; only crates/victory-shader/src/emit/lower.rs, +87/−1), Windows 11, rustc 1.98.1 (x86_64-pc-windows-msvc):

  • cargo test --locked -p victory-shader --lib, CPU-only suite skipping diff_tests, valu_tests, waterfall_tests, stub_pipeline_is_created: 98 passed, 0 failed, 1 ignored — packed_pixel_inputs_find_their_second_row included.
  • cargo clippy --locked -p victory-shader --lib --tests -- -D warnings: clean.
  • cargo xtask policy: 154 files ok.

Code read on the merged tree: half_input_partners mirrors the output-side half_outputs convention — the next 16-bit signature row that no input entry names and no explicit row2 already claims, in row order — and the partner is consulted only under pack2 && row2 == row, so flat inputs and explicitly paired rows are untouched. The test's assignments (0→1, 3→4, explicit 5→6 left alone) match that rule, and @fiestorra's probe (220 partner-absent reads vs 828 named-but-short) lines up with what this PR covers versus what remains for #621.

One observation, not blocking: the partner map is rebuilt per packed-half read. Signatures are small, so the cost is negligible, and caching it would complicate lifetimes for no measurable gain.

Disclosure: my #621 is stacked on this head, so I have an interest in it landing; this is still an independent check of the merge with current main, which the existing runs don't cover (Linux, macOS, or the older 7139712 head).

CPU-only; no GPU run, no game data. AI-assisted (Kimi).

<!-- greyfinch-sync:Marvisak/VIctory:review:6044163914 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/592#pullrequestreview-6044163914). Originally posted by [Halfect](https://github.com/Halfect) on 2026-11-24T17:27:00Z. **Review:** COMMENTED --- Independent verification of `35bf153` merged onto current main `ffe310e` (clean merge; only `crates/victory-shader/src/emit/lower.rs`, +87/−1), Windows 11, rustc 1.98.1 (x86_64-pc-windows-msvc): - `cargo test --locked -p victory-shader --lib`, CPU-only suite skipping `diff_tests`, `valu_tests`, `waterfall_tests`, `stub_pipeline_is_created`: **98 passed, 0 failed, 1 ignored** — `packed_pixel_inputs_find_their_second_row` included. - `cargo clippy --locked -p victory-shader --lib --tests -- -D warnings`: clean. - `cargo xtask policy`: 154 files ok. Code read on the merged tree: `half_input_partners` mirrors the output-side `half_outputs` convention — the next 16-bit signature row that no input entry names and no explicit `row2` already claims, in row order — and the partner is consulted only under `pack2 && row2 == row`, so flat inputs and explicitly paired rows are untouched. The test's assignments (0→1, 3→4, explicit 5→6 left alone) match that rule, and @fiestorra's probe (220 partner-absent reads vs 828 named-but-short) lines up with what this PR covers versus what remains for #621. One observation, not blocking: the partner map is rebuilt per packed-half read. Signatures are small, so the cost is negligible, and caching it would complicate lifetimes for no measurable gain. Disclosure: my #621 is stacked on this head, so I have an interest in it landing; this is still an independent check of the merge with current main, which the existing runs don't cover (Linux, macOS, or the older `7139712` head). CPU-only; no GPU run, no game data. AI-assisted (Kimi).
upstream-sync closed this pull request 2026-11-25 01:04:24 +00:00
Marvisak commented 2026-11-25 01:07:47 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:25:58Z.


Automated triage for the maintainers. Closing because this change is already in main, or main has since replaced the code it patches.

Second rows of packed 16-bit pixel inputs: superseded by main's first-fit packing rule (packed_half in emit/lower.rs, 13091f6e), which needs no partner row.

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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148503696 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/592#issuecomment-7148503696). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:25:58Z. --- Automated triage for the maintainers. Closing because this change is already in `main`, or `main` has since replaced the code it patches. Second rows of packed 16-bit pixel inputs: superseded by main's first-fit packing rule (packed_half in emit/lower.rs, 13091f6e), which needs no partner row. 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

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!592
No description provided.