feat(agc): implement 10_11_11 unorm color targets through 32-bit uint attachments #1485

Merged
Celegans12 merged 1 commit from upstream-pr/1485 into main 2026-10-10 05:58:55 +00:00
Celegans12 commented 2026-10-08 08:58:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-08T08:58:01Z.


What

Color targets with CB_COLOR_INFO format 6 (COLOR_10_11_11) and NUMBER_UNORM throw unsupported color format 6 number type 0 component swap 0; Vulkan has no unorm 11_11_10 format.

  • Such a target becomes an R32_UINT attachment in the layout of image format 30 (unorm11 R and G in bits 0-21, unorm10 B in 22-31; Mesa ac_formats.c, gfx10-rsrc.json), as #805 reads it.
  • The registered pixel shader (#639) packs each float MRT export like format-30 image stores (EmitFormatStoreComponent: nearest even, NaN and negatives to 0) behind spec constant ExportPackingBase + target; SpecializeFragmentOutputs makes a packed target's output the uint4 ValidateShaders requires. TechnicalDebt: the CB is assumed to round alike.
  • targetExportPacking is draw state: outside the static ABI key, inside the module key, the result memo, the draw key and the serialized request (version 14, after #1816's 13). Specialization failures are now rethrown instead of terminating inside std::call_once on MinGW.
  • Still throws: blending, partial RGB writes, UNORM16/SNORM16 exports, DCC, ROUND_MODE, component swaps, other number types.
  • PPSA26344 v1.008: the G-buffer pass writes slot 2 (0x5065bd0000, 3840x2160) this way; 79 skips in one run.
  • #1073 and #1736 edit the same ValidateShaders check; #423, #448 and #1442 change the request version lines; #1349 edits DecodeColorFormat and DecodeState, with no conflict beyond its own with main.

Tested

  • Windows 11, MinGW-w64 GCC 15.2.0, based on main f1451396: configure -DBUILD_TESTING=ON, full build, --target libs, ctest:
  • 489/489 tests pass (ctest --output-on-failure)
  • Linux (WSL Ubuntu 24.04, GCC 13.3, Mesa llvmpipe, upstream's job configuration), merged with main f1451396: 498/498 pass
  • New agc_driver_packed_unorm_color_target draws through the registered pixel shader (tiled and linear; 32_ABGR and FP16_ABGR; ties, NaN, infinities) and checks exact words. It fails with the packing in the static key (unregistered program is not a compute shader) or out of the module key.
  • unorm10_11_11TargetTests (agc_driver_graphics): one artifact, two specializations. agc_shader_memory: version 1-13 requests decode unpacked. None of the three builds on main.
  • Not tested: 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:4784340172 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1485). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-08T08:58:01Z. --- ### What Color targets with CB_COLOR_INFO format 6 (`COLOR_10_11_11`) and `NUMBER_UNORM` throw `unsupported color format 6 number type 0 component swap 0`; Vulkan has no unorm 11_11_10 format. - Such a target becomes an R32_UINT attachment in the layout of image format 30 (unorm11 R and G in bits 0-21, unorm10 B in 22-31; Mesa [ac_formats.c](https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/amd/common/ac_formats.c), [gfx10-rsrc.json](https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/amd/registers/gfx10-rsrc.json)), as #805 reads it. - The registered pixel shader (#639) packs each float MRT export like format-30 image stores (`EmitFormatStoreComponent`: nearest even, NaN and negatives to 0) behind spec constant `ExportPackingBase + target`; `SpecializeFragmentOutputs` makes a packed target's output the uint4 `ValidateShaders` requires. TechnicalDebt: the CB is assumed to round alike. - `targetExportPacking` is draw state: outside the static ABI key, inside the module key, the result memo, the draw key and the serialized request (version 14, after #1816's 13). Specialization failures are now rethrown instead of terminating inside `std::call_once` on MinGW. - **Still throws:** blending, partial RGB writes, UNORM16/SNORM16 exports, DCC, `ROUND_MODE`, component swaps, other number types. - PPSA26344 v1.008: the G-buffer pass writes slot 2 (0x5065bd0000, 3840x2160) this way; 79 skips in one run. - #1073 and #1736 edit the same `ValidateShaders` check; #423, #448 and #1442 change the request version lines; #1349 edits `DecodeColorFormat` and `DecodeState`, with no conflict beyond its own with `main`. ### Tested - Windows 11, MinGW-w64 GCC 15.2.0, based on `main` f1451396: configure `-DBUILD_TESTING=ON`, full build, `--target libs`, `ctest`: - 489/489 tests pass (`ctest --output-on-failure`) - Linux (WSL Ubuntu 24.04, GCC 13.3, Mesa llvmpipe, upstream's job configuration), merged with `main` f1451396: 498/498 pass - New `agc_driver_packed_unorm_color_target` draws through the registered pixel shader (tiled and linear; 32_ABGR and FP16_ABGR; ties, NaN, infinities) and checks exact words. It fails with the packing in the static key (`unregistered program is not a compute shader`) or out of the module key. - `unorm10_11_11TargetTests` (`agc_driver_graphics`): one artifact, two specializations. `agc_shader_memory`: version 1-13 requests decode unpacked. None of the three builds on `main`. - Not tested: 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-09 23:57:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T23:57:50Z.


Checked on current main: the only conflict was with #1073 in ShaderValidation.cpp (uintExport vs packed in the same check). I merged both conditions (a target expects u32x4 if either applies, each with its own message) and rebased. Build + ctest of libSceAgcDriver green (267/267); the new tests don't compile without the change and agc_driver_packed_unorm_color_target passes.

Unmodelled cases still throw and the CB-rounding assumption is recorded in TechnicalDebt. Merging once CI is green on the rebased head.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6091313297 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1485#issuecomment-6091313297). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-09T23:57:50Z. --- Checked on current `main`: the only conflict was with #1073 in `ShaderValidation.cpp` (`uintExport` vs `packed` in the same check). I merged both conditions (a target expects `u32x4` if either applies, each with its own message) and rebased. Build + ctest of libSceAgcDriver green (267/267); the new tests don't compile without the change and `agc_driver_packed_unorm_color_target` passes. Unmodelled cases still throw and the CB-rounding assumption is recorded in TechnicalDebt. Merging once CI is green on the rebased head.
github-actions[bot] commented 2026-10-10 01:56:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T01:56:00Z.


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
#1607 docs/dev/TechnicalDebt.md L332-333
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6092425675 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1485#issuecomment-6092425675). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-10T01:56:00Z. --- <!-- 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 | |---|---|---|---| | #1607 | `docs/dev/TechnicalDebt.md` [L332-333](https://github.com/boykopovar/AnyPS5/blob/6635c7abbf43dea92b6d0c67622a6f7f3bfbf31d/docs/dev/TechnicalDebt.md#L332-L333) | | |
adriadam10 commented 2026-10-10 05:58:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T05:58:52Z.


Checked on current main: build + ctest of libSceAgcDriver/libSceAgc green, the new tests don't compile without the change, agc_driver_packed_unorm_color_target draws through the registered pixel shader on lavapipe, unmodelled cases still throw, the CB-rounding assumption is in TechnicalDebt. Merging once the full Linux/Windows build (dispatched manually) is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6094433885 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1485#issuecomment-6094433885). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T05:58:52Z. --- Checked on current `main`: build + ctest of libSceAgcDriver/libSceAgc green, the new tests don't compile without the change, `agc_driver_packed_unorm_color_target` draws through the registered pixel shader on lavapipe, unmodelled cases still throw, the CB-rounding assumption is in TechnicalDebt. Merging once the full Linux/Windows build (dispatched manually) is green.
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!1485
No description provided.