feat(shader): decode image_sample_d_cl_o #389

Merged
DotDebian merged 2 commits from upstream-pr/389 into main 2026-10-04 01:04:48 +00:00
DotDebian commented 2026-10-02 17:08:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DotDebian on 2026-10-02T17:08:11Z.


What

Decodes image_sample_d_cl_o (MIMG opcode 0x33): a sample with explicit derivatives, an LOD clamp and a texel offset.

  • One row in the image opcode table. The opcode number is the GFX10 one of IMAGE_SAMPLE_D_CL_O in LLVM's MIMGInstructions.td, between 0x32 (_d_o) and 0x34 (_l_o), which the table already has. The address layout (offset, derivatives, coordinates, clamp) follows from the three existing flags; the decoder and the emitter are otherwise unchanged.
  • tools/progress.py counts IMAGE_SAMPLE_D_CL_O as a variant of ImageSample.

This branch sits on #388 (an LOD clamp cannot be emitted without it). The change of this PR is the last commit.

Tested

Windows 11, MinGW-w64 GCC 15.2.0, NVIDIA GeForce RTX 5080. ctest: 109/109 pass.

The execution test agc_driver_image_sample_lod_clamp of #388 gains two image_sample_d_cl_o samples, with the offsets (1, 2) and (-1, -2):

v_mov_b32 v4, 0x00000201
image_sample_d_cl_o v[12:15], v[4:11], s[4:11], s[12:15]
buffer_store_dword v12..v15, v1, s[0:3], 0 offen offset:64..76
v_mov_b32 v4, 0x00003e3f
image_sample_d_cl_o v[12:15], v[4:11], s[4:11], s[12:15]
buffer_store_dword v12..v15, v1, s[0:3], 0 offen offset:80..92
  • Each of the 32 threads reads the texel of level max(level of the derivatives, clamp) at its coordinates moved by the offset in that level, wrapped by the sampler.
  • Without the table row the test fails with unsupported MIMG opcode.

Not tested: a title, 16-bit addresses (A16).

Checklist

  • Based on current main; no other open PR implements the same functions (#226 adds other sample variants, not 0x33; it merges cleanly with this branch)
  • 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 (none added)
  • Generic behaviour, not specific to one title
  • Depends on: #388
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4719234143 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/389). Originally posted by [DotDebian](https://github.com/DotDebian) on 2026-10-02T17:08:11Z. --- ### What Decodes `image_sample_d_cl_o` (MIMG opcode `0x33`): a sample with explicit derivatives, an LOD clamp and a texel offset. - One row in the image opcode table. The opcode number is the GFX10 one of `IMAGE_SAMPLE_D_CL_O` in LLVM's `MIMGInstructions.td`, between `0x32` (`_d_o`) and `0x34` (`_l_o`), which the table already has. The address layout (offset, derivatives, coordinates, clamp) follows from the three existing flags; the decoder and the emitter are otherwise unchanged. - `tools/progress.py` counts `IMAGE_SAMPLE_D_CL_O` as a variant of `ImageSample`. This branch sits on #388 (an LOD clamp cannot be emitted without it). The change of this PR is the last commit. ### Tested Windows 11, MinGW-w64 GCC 15.2.0, NVIDIA GeForce RTX 5080. `ctest`: 109/109 pass. The execution test `agc_driver_image_sample_lod_clamp` of #388 gains two `image_sample_d_cl_o` samples, with the offsets (1, 2) and (-1, -2): ``` v_mov_b32 v4, 0x00000201 image_sample_d_cl_o v[12:15], v[4:11], s[4:11], s[12:15] buffer_store_dword v12..v15, v1, s[0:3], 0 offen offset:64..76 v_mov_b32 v4, 0x00003e3f image_sample_d_cl_o v[12:15], v[4:11], s[4:11], s[12:15] buffer_store_dword v12..v15, v1, s[0:3], 0 offen offset:80..92 ``` - Each of the 32 threads reads the texel of level `max(level of the derivatives, clamp)` at its coordinates moved by the offset in that level, wrapped by the sampler. - Without the table row the test fails with `unsupported MIMG opcode`. Not tested: a title, 16-bit addresses (A16). ### Checklist - [x] Based on current `main`; no other open PR implements the same functions (#226 adds other sample variants, not `0x33`; it merges cleanly with this branch) - [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 (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: #388 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-03 19:51:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-03T19:51:07Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#475 core/shader/recompiler/RdnaDecoder/src/RdnaImageOpDecoder.cpp L43
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5972883693 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/389#issuecomment-5972883693). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-03T19:51:07Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #475 | `core/shader/recompiler/RdnaDecoder/src/RdnaImageOpDecoder.cpp` [L43](https://github.com/boykopovar/AnyPS5/blob/1137cffb72781a2d5c45bbaa1f045468c1c1c81e/core/shader/recompiler/RdnaDecoder/src/RdnaImageOpDecoder.cpp#L43) | | |
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!389
No description provided.