fix(agc): upload initial MSAA color through an attachment fallback #20579
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/20579"
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 carminelau on 2026-11-15T10:18:48Z.
What
Import nonuniform initial MSAA color on hosts that lack
shaderStorageImageMultisampleorshaderStorageImageWriteWithoutFormatand support the required multisampled color attachment and sample-rate shading. A fragment pass writes each guest sample through a format-compatible unsigned attachment view. The existing compute upload is still used when its features are available.Reuse the staging buffer and respect storage-buffer alignment and range limits. Keep the upload resources alive through submission and use the recorder's uncounted pass for the internal draw.
Tested
Ran
ctest --test-dir build -R '^agc_driver_native_color_initial_' -Von the same Intel Arc 140V, withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, andVK_LOADER_DEBUG=layer. The loader inserted validation layer 1.4.363 in all seven test processes in both runs.mainat055010d80bThe four nonuniform cases ran on the attachment fallback. The sample checks covered 2×, 4×, and 8× MSAA with pipe-bank XOR values of 0 and 0x8100. The capability fixture also forced a 256-byte storage buffer range.
A separate title smoke test with the same fallback applied to AnyPS5 v0.1.5 reached the title screen of Plants vs. Zombies: Replanted (PPSA29802, 01.510.000) on the same GPU.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-15T10:41:50Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
7b770f9cad9520e4d3b37f0c4eecf8334e0a458a. I usedrepo_read.pyto inspect the prepared diff and targeted source ranges; I ran no build or tests. The PR description reports Vulkan validation tests and a title smoke test; those were not run by me.Results
Findings
Blocking
None.
Non-blocking
core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleUpload.cpp:93)Not verified
No build, test, physical-console run, or independent confirmation of the author-reported results was performed. I read every changed file listed in the manifest:
core/libs/prx/libSceAgcDriver/CMakeLists.txt,core/libs/prx/libSceAgcDriver/Graphics/include/TextureDetiler.hpp,core/libs/prx/libSceAgcDriver/Graphics/shaders/MultisampleUpload.comp,core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp,core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleUpload.cpp,core/libs/prx/libSceAgcDriver/tests/execution/SampleMultisampleTarget.cpp, anddocs/dev/debt/changes/fix-agc-msaa-initial-color-upload.md. No changed files were excluded by the manifest.To get this to a good state
Nothing is required. The chunk-count performance point above is optional.
Imported from boykopovar/AnyPS5. Originally posted by kurexw on 2026-11-16T21:12:50Z.
Review: COMMENTED
Tested on an Apple M4 (macOS 27.2, MoltenVK 1.4.2 from the LunarG SDK 1.4.363.1, x86-64 build under Rosetta). This device has
sampleRateShadingandshaderStorageImageWriteWithoutFormatbut noshaderStorageImageMultisample, so it is the case this fallback targets.Method:
mainat3b17977ba6against this PR merged onto that commit (clean merge), three runs per side, withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationandVK_LOADER_DEBUG=layer:Every test process logged
Insert instance layer "VK_LAYER_KHRONOS_validation"(layer 1.4.363). None logged the missing-layer message. There were 0VUID-lines on either side. All three runs were identical.agc_driver_native_color_snapshotagc_driver_native_color_snapshot_refusalsagc_driver_native_color_initial_nonuniformagc_driver_native_color_initial_nonuniform_lifetimeagc_driver_native_color_initial_nonuniform_capabilitiesagc_driver_native_color_initial_nonuniform_hookagc_driver_native_color_readbackagc_driver_sample_multisample_targetinitial_uniform*,multisample_srgb_twin)On main the failures were "initial multisample color samples require enabled formatless multisampled storage image writes". With this PR, the attachment fallback handles those imports on the M4.
agc_driver_native_color_readbacknow passes its 2× coverage, fill, refusal, chunk and exceptional-value checks. It then fails atSampleMultisampleTarget.cpp:1363, where the 4× pass callsStoreSamples. That step dispatches a guest shader that stores to a multisampled storage image, and the recompiler refuses it:SPIR-V module emission failed: storage image multisampling is unavailable on the target device. This is not a regression; on main the test never reached that line. A device withoutshaderStorageImageMultisamplecan't run that step at all.Suggestion: gate that block on
context.storageImageMultisample, as the same file already does at line 855 ("a dispatch's store after a claim not tested: storage image multisampling unavailable"). Then the remaining checks also run on MoltenVK. The PR's code needs no changes.I didn't test this on Linux, Windows or another GPU vendor.