Skip to content

feat(shader): decode image_sample_d_cl_o - #389

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
DotDebian:feat/mimg-sample-d-cl-o
Oct 4, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
DotDebian:feat/mimg-sample-d-cl-o

Conversation

@DotDebian

Copy link
Copy Markdown
Contributor

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

🤖 Generated with Claude Code

DotDebian and others added 2 commits October 2, 2026 19:03
…ResourceMinLod

The LOD clamp of an image sample looked for the MinLod capability in the
emitter's own requirement list, which nothing fills, so every sample with
a clamp failed to compile on every device. The check now reads the
capabilities of the target, and a sample that takes the MinLod operand
declares the capability in its module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MIMG opcode 0x33 samples with explicit derivatives, an LOD clamp and a
texel offset. The three address flags already exist; only the opcode was
missing from the decoder table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added shader core/shader agc libSceAgc* labels Oct 2, 2026
@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

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

@oneandonlydean
oneandonlydean merged commit ad473fa into boykopovar:main Oct 4, 2026
3 checks passed
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.

2 participants