Shaders: pair packed fp16 pixel inputs with unlisted signature rows #176

Closed
Yaekai wants to merge 2 commits from upstream-pr/176 into main
Yaekai commented 2026-11-24 01:07:20 +00:00 (Migrated from github.com)

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 with fp16 and pack2 set sometimes leave PsInput.row2 == PsInput.row even when a second 16-bit signature row is packed into the trailing channels of the same hardware attribute (for example, row 0 with row2 == 0 packing unlisted row 1, or row 3 with row2 == 3 packing unlisted row 6). Previously, interp() treated row2 == row as having no partner (None), causing emit: a packed input half no element holds.

This mirrors the existing half_outputs pairing logic for pixel inputs via a new half_inputs helper:

  • Collects all 16-bit (half && kind == 0) signature rows not named as i.row by any PsInput and not explicitly claimed as i.row2 (where i.row2 != i.row).
  • For each fp16 PsInput in row order: uses i.row2 when i.row2 != i.row, and otherwise pairs pack2 entries with the next available unlisted 16-bit signature row > i.row.
  • Adds a unit test packed_half_inputs_pair_unlisted_rows covering explicit row2 preservation 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 --validate on shaders.rpf (26,084 programs): reduced emit: a packed input half no element holds from 172 → 6, increasing complete VS/PS shaders from 12,316 → 12,433 emitted (+117) and 12,208 → 12,325 dxil.dll-validated (+117, 100% validation pass rate, 0 new validator errors).
<!-- greyfinch-sync:Marvisak/VIctory:issue:6572256566 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/176). Originally posted by [Yaekai](https://github.com/Yaekai) on 2026-11-24T01:07:20Z. --- In `crates/victory-shader/src/emit/lower.rs`, pixel shader inputs with `fp16` and `pack2` set sometimes leave `PsInput.row2 == PsInput.row` even when a second 16-bit signature row is packed into the trailing channels of the same hardware attribute (for example, `row 0` with `row2 == 0` packing unlisted `row 1`, or `row 3` with `row2 == 3` packing unlisted `row 6`). Previously, `interp()` treated `row2 == row` as having no partner (`None`), causing `emit: a packed input half no element holds`. This mirrors the existing `half_outputs` pairing logic for pixel inputs via a new `half_inputs` helper: - Collects all 16-bit (`half && kind == 0`) signature rows not named as `i.row` by any `PsInput` and not explicitly claimed as `i.row2` (where `i.row2 != i.row`). - For each `fp16` `PsInput` in row order: uses `i.row2` when `i.row2 != i.row`, and otherwise pairs `pack2` entries with the next available unlisted 16-bit signature row `> i.row`. - Adds a unit test `packed_half_inputs_pair_unlisted_rows` covering explicit `row2` preservation 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 --validate` on `shaders.rpf` (26,084 programs): reduced `emit: a packed input half no element holds` from **172 → 6**, increasing complete VS/PS shaders from **12,316 → 12,433 emitted (+117)** and **12,208 → 12,325 `dxil.dll`-validated (+117, 100% validation pass rate, 0 new validator errors)**.
raffclar commented 2026-11-24 06:51:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by raffclar on 2026-11-24T01:10:48Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:Marvisak/VIctory:review:6032105093 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/176#pullrequestreview-6032105093). Originally posted by [raffclar](https://github.com/raffclar) on 2026-11-24T01:10:48Z. **Review:** COMMENTED --- _No description provided._
raffclar commented 2026-11-24 06:51:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by raffclar on 2026-11-24T01:13:51Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:Marvisak/VIctory:review:6032134958 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/176#pullrequestreview-6032134958). Originally posted by [raffclar](https://github.com/raffclar) on 2026-11-24T01:13:51Z. **Review:** COMMENTED --- _No description provided._
raffclar commented 2026-11-24 06:51:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by raffclar on 2026-11-24T01:14:31Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:Marvisak/VIctory:review:6032140570 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/176#pullrequestreview-6032140570). Originally posted by [raffclar](https://github.com/raffclar) on 2026-11-24T01:14:31Z. **Review:** COMMENTED --- _No description provided._
raffclar commented 2026-11-24 06:51:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by raffclar on 2026-11-24T01:15:08Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:Marvisak/VIctory:review:6032146267 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/176#pullrequestreview-6032146267). Originally posted by [raffclar](https://github.com/raffclar) on 2026-11-24T01:15:08Z. **Review:** COMMENTED --- _No description provided._
DaviTostes commented 2026-11-24 06:54:54 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DaviTostes on 2026-11-24T01:19:36Z.


Tested a823dfb on 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.
  • The full workspace still needs #112 for the victory-gpu E0425.

No game data used.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7118989016 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/176#issuecomment-7118989016). Originally posted by [DaviTostes](https://github.com/DaviTostes) on 2026-11-24T01:19:36Z. --- Tested `a823dfb` on **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. - The full workspace still needs #112 for the `victory-gpu` E0425. No game data used.
Yaekai commented 2026-11-24 06:55:03 +00:00 (Migrated from github.com)

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:

  1. Clarified row2 == row: added comments explaining that in the console's PsInput table, row2 repeats row when no distinct partner row is named.
  2. Duplicates: deduplicated halves by i.row keeping the first fp16 entry (matching the previous .find() behaviour) so duplicates neither overwrite earlier entries nor consume an extra free partner row.
  3. Bounding fallback partners: restricted fallback selection to r > i.row && r < next_fp16 (the next fp16 input row) so an earlier unpaired fp16 input cannot steal a later fp16 input's partner, while still allowing 32-bit PsInput rows in between (e.g. row 3 pairing with unlisted row 6 across 32-bit rows 4–5).

Added unit test coverage for both duplicate rows and the next_fp16 bound (cargo test -p victory-shader: 70/70 passed) and re-verified victory translate --validate on shaders.rpf (still 172 → 6, +117 VS/PS emitted & dxil.dll-validated, 0 new validator errors).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7119452826 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/176#issuecomment-7119452826). Originally posted by [Yaekai](https://github.com/Yaekai) on 2026-11-24T01:47:40Z. --- Thanks for the review @raffclar! Addressed all three points in `f0e7745`: 1. **Clarified `row2 == row`**: added comments explaining that in the console's `PsInput` table, `row2` repeats `row` when no distinct partner row is named. 2. **Duplicates**: deduplicated `halves` by `i.row` keeping the **first** `fp16` entry (matching the previous `.find()` behaviour) so duplicates neither overwrite earlier entries nor consume an extra free partner row. 3. **Bounding fallback partners**: restricted fallback selection to `r > i.row && r < next_fp16` (the next `fp16` input row) so an earlier unpaired `fp16` input cannot steal a later `fp16` input's partner, while still allowing 32-bit `PsInput` rows in between (e.g. `row 3` pairing with unlisted `row 6` across 32-bit rows 4–5). Added unit test coverage for both duplicate rows and the `next_fp16` bound (`cargo test -p victory-shader`: 70/70 passed) and re-verified `victory translate --validate` on `shaders.rpf` (still **172 → 6**, **+117** VS/PS emitted & `dxil.dll`-validated, 0 new validator errors).
raffclar commented 2026-11-24 06:56:31 +00:00 (Migrated from github.com)

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 352

@@ -319,6 +322,47 @@ fn half_outputs(io: &StageIo, outputs: &[SigElement]) -> HashMap<u8, (bool, Opti
         .collect()
 }
 
+/// Pixel inputs of 16-bit values (see [`Lower::half_inputs`]): a packed row's
+/// partner is `row2` when distinct from `row`, else the next 16-bit row of the
+/// signature that no input entry names or claims as `row2`, taken in row order.
+fn half_inputs(io: &StageIo, inputs: &[SigElement]) -> HashMap<u8, (bool, Option<u8>)> {
+    let StageIo::Ps {
+        inputs: entries, ..
+    } = io
+    else {
+        return HashMap::new();
+    };
+    let mut free: Vec<u8> = inputs
+        .iter()
+        .filter(|e| e.half && e.kind == 0)
+        .filter_map(|e| u8::try_from(e.row?).ok())
+        .filter(|&r| {
+            !entries
+                .iter()
+                .any(|i| i.row == r || (i.fp16 && i.pack2 && i.row2 != i.row && i.row2 == r))
+        })
+        .collect();
+    free.sort_unstable();
+    free.dedup();
+    let mut halves: Vec<_> = entries.iter().filter(|i| i.fp16).collect();
+    halves.sort_by_key(|i| i.row);
+    halves
+        .into_iter()
+        .map(|i| {
+            let b = if !i.pack2 {

Do 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

<!-- greyfinch-sync:Marvisak/VIctory:review-comment:4674204327 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/176#discussion_r4674204327). Originally posted by [raffclar](https://github.com/raffclar) on 2026-11-24T01:10:48Z. **Code review location:** `crates/victory-shader/src/emit/lower.rs`; line 352 ~~~~diff @@ -319,6 +322,47 @@ fn half_outputs(io: &StageIo, outputs: &[SigElement]) -> HashMap<u8, (bool, Opti .collect() } +/// Pixel inputs of 16-bit values (see [`Lower::half_inputs`]): a packed row's +/// partner is `row2` when distinct from `row`, else the next 16-bit row of the +/// signature that no input entry names or claims as `row2`, taken in row order. +fn half_inputs(io: &StageIo, inputs: &[SigElement]) -> HashMap<u8, (bool, Option<u8>)> { + let StageIo::Ps { + inputs: entries, .. + } = io + else { + return HashMap::new(); + }; + let mut free: Vec<u8> = inputs + .iter() + .filter(|e| e.half && e.kind == 0) + .filter_map(|e| u8::try_from(e.row?).ok()) + .filter(|&r| { + !entries + .iter() + .any(|i| i.row == r || (i.fp16 && i.pack2 && i.row2 != i.row && i.row2 == r)) + }) + .collect(); + free.sort_unstable(); + free.dedup(); + let mut halves: Vec<_> = entries.iter().filter(|i| i.fp16).collect(); + halves.sort_by_key(|i| i.row); + halves + .into_iter() + .map(|i| { + let b = if !i.pack2 { ~~~~ --- Do 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
raffclar commented 2026-11-24 06:56:31 +00:00 (Migrated from github.com)

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 363

@@ -319,6 +322,47 @@ fn half_outputs(io: &StageIo, outputs: &[SigElement]) -> HashMap<u8, (bool, Opti
         .collect()
 }
 
+/// Pixel inputs of 16-bit values (see [`Lower::half_inputs`]): a packed row's
+/// partner is `row2` when distinct from `row`, else the next 16-bit row of the
+/// signature that no input entry names or claims as `row2`, taken in row order.
+fn half_inputs(io: &StageIo, inputs: &[SigElement]) -> HashMap<u8, (bool, Option<u8>)> {
+    let StageIo::Ps {
+        inputs: entries, ..
+    } = io
+    else {
+        return HashMap::new();
+    };
+    let mut free: Vec<u8> = inputs
+        .iter()
+        .filter(|e| e.half && e.kind == 0)
+        .filter_map(|e| u8::try_from(e.row?).ok())
+        .filter(|&r| {
+            !entries
+                .iter()
+                .any(|i| i.row == r || (i.fp16 && i.pack2 && i.row2 != i.row && i.row2 == r))
+        })
+        .collect();
+    free.sort_unstable();
+    free.dedup();
+    let mut halves: Vec<_> = entries.iter().filter(|i| i.fp16).collect();
+    halves.sort_by_key(|i| i.row);
+    halves
+        .into_iter()
+        .map(|i| {
+            let b = if !i.pack2 {
+                None
+            } else if i.row2 != i.row {
+                Some(i.row2)
+            } else {
+                free.iter()
+                    .position(|&r| r > i.row)
+                    .map(|idx| free.remove(idx))
+            };
+            (i.row, (i.pack2, b))
+        })
+        .collect()

Also 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.

<!-- greyfinch-sync:Marvisak/VIctory:review-comment:4674228783 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/176#discussion_r4674228783). Originally posted by [raffclar](https://github.com/raffclar) on 2026-11-24T01:13:51Z. **Code review location:** `crates/victory-shader/src/emit/lower.rs`; line 363 ~~~~diff @@ -319,6 +322,47 @@ fn half_outputs(io: &StageIo, outputs: &[SigElement]) -> HashMap<u8, (bool, Opti .collect() } +/// Pixel inputs of 16-bit values (see [`Lower::half_inputs`]): a packed row's +/// partner is `row2` when distinct from `row`, else the next 16-bit row of the +/// signature that no input entry names or claims as `row2`, taken in row order. +fn half_inputs(io: &StageIo, inputs: &[SigElement]) -> HashMap<u8, (bool, Option<u8>)> { + let StageIo::Ps { + inputs: entries, .. + } = io + else { + return HashMap::new(); + }; + let mut free: Vec<u8> = inputs + .iter() + .filter(|e| e.half && e.kind == 0) + .filter_map(|e| u8::try_from(e.row?).ok()) + .filter(|&r| { + !entries + .iter() + .any(|i| i.row == r || (i.fp16 && i.pack2 && i.row2 != i.row && i.row2 == r)) + }) + .collect(); + free.sort_unstable(); + free.dedup(); + let mut halves: Vec<_> = entries.iter().filter(|i| i.fp16).collect(); + halves.sort_by_key(|i| i.row); + halves + .into_iter() + .map(|i| { + let b = if !i.pack2 { + None + } else if i.row2 != i.row { + Some(i.row2) + } else { + free.iter() + .position(|&r| r > i.row) + .map(|idx| free.remove(idx)) + }; + (i.row, (i.pack2, b)) + }) + .collect() ~~~~ --- Also 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.
raffclar commented 2026-11-24 06:56:31 +00:00 (Migrated from github.com)

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 358

@@ -319,6 +322,47 @@ fn half_outputs(io: &StageIo, outputs: &[SigElement]) -> HashMap<u8, (bool, Opti
         .collect()
 }
 
+/// Pixel inputs of 16-bit values (see [`Lower::half_inputs`]): a packed row's
+/// partner is `row2` when distinct from `row`, else the next 16-bit row of the
+/// signature that no input entry names or claims as `row2`, taken in row order.
+fn half_inputs(io: &StageIo, inputs: &[SigElement]) -> HashMap<u8, (bool, Option<u8>)> {
+    let StageIo::Ps {
+        inputs: entries, ..
+    } = io
+    else {
+        return HashMap::new();
+    };
+    let mut free: Vec<u8> = inputs
+        .iter()
+        .filter(|e| e.half && e.kind == 0)
+        .filter_map(|e| u8::try_from(e.row?).ok())
+        .filter(|&r| {
+            !entries
+                .iter()
+                .any(|i| i.row == r || (i.fp16 && i.pack2 && i.row2 != i.row && i.row2 == r))
+        })
+        .collect();
+    free.sort_unstable();
+    free.dedup();
+    let mut halves: Vec<_> = entries.iter().filter(|i| i.fp16).collect();
+    halves.sort_by_key(|i| i.row);
+    halves
+        .into_iter()
+        .map(|i| {
+            let b = if !i.pack2 {
+                None
+            } else if i.row2 != i.row {
+                Some(i.row2)
+            } else {
+                free.iter()
+                    .position(|&r| r > i.row)

You should only use a free row that comes before the next named input row

<!-- greyfinch-sync:Marvisak/VIctory:review-comment:4674233239 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/176#discussion_r4674233239). Originally posted by [raffclar](https://github.com/raffclar) on 2026-11-24T01:14:31Z. **Code review location:** `crates/victory-shader/src/emit/lower.rs`; line 358 ~~~~diff @@ -319,6 +322,47 @@ fn half_outputs(io: &StageIo, outputs: &[SigElement]) -> HashMap<u8, (bool, Opti .collect() } +/// Pixel inputs of 16-bit values (see [`Lower::half_inputs`]): a packed row's +/// partner is `row2` when distinct from `row`, else the next 16-bit row of the +/// signature that no input entry names or claims as `row2`, taken in row order. +fn half_inputs(io: &StageIo, inputs: &[SigElement]) -> HashMap<u8, (bool, Option<u8>)> { + let StageIo::Ps { + inputs: entries, .. + } = io + else { + return HashMap::new(); + }; + let mut free: Vec<u8> = inputs + .iter() + .filter(|e| e.half && e.kind == 0) + .filter_map(|e| u8::try_from(e.row?).ok()) + .filter(|&r| { + !entries + .iter() + .any(|i| i.row == r || (i.fp16 && i.pack2 && i.row2 != i.row && i.row2 == r)) + }) + .collect(); + free.sort_unstable(); + free.dedup(); + let mut halves: Vec<_> = entries.iter().filter(|i| i.fp16).collect(); + halves.sort_by_key(|i| i.row); + halves + .into_iter() + .map(|i| { + let b = if !i.pack2 { + None + } else if i.row2 != i.row { + Some(i.row2) + } else { + free.iter() + .position(|&r| r > i.row) ~~~~ --- You should only use a free row that comes before the next named input row
raffclar commented 2026-11-24 06:56:31 +00:00 (Migrated from github.com)

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 358

@@ -319,6 +322,47 @@ fn half_outputs(io: &StageIo, outputs: &[SigElement]) -> HashMap<u8, (bool, Opti
         .collect()
 }
 
+/// Pixel inputs of 16-bit values (see [`Lower::half_inputs`]): a packed row's
+/// partner is `row2` when distinct from `row`, else the next 16-bit row of the
+/// signature that no input entry names or claims as `row2`, taken in row order.
+fn half_inputs(io: &StageIo, inputs: &[SigElement]) -> HashMap<u8, (bool, Option<u8>)> {
+    let StageIo::Ps {
+        inputs: entries, ..
+    } = io
+    else {
+        return HashMap::new();
+    };
+    let mut free: Vec<u8> = inputs
+        .iter()
+        .filter(|e| e.half && e.kind == 0)
+        .filter_map(|e| u8::try_from(e.row?).ok())
+        .filter(|&r| {
+            !entries
+                .iter()
+                .any(|i| i.row == r || (i.fp16 && i.pack2 && i.row2 != i.row && i.row2 == r))
+        })
+        .collect();
+    free.sort_unstable();
+    free.dedup();
+    let mut halves: Vec<_> = entries.iter().filter(|i| i.fp16).collect();
+    halves.sort_by_key(|i| i.row);
+    halves
+        .into_iter()
+        .map(|i| {
+            let b = if !i.pack2 {
+                None
+            } else if i.row2 != i.row {
+                Some(i.row2)
+            } else {
+                free.iter()
+                    .position(|&r| r > i.row)

Otherwise an earlier input can take a free row that really belongs to a later input. Causes wrong row to be read or fails

<!-- greyfinch-sync:Marvisak/VIctory:review-comment:4674237603 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/176#discussion_r4674237603). Originally posted by [raffclar](https://github.com/raffclar) on 2026-11-24T01:15:08Z. **Code review location:** `crates/victory-shader/src/emit/lower.rs`; line 358 ~~~~diff @@ -319,6 +322,47 @@ fn half_outputs(io: &StageIo, outputs: &[SigElement]) -> HashMap<u8, (bool, Opti .collect() } +/// Pixel inputs of 16-bit values (see [`Lower::half_inputs`]): a packed row's +/// partner is `row2` when distinct from `row`, else the next 16-bit row of the +/// signature that no input entry names or claims as `row2`, taken in row order. +fn half_inputs(io: &StageIo, inputs: &[SigElement]) -> HashMap<u8, (bool, Option<u8>)> { + let StageIo::Ps { + inputs: entries, .. + } = io + else { + return HashMap::new(); + }; + let mut free: Vec<u8> = inputs + .iter() + .filter(|e| e.half && e.kind == 0) + .filter_map(|e| u8::try_from(e.row?).ok()) + .filter(|&r| { + !entries + .iter() + .any(|i| i.row == r || (i.fp16 && i.pack2 && i.row2 != i.row && i.row2 == r)) + }) + .collect(); + free.sort_unstable(); + free.dedup(); + let mut halves: Vec<_> = entries.iter().filter(|i| i.fp16).collect(); + halves.sort_by_key(|i| i.row); + halves + .into_iter() + .map(|i| { + let b = if !i.pack2 { + None + } else if i.row2 != i.row { + Some(i.row2) + } else { + free.iter() + .position(|&r| r > i.row) ~~~~ --- Otherwise an earlier input can take a free row that really belongs to a later input. Causes wrong row to be read or fails
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: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 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:7126491524 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/176#issuecomment-7126491524). Originally posted by [slint6614-dev](https://github.com/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 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.
Halfect commented 2026-11-24 13:59:09 +00:00 (Migrated from github.com)

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 main ffe310e locally. No GPU execution and no game data used.

Merge state. GitHub shows the PR as dirty; the only conflict with ffe310e is in the test module of emit/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 no resource::track call, so it is not affected by #801.

Verification on the merged tree (Windows, rustc 1.98.1):

  • packed_half_inputs_pair_unlisted_rows: passed.
  • CPU-only library suite (skipping 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):

  1. Readability: the doc comment now states the console's PsInput table repeats row in row2 when no distinct partner is named.
  2. Duplicates: 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.
  3. Free-row stealing: the fallback only takes a free row r with i.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-pack2 fp16 input with an explicit row2 != row, the old code passed Some(row2) through while this head stores None. This is a no-op in practice: the only consumer of the partner is packed_half, and it is reached only when pack2 is set (the !pack2 arm 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-row2 stops). 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.

<!-- greyfinch-sync:Marvisak/VIctory:review:6040540248 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/176#pullrequestreview-6040540248). Originally posted by [Halfect](https://github.com/Halfect) on 2026-11-24T13:59:09Z. **Review:** COMMENTED --- CPU-only re-check of `f0e7745`, merged onto current main `ffe310e` locally. No GPU execution and no game data used. **Merge state.** GitHub shows the PR as dirty; the only conflict with `ffe310e` is in the test module of `emit/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 no `resource::track` call, so it is not affected by #801. **Verification on the merged tree** (Windows, rustc 1.98.1): - `packed_half_inputs_pair_unlisted_rows`: passed. - CPU-only library suite (skipping `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): 1. Readability: the doc comment now states the console's PsInput table repeats `row` in `row2` when no distinct partner is named. 2. Duplicates: `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. 3. Free-row stealing: the fallback only takes a free row `r` with `i.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-`pack2` fp16 input with an explicit `row2 != row`, the old code passed `Some(row2)` through while this head stores `None`. This is a no-op in practice: the only consumer of the partner is `packed_half`, and it is reached only when `pack2` is set (the `!pack2` arm 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-`row2` stops). 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.
justlovett0 commented 2026-11-24 19:04:27 +00:00 (Migrated from github.com)

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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7141180179 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/176#issuecomment-7141180179). Originally posted by [justlovett0](https://github.com/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.
upstream-sync closed this pull request 2026-11-24 23:03:56 +00:00

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!176
No description provided.