feat(shader): implement 1D array gathers #940

Merged
CnRJay merged 1 commit from upstream-pr/940 into main 2026-10-07 22:02:35 +00:00
CnRJay commented 2026-10-06 18:47:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-06T18:47:14Z.


What

image_gather4_lz(_o) on a 1D array view threw. The 1D gather emulation now takes the width from the array view's size, keeps the layer coordinate and samples both texel centres of that layer. As a result, 1D array gathers return the same footprint as 1D ones.

It builds on #931 (1D array textures) and #932 (1D gather offsets), both merged.

Tested

Windows 11, MinGW GCC Release build, ctest agc_driver_graphics, agc_driver_image_one_dimensional_array, agc_driver_image_gather_one_dimensional and agc_driver_image_gather_one_dimensional_array pass. The new agc_driver_image_gather_one_dimensional_array test (on the GPU) runs image_gather4_lz and image_gather4_lz_o with clamp-to-edge and wrap samplers on a 3-layer 1D array. It uses offsets from -5 to +5 and fractional and out-of-range layer coordinates, and compares every component with a CPU reference.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4763208741 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/940). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-10-06T18:47:14Z. --- ### What `image_gather4_lz(_o)` on a 1D array view threw. The 1D gather emulation now takes the width from the array view's size, keeps the layer coordinate and samples both texel centres of that layer. As a result, 1D array gathers return the same footprint as 1D ones. It builds on #931 (1D array textures) and #932 (1D gather offsets), both merged. ### Tested Windows 11, MinGW GCC Release build, ctest `agc_driver_graphics`, `agc_driver_image_one_dimensional_array`, `agc_driver_image_gather_one_dimensional` and `agc_driver_image_gather_one_dimensional_array` pass. The new `agc_driver_image_gather_one_dimensional_array` test (on the GPU) runs `image_gather4_lz` and `image_gather4_lz_o` with clamp-to-edge and wrap samplers on a 3-layer 1D array. It uses offsets from -5 to +5 and fractional and out-of-range layer coordinates, and compares every component with a CPU reference. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
adriadam10 commented 2026-10-07 21:05:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-07T21:05:21Z.


Checked on hardware (gfx1035 oracle, 1D array 32_FLOAT T#, 3 layers): image_gather4_lz and image_gather4_lz_o, clamp-to-edge and wrap, 37 coordinates × offsets -32..31 (y/z bits set) × 19 layer values (ties 0.5/1.5/2.5, ±1e30, ±inf, out of range): 5624 rows, all match the emitted footprint and layer selection (round to nearest even + clamp, as Vulkan does). Build + ctest green, the new test passes on CI's lavapipe and fails without the emitter change.

What I added on your branch:

  • Rebased onto current main, dropping the three merge commits (CONTRIBUTING: no merge commits). The diff is unchanged.

Merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6046838889 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/940#issuecomment-6046838889). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-07T21:05:21Z. --- Checked on hardware (gfx1035 oracle, 1D array 32_FLOAT T#, 3 layers): `image_gather4_lz` and `image_gather4_lz_o`, clamp-to-edge and wrap, 37 coordinates × offsets -32..31 (y/z bits set) × 19 layer values (ties 0.5/1.5/2.5, ±1e30, ±inf, out of range): 5624 rows, all match the emitted footprint and layer selection (round to nearest even + clamp, as Vulkan does). Build + ctest green, the new test passes on CI's lavapipe and fails without the emitter change. What I added on your branch: - Rebased onto current `main`, dropping the three merge commits (CONTRIBUTING: no merge commits). The diff is unchanged. Merging once CI is green.
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
boykopovar/AnyPS5!940
No description provided.