fix(agc): rasterize a multisampled target without MSAA_ENABLE at the pixel center #5882
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5882"
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 billythemenace2 on 2026-10-14T14:40:20Z.
Requested by billy
What
Before: a draw whose
PA_SC_AA_CONFIG.MSAA_NUM_SAMPLESis above 0 whilePA_SC_MODE_CNTL_0.MSAA_ENABLEis clear threw "multisampled targets rasterized without MSAA_ENABLE are unsupported". SONIC SUPERSTARS (PPSA06888) stops on such a draw: a 2x color target, no depth target, no alpha-to-coverage,PA_SC_AA_CONFIG0x00108001,PA_SC_MODE_CNTL_00, nonstandard sample locations (0xc44c).After: such a draw keeps the target's sample count and puts every sample at the pixel center, the representation #4414 already uses for a single-sample scan into a multisampled target. Points, lines, a depth target and alpha-to-coverage still throw.
Where the semantics come from (not measured on hardware; the hardware oracle runs compute kernels only):
MSAA_ENABLEis what makes the rasterizer use the programmed sample locations: RADV 061bc615 sets it for 1x user sample locations because they have no effect without it. TheMSAA_ENABLE on a single-sample targetdebt entry relies on the same commit.MSAA_ENABLEfrom the GL multisample state (si_state.c, mesa-25.2.0). With multisampling disabled, GL rasterizes at the pixel center and gives the fragment full coverage, so every sample gets the pixel's value.The debt entry in
docs/dev/debt/libSceAgcDriver.mdrecords that the result withMSAA_NUM_SAMPLESabove 0 is inferred.How
DecodeStateused to refuse the combination after decoding the depth target and alpha-to-coverage state. It now accepts it for filled primitives without either, and setscustomSampleLocationswith every location at the center. That is the same pathSampleLocationsalready serves for #4414. TheGraphics.cppcase that expected the refusal now checks the sample count and the centered locations, and that alpha-to-coverage still throws.Tested
Windows 11, MinGW-w64 GCC 15, Release.
agc_driver_graphicsandagc_driver_msaa_enable_single_samplepass, andtools/check_conventions.py --base origin/mainpasses. SONIC SUPERSTARS (PPSA06888), on main with #5865, #5375 and #5456 merged locally, gets past this stop and reaches the next one: a shader reading a multisampled image. I did not compare the picture with a console. Not tested: Linux, other GPU vendors.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by mrfelek on 2026-10-14T16:21:19Z.
Real-title check. METAL GEAR SOLID: Peace Walker (PPSA18216), Linux, RTX 3080 Ti (NVIDIA 615.71.09),
maine34c47921plus #5439, #5915 and this PR, with the launcher hand-over from boykopovar/AnyPS5#5268. After #5915 clears the single-sample draw over a 4-sample depth target, the frame stops at this PR'smultisampled targets rasterized without MSAA_ENABLE are unsupported for points, lines, a depth target or alpha-to-coverage(the!result.depthcheck inState.cpp). The draw is a depth plus colour pair withMSAA_ENABLEclear:PA_SC_AA_CONFIG0x0020c002,DB_EQAA0x00010002,DB_Z_INFO0xa290098b (4 samples),DB_DEPTH_CONTROL0x00000710 and 0x00000711,CB_COLOR0_INFO0x00008028,CB_COLOR0_ATTRIB0x00012000 (4 samples, 4 fragments), noPA_SC_MODE_CNTL_0bit 0 (value 0x2). So this is the case discussed on #5268 as draw B. I can rerun with more registers if useful.AI-assisted; the runs are from my machine.
Imported from boykopovar/AnyPS5. Originally posted by SandstromPL on 2026-10-14T16:46:14Z.
MGS Peace Walker (PPSA18216, #5268) reaches this refusal with a depth target bound. On
main+ #5439 + #5915 + this PR, mrfelek's run stops at draw B:PA_SC_AA_CONFIG0x0020c002 (4x),MSAA_ENABLEclear,DB_Z_INFO0xa290098b (4x),CB_COLOR0_ATTRIB0x00012000 (4x/4f), from https://github.com/boykopovar/AnyPS5/discussions/5268#discussioncomment-18926400. #5915 handles the single-sample-rasterizer version with a depth target by centring the depth samples too. Would you extend this PR to a depth target the same way, or would you prefer a follow-up after it merges? Happy to send that follow-up.AI-assisted
Imported from boykopovar/AnyPS5. Originally posted by billythemenace2 on 2026-10-14T18:34:22Z.
@mrfelek @SandstromPL Thanks for the Peace Walker data. I'd keep this PR to the case it was checked on, filled primitives with no depth target and no alpha-to-coverage, and take the depth target in a follow-up after it merges. #5915 already centres the depth samples for the single-sample-rasterizer case, so the depth handling belongs with that work. @SandstromPL, please go ahead with the follow-up.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by SandstromPL on 2026-10-14T19:21:48Z.
One thing for this PR on current
main: since #5861,decodeSampleLocationssetssampleLocationGridfor a pattern that varies between pixels (State.cpp:438), and this block fills the locations with zeros but leaves the flag set. The locations are then all centred, but Pipeline.cpp:120 still requires a 2x2 sample-location grid and the pipeline keys differ for the same state. Addingresult.sampleLocationGrid = false;next toresult.sampleLocations.fill(0);covers it. The draw B follow-up is up as #6014 , stacked on this PR.Imported from boykopovar/AnyPS5. Originally posted by billythemenace2 on 2026-10-14T21:06:17Z.
@SandstromPL Thanks, good catch. Done in
e10ec3904on top of a rebase onto currentmain: the block now also clearssampleLocationGrid. The test adds a 2x target withoutMSAA_ENABLEwhose pixel 1 holds different locations, and checks that it ends up centred with no grid. The test fails without the line and passes with it, andtools/check_conventions.pypasses.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:11:04Z.
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)docs/dev/debt/libSceAgcDriver.mdL21Some 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.
core/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T14:12:20Z.
Checked on the merged tree:
agc_driver_graphicspasses and fails without theState.cppchange (the 2x case, the alpha-to-coverage throw and the clearedsampleLocationGridare all pinned). The libSceAgcDriver ctest scope is green apart fromagc_driver_tessellation, which segfaults on main too. The debt entry is in place and marks the pixel-center result as inferred. Merging once the full Build is green.