Skip to content

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

Merged
adriadam10 merged 3 commits into
boykopovar:mainfrom
JJenkx:fix/agc-srgb-msaa-dcc-clear
Oct 28, 2026
Merged

adriadam10 merged 3 commits into
boykopovar:mainfrom
JJenkx:fix/agc-srgb-msaa-dcc-clear

Conversation

@JJenkx

@JJenkx JJenkx commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

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 Bendy and the Dark Revival (PPSA27624) #10154
  • GPUs tested: AMD Radeon RX 6650 XT, Mesa RADV 26.2.4-1, Arch Linux
  • AI-assisted: yes

@github-actions github-actions Bot added the unblocks title Names a title ID on the Unblocks line label Oct 27, 2026
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

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
PR 6973 core/libs/prx/libSceAgcDriver/tests/execution/AlphaToCoverage.cpp L1149
PR 6987 core/libs/prx/libSceAgcDriver/tests/execution/AlphaToCoverage.cpp L1149
PR 6989 core/libs/prx/libSceAgcDriver/tests/execution/AlphaToCoverage.cpp L1149
PR 6995 core/libs/prx/libSceAgcDriver/tests/execution/AlphaToCoverage.cpp L1149
PR 7002 core/libs/prx/libSceAgcDriver/tests/execution/AlphaToCoverage.cpp L1149
PR 10581 core/libs/prx/libSceAgcDriver/tests/execution/AlphaToCoverage.cpp L524

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1368 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 1395 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 1896 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 2434 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 4040 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4449 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5021 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5371 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5925 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6185 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6186 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6187 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6188 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6192 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6194 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6209 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6235 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6280 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6300 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6412 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6481 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6548 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6804 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6808 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6970 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6971 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
PR 7048 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7256 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7275 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7395 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7410 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7457 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7514 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7604 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7642 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 8223 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
PR 8395 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 8484 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8542 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8592 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8939 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9020 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9248 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9335 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9356 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9387 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9457 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9489 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9508 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9533 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
PR 9633 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9675 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9700 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9717 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
PR 9742 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
PR 9748 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9749 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9790 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9852 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9892 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9897 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9898 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 9969 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10000 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10043 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10049 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 10064 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10193 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 10233 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
PR 10333 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10435 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 10442 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10489 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10757 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10846 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10867 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 11351 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 11551 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 11557 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 11920 core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp
PR 11998 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@JJenkx

JJenkx commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Fresh native validation also completed on main b986c11a344 plus this PR and the disclosed #11690/#11692/#6782/#6913 requirements (a675acc1f365), with all eight executable/module outputs newly converted. All15 focused GPU groups pass with11 actual Khronos insertions, no skips/VUIDs. The checkpoint reload and camera turn render correctly; ordinary close at390s gives native exit0, active native Khronos/zero VUIDs, all saves/config/kernel state restored and no leftover processes. Forward input was sent but translation or a door interaction was not visually verified; this does not extend the claim to full gameplay or FPS gains.

Source pins, conversion hashes, GPU logs, native summary and room screenshot, SHA256 51d515e44d15495c464f545f49ba49950d9439f7356d3a224c4ab1f6a1d364e9. A preceding run lost its outer terminal and was excluded; the recorded run used an independent bounded PTY service and completed without I/O errors.

Latest upstream refresh (2026-10-27): private integration 444d40a7f9897affec660ef2aab16e9bca85d67d applies the same twelve prerequisite/fix commits to main f9b2db1d4143ae247e5c3d0c0ced875c0aed906f. This includes #11704, #11690, #11692 with its within-unit page-hole revision, and peer #6782/#6913. All 16 focused checks passed with 12 Khronos validation-layer insertions, no VUIDs, no missing layer, and no skips. Eight converted outputs were regenerated from this exact integration. The normal pipelined native run loaded the ordinary manual office save, showed the doorway without camera input, and closed normally at 240 seconds with exit 0; saves, memory saves, config bytes and kernel setting were restored, with no remaining native process. Native validation was off; the focused GPU checks above used KHR validation. This is composition evidence on newer upstream, not an unmodified-main benchmark or a source speed claim.

Fresh-main source composition, focused results, trace/digest and reviewed X11 screenshot, SHA-256 111e04dc947b9feb3ef75762f103a2d753fdc882ffef98e963510a9fdf9bd013. XComposite retained old loading-screen pixels in these experiments; the included scene proof uses the active-window X11 readback. Initial office only; audio and later gameplay remain unverified.

@jotitadev jotitadev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ycbuzi

ycbuzi commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Windows run of bde84e5289 merged onto main d13b3d7c55 (9e03994f60, clean). Windows 11 Home 10.0.26200, WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release. One GPU at a time with ANYPS5_GPU, plus ANYPS5_REQUIRE_VULKAN=1 and ANYPS5_NO_SHADER_CACHE=1, ctest -V --repeat until-fail:2. Each log's Selected GPU line names its device.

device 47 tests of agc_driver_alpha_to_coverage_tests and agc_driver_graphics_tests
GeForce RTX 4070 SUPER (0x2783), NVIDIA 616.92 44 pass, both runs; 3 skip
GeForce GTX 1650 SUPER (0x2187), NVIDIA 616.92 same
AMD Radeon(TM) Graphics (1002:164e), AMD 32.0.21030.2001 same
  • The build has no errors or warnings.
  • The skips are agc_driver_msaa_dcc_compared_import_{2,4,8}, by design: skipped, Linux comparison mode only: Windows host imports settle on a second queue or keep their write watch. They skip on the control too.
  • Negative control: with main's Graphics/src/MultisampleTarget.cpp and this head's tests, on the RTX 4070 SUPER, agc_driver_msaa_dcc_srgb_clear_{2,4,8} and agc_driver_msaa_dcc_state fail with AGC graphics: multisampled DCC fast clear has no exact host value.
  • agc_driver_graphics_tests opens no device, so its part is CPU-side on every row.

AI-assisted: yes (Claude Code)

@maskym

maskym commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Windows + NVIDIA result for head bde84e5289, merged into main f759e165d9 (the PR's GPUs tested line names no NVIDIA run on Windows).

This PR's own tests: agc_driver_msaa_dcc_srgb_clear_2, _4, _8 (about 0.6 s each), agc_driver_alpha_to_coverage and _state, all passed.

Host: Windows 11 26300, Intel i7-12700K, NVIDIA GeForce RTX 2070 SUPER (vendor 0x10de, device 0x1e84; Vulkan loader 1.4.357 from the NVIDIA driver), Khronos Validation Layers nightly 1.4.366 (b2b44c0d37) through VK_ADD_LAYER_PATH, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release, BUILD_TESTING=ON, Ninja. Build clean.

Same focused run on main f759e165d9 and on this tree, same machine and GPU: VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1, VK_LOADER_DEBUG=error,warn,layer, ctest --test-dir build -R '^(agc|guest_video_out|video_out)' --parallel 4 -V.

The tree also carried the open PRs #11951, #11711, #11692, #11691, #11690, #11794, #11949, all merged cleanly, so the run is a joint one; of those, #11692's new agc_driver_depth_plane_cpu_write_after_page_unwatch fails on this host, reported on that PR. Not run on a PS5.

AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine.

@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the fallback in MultisampledDccClear against MultisampledFillClearColor (only repeated 32-bit patterns, sRGB RGB endpoints exactly 0/1, everything else still throws), and that the new state and GPU tests fail without the change; confirmed by @MarcZX10 and @jotitadev (RTX 3070, lavapipe) and the AMD runs in the description; merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants