fix(agc): import exact sRGB multisampled DCC clears #11704

Merged
JJenkx merged 3 commits from upstream-pr/11704 into main 2026-10-28 04:10:37 +00:00
JJenkx commented 2026-10-27 04:15:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-27T04:15:27Z.


What

A uniform DCC fast clear of a multisampled sRGB attachment reaches ClearColorForTexel, which has no sRGB layout, and throws even for all-zero texels. Bendy PPSA27624 hits this on an 8-sample R8G8B8A8_SRGB target.

For a repeated 32-bit pattern, let the existing MultisampledFillClearColor conversion handle the exact clear when the ordinary texel conversion cannot. That helper accepts only RGB endpoints 0/1 for sRGB; unsupported values retain the original refusal. Non-repeated and non-sRGB patterns retain their existing conversion. No metadata key interpretation or shader semantics change.

The regression checks returned clear components and actual initial GPU imports/resolves for RGBA/BGRA sRGB, keys00/40/80/c0, both alpha placements and 2/4/8 samples. Source bytes start as a non-clear sentinel; a zero-sample-mask draw leaves all samples undrawn, then every resolved texel must match the encoded DCC endpoint. Existing RGBA16F DCC tests remain controls.

Tested

Independent Linux validation by jotitadev, main a8bc4474c versus head bde84e528 merged onto it: RTX3070 / driver595.99.02 reproduces the four expected failures before the production fix and passes7/7 afterward; lavapipe / Mesa26.0.3 reproduces the supported failures and passes5 with the two unsupported2x cases skipped. All four runs report zero VUIDs. The wider AGC suite reports1045/1045 on RTX3070; lavapipe1044/1045 has the same agc_driver_multisample_retirement failure as main (#9455). These are the contributor's results, separate from the AMD runs below.

Arch Linux; AMD Radeon RX 6650 XT (RADV NAVI23), Mesa 26.2.4-1. Main b986c11a344 plus only the final regressions (f55badfb9659): the state and all three sRGB GPU groups fail at the same exact-clear guard; existing 2x/4x/8x DCC controls pass (3/7). The final candidate bde84e5289a6 passes 7/7. Both arms use required Vulkan, disabled shader caches and actual Khronos validation: six layer insertions, zero VUIDs, no missing layers or skipped tests.

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 \
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
ctest --test-dir build -R '^(agc_driver_msaa_dcc_state|agc_driver_msaa_dcc_clear_[248]|agc_driver_msaa_dcc_srgb_clear_[248])$' -V

tools/check_conventions.py --base origin/main passes. tools/pr_overlap.py --branch codex/msaa-dcc-srgb-clear-20261027 found no direct overlap; shared-file changes in unmergeable older PRs were reviewed for a duplicate conversion. #8123 handles register clear key 20, and #11691 changes multisample sampling-format matching; neither implements this conversion.

Native Bendy PPSA27624 v01.000.003, same verified standing-room checkpoint and 900ms movement/camera input: the prior diagnostic integration a0b5021bad0 stops on 8x R8G8B8A8_SRGB, key00, all-zero pattern. With the change (283feacdd95), the camera turn works and the room renders from the new viewpoint; ordinary close at 270s gives native exit0 (273.44s including cleanup). Both native arms have active Khronos, zero VUIDs and complete save/config/kernel restoration with no remaining processes. The native comparison uses frozen main abed0354680 plus #11690/#11692/#6782/#6913; the final seven-group comparison above uses latest fetched main b986c11a344. The native candidate also passes 15 focused GPU groups before launch. This is initial-room control evidence, not a full-game pass.

Paired latest-main logs, source pins, patch and native camera screenshot, SHA256 bbacd056a7130f7c1625e3c2c64dc2dddc2224b1587010c49dfcf5e97f3e20c9. Raw game memory, shaders, requests and saves are excluded.

Windows and other GPU vendors not tested locally; no FPS claim.

The complete tested native composition patch applies to abed03546804575703dbedcdd3c65efc6bf5d0f2 and preserves the disclosed prerequisite changes; SHA256 852b3a16f091237710e5bb68ae43e752413b01397f3bb47ed0b86e80e6e74f9a. It is reproduction evidence, separate from this standalone two-line production fix.

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: none
  • Fixes: none
  • Unblocks: PPSA27624 #10154
  • GPUs tested: AMD Radeon RX 6650 XT, Mesa RADV 26.2.4-1, Arch Linux
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5028479142 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11704). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-27T04:15:27Z. --- ### What A uniform DCC fast clear of a multisampled sRGB attachment reaches `ClearColorForTexel`, which has no sRGB layout, and throws even for all-zero texels. Bendy PPSA27624 hits this on an 8-sample `R8G8B8A8_SRGB` target. For a repeated 32-bit pattern, let the existing `MultisampledFillClearColor` conversion handle the exact clear when the ordinary texel conversion cannot. That helper accepts only RGB endpoints 0/1 for sRGB; unsupported values retain the original refusal. Non-repeated and non-sRGB patterns retain their existing conversion. No metadata key interpretation or shader semantics change. The regression checks returned clear components and actual initial GPU imports/resolves for RGBA/BGRA sRGB, keys00/40/80/c0, both alpha placements and 2/4/8 samples. Source bytes start as a non-clear sentinel; a zero-sample-mask draw leaves all samples undrawn, then every resolved texel must match the encoded DCC endpoint. Existing RGBA16F DCC tests remain controls. ### Tested Independent [Linux validation by jotitadev](https://github.com/boykopovar/AnyPS5/pull/11704#pullrequestreview-5662883330), main `a8bc4474c` versus head `bde84e528` merged onto it: RTX3070 / driver595.99.02 reproduces the four expected failures before the production fix and passes7/7 afterward; lavapipe / Mesa26.0.3 reproduces the supported failures and passes5 with the two unsupported2x cases skipped. All four runs report zero VUIDs. The wider AGC suite reports1045/1045 on RTX3070; lavapipe1044/1045 has the same `agc_driver_multisample_retirement` failure as main (#9455). These are the contributor's results, separate from the AMD runs below. Arch Linux; AMD Radeon RX 6650 XT (RADV NAVI23), Mesa 26.2.4-1. Main `b986c11a344` plus only the final regressions (`f55badfb9659`): the state and all three sRGB GPU groups fail at the same exact-clear guard; existing 2x/4x/8x DCC controls pass (3/7). The final candidate `bde84e5289a6` passes 7/7. Both arms use required Vulkan, disabled shader caches and actual Khronos validation: six layer insertions, zero VUIDs, no missing layers or skipped tests. ```sh ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 \ VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \ ctest --test-dir build -R '^(agc_driver_msaa_dcc_state|agc_driver_msaa_dcc_clear_[248]|agc_driver_msaa_dcc_srgb_clear_[248])$' -V ``` `tools/check_conventions.py --base origin/main` passes. `tools/pr_overlap.py --branch codex/msaa-dcc-srgb-clear-20261027` found no direct overlap; shared-file changes in unmergeable older PRs were reviewed for a duplicate conversion. #8123 handles register clear key 20, and #11691 changes multisample sampling-format matching; neither implements this conversion. Native Bendy PPSA27624 v01.000.003, same verified standing-room checkpoint and 900ms movement/camera input: the prior diagnostic integration `a0b5021bad0` stops on 8x `R8G8B8A8_SRGB`, key00, all-zero pattern. With the change (`283feacdd95`), the camera turn works and the room renders from the new viewpoint; ordinary close at 270s gives native exit0 (273.44s including cleanup). Both native arms have active Khronos, zero VUIDs and complete save/config/kernel restoration with no remaining processes. The native comparison uses frozen main `abed0354680` plus #11690/#11692/#6782/#6913; the final seven-group comparison above uses latest fetched main `b986c11a344`. The native candidate also passes 15 focused GPU groups before launch. This is initial-room control evidence, not a full-game pass. [Paired latest-main logs, source pins, patch and native camera screenshot](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/msaa-dcc-srgb-clear-linux-20261027.tar.gz), SHA256 `bbacd056a7130f7c1625e3c2c64dc2dddc2224b1587010c49dfcf5e97f3e20c9`. Raw game memory, shaders, requests and saves are excluded. Windows and other GPU vendors not tested locally; no FPS claim. <!-- 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. --> The [complete tested native composition patch](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/bendy-srgb-native-composition-linux-20261027.patch) applies to `abed03546804575703dbedcdd3c65efc6bf5d0f2` and preserves the disclosed prerequisite changes; SHA256 `852b3a16f091237710e5bb68ae43e752413b01397f3bb47ed0b86e80e6e74f9a`. It is reproduction evidence, separate from this standalone two-line production fix. ### 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: none - [x] Fixes: none - [x] Unblocks: PPSA27624 #10154 - [x] GPUs tested: AMD Radeon RX 6650 XT, Mesa RADV 26.2.4-1, Arch Linux - [x] AI-assisted: yes
MarcZX10 commented 2026-10-27 05:12:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T05:12:37Z.

Review: APPROVED


Reviewed exact head bde84e5289a6403ea6c47b0bd763c687392414bf.

The fallback is narrowly gated: it runs only after the existing exact texel clear path fails, only for repeated four-word 32-bit fills, and the sRGB conversion accepts exact RGB endpoints. Other formats and values retain the existing failure path. I checked the new cases against the existing DCC clear semantics and inspected the GPU test setup and teardown; the added coverage spans RGBA/BGRA sRGB layouts, endpoint keys, alpha positions, and 2/4/8 samples.

I built agc_driver_graphics_tests and ran agc_driver_msaa_dcc_state: 1/1 passed. This host lacks the Zen 2 CPU features required by the normal startup guard, so I temporarily bypassed that guard in the disposable review checkout to execute the CPU-only state test, then restored it and verified the checkout is clean. This result does not validate GPU execution. The PR description reports RX 6650 XT / Mesa RADV before-and-after GPU measurements and title-scene validation; I have not independently reproduced those GPU runs.

The required intake, eligibility, conventions, label, and report checks are green. Hosted product jobs were skipped by the repository's path policy. No blocking issue found in the reviewed diff.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5662504169 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11704#pullrequestreview-5662504169). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-27T05:12:37Z. **Review:** APPROVED --- Reviewed exact head `bde84e5289a6403ea6c47b0bd763c687392414bf`. The fallback is narrowly gated: it runs only after the existing exact texel clear path fails, only for repeated four-word 32-bit fills, and the sRGB conversion accepts exact RGB endpoints. Other formats and values retain the existing failure path. I checked the new cases against the existing DCC clear semantics and inspected the GPU test setup and teardown; the added coverage spans RGBA/BGRA sRGB layouts, endpoint keys, alpha positions, and 2/4/8 samples. I built `agc_driver_graphics_tests` and ran `agc_driver_msaa_dcc_state`: 1/1 passed. This host lacks the Zen 2 CPU features required by the normal startup guard, so I temporarily bypassed that guard in the disposable review checkout to execute the CPU-only state test, then restored it and verified the checkout is clean. This result does not validate GPU execution. The PR description reports RX 6650 XT / Mesa RADV before-and-after GPU measurements and title-scene validation; I have not independently reproduced those GPU runs. The required intake, eligibility, conventions, label, and report checks are green. Hosted product jobs were skipped by the repository's path policy. No blocking issue found in the reviewed diff.
jotitadev commented 2026-10-27 06:03:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-27T06:03:45Z.

Review: COMMENTED


NVIDIA and lavapipe on Linux, red to green on both. Ubuntu 26.04, GCC 15.2, Release, main a8bc4474c; head bde84e528 merged onto it (clean). RTX 3070 (595.99.02) and lavapipe (Mesa 26.0.3, LLVM 21.1.8) on the same host, one at a time with VK_ICD_FILENAMES. Same command as the description, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, -j1.

arm RTX 3070 lavapipe
main + this PR's test and CMake changes only msaa_dcc_state and msaa_dcc_srgb_clear_{2,4,8} fail with multisampled DCC fast clear has no exact host value; msaa_dcc_clear_{2,4,8} pass (3/7) same 4 fail with the same message; clear_4/clear_8 pass, clear_2 skipped
head 7/7 5/7, srgb_clear_2 and clear_2 skipped (lavapipe has no 2x color attachments)

0 VUID- in all four runs.

Suite (ctest -R ^agc -E "agc_display_buffer_dcc|agc_driver_flip|agc_driver_lds_atomics64" -j1 --timeout 30) with the head: RTX 3070 1045/1045; lavapipe 1044/1045, the one failure is agc_driver_multisample_retirement, which fails the same way on main on lavapipe (#9455).

GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02, Linux), lavapipe (Mesa 26.0.3).

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5662883330 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11704#pullrequestreview-5662883330). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-27T06:03:45Z. **Review:** COMMENTED --- NVIDIA and lavapipe on Linux, red to green on both. Ubuntu 26.04, GCC 15.2, Release, `main` `a8bc4474c`; head `bde84e528` merged onto it (clean). RTX 3070 (595.99.02) and lavapipe (Mesa 26.0.3, LLVM 21.1.8) on the same host, one at a time with `VK_ICD_FILENAMES`. Same command as the description, `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `-j1`. | arm | RTX 3070 | lavapipe | |---|---|---| | `main` + this PR's test and CMake changes only | `msaa_dcc_state` and `msaa_dcc_srgb_clear_{2,4,8}` fail with `multisampled DCC fast clear has no exact host value`; `msaa_dcc_clear_{2,4,8}` pass (3/7) | same 4 fail with the same message; `clear_4`/`clear_8` pass, `clear_2` skipped | | head | 7/7 | 5/7, `srgb_clear_2` and `clear_2` skipped (lavapipe has no 2x color attachments) | 0 `VUID-` in all four runs. Suite (`ctest -R ^agc -E "agc_display_buffer_dcc|agc_driver_flip|agc_driver_lds_atomics64" -j1 --timeout 30`) with the head: RTX 3070 1045/1045; lavapipe 1044/1045, the one failure is `agc_driver_multisample_retirement`, which fails the same way on `main` on lavapipe (#9455). GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02, Linux), lavapipe (Mesa 26.0.3). Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
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!11704
No description provided.