fix(agc): take a CB resolve's sample count from its source target #2121

Merged
Raghav314 merged 1 commit from upstream-pr/2121 into main 2026-10-13 04:00:06 +00:00
Raghav314 commented 2026-10-09 09:25:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Raghav314 on 2026-10-09T09:25:44Z.


What

Follow-up to #419, as discussed there. DecodeColorMetadataPass counted a draw with CB_COLOR_CONTROL in resolve mode as a CB resolve only when PA_SC_AA_CONFIG had a sample count, and required the source target to match it. A title that resolves with the rasterizer single-sample fell through to the normal draw path, which refuses it with "only normal color rendering with copy ROP is supported (CB_COLOR_CONTROL 0x00cc0030, mode resolve)".

A color target's own sample count is CB_COLOR_ATTRIB.NUM_SAMPLES, separate from the rasterizer's. radeonsi itself writes PA_SC_AA_CONFIG = 0 for a multisampled framebuffer when rasterizer multisampling and line smoothing are off (si_emit_msaa_config).

  • A resolve-mode draw is a CB resolve when either the rasterizer or CB0 is multisampled, and it takes its sample count from CB0.
  • When the rasterizer is multisampled, the source still has to match it, as before.
  • A resolve-mode draw where neither is multisampled is left to the draw path, as before (the existing test for that is unchanged).
  • TechnicalDebt gets an entry, since the rule is inferred from the title and radeonsi rather than from register documentation.

PPSA36082

Hades II resolves its 4x targets with no sample count in PA_SC_AA_CONFIG. On main f1451396 with the fixes it needs to get that far plus #419, its resolve draws were skipped with the error above. With this change they go through as CB resolves. (It also needs a fix for its non-standard 4x sample positions to render correctly, which is a separate follow-up.)

Tested

Linux (CachyOS), x86-64, GCC, 7800X3D / RTX 4090.

  • agc_driver_graphics (new checks):
    • The existing 2x resolve with PA_SC_AA_CONFIG cleared still decodes as a resolve, with its 2 samples taken from CB0.
    • A 4x rasterizer with a 2x source is still refused ("differs from the rasterizer's").
  • Mutation: going back to "resolve only when the rasterizer is multisampled" fails the new check.
  • The linux job of current build.yml run locally on this head, rebased on main d1fd9372 (SPIRV tools on, test registration check, build, libs, ctest): 1002/1004. guest_kernel_fcntl failed only because my script ran ctest with no terminal on stdin; it passes when run from a terminal. agc_driver_pixel_lds hung the GPU once (Xid 109). It is the intermittent hang I also see on other heads, doesn't touch CB resolves, and passed in the next run on the same machine.

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:4798570843 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2121). Originally posted by [Raghav314](https://github.com/Raghav314) on 2026-10-09T09:25:44Z. --- ### What Follow-up to #419, as discussed there. `DecodeColorMetadataPass` counted a draw with `CB_COLOR_CONTROL` in resolve mode as a CB resolve only when `PA_SC_AA_CONFIG` had a sample count, and required the source target to match it. A title that resolves with the rasterizer single-sample fell through to the normal draw path, which refuses it with "only normal color rendering with copy ROP is supported (CB_COLOR_CONTROL 0x00cc0030, mode resolve)". A color target's own sample count is `CB_COLOR_ATTRIB.NUM_SAMPLES`, separate from the rasterizer's. radeonsi itself writes `PA_SC_AA_CONFIG` = 0 for a multisampled framebuffer when rasterizer multisampling and line smoothing are off (`si_emit_msaa_config`). - A resolve-mode draw is a CB resolve when either the rasterizer or CB0 is multisampled, and it takes its sample count from CB0. - When the rasterizer is multisampled, the source still has to match it, as before. - A resolve-mode draw where neither is multisampled is left to the draw path, as before (the existing test for that is unchanged). - TechnicalDebt gets an entry, since the rule is inferred from the title and radeonsi rather than from register documentation. ### PPSA36082 Hades II resolves its 4x targets with no sample count in `PA_SC_AA_CONFIG`. On main f1451396 with the fixes it needs to get that far plus #419, its resolve draws were skipped with the error above. With this change they go through as CB resolves. (It also needs a fix for its non-standard 4x sample positions to render correctly, which is a separate follow-up.) ### Tested Linux (CachyOS), x86-64, GCC, 7800X3D / RTX 4090. - `agc_driver_graphics` (new checks): - The existing 2x resolve with `PA_SC_AA_CONFIG` cleared still decodes as a resolve, with its 2 samples taken from CB0. - A 4x rasterizer with a 2x source is still refused ("differs from the rasterizer's"). - Mutation: going back to "resolve only when the rasterizer is multisampled" fails the new check. - The linux job of current `build.yml` run locally on this head, rebased on main d1fd9372 (SPIRV tools on, test registration check, build, libs, ctest): 1002/1004. `guest_kernel_fcntl` failed only because my script ran ctest with no terminal on stdin; it passes when run from a terminal. `agc_driver_pixel_lds` hung the GPU once (Xid 109). It is the intermittent hang I also see on other heads, doesn't touch CB resolves, and passed in the next run on the same machine. ### 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
Mouhand-Kaddo commented 2026-10-10 10:05:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-10T10:05:32Z.


Additional platform validation on standalone PR head 3dc5175ec0000311e11ac00f2b7fd26156b87d73:

Windows: passed — Windows 11, supported WinLibs GCC 15.2.0 UCRT/POSIX/SEH r7; CMake 4.3.1 / Ninja.

Release / BUILD_TESTING=ON: built the selected test targets; 1 CTest cases, 0 failures, 0 CTest skips.

Tests: agc_driver_graphics.

Reproduce after building the test targets: ctest --test-dir <build> --verbose --no-tests=error --timeout 30 -R "^agc_driver_(graphics|cb_resolve)$".

Vulkan: native AMD RX 6900 XT, driver 32.0.21045.5002.

Integration limitation: a local merge against main 948a526c2 has source conflicts; these results validate the standalone PR head, not a resolved merge.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6096397410 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2121#issuecomment-6096397410). Originally posted by [Mouhand-Kaddo](https://github.com/Mouhand-Kaddo) on 2026-10-10T10:05:32Z. --- <!-- anyps5-platform-validation:3dc5175ec0000311e11ac00f2b7fd26156b87d73 --> Additional platform validation on standalone PR head `3dc5175ec0000311e11ac00f2b7fd26156b87d73`: **Windows: passed** — Windows 11, supported WinLibs GCC 15.2.0 UCRT/POSIX/SEH r7; CMake 4.3.1 / Ninja. Release / `BUILD_TESTING=ON`: built the selected test targets; 1 CTest cases, 0 failures, 0 CTest skips. Tests: `agc_driver_graphics`. Reproduce after building the test targets: `ctest --test-dir <build> --verbose --no-tests=error --timeout 30 -R "^agc_driver_(graphics|cb_resolve)$"`. Vulkan: native AMD RX 6900 XT, driver 32.0.21045.5002. Integration limitation: a local merge against main `948a526c2` has source conflicts; these results validate the standalone PR head, not a resolved merge.
KingDarkHN commented 2026-10-12 13:59:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by KingDarkHN on 2026-10-12T13:59:47Z.


Confirmed needed: Fallen Legion (PPSA07645) issues a mode-3 CB resolve while CB_AA_CONFIG (0x2f8) reports a single sample, so DecodeColorMetadataPass does not treat it as a resolve and the draw is rejected with:

AGC graphics: only normal color rendering with copy ROP is supported (CB_COLOR_CONTROL 0x00cc0030, mode resolve)

Taking the sample count from the resolve source target (this PR) unblocks it. Two further MSAA-guard findings are on #1189. Repro: run app.elf from a standard PPSA07645 layout.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6125802431 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2121#issuecomment-6125802431). Originally posted by [KingDarkHN](https://github.com/KingDarkHN) on 2026-10-12T13:59:47Z. --- Confirmed needed: **Fallen Legion (PPSA07645)** issues a mode-3 CB resolve while `CB_AA_CONFIG` (0x2f8) reports a single sample, so `DecodeColorMetadataPass` does not treat it as a resolve and the draw is rejected with: ``` AGC graphics: only normal color rendering with copy ROP is supported (CB_COLOR_CONTROL 0x00cc0030, mode resolve) ``` Taking the sample count from the resolve **source target** (this PR) unblocks it. Two further MSAA-guard findings are on #1189. Repro: run `app.elf` from a standard PPSA07645 layout.
oneandonlydean commented 2026-10-13 03:25:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T03:25:31Z.


Rebased onto main myself (one conflict, the debt line next to #4199's entry; both kept). Build and ctest pass on d57f9cfb.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6137510064 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2121#issuecomment-6137510064). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T03:25:31Z. --- Rebased onto main myself (one conflict, the debt line next to #4199's entry; both kept). Build and ctest pass on d57f9cfb.
github-actions[bot] commented 2026-10-13 03:40:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T03:40:38Z.


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
#4767 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp L1105-1107
#4861 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp L1109-1110
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6137690878 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2121#issuecomment-6137690878). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-13T03:40:38Z. --- <!-- 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 | |---|---|---|---| | #4767 | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` [L1105-1107](https://github.com/boykopovar/AnyPS5/blob/6124bf063f6348e4451ad0b9c67f82acec5bc1c2/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp#L1105-L1107) | | | | #4861 | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` [L1109-1110](https://github.com/boykopovar/AnyPS5/blob/6124bf063f6348e4451ad0b9c67f82acec5bc1c2/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp#L1109-L1110) | | |
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!2121
No description provided.