Shaders: extend image_gather4_l(_o) to all address modes, borders, a16, d16, unorm, and 2D arrays #1851

Open
ESAT586 wants to merge 3 commits from upstream-pr/1853 into main
ESAT586 commented 2026-11-24 23:29:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ESAT586 on 2026-11-24T23:29:04Z.


Summary

Extends image_gather4_l and image_gather4_l_o emulation (Lower::gather_at_level) on top of 70564ae beyond 2D transparent-black-border 32 gathers:

  1. All 6 RDNA2 point/gather address modes per axis (including mixed X/Y):
    • WRAP (
<!-- greyfinch-sync:Marvisak/VIctory:issue:6593521431 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1853). Originally posted by [ESAT586](https://github.com/ESAT586) on 2026-11-24T23:29:04Z. --- ## Summary Extends image_gather4_l and image_gather4_l_o emulation (Lower::gather_at_level) on top of 70564ae beyond 2D transparent-black-border 32 gathers: 1. **All 6 RDNA2 point/gather address modes per axis (including mixed X/Y)**: - WRAP (
catminou4 commented 2026-11-25 00:06:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T23:52:18Z.

Review: APPROVED


Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (70564ae), cargo test -p victory-shader --locked → 118 passed, 0 failed. GPU execution tests are #[cfg(all(test, windows))] and run only on Windows.

image_gather4_l(_o) extended to all address modes/borders: gather lowering coverage widened.

<!-- greyfinch-sync:Marvisak/VIctory:review:6049333699 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1853#pullrequestreview-6049333699). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T23:52:18Z. **Review:** APPROVED --- Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (70564ae), cargo test -p victory-shader --locked → 118 passed, 0 failed. GPU execution tests are #[cfg(all(test, windows))] and run only on Windows. image_gather4_l(_o) extended to all address modes/borders: gather lowering coverage widened.
upipibi commented 2026-11-25 00:06:51 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-24T23:42:28Z.


NVIDIA run: RTX 3070 8 GB, driver 616.56, plus WARP, Windows 11, debug, 0ec4750 (on main 70564ae). cargo test -p victory-shader --locked: 209 passed, 3 failed, 2 ignored. The 3 are #1744's NVIDIA failures on main.

On the cases left refused ("a gather at a level that may not be whole", fractional LOD limits and bias): the level rule for a fractional LOD has now been measured on RDNA2 (gfx1036) in boykopovar/AnyPS5#23856 and #23666. LOD bias is added first, then the S# MIN_LOD / MAX_LOD clamp, then the T# MIN_LOD. The LOD is rounded to 1/256 with halves up, and the nearest level is taken with ties up, i.e. level floor(lod + 0.501953125). A linear MIP_FILTER gathers that single level too. That would let those cases be accepted rather than refused.

AI-assisted (Claude Code). Synthetic tests only.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7147705264 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1853#issuecomment-7147705264). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-24T23:42:28Z. --- NVIDIA run: RTX 3070 8 GB, driver 616.56, plus WARP, Windows 11, debug, `0ec4750` (on `main` `70564ae`). `cargo test -p victory-shader --locked`: 209 passed, 3 failed, 2 ignored. The 3 are #1744's NVIDIA failures on `main`. On the cases left refused ("a gather at a level that may not be whole", fractional LOD limits and bias): the level rule for a fractional LOD has now been measured on RDNA2 (gfx1036) in boykopovar/AnyPS5#23856 and #23666. LOD bias is added first, then the S# `MIN_LOD` / `MAX_LOD` clamp, then the T# `MIN_LOD`. The LOD is rounded to 1/256 with halves up, and the nearest level is taken with ties up, i.e. level `floor(lod + 0.501953125)`. A linear `MIP_FILTER` gathers that single level too. That would let those cases be accepted rather than refused. AI-assisted (Claude Code). Synthetic tests only.
AlanQiang0418 commented 2026-11-25 00:06:53 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by AlanQiang0418 on 2026-11-24T23:53:20Z.


Two independent follow-ups on 0ec4750.

Null texture and an opaque border. I dispatched the PR's existing address-mode shader twice, keeping the sampler, input coordinates and output layout identical. The second dispatch bound a typed RGBA32F null Texture2D SRV. With opaque white/red or opaque black/alpha, both explicit-level gathers returned four 1.0 values on all 32 lanes. The native level-zero gather in the same shader returned four zeros. I reproduced this on an RTX 5080 (621.14) and Microsoft WARP. The runtime creates typed null texture descriptors in null_like and null_view. D3D12 null descriptor behavior

Null-texture fix and regression. The emulation checks the mip-zero width before calculating a footprint or applying a border color. All 11 sampler configurations now return zero for the null view on both backends, with the original live-texture checks still passing.

Whole-LOD check for packed A16 array coordinates. For v_lshl_or_b32 dst, src0, 16, src2, the upper half is src0.low | src2.high. With src0 = 0x3c00, changing src2 from 0x00003c00 to 0x02003c00 keeps the array slice at 1 but changes the half-float LOD from 1.0 to 1.5. The original proof accepts both. Packed-LOD fix and four synthetic cases. The literal and per-lane fractional cases are now rejected, and a per-lane whole LOD and a constant −1 remain accepted.

Both commits apply together. Five gather tests passed with both applied, and shader all-targets Clippy passed. The sixth gather test, gathers_at_a_level_match_the_hardware, still differs on RTX lane 0 ([0, 1, 0, 0] vs [0, 0, 0, 0]). I got the same result on clean upstream 70564ae, clean PR head 0ec4750, and both commits combined. Previous hardware report

<!-- greyfinch-sync:Marvisak/VIctory:comment:7147905677 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1853#issuecomment-7147905677). Originally posted by [AlanQiang0418](https://github.com/AlanQiang0418) on 2026-11-24T23:53:20Z. --- Two independent follow-ups on `0ec4750`. **Null texture and an opaque border.** I dispatched the PR's existing address-mode shader twice, keeping the sampler, input coordinates and output layout identical. The second dispatch bound a typed RGBA32F null Texture2D SRV. With opaque white/red or opaque black/alpha, both explicit-level gathers returned four `1.0` values on all 32 lanes. The native level-zero gather in the same shader returned four zeros. I reproduced this on an RTX 5080 (621.14) and Microsoft WARP. The runtime creates typed null texture descriptors in [null_like and null_view](https://github.com/Marvisak/VIctory/blob/0ec4750adabd9a0ded44103704970b9a297476fb/crates/victory-gpu/src/descriptor/host.rs#L1310-L1355). [D3D12 null descriptor behavior](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-createshaderresourceview) [Null-texture fix and regression](https://github.com/AlanQiang0418/VIctory/commit/bf0b2b47b97d09b9877b9f3a1cc81f5fae5939a2). The emulation checks the mip-zero width before calculating a footprint or applying a border color. All 11 sampler configurations now return zero for the null view on both backends, with the original live-texture checks still passing. **Whole-LOD check for packed A16 array coordinates.** For `v_lshl_or_b32 dst, src0, 16, src2`, the upper half is `src0.low | src2.high`. With `src0 = 0x3c00`, changing `src2` from `0x00003c00` to `0x02003c00` keeps the array slice at 1 but changes the half-float LOD from 1.0 to 1.5. The original proof accepts both. [Packed-LOD fix and four synthetic cases](https://github.com/AlanQiang0418/VIctory/commit/441ebb3a1246569ba6ccbed4aa067c53d27ded3e). The literal and per-lane fractional cases are now rejected, and a per-lane whole LOD and a constant −1 remain accepted. Both commits apply together. Five gather tests passed with both applied, and shader all-targets Clippy passed. The sixth gather test, `gathers_at_a_level_match_the_hardware`, still differs on RTX lane 0 (`[0, 1, 0, 0]` vs `[0, 0, 0, 0]`). I got the same result on clean upstream `70564ae`, clean PR head `0ec4750`, and both commits combined. [Previous hardware report](https://github.com/Marvisak/VIctory/pull/1752#issuecomment-7145928131)
ESAT586 commented 2026-11-25 01:07:35 +00:00 (Migrated from github.com)

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


Thanks @AlanQiang0418 and @upipibi for the thorough hardware runs and exact catches!

Both bugs reported by @AlanQiang0418 are now fixed in the latest commit on this branch:

  1. Null texture SRV + opaque border color: gather_at_level now checks mip-0 width (w0 == 0 from getDimensions(h, 0)), guards URem divisors against zero on WRAP/MIRROR, clamps null-view mip level to 0, and forces 0.0 across all 4 gather results (matching native D3D12 textureGather even under OpaqueWhite and OpaqueBlack alpha). Added View::NullTexture (#[cfg(test)]) and gathers_at_a_level_return_zero_on_null_texture_even_with_opaque_border testing all 11 sampler configs on hardware + WARP.
  2. whole_f16 soundness for v_lshl_or_b32 dst, src0, 16, src2: when inspecting the packed high half (hi == true), whole_f16 now evaluates constant (src0, src2) pairs together or requires high16_zero_op(src2) to prove src2[31:16] == 0 (and decodes inline float constants 240..=248 as f16 bits for 16-bit float ops). Added gathers_at_a_level_a16_packed_lshl_or_validates_src2_high_half covering literal fractional src2, per-lane unmasked src2, per-lane whole + masked src2, and constant -1.0f16.

Regarding @upipibi's note on fractional LOD rounding (floor(lod + 0.501953125)): keeping fractional-LOD acceptance out of this PR to stay focused and preserve the existing scope; happy to follow up separately if desired.

Re-verified on Windows 11 with NVIDIA GeForce RTX 3060 Ti + Microsoft D3D12 WARP + dxil.dll:

  • cargo test -p victory-shader --lib emit::synthetic_tests::gathers_at_a_level_ -- --test-threads=1 --skip gathers_at_a_level_match_the_hardware: 6 passed, 0 failed
  • cargo clippy --workspace --all-targets -- -D warnings & --all-features: 0 warnings
  • cargo xtask policy: ok

(Clean-room synthetic tests only, zero game data. AI-assisted with Gemini 4 Neon (Extra High Mode).)

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148215535 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1853#issuecomment-7148215535). Originally posted by [ESAT586](https://github.com/ESAT586) on 2026-11-25T00:09:50Z. --- Thanks @AlanQiang0418 and @upipibi for the thorough hardware runs and exact catches! Both bugs reported by @AlanQiang0418 are now fixed in the latest commit on this branch: 1. **Null texture SRV + opaque border color**: `gather_at_level` now checks mip-0 width (`w0 == 0` from `getDimensions(h, 0)`), guards `URem` divisors against zero on `WRAP`/`MIRROR`, clamps null-view mip level to `0`, and forces `0.0` across all 4 gather results (matching native D3D12 `textureGather` even under `OpaqueWhite` and `OpaqueBlack` alpha). Added `View::NullTexture` (`#[cfg(test)]`) and `gathers_at_a_level_return_zero_on_null_texture_even_with_opaque_border` testing all 11 sampler configs on hardware + WARP. 2. **`whole_f16` soundness for `v_lshl_or_b32 dst, src0, 16, src2`**: when inspecting the packed high half (`hi == true`), `whole_f16` now evaluates constant `(src0, src2)` pairs together or requires `high16_zero_op(src2)` to prove `src2[31:16] == 0` (and decodes inline float constants `240..=248` as f16 bits for 16-bit float ops). Added `gathers_at_a_level_a16_packed_lshl_or_validates_src2_high_half` covering literal fractional `src2`, per-lane unmasked `src2`, per-lane whole + masked `src2`, and constant `-1.0f16`. Regarding @upipibi's note on fractional LOD rounding (`floor(lod + 0.501953125)`): keeping fractional-LOD acceptance out of this PR to stay focused and preserve the existing scope; happy to follow up separately if desired. Re-verified on Windows 11 with **NVIDIA GeForce RTX 3060 Ti** + **Microsoft D3D12 WARP** + **`dxil.dll`**: - `cargo test -p victory-shader --lib emit::synthetic_tests::gathers_at_a_level_ -- --test-threads=1 --skip gathers_at_a_level_match_the_hardware`: **6 passed, 0 failed** - `cargo clippy --workspace --all-targets -- -D warnings` & `--all-features`: **0 warnings** - `cargo xtask policy`: **ok** *(Clean-room synthetic tests only, zero game data. AI-assisted with Gemini 4 Neon (Extra High Mode).)*
upipibi commented 2026-11-25 01:07:46 +00:00 (Migrated from github.com)

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


Re-checked 59b8454 on the RTX 3070 (driver 616.56, Windows 11, debug). cargo test -p victory-shader --locked gives 211 passed, 3 failed, 2 ignored. The 3 are #1744's NVIDIA failures on main (the two stride_tests heap-buffer reads and gathers_at_a_level_match_the_hardware). The new null-texture test passes here, so this matches main plus the new tests.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148495143 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1853#issuecomment-7148495143). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-25T00:25:29Z. --- Re-checked `59b8454` on the RTX 3070 (driver 616.56, Windows 11, debug). `cargo test -p victory-shader --locked` gives 211 passed, 3 failed, 2 ignored. The 3 are #1744's NVIDIA failures on `main` (the two `stride_tests` heap-buffer reads and `gathers_at_a_level_match_the_hardware`). The new null-texture test passes here, so this matches `main` plus the new tests. AI-assisted (Claude Code).
AlanQiang0418 commented 2026-11-25 01:07:56 +00:00 (Migrated from github.com)

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


Retested your integrated 59b8454 on RTX 5080 (621.14) and WARP. The null-texture and packed-LOD cases pass. With #1887 at bb5acba applied, the previously failing legacy gather also passes: 7/7 gather tests.

I found one remaining way for a fractional LOD to pass the updated proof. Take the existing loaded slice word v13, copy it with v_and_b32 v16, v13, v13, and use v16 as the final operand of the shift-OR. The AND preserves bit 25, which can change the packed half from 1.0 to 1.5. On this head the checker fails to prove the first operand has zero high bits, then accepts the same value on its second visit. The synthetic shader consequently translates.

Follow-up commit on your new head caches the proof result and scopes loop assumptions to the incoming edges of each phi. The regression rejects the unmasked copy, accepts a copy masked to 16 bits, and checks both outcomes with a two-iteration loop. With the follow-up and #1887's view change applied, all seven gather tests, the indexed-buffer read test and shader all-targets Clippy passed.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148574025 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1853#issuecomment-7148574025). Originally posted by [AlanQiang0418](https://github.com/AlanQiang0418) on 2026-11-25T00:30:06Z. --- Retested your integrated `59b8454` on RTX 5080 (621.14) and WARP. The null-texture and packed-LOD cases pass. With #1887 at `bb5acba` applied, the previously failing legacy gather also passes: 7/7 gather tests. I found one remaining way for a fractional LOD to pass the updated proof. Take the existing loaded slice word `v13`, copy it with `v_and_b32 v16, v13, v13`, and use `v16` as the final operand of the shift-OR. The AND preserves bit 25, which can change the packed half from 1.0 to 1.5. On this head the checker fails to prove the first operand has zero high bits, then accepts the same value on its second visit. The synthetic shader consequently translates. [Follow-up commit on your new head](https://github.com/AlanQiang0418/VIctory/commit/2f964b8f78cf6508e47af5ac3785f9c1c7a9f880) caches the proof result and scopes loop assumptions to the incoming edges of each phi. The regression rejects the unmasked copy, accepts a copy masked to 16 bits, and checks both outcomes with a two-iteration loop. With the follow-up and #1887's view change applied, all seven gather tests, the indexed-buffer read test and shader all-targets Clippy passed.
andrewpozdnakov7-jpg commented 2026-11-25 01:08:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-25T00:50:04Z.


I checked the gather coordinate product on your current head, 59b8454a8f. It sets Int64ShaderOps even though the final coordinate fits in 32 bits for every D3D12 texture dimension. DirectX feature requirements

16a4e77 is one commit directly on that head. It splits the signed product at bit 16 and preserves the exact footprint rounding. I ran the same test before and after on WARP, including a 16,381-texel-wide 2D array plus the A16, D16 and unnormalized cases. The texel readbacks matched on both builds. The SFI0 assertion failed with 0x8000 before and passed with zero after.

Full forced-WARP suite: 211 passed / 3 failed / 2 ignored before, 212 / 2 / 2 after. The legacy native gather comparison and lane permute produced the same failures in both runs. Strict shader Clippy and asset policy passed.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148928121 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1853#issuecomment-7148928121). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-25T00:50:04Z. --- I checked the gather coordinate product on your current head, 59b8454a8fabe13809be8c6fc420fe0b4e9927e2. It sets Int64ShaderOps even though the final coordinate fits in 32 bits for every D3D12 texture dimension. [DirectX feature requirements](https://microsoft.github.io/DirectX-Specs/d3d/HLSL_SM_6_6_Int64_and_Float_Atomics.html) [16a4e77](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/16a4e77f96844576703426416f4919230ec54a52) is one commit directly on that head. It splits the signed product at bit 16 and preserves the exact footprint rounding. I ran the same test before and after on WARP, including a 16,381-texel-wide 2D array plus the A16, D16 and unnormalized cases. The texel readbacks matched on both builds. The SFI0 assertion failed with 0x8000 before and passed with zero after. Full forced-WARP suite: 211 passed / 3 failed / 2 ignored before, 212 / 2 / 2 after. The legacy native gather comparison and lane permute produced the same failures in both runs. Strict shader Clippy and asset policy passed.
AlanQiang0418 commented 2026-11-25 03:03:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by AlanQiang0418 on 2026-11-25T02:27:17Z.


I compared the 32-bit coordinate patch with its parent 59b8454 on RTX 5080 (621.14) and Microsoft WARP. For each adapter and build I compared 1,408 four-texel gathers against the CPU reference (widths 16,381 and 16,384; 11 sampler configurations; 32 lanes; with and without offsets). All 1,408 matched. The patch cleared the generated shader's Int64 feature flag; the wider A16/D16/unnormalized array fixture also passed.

One detail for reproducing boundary comparisons: at width 16,384, normalized u = f32::from_bits(0x3d800ff0), v = 0.25, wrap, level zero, the reference and both translated versions returned [33793, 33794, 17410, 17409]. Native gather returned [33792, 33793, 17409, 17408]. Both backends differed from the translated footprint in 28/108 native level-zero comparisons at this width, with the same differences before and after the change. At width 16,381 the corresponding counts were 0/108 for RTX and 7/108 for WARP. The old and new code agreed even at the neighboring f32 values on either side of the tested thresholds.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7150743206 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1853#issuecomment-7150743206). Originally posted by [AlanQiang0418](https://github.com/AlanQiang0418) on 2026-11-25T02:27:17Z. --- I compared the [32-bit coordinate patch](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/16a4e77f96844576703426416f4919230ec54a52) with its parent `59b8454` on RTX 5080 (621.14) and Microsoft WARP. For each adapter and build I compared 1,408 four-texel gathers against the CPU reference (widths 16,381 and 16,384; 11 sampler configurations; 32 lanes; with and without offsets). All 1,408 matched. The patch cleared the generated shader's Int64 feature flag; the wider A16/D16/unnormalized array fixture also passed. One detail for reproducing boundary comparisons: at width 16,384, normalized `u = f32::from_bits(0x3d800ff0)`, `v = 0.25`, wrap, level zero, the reference and both translated versions returned `[33793, 33794, 17410, 17409]`. Native gather returned `[33792, 33793, 17409, 17408]`. Both backends differed from the translated footprint in 28/108 native level-zero comparisons at this width, with the same differences before and after the change. At width 16,381 the corresponding counts were 0/108 for RTX and 7/108 for WARP. The old and new code agreed even at the neighboring f32 values on either side of the tested thresholds.
Marvisak commented 2026-11-25 08:06:37 +00:00 (Migrated from github.com)

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


Automated triage for the maintainers.

Needs rebase. This PR no longer merges cleanly into main (conflict in crates/victory-shader/src/emit/synthetic_tests.rs). It will be reviewed again once it is rebased.

From the earlier needs-work note, still open: fix the CI compile error (view_marks missing in synthetic_tests.rs), say which title shaders need which gather modes and keep only those, and ideally split out the null-texture and v_lshl_or_b32 proof work.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7155849420 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1853#issuecomment-7155849420). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T07:25:45Z. --- <!-- victory-triage v1 head=dc26c73612fb10286e9d1a9ba8788d0801cd3f63 verdict=needs-rebase at=2026-11-25T22:22:35Z --> Automated triage for the maintainers. **Needs rebase.** This PR no longer merges cleanly into `main` (conflict in `crates/victory-shader/src/emit/synthetic_tests.rs`). It will be reviewed again once it is rebased. From the earlier needs-work note, still open: fix the CI compile error (`view_marks` missing in `synthetic_tests.rs`), say which title shaders need which gather modes and keep only those, and ideally split out the null-texture and `v_lshl_or_b32` proof work. --- _Generated by [Claude Code](https://claude.ai/code)_
Dathinel commented 2026-11-25 09:06:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dathinel on 2026-11-25T08:21:46Z.


I tested the two suggested follow-ups together on Windows. The 32-bit footprint change and the packed LOD proof fix merged cleanly on 59b8454. With the test-host delta from #1887 (ccfb029..62bd980), all 7 tests passed with cargo test --locked -p victory-shader --lib synthetic_tests::gathers_at_a_level, including the 16,381-wide array and packed-LOD loop cases.

As a control, keeping the combined tests and restoring only lower.rs from the 32-bit patch made the repeated-operand regression fail: translation accepted the unknown upper half. The two fixes can be evaluated together; the coordinate change alone still needs the LOD fix for that case. These synthetic results leave the requested evidence about which modes the title uses open. AI-assisted validation.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7156931781 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1853#issuecomment-7156931781). Originally posted by [Dathinel](https://github.com/Dathinel) on 2026-11-25T08:21:46Z. --- I tested the two suggested follow-ups together on Windows. The [32-bit footprint change](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/16a4e77f96844576703426416f4919230ec54a52) and the [packed LOD proof fix](https://github.com/AlanQiang0418/VIctory/commit/2f964b8f78cf6508e47af5ac3785f9c1c7a9f880) merged cleanly on 59b8454. With the test-host delta from #1887 (ccfb029..62bd980), all 7 tests passed with **cargo test --locked -p victory-shader --lib synthetic_tests::gathers_at_a_level**, including the 16,381-wide array and packed-LOD loop cases. As a control, keeping the combined tests and restoring only lower.rs from the 32-bit patch made the repeated-operand regression fail: translation accepted the unknown upper half. The two fixes can be evaluated together; the coordinate change alone still needs the LOD fix for that case. These synthetic results leave the requested evidence about which modes the title uses open. AI-assisted validation.
sinan-cmyk commented 2026-11-25 13:02:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-25T12:11:20Z.


Offline measurement on a retail dump

Result: no count change against main.

I merged head 59b8454a onto main 940d32f (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 23,918 on main, 23,918 with this PR.

No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7162036806 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1853#issuecomment-7162036806). Originally posted by [sinan-cmyk](https://github.com/sinan-cmyk) on 2026-11-25T12:11:20Z. --- ### Offline measurement on a retail dump **Result: no count change against `main`.** I merged head 59b8454a onto `main` 940d32f (clean merge) and ran `victory translate --validate --list` on `shaders.rpf` (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with `main` program by program (25,889 programs). Validated: 23,918 on `main`, 23,918 with this PR. No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
ESAT586 commented 2026-11-25 16:09:09 +00:00 (Migrated from github.com)

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


Thanks for the thorough reviews, bug catches, and testing @andrewpozdnakov7-jpg, @AlanQiang0418, @Dathinel, and @sinan-cmyk!

Addressed all three concrete review findings in dc26c73:

  1. Drop Int64ShaderOps in Lower::gather_first (@andrewpozdnakov7-jpg): Replaced the 64-bit product with a bit-16 split 32-bit signed product (exact for every D3D12 texture axis up to 16,384 texels and unnormalized [-65536, 65536]) and removed self.s.flags |= flags::INT64. Added an SFI0 & 0x8000 == 0 assertion to synthetic_tests.
  2. Fix high16_zero repeated-operand & loop proof soundness (@AlanQiang0418, @Dathinel): Split cycle detection ( isiting) from memoized proof results (known), caching failed proofs unconditionally and successful proofs once out of active cycles so repeated unknown operands ( _and_b32 v16, v13, v13) and unknown-entry loops stay rejected while masked repeats and zero-entry loops remain accepted. Added all four regression cases.
  3. Fix View doc comment in crates/victory-shader/src/emit/host.rs (triage note): Restored View::Levels's doc comment above Levels (and enum View is already #[cfg(test)]).

Re-verified on RTX 3060 Ti and WARP (VICTORY_WARP=1): all 6 PR gathers_at_a_level* tests pass on both backends (with legacy gathers_at_a_level_match_the_hardware showing only the pre-existing #1744/#1887 baseline diff), strict Clippy (--all-targets -- -D warnings) clean, and cargo xtask policy (174 files ok).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7166675367 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1853#issuecomment-7166675367). Originally posted by [ESAT586](https://github.com/ESAT586) on 2026-11-25T15:19:58Z. --- Thanks for the thorough reviews, bug catches, and testing @andrewpozdnakov7-jpg, @AlanQiang0418, @Dathinel, and @sinan-cmyk! Addressed all three concrete review findings in `dc26c73`: 1. **Drop Int64ShaderOps in Lower::gather_first (@andrewpozdnakov7-jpg):** Replaced the 64-bit product with a bit-16 split 32-bit signed product (exact for every D3D12 texture axis up to 16,384 texels and unnormalized [-65536, 65536]) and removed self.s.flags |= flags::INT64. Added an SFI0 & 0x8000 == 0 assertion to synthetic_tests. 2. **Fix high16_zero repeated-operand & loop proof soundness (@AlanQiang0418, @Dathinel):** Split cycle detection ( isiting) from memoized proof results (known), caching failed proofs unconditionally and successful proofs once out of active cycles so repeated unknown operands ( _and_b32 v16, v13, v13) and unknown-entry loops stay rejected while masked repeats and zero-entry loops remain accepted. Added all four regression cases. 3. **Fix View doc comment in crates/victory-shader/src/emit/host.rs (triage note):** Restored View::Levels's doc comment above Levels (and enum View is already #[cfg(test)]). Re-verified on **RTX 3060 Ti** and **WARP** (VICTORY_WARP=1): all 6 PR gathers_at_a_level* tests pass on both backends (with legacy gathers_at_a_level_match_the_hardware showing only the pre-existing #1744/#1887 baseline diff), strict Clippy (--all-targets -- -D warnings) clean, and cargo xtask policy (174 files ok).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1853:upstream-pr/1853'
git switch 'upstream-pr/1853'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1853'
git switch 'upstream-pr/1853'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1853'
git switch 'upstream-pr/1853'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1853'
git switch 'main'
git merge --squash 'upstream-pr/1853'
git switch 'main'
git merge --ff-only 'upstream-pr/1853'
git switch 'main'
git merge 'upstream-pr/1853'
git push origin 'main'
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!1851
No description provided.