feat(agc): average the samples of an 11_11_10 float CB resolve #23225

Merged
Callimann8 merged 3 commits from upstream-pr/23225 into main 2026-11-19 22:20:29 +00:00
Callimann8 commented 2026-11-18 20:31:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Callimann8 on 2026-11-18T20:31:55Z.


What

PPSA12361 stops on AGC graphics: CB resolves of 11_11_10 float color targets are unsupported (#11362). The target is an R32_UINT image, and a subpass resolve takes one sample of an integer format, so the resolve was refused.

This resolves a multisampled 11_11_10 float source with a fragment pass instead. It reuses FirstSampleCopy with a new PACKED_SAMPLES variant of FirstSample.frag. For each channel (10 bits at 0, 11 at 10, 11 at 21, the export layout) the pass sums the samples exactly in 64-bit integer units of the smallest subnormal step, divides by the sample count with a shift, and truncates the quotient back to the small float. Any NaN sample gives the canonical NaN (0x7e0 for an 11-bit channel, 0x3f0 for the 10-bit one), ahead of infinity, and an infinite sample gives infinity. This matches the gfx1036 measurements in #11362. RecordInto draws into the destination's attachment view, through the recorder or a batch. The decoder only accepts it when the source and destination both have the 11_11_10 float layout with the same component order, since 11_11_10 float, 10_11_11 unorm and plain 32-bit uint targets all decode to VK_FORMAT_R32_UINT. The refusals for 10_11_11 unorm and 4_4_4_4 resolves stay.

The debt entry for the 11_11_10 float CB resolve records that only gfx1036 was measured.

Tested

Linux (Ubuntu 24.04), GCC 13, Release, lavapipe (llvmpipe, Mesa 25.2.8). Not tested on a title.

  • agc_driver_packed_float_color_target_tests: new cases draw a different value into each sample of an 11_11_10 float target, resolve it, and check every texel. A 4-sample case covers a red average halfway between two steps (truncated, not rounded to even) and a subnormal blue average. A 4-sample case with NaN and infinite samples expects the canonical NaN ahead of infinity; the earlier float32 version of this pass gives 0xfe1f03f8 instead of 0xfc1f03f0 there. An 8-sample case uses values whose float32 sum rounds up across a step (0x730) while the exact sum gives 0x72f; lavapipe has no 8-sample color attachments, so it is skipped there. lavapipe has no 2-sample color attachments either, so the other cases use 4 samples. With the averaging pass turned off, the subpass resolve gives 0x041081e1 instead of 0x030fc1e1.
  • agc_driver_graphics_tests: the decode test now expects the 11_11_10 float resolve to decode, and the 10_11_11 unorm one to still be refused. New cases refuse a resolve between an 11_11_10 float target and a 10_11_11 unorm one in either direction, and between two 11_11_10 float targets with different component orders; without the layout check they decode. It passes.
  • With VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, the loader inserted the layer. The only VUID reported is VUID-VkDeviceCreateInfo-pNext-pNext, from the older installed layer (1.3.275). No VUID comes from the resolve.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: none
  • Fixes: Fixes #11362
  • Unblocks: PPSA12361 (#11362 reports that it then stops on blending into an 11_11_10 float color target)
  • GPUs tested: llvmpipe (lavapipe, Mesa 25.2.8), Linux; reviewers ran the earlier revision on RTX 2060, RTX 2070 SUPER and RADV
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5383597909 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23225). Originally posted by [Callimann8](https://github.com/Callimann8) on 2026-11-18T20:31:55Z. --- ### What PPSA12361 stops on `AGC graphics: CB resolves of 11_11_10 float color targets are unsupported` (#11362). The target is an R32_UINT image, and a subpass resolve takes one sample of an integer format, so the resolve was refused. This resolves a multisampled 11_11_10 float source with a fragment pass instead. It reuses `FirstSampleCopy` with a new `PACKED_SAMPLES` variant of `FirstSample.frag`. For each channel (10 bits at 0, 11 at 10, 11 at 21, the export layout) the pass sums the samples exactly in 64-bit integer units of the smallest subnormal step, divides by the sample count with a shift, and truncates the quotient back to the small float. Any NaN sample gives the canonical NaN (`0x7e0` for an 11-bit channel, `0x3f0` for the 10-bit one), ahead of infinity, and an infinite sample gives infinity. This matches the gfx1036 measurements in #11362. `RecordInto` draws into the destination's attachment view, through the recorder or a batch. The decoder only accepts it when the source and destination both have the 11_11_10 float layout with the same component order, since 11_11_10 float, 10_11_11 unorm and plain 32-bit uint targets all decode to `VK_FORMAT_R32_UINT`. The refusals for 10_11_11 unorm and 4_4_4_4 resolves stay. The debt entry for the 11_11_10 float CB resolve records that only gfx1036 was measured. ### Tested Linux (Ubuntu 24.04), GCC 13, Release, lavapipe (llvmpipe, Mesa 25.2.8). Not tested on a title. - `agc_driver_packed_float_color_target_tests`: new cases draw a different value into each sample of an 11_11_10 float target, resolve it, and check every texel. A 4-sample case covers a red average halfway between two steps (truncated, not rounded to even) and a subnormal blue average. A 4-sample case with NaN and infinite samples expects the canonical NaN ahead of infinity; the earlier float32 version of this pass gives `0xfe1f03f8` instead of `0xfc1f03f0` there. An 8-sample case uses values whose float32 sum rounds up across a step (`0x730`) while the exact sum gives `0x72f`; lavapipe has no 8-sample color attachments, so it is skipped there. lavapipe has no 2-sample color attachments either, so the other cases use 4 samples. With the averaging pass turned off, the subpass resolve gives `0x041081e1` instead of `0x030fc1e1`. - `agc_driver_graphics_tests`: the decode test now expects the 11_11_10 float resolve to decode, and the 10_11_11 unorm one to still be refused. New cases refuse a resolve between an 11_11_10 float target and a 10_11_11 unorm one in either direction, and between two 11_11_10 float targets with different component orders; without the layout check they decode. It passes. - With `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, the loader inserted the layer. The only VUID reported is `VUID-VkDeviceCreateInfo-pNext-pNext`, from the older installed layer (1.3.275). No VUID comes from the resolve. ### 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) and the licence notice of code adapted from upstream (see AGENTS.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: none - [x] Fixes: Fixes #11362 - [x] Unblocks: PPSA12361 (#11362 reports that it then stops on blending into an 11_11_10 float color target) - [x] GPUs tested: llvmpipe (lavapipe, Mesa 25.2.8), Linux; reviewers ran the earlier revision on RTX 2060, RTX 2070 SUPER and RADV - [x] AI-assisted: yes
MarcZX10 commented 2026-11-18 22:02:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T22:02:14Z.

Review: COMMENTED


Reviewed — no blocking findings

The inspected code adds a shader resolve for 11_11_10 float targets, and I found no concrete blocking defect; runtime checks were not run.

What I ran

Read the prepared diff at head 759c274562b78e606d243020fb2eb347ba9941b7, the description, commits, and manifest. Read changed code and relevant context through repo_read.py. No commands or tests were run.

Results

Check Result Note
Diff and changed code passed Inspected relevant implementation and test changes
Runtime tests not run No command execution available
Validation layer not run Author-reported only

Findings

Blocking

None identified in the code inspected.

Non-blocking

Runtime behavior on the stated lavapipe setup and other GPUs remains unconfirmed by this review.

Not verified

I read the changed sections of all listed files, including the changed lines in tests/Graphics.cpp via the pinned reader. I did not read complete large files or run tests, builds, or validation. The PR description’s test results are author-reported, not independently verified.

To get this to a good state

Nothing is required. Optional: run the reported execution and graphics tests on the exact head and attach the results.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5965885862 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23225#pullrequestreview-5965885862). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-18T22:02:14Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The inspected code adds a shader resolve for 11_11_10 float targets, and I found no concrete blocking defect; runtime checks were not run. ## What I ran Read the prepared diff at head `759c274562b78e606d243020fb2eb347ba9941b7`, the description, commits, and manifest. Read changed code and relevant context through `repo_read.py`. No commands or tests were run. ## Results | Check | Result | Note | |---|---|---| | Diff and changed code | passed | Inspected relevant implementation and test changes | | Runtime tests | not run | No command execution available | | Validation layer | not run | Author-reported only | ## Findings ### Blocking None identified in the code inspected. ### Non-blocking Runtime behavior on the stated lavapipe setup and other GPUs remains unconfirmed by this review. ## Not verified I read the changed sections of all listed files, including the changed lines in `tests/Graphics.cpp` via the pinned reader. I did not read complete large files or run tests, builds, or validation. The PR description’s test results are author-reported, not independently verified. ## To get this to a good state Nothing is required. Optional: run the reported execution and graphics tests on the exact head and attach the results.
thalesdot1dot1 commented 2026-11-19 02:35:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by thalesdot1dot1 on 2026-11-19T02:35:17Z.

Review: COMMENTED


Reviewed 759c274562. I left one finding about the guest color layout accepted by the packed resolve. This was a static review. AI-assisted with Codex.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5968468385 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23225#pullrequestreview-5968468385). Originally posted by [thalesdot1dot1](https://github.com/thalesdot1dot1) on 2026-11-19T02:35:17Z. **Review:** COMMENTED --- Reviewed `759c274562`. I left one finding about the guest color layout accepted by the packed resolve. This was a static review. AI-assisted with Codex.
MarcZX10 commented 2026-11-19 07:28:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T07:28:16Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this change; the reviewed code supports the documented resolve behavior, though test execution and one changed file remain unverified.

What I ran

Reviewed head 65fe89b79025d5b237d8bc514f06209826ab030a using the prepared diff and repo_read.py. No build or tests were run. The PR description reports Linux/lavapipe tests; those results were not independently run here.

Results

Check Result Note
Diff and changed implementation passed Read relevant implementation and shader files
Reported tests not run Author-reported only
Changed test source not run One file read through the reader

Findings

Blocking

None.

Non-blocking

None.

Not verified

core/libs/prx/libSceAgcDriver/tests/Graphics.cpp is excluded from the prepared bundle, but its changed lines were read through the repository reader. All files marked included: true in the manifest were read; the changed test file was inspected only at its changed range. The complete test suite and console/title behavior were not run. No build or validation-layer checks were run.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5970950477 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23225#pullrequestreview-5970950477). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-19T07:28:16Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this change; the reviewed code supports the documented resolve behavior, though test execution and one changed file remain unverified. ## What I ran Reviewed head `65fe89b79025d5b237d8bc514f06209826ab030a` using the prepared diff and `repo_read.py`. No build or tests were run. The PR description reports Linux/lavapipe tests; those results were not independently run here. ## Results | Check | Result | Note | |---|---|---| | Diff and changed implementation | passed | Read relevant implementation and shader files | | Reported tests | not run | Author-reported only | | Changed test source | not run | One file read through the reader | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` is excluded from the prepared bundle, but its changed lines were read through the repository reader. All files marked `included: true` in the manifest were read; the changed test file was inspected only at its changed range. The complete test suite and console/title behavior were not run. No build or validation-layer checks were run. ## To get this to a good state Nothing is required.
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!23225
No description provided.