feat(agc): support uniform custom MSAA sample locations #2169
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2169"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by authurtabo-byte on 2026-10-09T10:36:52Z.
What
Depends on #419. Its prerequisite commits are included; the follow-up is
feat(agc): support uniform custom MSAA sample locations.After multisampled targets are supported, 3D MiniGolf (PPSA03647) aborts while loading its first course because its four PA_SC_AA_SAMPLE_LOCS_PIXEL registers contain
0x22eea66a, rather than Vulkan's standard four-sample pattern. Preserve the guest's sample indices and signed sixteenth-pixel offsets through VK_EXT_sample_locations for uniform 2x, 4x and 8x patterns.Query the device's sample counts, coordinate range, subpixel precision and grid support before enabling the extension. Include the pattern in pipeline and render-pass continuation keys, check the actual depth format and sample count with vkGetPhysicalDeviceImageFormatProperties, create compatible depth images, and supply sample locations at pipeline creation and render-pass begin. Depth attachments retain GENERAL throughout their use. Spatially varying 2x2 patterns and unsupported devices throw. CB resolves validate sample counts independently of raster sample locations.
Vulkan behavior follows the official sample-location pipeline state, render-pass state, and depth-attachment requirement. The guest coordinate interpretation is unchanged from #419; PS5 coverage and interpolation equivalence remain unmeasured and are recorded in TechnicalDebt.
Tested
Rebased onto main
c9da0f93. Preserved upstream depth-surface extent/format checks while retaining the prerequisite HTILE fast-clear handling. Windows, MinGW-w64 GCC 15.2.0, Release, NVIDIA GeForce RTX 3050 6GB Laptop GPU.libSceAgcDriver,agc_driver_graphics_tests, and both depth fast-clear test targets build successfully. All three focused tests pass:agc_driver_graphics(6.25 s),agc_driver_depth_fast_clear(1.23 s), andagc_driver_depth_fast_clear_submit(0.47 s).tools/check_conventions.py --base origin/mainpasses.nonstandard sample locations are unsupportedto a rendered course and HUD. The separate unwritten-pixel-program blocker is covered by #2022. A completed shot is not confirmed; this PR alone does not provide all title startup fixes.0x444cc4cclocations rendered correctly in gameplay. His overlapping #2183 was closed in favor of this PR. The depth-format capability check and standard-coordinate regression above address his feedback.Linux was not rerun locally. Validation layers and console coverage/interpolation equivalence were not tested. Guest coordinate interpretation remains documented as inferred in TechnicalDebt.
Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T10:48:34Z.
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.
main)core/libs/prx/libSceAgcDriver/Graphics/include/Context.hppL173core/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hppL15docs/dev/TechnicalDebt.mdL559core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppL189core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppL1153docs/dev/TechnicalDebt.mdL559Imported from boykopovar/AnyPS5. Originally posted by Raghav314 on 2026-10-09T11:07:47Z.
Tested this with Hades II (PPSA36082) on Linux / RTX 4090. It needs the same thing with a different pattern:
PA_SC_AA_SAMPLE_LOCSis0x444cc4ccfor all four pixels, an ordered (±4, ±4)/16 grid on its 4x targets. With this commit in place of my own version, it renders correctly in gameplay with no refusals in the log. (Stack: #419 plus my #2121 and #2132.)One thing I ran into doing the same change:
vkCreateImageneedsSAMPLE_LOCATIONS_COMPATIBLE_DEPTHto be supported for the depth format and sample count, and the extension's sample counts alone don't guarantee that. I checked it withvkGetPhysicalDeviceImageFormatProperties(the flag plus the image's usage) before setting it, and refused a custom-location draw whose depth format the device can't support. Every depth format passes on the 4090, so it doesn't change anything there, but it might matter on other drivers.If it's useful as a test: the console's standard 4x offsets
{-2,-6}, {6,-2}, {-6,2}, {2,6}should come out as Vulkan's standard 4x positions(0.375, 0.125), (0.875, 0.375), (0.125, 0.625), (0.625, 0.875). That checks both the 1/16 scale and the y direction in one go.I opened #2183 before I saw this one. I'll close it, since this came first and covers more (render-pass begin, devices without variable locations).
Imported from boykopovar/AnyPS5. Originally posted by JAB-dev on 2026-10-09T17:45:43Z.
Tested this at 04853638 on Seeker: My Shadow (PPSA12500, Unity), Windows 11, RTX 4070 SUPER. It renders into 4x MSAA targets (
PA_SC_AA_CONFIG0x0020c002) with nonstandard sample positions. Without it the title stops atmultisampling or coverage conversion is unsupported, with #419 alone atnonstandard sample locations are unsupported, and with this PR it gets past both.Imported from boykopovar/AnyPS5. Originally posted by authurtabo-byte on 2026-10-09T20:31:05Z.
Thanks @Raghav314 and @JAB-dev for testing across Hades II (Linux/NVIDIA) and Seeker: My Shadow (Windows/NVIDIA).
Pushed \d92a665f:
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T04:55:48Z.
Thanks for the rebase and for adding the depth-format check and the standard 4x test. Nothing more is needed from you right now.
This is stacked on #419, which conflicts with main and is waiting on #374 and on a direction for multisampled targets. Once #419 is in, rebase this so it only carries its own commit and it goes into testing next. Three titles are waiting on it (PPSA03647, PPSA12500, PPSA36082), so it won't be dropped.
Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-11T05:12:29Z.
Independent validation: standard 8x sample7 table mismatch
The final entry in
StandardLocations8is(7, -8)in #419 at b75dc179 and #2169 at 55cc2824. Vulkan's standard sample table specifies sample index 7 at(0.9375, 0.0625), which corresponds to(7, -7)under the existing signed sixteenth-pixel conversion.(7, -8)converts to(0.9375, 0.0).Two captures of PPSA99902's first blocked draw have this uniform pattern in all four pixels:
I compiled the unchanged extracted decoder blocks from both exact heads, then separately changed only
(7, -8)to(7, -7). WithAA_CONFIG=0x0030e003only in the CPU fixture:nonstandard sample locations are unsupported; the one-entry correction returns eight.customSampleLocations=true; the one-entry correction sets it false. This avoids requiring custom sample-location support for an actually standard 8x pattern.Independent native Vulkan measurement on Windows 11 / RTX 5080 (
standardSampleLocations=VK_TRUE), usinggl_SamplePosition/gl_SampleID, full sample shading and a fragment SSBO: every 2x/4x/8x position matched Vulkan's table in five repeats (70 samples, 280 component checks, max 0.270 s). Sample7 was(0.9375, 0.0625)every time. All five deliberately wrong expectations with last Y=0 failed. Shaders were compiled with this repository's built glslang and Vulkan headers. No validation-layer run is claimed.Suggested narrow correction: replace the last
StandardLocations8entry with{7, -7}, plus a regression using the two independent register words above. #2169 should assert that this standard 8x pattern does not requireVK_EXT_sample_locations. Its existing standard-coordinate regression covers 4x; custom 8x endpoint checks do not test this standard pattern.The separate raw captured
PA_SC_AA_CONFIG=0x2030e003still fails both unchanged decoders on bit29, before sample-location validation. The pinned GFX10.3 schema names itCOVERED_CENTROID_IS_CENTER; the pinned RADV producer sets it for GFX10.3+. CapturedSPI_PS_INPUT_ENA=SPI_PS_INPUT_ADDR=0x2enables perspective-center input, without centroid inputs. This identifies the source flag; it does not establish complete PS5 centroid/coverage equivalence or justify removing the general refusal. No bit-cleared state was injected into the title.This title capture is conditional on earlier local startup prerequisites and a separately validated guest-MSAA-depth snapshot subset; scope and results. Related #419 report.
Scope: exact-head extracted CPU decoder checks and independent native host Vulkan sample positions, not a full #2169 build or title run with this correction. No PS5/AMD coverage/interpolation, Linux/lavapipe, presented frame or gameplay validation is claimed. AI-assisted; evidence/reproducers/one-entry patches preserved locally outside the repository; no new PR or push.
Fork code and validation update (2026-10-11)
Proposed correction (fork only): minimal 8x sample-position commit. This is a one-entry change on the pinned #419 head
b75dc179; it depends on that pending MSAA implementation. The same(7,-7)correction applies to #2169. Exact extracted decoders and independent sample-position checks were validated; a full unchanged PR/topic branch build is not claimed. Full runtime checks used the adapted integration. AI-assisted: Codex.Experimental integration has separate covered-centroid and DCC blockers; correcting the sample table alone does not establish title startup.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T11:41:03Z.
Review: CHANGES_REQUESTED
Thanks for the work and for the third-party results. One thing to fix before this can land:
libraryKeys(Graphics/src/Pipeline.cpp:140-184): on GPL devices the fragment shader and fragment output libraries are built withrasterizationSamplesand, for custom patterns, aVkPipelineSampleLocationsStateCreateInfoEXT(Pipeline.cpp:350-356), but the keys don't include the sample count orstate.customSampleLocations/state.sampleLocations. Two draws that differ only in pattern would reuse the same cached library. Append both tokeys.fragmentShaderandkeys.fragmentOutput, and add a test that two states differing only in pattern produce different keys.As @oneandonlydean said, please rebase so it carries only its own commits once #419 is in. The same GPL key gap applies to the sample count in #419.
Imported from boykopovar/AnyPS5. Originally posted by santhoshkumar-dev on 2026-10-11T11:54:19Z.
PPSA03706 (My Friend Peppa Pig, Unity): working fine with #419 + #2169
Tested on main
0f863c102with #419's own commits and this PR's own commits cherry-picked on top (#374 is already on main;d19dcd275became empty). Branch:test/pr419-pr2169-ppsa03706at50daffdfe. Windows 11, AMD Radeon RX 6700 XT, MinGW-w64 GCC 15.2.0, Release.register 0x2f8 = 0x0030e003(standard 8x, the same value Wobbly Life hit in #419).nonstandard sample locations are unsupported. All four pixels carryPA_SC_AA_SAMPLE_LOCS=5bb137d9 1ff5739d, a uniform 8x pattern: (-7,-3) (7,3) (1,-5) (-5,5) (-3,-7) (3,7) (5,-1) (-1,1).storage image access to depth/stencil surface … is not implementedkeeps a 1920x1080 depth texture on the snapshot path.agc_driver_graphicspasses on the combined branch. Changes needed on current main beyond conflict resolution:DrawKeyRegistersgrows to 49 entries (main's0x286range plus0x2fe).state.samplesis appended to the GPLfragmentShaderandfragmentOutputlibrary keys, per @adriadam10's note on #419.CheckRange) are applied to single-sample targets only. The resolve test's fast-clear destination needs that metadata and real CMASK memory to reach the "fast-clear color target" rejection.🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by cookie42073-cmd on 2026-10-11T13:56:16Z.
Hi, I’m Blazing Cook. Here’s an update on the fix and the Windows testing.
Independent regression evidence for the fragment-library cache-key review, supporting the correction planned in #419.
Tested exact #2169 head
55cc2824f9fce4f5e1ae1bb0e12c5eb0026e4aebon Windows x64, MinGW-w64 GCC 15.2.0, Release. The optional attached patch includes sample count, custom-location mode and ordered active sample bytes in both fragment keys. Unsupported counts throw before indexing; inactive bytes and unused standard-pattern bytes preserve reuse.The permanent regression uses the public
Pipelineconstructor, production key builder and library cache. Twelve transitions check changed fragment handles/counters, unchanged vertex libraries, linked sample counts/coordinates, sample-index order, reuse and cleanup.agc_driver_graphicsfails in 1.12 s,sample state rebuilt the wrong pipeline library parts(CTest exit 8).8254975e812705d2f03cc3327940cac02f66c30epasses against the pinned dependency. Full current-main CI, Linux/lavapipe, validation layers and asynchronous LTO remain untested.Our local commit is
cc29a95137038b09f71cfd6d9d493cadc5ad3bf1. Building this older head also required the already-upstream one-line depth-test prerequisite ce65ab2, by MichonGoddijn231849, kept separate from this patch. Integrate after #419/#2169 settle and rebase; this is a pinned-head proposal, not a current-main PR. No duplicate MSAA feature PR is being opened.AI-assisted with Codex, including Astra. Preserves authurtabo-byte's #2169 and MichonGoddijn231849's #419 work.
The exact optional two-file patch is included below. Raw before/after logs and the reproducible checkpoint are preserved locally.
Cache correction and permanent production regression patch
Imported from boykopovar/AnyPS5. Originally posted by cookie42073-cmd on 2026-10-11T17:38:46Z.
Hi, I’m Blazing Cook. Here’s an update on the fix and the Windows testing.
Updated verification on PR #2169 head
589d42b7cc7d76193be93999d3d41eae5a0b0d32. This replaces the older505aa13e/27c69c12test evidence and patch in this comment.The current keys include the sample count and custom pattern, but still omit the resolved
sampleLocationsEnabledvalue. On a fixed-capability device, changing to an incompatible depth format can disable standard sample locations while the fragment-shader library still reuses its previous enabled state. The linked multisample definitions then disagree (Vulkan VUID 06635).The correction passes the already resolved boolean into the private key builder and appends it to both fragment keys. It preserves this head's full-array custom-pattern keys and adds no capability query.
Windows results: MinGW-w64 GCC 15.2.0, Release, bundled dependencies, SPIRV-Tools off (the project default). The full default build passed. With identical regression bytes throughout:
589d42b7keylinked fragment libraries disagree on sample-location enablement; test 0.81 sFive existing pipeline tests also passed in 1.86 s total: cache, normal GPL reuse, GPL-disabled fallback, fast-only GPL reuse, and the link-optimization policy unit test. These are four real-Vulkan invocations plus one policy test; the disabled-GPL run correctly used whole pipelines. No CTest skips occurred. Shader caches were disabled and each test retained its 30 s cap.
The permanent regression uses the production
Pipelineconstructor and library cache with mocked Vulkan creation callbacks. It covers 11 sample/pattern comparisons and 10 four-build enablement transitions: unsupported-format and supported-format/missing-4x outcomes, both directions, repeats and return reuse, incompatible/compatible formats with depth present on both sides, and no-depth/compatible-depth preserving fragment-shader reuse. Vertex parts remain reused. The native tests are additional coverage; they do not exercise this exact mocked depth-enable matrix or prove background LTO.Local review-support commit:
d8445c6460ded28000b3abc49586ee3d4a0737cf, directly on the pinned PR head. The two-file patch below includes the required mock support; it does not depend on our old local integration. The current-main conventions checker passed for this topic delta. Both project chats independently reviewed the patch and test evidence. A self-contained source checkpoint restored all 2,057 source blobs and passed strict Git integrity checks; raw logs are preserved locally.This verifies the cache correction on the pinned PR head. It is not a merge with current
main, full CI, Linux validation, native reproduction of the depth-enable matrix, or a demonstrated title fix. No duplicate MSAA feature PR is being opened.Community testing request: Could someone check this transition with native GPL on another GPU/driver, or link an existing small test that reaches it? Please include the exact commit and dependency/patch stack, GPU/driver, OS, settings, and paired startup-to-first-failure logs using the same reproduction steps.
For the separate MSAA memory problem in #419, we still need the intervening writer and completion history. Useful evidence would be:
Links to existing logs or issues are welcome. Testers can run their own local game copies and share observations; please share logs or redistributable repros rather than commercial game files, firmware or keys. The diagnostic prototype is still local and is not being offered as a verified title build.
AI-assisted with Codex, including Astra, with coordinated review across both project chats. Original #2169 and #419 authorship remains with authurtabo-byte and MichonGoddijn231849.
Resolved-enablement correction and permanent regression, directly against 589d42b7
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T20:51:30Z.
Review: DISMISSED
Thanks for adding the sample count and pattern to the fragment keys; that covers the earlier request. Built the PR merged onto main and ran the libSceAgcDriver ctest scope (391/391 pass, including
agc_driver_graphicsandagc_driver_prepared_graphics).One thing left, also reported by @cookie42073-cmd:
libraryKeys(Graphics/src/Pipeline.cpp:197-205): the resolvedsampleLocationsEnabledfromValidateSampleLocations(Pipeline.cpp:110-115) depends on the depth format, but isn't part ofkeys.fragmentShader/keys.fragmentOutput. Two draws with the same pattern and sample count but a compatible vs. incompatible depth format can reuse a library built with the other enablement, which links different multisample states (VUID 06635). Append the resolved value to both keys and add a case with the same pattern and two depth formats.Still stacked on #419; this will wait for it to land, then rebase so it only carries its own commit.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T02:12:45Z.
Can you rebase this please?
Imported from boykopovar/AnyPS5. Originally posted by authurtabo-byte on 2026-10-12T03:43:32Z.
Thanks everyone for the review and title testing. I?ve pushed the rebased update; it is now based on current
mainand no longer includes the #419 commits.SAMPLE_LOCATIONS_COMPATIBLE_DEPTHis unavailable for the selected depth format and sample count. The standard 4? coordinate checks remain in Graphics tests.(7, -8)to(7, -7), avoiding treating that standard pattern as custom. The captured 8? pattern remains a useful independent regression report.Locally on Windows / AMD Radeon 780M,
agc_driver_recorder_tests.exe --pipeline-library-onlypasses, including the new cache checks, andagc_driver_graphics_tests.exepasses. No PS5 hardware run is claimed.Imported from boykopovar/AnyPS5. Originally posted by cookie42073-cmd on 2026-10-12T18:20:56Z.
Hi, Blazing Cook here. Following up on the earlier Ping Pong testing: we completed a full one-player match in Middle Ages Ping Pong on unmodified upstream
2a5eca11cd1bf583db39ce67034e8453842ac244, with restart and menu transitions working in the same run.Tested STL1te's Middle Ages Ping Pong, PPSA28319 / 01.000.000, on Windows with an RTX 4070 SUPER. This was a fresh Release build with MinGW-w64 GCC 15.2.0 and a fresh relink, without local production patches or a diagnostic library overlay. Relink inputs were reconstructed from the release; packaged ELF headers and PT_LOAD payloads were independently matched. Original full-ELF equivalence is not claimed.
Using upstream
tools/pad_input.py/APS5_PAD_INPUT_FILE, the saved frames show:The capture ran for 317.624 seconds, saving 314 raw GPU frames. It ended with a requested recorder stop after those checks. The recorded game exit code 1 is from that deliberate process termination; it is not a spontaneous crash or a graceful in-game exit. Neither game log contains the fatal, unsupported, assertion or Vulkan-error signatures checked by the analysis script.
The full default build and
libscompleted, and 12 selected memory, input and graphics tests passed, with Vulkan required and no skips. The full test suite was not run. FFmpeg used the existing upstream prebuilt package, with its recipe and file hashes recorded. A second Codex chat independently checked all 11 selected images against the original BMPs, the logs, build receipts and file hashes.This is a compatibility follow-up after the upstream work in #419 and #2169, not an isolated before/after result for either change. Thanks to MichonGoddijn231849, authurtabo-byte and everyone who reviewed and tested them. STL1te is the homebrew author. There is no new code fix from this run.
Victory, two-player mode, physical input, fullscreen, audio quality, performance and PS5 pixel equivalence remain untested. Frame readback and disabled caches make this unsuitable as a performance benchmark. These results also do not establish any commercial-title memory failure.
If anyone reproduces a failure in this title, please share the exact AnyPS5 commit, title version, OS/GPU, reproduction steps and runtime log so we can compare it with this baseline.
AI-assisted: yes, Codex. The attached evidence contains logs, frames, scripts and verification receipts, with no game binaries or assets.
Evidence ZIP — SHA-256:
d7aeda6e33b29c5b6fbace77c2fa7fc4be3eaa4806e5eb7eac4faf8090c3567a