feat(agc): sample and store unsigned 10_11_11 and 2_10_10_10 images #15450

Merged
AlexWhitehouse merged 1 commit from upstream-pr/15450 into main 2026-11-12 20:30:31 +00:00
AlexWhitehouse commented 2026-11-03 11:09:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AlexWhitehouse on 2026-11-03T11:09:30Z.


What

Supports guest image format codes 37 and 41 (unsigned 10_11_11, UNorm and UInt) and 44 and 48 (unsigned 2_10_10_10, UNorm and UInt) for sampling, loads and stores. Before this PR they were unsupported image formats.

Layout. Codes 37 and 41 have X, Y and Z fields 10, 11 and 11 bits wide at bits 0, 10 and 21. Codes 44 and 48 have X, Y, Z and W fields 2, 10, 10 and 10 bits wide at bits 0, 2, 12 and 22.

  • These come from Mesa's gfx10 tables (418c4cfa6708a0e0b1175e72fb8fd27d3ca1615a, src/amd/registers/gfx10-rsrc.json), whose names src/amd/common/gfx10_format_table.py reverses into little-endian component order.
  • AMD's RDNA 2 ISA guide, §8.2.8, Table 47 (printed pp. 78-79), lists 44 and 48 for images and buffers but omits 37 and 41, as it omits the existing 30 and 34. The debt entries record the omission.

Mapping.

  • The image views use R32_UINT, the same host format codes 30, 34, 36 and 43 already use. The shader unpacks the bitfields with the existing typed-buffer bitfield conversion.
  • UInt codes 41 and 48 keep exact integers. UNorm codes 37 and 44 divide each field by its maximum in the shader.
  • Guest swizzles are applied in the shader, and the host views keep identity swizzles.
  • UNorm 37 and 44 take on the existing converted-UNORM sampling limits:
    • Allowed: direct 2D and 2D-array views, LOD 0, equal point or bilinear min and mag filters, and wrap or clamp-to-edge.
    • Still thrown: other samples, gathers, LOD queries, reductions, unnormalized coordinates, D16 samples, and selecting the missing W of code 37.
  • D16 loads and stores of UNorm 37 and 44 take the converted-image D16 path #11580 added for 10_11_11 UNORM. This PR doesn't exercise that path for the new codes, and the debt entry says so.
  • Typed-buffer handling and render targets are unchanged.
  • Converted DCC clear codes 0001 and 1110 stay refused for the new codes, as for 30 and 34.

Debt. The docs/dev/debt/libSceAgcDriver.md and shader.md entries say that none of the four codes, nor their store rounding, is measured on AMD or PS5 hardware.

The progress scan's format coverage moves from sampled 81 to 85 and host 68 to 72, with typed buffer unchanged at 80.

Tested

  • agc_driver_image_unsigned_packed32_{37,41,44,48} (tests/execution/ImageConvertedUnorm.cpp). For each code, the test:

    • walks every bit of the 32-bit word, plus 0, all ones, and per-field boundaries (0, 1, max-1, max, and the two values around the midpoint);
    • loads with full and partial DMASK through XYZW, a reversed swizzle and X011;
    • takes point samples, plus bilinear samples for UNorm;
    • checks that selecting code 37's missing W is refused, as main does for 10_11_11. Following fedf3e91a7, it doesn't pin gathers, border sampling or D16 as refused;
    • stores through four passes (identity, reversed swizzle, and a partial write mask), comparing the guest bytes with guard bytes around the target.

    Integers and UNorm endpoints must be exact. UNorm fractions allow 3 ULP, and bilinear samples use the existing 1e-5 tolerance.

  • agc_driver_graphics (tests/TextureFormat.cpp): the converted DCC clear checks now include 37, 41, 44 and 48. This test runs against a mock Vulkan device, so it loads no validation layer.

  • Mutation checks: shifting the field offsets of 37 and of 44 each fails its test at the first affected bit. This was run on the first version; the conversion code is unchanged.

  • Required focused comparison: ctest -R "agc_driver_image_unsigned_packed32|agc_driver_image_converted_unorm|^agc_driver_graphics$" -V, on main (3c2af82080) and this PR (c652dd8e89). The main runs overlay main's six non-test source files onto this PR. Both runs used the same test sources and ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation.

    • NVIDIA RTX 3060, Windows 11 (driver 610.88): main passes 1/6.

      • agc_driver_graphics fails on unsupported guest texture format 37.
      • The four unsigned_packed32 tests fail on sampled image descriptor uses an unsupported format.

      This PR passes 6/6. The validation layer is confirmed loaded, and neither log has a missing-layer warning or a VUID- error. Before the rebase, on 4f41f4c375, a wider image and graphics run (74 tests) failed only those same five on main and passed all on this PR.

    • lavapipe, Ubuntu 26.04: main passes 1/6.

      • agc_driver_graphics fails on unsupported guest texture format 37.
      • The four unsigned_packed32 tests fail on sampled image descriptor uses an unsupported format.

      This PR passes 6/6. The validation layer is confirmed loaded, and neither log has a missing-layer warning or a VUID- error.

  • Same executable, other tests, with the same variables at c652dd8e89 and with main's six source files: agc_driver_image_packed16_storage_{133,134,136} and agc_driver_image_depth24_float pass on both GPUs. agc_driver_image_depth24 (added by #16294) passes on the RTX 3060, and on lavapipe it fails the same way with and without this PR (0x3effe004 for texel 0x007ff001).

  • Wider run on lavapipe at 596a855973 (on main 7960a0bcb2), with the same variables: every agc_driver_image_* test plus agc_driver_graphics (75 tests). 74 pass and agc_driver_image_sample_lod_clamp skips, because lavapipe has no VK_EXT_image_view_min_lod. The only VUID- errors are four VkSamplerCreateInfo address-mode IDs in agc_driver_image_gather_volume, which logs the same IDs with main's six source files.

  • History: first written on an older main (348d7f0d71). On the RTX 3060 then, main passed 1/6 and this change 6/6. When rebased, the 11_11_10 runtime-mode conditions follow current main, and the test drops the refusal checks fedf3e91a7 removed upstream. Rebased again onto 7960a0bcb2: DescriptorBindingBuilder.cpp keeps main's new 3D gather block, which refuses converted images, so a 3D gather of UNorm 37 or 44 throws. Rebased onto 3c2af82080: kFormatInfoTable grows from 83 entries (after #16294) to 87.

  • python3 tools/check_conventions.py --base origin/main: all conventions checks passed.

  • python3 tools/pr_overlap.py:

    • #14628 (Alex's format 135, 1_5_5_5 UNorm) edits the same test registration and debt lines. This PR goes after it: Depends on: #14628.
    • #14709 (akkadbakkad89, scaled formats) bumps the same kFormatInfoTable array size in RdnaDescriptorFormat.cpp; whichever merges second rebases that line.
    • Not compared: the tool couldn't compare about 45 PRs that conflict with main. None of their diffs touches the new formats or IsConvertedUnormTextureFormat.

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 under Silent stubs in their library's technical debt file
  • 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: #14628
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 3060, driver 610.88, Windows 11 (build 26300); Mesa lavapipe 26.0.8 (LLVM 21.1.8), Ubuntu 26.04
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5136178891 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15450). Originally posted by [AlexWhitehouse](https://github.com/AlexWhitehouse) on 2026-11-03T11:09:30Z. --- ### What Supports guest image format codes 37 and 41 (unsigned 10_11_11, UNorm and UInt) and 44 and 48 (unsigned 2_10_10_10, UNorm and UInt) for sampling, loads and stores. Before this PR they were unsupported image formats. **Layout.** Codes 37 and 41 have X, Y and Z fields 10, 11 and 11 bits wide at bits 0, 10 and 21. Codes 44 and 48 have X, Y, Z and W fields 2, 10, 10 and 10 bits wide at bits 0, 2, 12 and 22. - These come from Mesa's gfx10 tables (418c4cfa6708a0e0b1175e72fb8fd27d3ca1615a, `src/amd/registers/gfx10-rsrc.json`), whose names `src/amd/common/gfx10_format_table.py` reverses into little-endian component order. - AMD's RDNA 2 ISA guide, §8.2.8, Table 47 (printed pp. 78-79), lists 44 and 48 for images and buffers but omits 37 and 41, as it omits the existing 30 and 34. The debt entries record the omission. **Mapping.** - The image views use `R32_UINT`, the same host format codes 30, 34, 36 and 43 already use. The shader unpacks the bitfields with the existing typed-buffer bitfield conversion. - UInt codes 41 and 48 keep exact integers. UNorm codes 37 and 44 divide each field by its maximum in the shader. - Guest swizzles are applied in the shader, and the host views keep identity swizzles. - UNorm 37 and 44 take on the existing converted-UNORM sampling limits: - Allowed: direct 2D and 2D-array views, LOD 0, equal point or bilinear min and mag filters, and wrap or clamp-to-edge. - Still thrown: other samples, gathers, LOD queries, reductions, unnormalized coordinates, D16 samples, and selecting the missing W of code 37. - D16 loads and stores of UNorm 37 and 44 take the converted-image D16 path #11580 added for 10_11_11 UNORM. This PR doesn't exercise that path for the new codes, and the debt entry says so. - Typed-buffer handling and render targets are unchanged. - Converted DCC clear codes 0001 and 1110 stay refused for the new codes, as for 30 and 34. **Debt.** The `docs/dev/debt/libSceAgcDriver.md` and `shader.md` entries say that none of the four codes, nor their store rounding, is measured on AMD or PS5 hardware. The progress scan's format coverage moves from sampled 81 to 85 and host 68 to 72, with typed buffer unchanged at 80. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> - **`agc_driver_image_unsigned_packed32_{37,41,44,48}`** (`tests/execution/ImageConvertedUnorm.cpp`). For each code, the test: - walks every bit of the 32-bit word, plus 0, all ones, and per-field boundaries (0, 1, max-1, max, and the two values around the midpoint); - loads with full and partial DMASK through `XYZW`, a reversed swizzle and `X011`; - takes point samples, plus bilinear samples for UNorm; - checks that selecting code 37's missing W is refused, as `main` does for 10_11_11. Following fedf3e91a7, it doesn't pin gathers, border sampling or D16 as refused; - stores through four passes (identity, reversed swizzle, and a partial write mask), comparing the guest bytes with guard bytes around the target. Integers and UNorm endpoints must be exact. UNorm fractions allow 3 ULP, and bilinear samples use the existing 1e-5 tolerance. - **`agc_driver_graphics`** (`tests/TextureFormat.cpp`): the converted DCC clear checks now include 37, 41, 44 and 48. This test runs against a mock Vulkan device, so it loads no validation layer. - **Mutation checks:** shifting the field offsets of 37 and of 44 each fails its test at the first affected bit. This was run on the first version; the conversion code is unchanged. - **Required focused comparison:** `ctest -R "agc_driver_image_unsigned_packed32|agc_driver_image_converted_unorm|^agc_driver_graphics$" -V`, on `main` (3c2af82080) and this PR (c652dd8e89). The `main` runs overlay main's six non-test source files onto this PR. Both runs used the same test sources and `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`. - **NVIDIA RTX 3060, Windows 11 (driver 610.88):** main passes 1/6. - `agc_driver_graphics` fails on `unsupported guest texture format 37`. - The four `unsigned_packed32` tests fail on `sampled image descriptor uses an unsupported format`. This PR passes 6/6. The validation layer is confirmed loaded, and neither log has a missing-layer warning or a `VUID-` error. Before the rebase, on 4f41f4c375, a wider image and graphics run (74 tests) failed only those same five on main and passed all on this PR. - **lavapipe, Ubuntu 26.04:** main passes 1/6. - `agc_driver_graphics` fails on `unsupported guest texture format 37`. - The four `unsigned_packed32` tests fail on `sampled image descriptor uses an unsupported format`. This PR passes 6/6. The validation layer is confirmed loaded, and neither log has a missing-layer warning or a `VUID-` error. - **Same executable, other tests**, with the same variables at c652dd8e89 and with main's six source files: `agc_driver_image_packed16_storage_{133,134,136}` and `agc_driver_image_depth24_float` pass on both GPUs. `agc_driver_image_depth24` (added by #16294) passes on the RTX 3060, and on lavapipe it fails the same way with and without this PR (`0x3effe004` for texel `0x007ff001`). - **Wider run on lavapipe** at 596a855973 (on `main` 7960a0bcb2), with the same variables: every `agc_driver_image_*` test plus `agc_driver_graphics` (75 tests). 74 pass and `agc_driver_image_sample_lod_clamp` skips, because lavapipe has no `VK_EXT_image_view_min_lod`. The only `VUID-` errors are four `VkSamplerCreateInfo` address-mode IDs in `agc_driver_image_gather_volume`, which logs the same IDs with main's six source files. - **History:** first written on an older `main` (348d7f0d71). On the RTX 3060 then, main passed 1/6 and this change 6/6. When rebased, the 11_11_10 runtime-mode conditions follow current `main`, and the test drops the refusal checks fedf3e91a7 removed upstream. Rebased again onto 7960a0bcb2: `DescriptorBindingBuilder.cpp` keeps main's new 3D gather block, which refuses converted images, so a 3D gather of UNorm 37 or 44 throws. Rebased onto 3c2af82080: `kFormatInfoTable` grows from 83 entries (after #16294) to 87. - `python3 tools/check_conventions.py --base origin/main`: all conventions checks passed. - **`python3 tools/pr_overlap.py`:** - **#14628** (Alex's format 135, 1_5_5_5 UNorm) edits the same test registration and debt lines. This PR goes after it: `Depends on: #14628`. - **#14709** (akkadbakkad89, scaled formats) bumps the same `kFormatInfoTable` array size in `RdnaDescriptorFormat.cpp`; whichever merges second rebases that line. - **Not compared:** the tool couldn't compare about 45 PRs that conflict with `main`. None of their diffs touches the new formats or `IsConvertedUnormTextureFormat`. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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: #14628 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 3060, driver 610.88, Windows 11 (build 26300); Mesa lavapipe 26.0.8 (LLVM 21.1.8), Ubuntu 26.04 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!15450
No description provided.