feat(shader): implement MIMG sample/gather flag variants #226

Merged
asimplestray merged 1 commit from upstream-pr/226 into main 2026-10-02 19:07:37 +00:00
asimplestray commented 2026-10-01 17:00:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by asimplestray on 2026-10-01T17:00:52Z.


What

Implements 43 MIMG opcodes (shaders 609/1166 -> 652/1166):

  • 25 IMAGE_SAMPLE_* bias/lod/clamp/compare/derivative/offset/level-zero combinations (0x21-0x3F range).
  • 18 IMAGE_GATHER4* variants including vanilla IMAGE_GATHER4 (0x40), bias/lod/compare/offset combinations (0x41-0x5E).
  • Encodings verified against LLVM's GFX10 disassembler tests; flag combos mirror the existing table rows.
  • All variants reuse the existing flag-driven imageSample/imageGather translation (compare-ref, bias, lod, offset and derivative flow through MemoryInfo); 15 pre-existing shared-enum rows now name their specific opcode.

Tested

Linux (GCC, BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS=OFF): full build, ctest 90/90 pass, including the new image_sample_gather test (decode opcode + family + image classification plus translation of all 43 encodings).

Checklist

  • Based on current main; no other open PR implements the same opcodes (checked open shader PRs: none touch MIMG sample/gather)
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (decoding unknown opcodes still throws)
  • 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 (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4706906689 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/226). Originally posted by [asimplestray](https://github.com/asimplestray) on 2026-10-01T17:00:52Z. --- ### What Implements 43 MIMG opcodes (shaders 609/1166 -> 652/1166): - 25 `IMAGE_SAMPLE_*` bias/lod/clamp/compare/derivative/offset/level-zero combinations (`0x21`-`0x3F` range). - 18 `IMAGE_GATHER4*` variants including vanilla `IMAGE_GATHER4` (`0x40`), bias/lod/compare/offset combinations (`0x41`-`0x5E`). - Encodings verified against LLVM's GFX10 disassembler tests; flag combos mirror the existing table rows. - All variants reuse the existing flag-driven `imageSample`/`imageGather` translation (compare-ref, bias, lod, offset and derivative flow through `MemoryInfo`); 15 pre-existing shared-enum rows now name their specific opcode. ### Tested Linux (GCC, `BUILD_TESTING=ON`, `ANYPS5_ENABLE_SPIRV_TOOLS=OFF`): full build, `ctest` 90/90 pass, including the new `image_sample_gather` test (decode opcode + family + image classification plus translation of all 43 encodings). ### Checklist - [x] Based on current `main`; no other open PR implements the same opcodes (checked open shader PRs: none touch MIMG sample/gather) - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw (decoding unknown opcodes still throws) - [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 (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-01 17:01:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-01T17:01:17Z.


Progress report (313de1c → f6e689d)

📈 GPU shader instructions: 63.29% (+3.68%, +43 implemented instructions)

✅ 43 implemented
Encoding Name
MIMG IMAGE_GATHER4
MIMG IMAGE_GATHER4_B
MIMG IMAGE_GATHER4_B_CL
MIMG IMAGE_GATHER4_B_CL_O
MIMG IMAGE_GATHER4_B_O
MIMG IMAGE_GATHER4_CL
MIMG IMAGE_GATHER4_CL_O
MIMG IMAGE_GATHER4_C_B
MIMG IMAGE_GATHER4_C_B_CL
MIMG IMAGE_GATHER4_C_B_CL_O
MIMG IMAGE_GATHER4_C_B_O
MIMG IMAGE_GATHER4_C_CL
MIMG IMAGE_GATHER4_C_CL_O
MIMG IMAGE_GATHER4_C_L
MIMG IMAGE_GATHER4_C_L_O
MIMG IMAGE_GATHER4_L
MIMG IMAGE_GATHER4_L_O
MIMG IMAGE_GATHER4_O
MIMG IMAGE_SAMPLE_B_CL
MIMG IMAGE_SAMPLE_B_CL_O
MIMG IMAGE_SAMPLE_B_O
MIMG IMAGE_SAMPLE_C
MIMG IMAGE_SAMPLE_CL
MIMG IMAGE_SAMPLE_CL_O
MIMG IMAGE_SAMPLE_C_B
MIMG IMAGE_SAMPLE_C_B_CL
MIMG IMAGE_SAMPLE_C_B_CL_O
MIMG IMAGE_SAMPLE_C_B_O
MIMG IMAGE_SAMPLE_C_CL
MIMG IMAGE_SAMPLE_C_CL_O
MIMG IMAGE_SAMPLE_C_D
MIMG IMAGE_SAMPLE_C_D_CL
MIMG IMAGE_SAMPLE_C_D_CL_O
MIMG IMAGE_SAMPLE_C_D_O
MIMG IMAGE_SAMPLE_C_L
MIMG IMAGE_SAMPLE_C_LZ_O
MIMG IMAGE_SAMPLE_C_L_O
MIMG IMAGE_SAMPLE_C_O
MIMG IMAGE_SAMPLE_D
MIMG IMAGE_SAMPLE_D_CL
MIMG IMAGE_SAMPLE_D_O
MIMG IMAGE_SAMPLE_LZ_O
MIMG IMAGE_SAMPLE_O
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5936375631 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/226#issuecomment-5936375631). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-01T17:01:17Z. --- <!-- progress-report --> ### Progress report (313de1c → f6e689d) 📈 **GPU shader instructions**: 63.29% (+3.68%, +43 implemented instructions) <details> <summary>✅ 43 implemented</summary> | Encoding | Name | | - | - | | MIMG | `IMAGE_GATHER4` | | MIMG | `IMAGE_GATHER4_B` | | MIMG | `IMAGE_GATHER4_B_CL` | | MIMG | `IMAGE_GATHER4_B_CL_O` | | MIMG | `IMAGE_GATHER4_B_O` | | MIMG | `IMAGE_GATHER4_CL` | | MIMG | `IMAGE_GATHER4_CL_O` | | MIMG | `IMAGE_GATHER4_C_B` | | MIMG | `IMAGE_GATHER4_C_B_CL` | | MIMG | `IMAGE_GATHER4_C_B_CL_O` | | MIMG | `IMAGE_GATHER4_C_B_O` | | MIMG | `IMAGE_GATHER4_C_CL` | | MIMG | `IMAGE_GATHER4_C_CL_O` | | MIMG | `IMAGE_GATHER4_C_L` | | MIMG | `IMAGE_GATHER4_C_L_O` | | MIMG | `IMAGE_GATHER4_L` | | MIMG | `IMAGE_GATHER4_L_O` | | MIMG | `IMAGE_GATHER4_O` | | MIMG | `IMAGE_SAMPLE_B_CL` | | MIMG | `IMAGE_SAMPLE_B_CL_O` | | MIMG | `IMAGE_SAMPLE_B_O` | | MIMG | `IMAGE_SAMPLE_C` | | MIMG | `IMAGE_SAMPLE_CL` | | MIMG | `IMAGE_SAMPLE_CL_O` | | MIMG | `IMAGE_SAMPLE_C_B` | | MIMG | `IMAGE_SAMPLE_C_B_CL` | | MIMG | `IMAGE_SAMPLE_C_B_CL_O` | | MIMG | `IMAGE_SAMPLE_C_B_O` | | MIMG | `IMAGE_SAMPLE_C_CL` | | MIMG | `IMAGE_SAMPLE_C_CL_O` | | MIMG | `IMAGE_SAMPLE_C_D` | | MIMG | `IMAGE_SAMPLE_C_D_CL` | | MIMG | `IMAGE_SAMPLE_C_D_CL_O` | | MIMG | `IMAGE_SAMPLE_C_D_O` | | MIMG | `IMAGE_SAMPLE_C_L` | | MIMG | `IMAGE_SAMPLE_C_LZ_O` | | MIMG | `IMAGE_SAMPLE_C_L_O` | | MIMG | `IMAGE_SAMPLE_C_O` | | MIMG | `IMAGE_SAMPLE_D` | | MIMG | `IMAGE_SAMPLE_D_CL` | | MIMG | `IMAGE_SAMPLE_D_O` | | MIMG | `IMAGE_SAMPLE_LZ_O` | | MIMG | `IMAGE_SAMPLE_O` | </details>
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!226
No description provided.