feat(shader): accept texel offsets in 1D gathers #932

Merged
CnRJay merged 1 commit from upstream-pr/932 into main 2026-10-07 09:25:42 +00:00
CnRJay commented 2026-10-06 18:46:58 +00:00 (Migrated from github.com)

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


What

image_gather4_lz_o on a 1D view threw. The 1D gather emulation picks the two texels around the coordinate itself, so it now adds the 6-bit x offset from the address to the left texel index before both texel centres are sampled. This offsets the footprint the same way the hardware does.

Tested

Windows 11, MinGW GCC Release build, ctest agc_driver_image_gather_one_dimensional passes (new, on the GPU). It covers image_gather4_lz and image_gather4_lz_o with clamp-to-edge and wrap samplers. The offsets range from -5 to +5, and every third thread also sets the unused y and z offset bits, which must be ignored. Every returned component is compared 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:4763205726 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/932). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-10-06T18:46:58Z. --- ### What `image_gather4_lz_o` on a 1D view threw. The 1D gather emulation picks the two texels around the coordinate itself, so it now adds the 6-bit x offset from the address to the left texel index before both texel centres are sampled. This offsets the footprint the same way the hardware does. ### Tested Windows 11, MinGW GCC Release build, ctest `agc_driver_image_gather_one_dimensional` passes (new, on the GPU). It covers `image_gather4_lz` and `image_gather4_lz_o` with clamp-to-edge and wrap samplers. The offsets range from -5 to +5, and every third thread also sets the unused y and z offset bits, which must be ignored. Every returned component is compared 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 09:25:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-07T09:25:38Z.


Checked the offset path on hardware (gfx1035 oracle, 1D F32 texture, clamp and wrap, offsets -32..31 with y/z and high bits set): the footprint shift matches in every row. Build + ctest green, the new test fails without the change. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6035013985 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/932#issuecomment-6035013985). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-07T09:25:38Z. --- Checked the offset path on hardware (gfx1035 oracle, 1D F32 texture, clamp and wrap, offsets -32..31 with y/z and high bits set): the footprint shift matches in every row. Build + ctest green, the new test fails without the change. Merging.
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!932
No description provided.