feat(shader): implement MIMG PCK2/PCK4 loads as measured on hardware #1809
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1809"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T19:57:04Z.
What
Implements the four MIMG packed horizontal loads,
image_load[_mip]_pck2/pck4(opcodes 0x70, 0x71, 0x73, 0x74), as measured on hardware. The four stores (0x76, 0x77, 0x79, 0x7a) decode, so they count in the progress table, but throw at translation.#1314 was closed after a measurement where these loads only returned zeros. That measurement used data masks 0x3 and 0xf. The loads only return data with DMASK 0x1, in a single dword. Measured on RDNA2 (gfx1035) with the hardware oracle, against plain
image_load_pcks of the same texels on random memory, over x/y/mip edge rows and 9 widths:x & ~(N-1)on row y, concatenated (element k at bitk * texel bits) and zero-extendedx+N-1 >= width, ory >= height0 mismatches over 2,160 rows per format (12,960 for mip variants) across 20 opcode/format combinations: 8-bit UNORM/SNORM/UINT/SINT, 16-bit UNORM/UINT/SINT/FLOAT and RG8 UNORM/UINT/SINT. It's the same aligned window and all-or-nothing bound as BY2/BY4 (#1793), so this reuses that path.
imageBywithimagePacked, one dword.PackedImageTexelcan't rebuild their bits from the view, so they throw. Packed image modes whose texels can't fit are not generated.EmitByReadOp): concatenatesPackedImageTexelof each aligned texel into one dword, zero when out of range.Tested
Linux (CachyOS), on current
main.agc_driver_image_pck_npasses on RADV (gfx1035) and CI's lavapipe (Mesa 25.2.8): PCK2 R8/R16/RG8 and PCK4 R8, with and without mip, 32 lanes per run with x near both edges, x ≥ width, x = -1 and 2^31, y = height and -1, and mip = level count. It also checks the store opcodes, wider formats and non-identity swizzle throw.image_pck_nchecks decode, every refused mask and translation. Negative checks: dropping the x alignment fails atx 5, dropping the bound fails atx 60(width 61), and not shifting element k fails atx 0. Full ctest: 490/490.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T21:28:14Z.
Progress report (
4b6ab6b→57d4be3)📈 GPU shader instructions: 99.74% (+0.68%, +8 implemented instructions)
✅ 8 implemented
IMAGE_LOAD_MIP_PCK2IMAGE_LOAD_MIP_PCK4IMAGE_LOAD_PCK2IMAGE_LOAD_PCK4IMAGE_STORE_MIP_PCK2IMAGE_STORE_MIP_PCK4IMAGE_STORE_PCK2IMAGE_STORE_PCK4