Skip to content

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

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
CnRJay:feat/image-gather-1d-array
Oct 7, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
CnRJay:feat/image-gather-1d-array

Conversation

@CnRJay

@CnRJay CnRJay commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

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

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, so 1D array
gathers return the same footprint as 1D ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adriadam10

Copy link
Copy Markdown
Collaborator

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.

@adriadam10
adriadam10 force-pushed the feat/image-gather-1d-array branch from f154e5c to 495aa94 Compare October 7, 2026 21:05
@adriadam10
adriadam10 merged commit df16c4c into boykopovar:main Oct 7, 2026
5 of 6 checks passed
@CnRJay
CnRJay deleted the feat/image-gather-1d-array branch October 10, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants