Repository navigation
fix(agc): upload initial MSAA color through an attachment fallback - #20579
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head 7b770f9cad9520e4d3b37f0c4eecf8334e0a458a. I used repo_read.py to 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
| Check | Result | Note |
|---|---|---|
| Diff and targeted source review | passed | All changed files were read |
| Build and tests | not run | Author-reported results only |
Findings
Blocking
None.
Non-blocking
- The attachment fallback creates a separate descriptor set for every storage-buffer chunk and a draw for each set. Very large initial targets could require many descriptor sets and draws; consider batching or imposing a practical chunk-count limit if this is seen in real workloads. (
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, and docs/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.
|
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.
|
|
Windows NVIDIA check of head Setup: Windows 11 Home 10.0.26300, i9-13900K, WinLibs GCC 15.2.0, Release, RTX 4080 (
The one test not run on both sides is All seven Not checked: AMD, Linux, macOS, any commercial title. AI-assisted: yes |
|
Results from a device this targets: an Intel HD Graphics 630 (Mesa 25.2.8 ANV,
On the GTX and llvmpipe without the mask all ten pass 3/3 with this PR, and So the fallback works on the HD 630. |
kurexw
left a comment
There was a problem hiding this comment.
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 sampleRateShading and shaderStorageImageWriteWithoutFormat but no shaderStorageImageMultisample, so it is the case this fallback targets.
Method: main at 3b17977 against this PR merged onto that commit (clean merge), three runs per side, with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation and VK_LOADER_DEBUG=layer:
ctest --test-dir build -R '^agc_driver_(native_color_(readback|snapshot|initial)|sample_multisample|multisample_srgb)' -V
Every test process logged Insert instance layer "VK_LAYER_KHRONOS_validation" (layer 1.4.363). None logged the missing-layer message. There were 0 VUID- lines on either side. All three runs were identical.
| Test | main | This PR |
|---|---|---|
agc_driver_native_color_snapshot |
Failed | Passed |
agc_driver_native_color_snapshot_refusals |
Failed | Passed |
agc_driver_native_color_initial_nonuniform |
Skipped | Passed |
agc_driver_native_color_initial_nonuniform_lifetime |
Skipped | Passed |
agc_driver_native_color_initial_nonuniform_capabilities |
Skipped | Passed |
agc_driver_native_color_initial_nonuniform_hook |
Skipped | Passed |
agc_driver_native_color_readback |
Failed | Failed (a later step, see below) |
agc_driver_sample_multisample_target |
Skipped | Skipped |
the other four (initial_uniform*, multisample_srgb_twin) |
Passed | Passed |
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_readback now passes its 2× coverage, fill, refusal, chunk and exceptional-value checks. It then fails at SampleMultisampleTarget.cpp:1363, where the 4× pass calls StoreSamples. 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 without shaderStorageImageMultisample can'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.
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)