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

Open
github-bot wants to merge 3 commits from github-bot/gh-1853 into main AGit
Owner

@⁠ESAT586 on GitHub · 2026-11-24 23:29 UTC · original
ESAT586:shader/gather-at-level-modes → main · +1810 −99 · 3 files · 3 commits · open

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 (
**@⁠ESAT586** on GitHub · 2026-11-24 23:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/1853) `ESAT586:shader/gather-at-level-modes` → `main` · +1810 −99 · 3 files · 3 commits · open ## 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 (
Extend gather_at_level (image_gather4_l and image_gather4_l_o) beyond
2D transparent-black-border f32 gathers:

- Support all six RDNA2 point/gather address modes per axis (including
  mixed X/Y modes): WRAP (0), MIRROR (1), CLAMP_LAST_TEXEL (2),
  MIRROR_ONCE_LAST_TEXEL (3), CLAMP_BORDER (6), and
  MIRROR_ONCE_BORDER (7), using exact IEEE-754 period reduction
  (u - trunc(u) and u - 2 * trunc(u * 0.5)) for periodic modes and
  [-64, 64] clamping for clamp/border modes before the 64-bit fixed-point
  texel index calculation.
- Support all three built-in border colours (TRANSPARENT_BLACK,
  OPAQUE_BLACK returning 1.0 on alpha and 0.0 on RGB, and OPAQUE_WHITE
  returning 1.0 on every channel), ignoring order_color_type when
  neither axis uses a border mode.
- Support whole sampler lod_bias, 16 (with f16 whole-LOD provenance
  tracking in whole_f16 for both low and high halves), d16 packed
  outputs, unnormalized (unorm / FORCE_UNNORMALIZED) coordinates on
  clamp/border modes, and Texture2DArray (dim = 5, ties-to-even slice
  rounding clamped to [0, array_size - 1]).
- Add View::MippedArray to the test harness and end-to-end GPU + WARP +
  DXIL-validated tests verifying all 11 sampler configurations against
  both the CPU reference and native hardware image_gather4_lz at level 0,
  plus 16, d16, unorm, Texture2DArray, and negative tests for
  still-refused sampler options.

AI disclosure: implemented and verified with Gemini 4 Neon (Extra High Mode)
using only synthetic test cases and public RDNA2 ISA documentation; zero
game binaries or copyrighted assets were accessed.
Addresses two review findings on #1853:
- Null Texture2D/Texture2DArray SRVs (mip-0 width == 0) now return 0.0 for all
  four channels even with opaque border colors (`OpaqueWhite`, `OpaqueBlack` alpha),
  matching native D3D12 `textureGather`, and avoid `URem` by zero on wrap/mirror.
- `whole_f16` on `v_lshl_or_b32 dst, src0, 16, src2` now requires `src2[31:16]` to
  be provably zero (or evaluates constant pairs directly) so a non-zero upper half
  in `src2` cannot turn a whole high-half f16 LOD into a fractional value; 16-bit
  float ops (`v_pack_b32_f16`, `v_min_f16`, `v_max_f16`) also decode inline float
  constants `240..=248` as f16 bits.
- Adds `View::NullTexture` (`#[cfg(test)]`) and regression tests covering all 11
  sampler configs against a null SRV on hardware + WARP plus the 4 `v_lshl_or_b32`
  packed-LOD validation cases.

Clean-room synthetic tests only; zero game data used.
AI-assisted with Gemini 4 Neon (Extra High Mode).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:46:38 +00:00
Author
Owner

@⁠upipibi on GitHub · 2026-11-24 23:42 UTC · original

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.

**@⁠upipibi** on GitHub · 2026-11-24 23:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/1853#issuecomment-7147705264) 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.
Author
Owner

@⁠AlanQiang0418 on GitHub · 2026-11-24 23:53 UTC · original

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

**@⁠AlanQiang0418** on GitHub · 2026-11-24 23:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/1853#issuecomment-7147905677) 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://git.gtahub.st/github/Marvisak--VIctory/pulls/1752)
Author
Owner

@⁠ESAT586 on GitHub · 2026-11-25 00:09 UTC · original

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

**@⁠ESAT586** on GitHub · 2026-11-25 00:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/1853#issuecomment-7148215535) 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).)*
Author
Owner

@⁠upipibi on GitHub · 2026-11-25 00:25 UTC · original

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

**@⁠upipibi** on GitHub · 2026-11-25 00:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/1853#issuecomment-7148495143) 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).
Author
Owner

@⁠AlanQiang0418 on GitHub · 2026-11-25 00:30 UTC · original

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.

**@⁠AlanQiang0418** on GitHub · 2026-11-25 00:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/1853#issuecomment-7148574025) 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.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 00:50 UTC · original

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.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 00:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/1853#issuecomment-7148928121) 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.
Author
Owner

@⁠AlanQiang0418 on GitHub · 2026-11-25 02:27 UTC · original

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.

**@⁠AlanQiang0418** on GitHub · 2026-11-25 02:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/1853#issuecomment-7150743206) 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.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 07:25 UTC · original · edited 2026-11-25 22:18 UTC

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

**@⁠Marvisak** on GitHub · 2026-11-25 07:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/1853#issuecomment-7155849420) · edited 2026-11-25 22:18 UTC <!-- 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)_
Author
Owner

@⁠Dathinel on GitHub · 2026-11-25 08:21 UTC · original

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.

**@⁠Dathinel** on GitHub · 2026-11-25 08:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/1853#issuecomment-7156931781) 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.
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-25 12:11 UTC · original

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

**@⁠sinan-cmyk** on GitHub · 2026-11-25 12:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/1853#issuecomment-7162036806) ### 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).
Author
Owner

@⁠ESAT586 on GitHub · 2026-11-25 15:19 UTC · original

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

**@⁠ESAT586** on GitHub · 2026-11-25 15:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/1853#issuecomment-7166675367) 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 has changes conflicting with the target branch.
  • crates/victory-shader/src/emit/synthetic_tests.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1853/head:github-bot/gh-1853'
git switch 'github-bot/gh-1853'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1853'
git switch 'github-bot/gh-1853'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1853'
git switch 'github-bot/gh-1853'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1853'
git switch 'main'
git merge --squash 'github-bot/gh-1853'
git switch 'main'
git merge --ff-only 'github-bot/gh-1853'
git switch 'main'
git merge 'github-bot/gh-1853'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1853
No description provided.