feat(agc): implement 10_11_11 unorm images through 32-bit uint views #805

Merged
Celegans12 merged 1 commit from upstream-pr/805 into main 2026-10-07 07:00:03 +00:00
Celegans12 commented 2026-10-06 05:33:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-06T05:33:38Z.


What

GFX10 format 30 (10_11_11_UNORM) T#s throw at decode (... image descriptor uses an unsupported format); Vulkan has no such format.

  • Layout (Mesa gfx10-rsrc.json, gfx10_format_table.py): unorm11 X and Y in bits 0-21, unorm10 Z in bits 22-31.
  • Format 30 takes format 34's R32_UINT route; each field is converted by the unorm buffer helpers (NormalizeFormatComponent, EmitFormatStoreComponent), assuming images round like buffers; DST_SEL 1 reads 1.0f.
  • Converted textures get an identity view, as the shader applies DST_SEL; format-34 views whose X selector was not X lost the dword.
  • Still throws: samples, gathers, LOD queries, 16-bit data, DST_SEL W, DCC clear codes 0001/1110 of formats 30 and 34, _pck, atomics, comparison sampling, render targets; two TechnicalDebt lines.
  • PPSA26344 v1.008: shaders 0x8000265d00 and 0x80003cfa00 image_load/image_store a 3840x2160 format-30 T#.
  • #639 makes DST_SEL a runtime swizzle, conflicting in UnpackImageTexel; the later PR carries the 1.0f constant and W check over. #757, #758 and #759 edit neighbouring emitter and ShaderResources.cpp lines; no conflict. #799 adds lines below the resolveImageBinding view line; no conflict. #293 adds lines to all three functions with a view line; no conflict. #788 edits the readDccKeys call above the DCC throw; no conflict. #546 changes the NormalizeFormatComponent rounding these loads reuse.

Tested

  • Windows 11, MinGW-w64 GCC 15.2.0, based on main e289b56e: configure -DBUILD_TESTING=ON, full build, --target libs, ctest:
  • 366/366 tests pass (ctest --output-on-failure)
  • Same build on lavapipe (Mesa 26.2.4 llvmpipe, 8-wide subgroups, VK_DRIVER_FILES): 365/365 pass; agc_driver_flat_store is left out there because it takes several minutes on Windows llvmpipe
  • New agc_driver_image_converted_unorm: every field value under four DST_SELs, a load-store round trip, 11 stored values (tie, +inf, NaN, denormal), format 34 under Y X Z 1 and seven throws; fails on main, and Z Y X 1 and the format-34 row fail without the identity view.
  • NVIDIA 610.62's OpFDiv is 1 ULP off for 66 of 6144 loaded values (lavapipe: none), so loads allow Vulkan's bound.
  • agc_driver_graphics: format 30, every remapped format and the converted DCC clear codes; fails on main.
  • PPSA26344 v1.008 (with #799): no format-30 throws; 0x8000265d00 now stops at an unnormalized S# used with a texel offset (image_sample_lz_o); with that dispatch skipped, 0x80003cfa00 dispatches without errors.
  • Not tested: Linux (CI), console behaviour.

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 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
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4754589212 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/805). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-06T05:33:38Z. --- ### What GFX10 format 30 (`10_11_11_UNORM`) T#s throw at decode (`... image descriptor uses an unsupported format`); Vulkan has no such format. - **Layout** (Mesa `gfx10-rsrc.json`, `gfx10_format_table.py`): unorm11 X and Y in bits 0-21, unorm10 Z in bits 22-31. - Format 30 takes format 34's R32_UINT route; each field is converted by the unorm buffer helpers (`NormalizeFormatComponent`, `EmitFormatStoreComponent`), assuming images round like buffers; DST_SEL 1 reads 1.0f. - Converted textures get an identity view, as the shader applies DST_SEL; format-34 views whose X selector was not X lost the dword. - **Still throws:** samples, gathers, LOD queries, 16-bit data, DST_SEL W, DCC clear codes 0001/1110 of formats 30 and 34, `_pck`, atomics, comparison sampling, render targets; two TechnicalDebt lines. - PPSA26344 v1.008: shaders 0x8000265d00 and 0x80003cfa00 `image_load`/`image_store` a 3840x2160 format-30 T#. - #639 makes DST_SEL a runtime swizzle, conflicting in `UnpackImageTexel`; the later PR carries the 1.0f constant and W check over. #757, #758 and #759 edit neighbouring emitter and `ShaderResources.cpp` lines; no conflict. #799 adds lines below the `resolveImageBinding` view line; no conflict. #293 adds lines to all three functions with a view line; no conflict. #788 edits the `readDccKeys` call above the DCC throw; no conflict. #546 changes the `NormalizeFormatComponent` rounding these loads reuse. ### Tested - Windows 11, MinGW-w64 GCC 15.2.0, based on `main` e289b56e: configure `-DBUILD_TESTING=ON`, full build, `--target libs`, `ctest`: - 366/366 tests pass (`ctest --output-on-failure`) - Same build on lavapipe (Mesa 26.2.4 llvmpipe, 8-wide subgroups, `VK_DRIVER_FILES`): 365/365 pass; `agc_driver_flat_store` is left out there because it takes several minutes on Windows llvmpipe - New `agc_driver_image_converted_unorm`: every field value under four DST_SELs, a load-store round trip, 11 stored values (tie, +inf, NaN, denormal), format 34 under Y X Z 1 and seven throws; fails on `main`, and Z Y X 1 and the format-34 row fail without the identity view. - NVIDIA 610.62's `OpFDiv` is 1 ULP off for 66 of 6144 loaded values (lavapipe: none), so loads allow Vulkan's bound. - `agc_driver_graphics`: format 30, every remapped format and the converted DCC clear codes; fails on `main`. - PPSA26344 v1.008 (with #799): no format-30 throws; 0x8000265d00 now stops at an unnormalized S# used with a texel offset (`image_sample_lz_o`); with that dispatch skipped, 0x80003cfa00 dispatches without errors. - Not tested: Linux (CI), console behaviour. ### Checklist - [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 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 - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
adriadam10 commented 2026-10-07 07:00:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-07T07:00:00Z.


Checked on the HW oracle (gfx1035): image_load of every 11/11/10-bit field value matches field / (2^n - 1) correctly rounded, image_store matches RNE with NaN/negatives to 0 on 116 rows (±0, ±1, NaN, ±Inf, denormal, near-ties), DST_SEL 0/1 as implemented. Build + ctest green merged onto main, new tests fail without the change, passes on CI's lavapipe (0.3 s). Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6032741081 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/805#issuecomment-6032741081). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-07T07:00:00Z. --- Checked on the HW oracle (gfx1035): `image_load` of every 11/11/10-bit field value matches field / (2^n - 1) correctly rounded, `image_store` matches RNE with NaN/negatives to 0 on 116 rows (±0, ±1, NaN, ±Inf, denormal, near-ties), DST_SEL 0/1 as implemented. Build + ctest green merged onto main, new tests fail without the change, passes on CI's lavapipe (0.3 s). Merging.
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!805
No description provided.