Repository navigation
fix(agc): accept MSAA_ENABLE on a single-sample target sampled at the pixel center - #4309
Merged
oneandonlydean merged 1 commit intoOct 12, 2026
Conversation
oneandonlydean
force-pushed
the
up4/fix-2776-msaa-enable-single-sample
branch
from
October 12, 2026 06:10
b174ea7 to
fdfbeba
Compare
Merged
10 tasks done
9 tasks done
10 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Refs #2776. Resident Evil 4 (PPSA07411) stops at
scan conversion mode is unsupported (register 0x292 = 0x00000003):PA_SC_MODE_CNTL_0.MSAA_ENABLE(bit 0) withPA_SC_AA_CONFIG.MSAA_NUM_SAMPLES = 0. Since #419 the bit is accepted only with more than one sample. #2169 does not decode sample locations for one sample, so this rule reads sample 0 from the registers.What the bit does with one sample, from Mesa at
745709a0(the drivers for this GPU family; nothing here is measured on a console):MSAA_ENABLE = 1withMSAA_NUM_SAMPLES = 0, for one-sample custom sample locations:radv_emit_msaa_state(msaa_enable = rasterization_samples > 1 || enable_1x_user_sample_locs, with the sample count at L13674). The commit that added it, 061bc615, says "Only GFX10+ can support 1x user sample locations, but MSAA_ENABLE needs to be enabled", and RADV advertises one-sample locations from GFX10 (radv_physical_device.cL2161). So with one sample the bit makes the rasterizer sample at the programmed location of sample 0 (S0_X/S0_Yof the fourPA_SC_AA_SAMPLE_LOCS_PIXEL_*_0registers) instead of the pixel center.PA_SU_SMALL_PRIM_FILTER_CNTL.SC_1XMSAA_COMPATIBLE_DISABLEwith the comment "use sample locations even for MSAA 1x" (ac_cmdbuf.cL751-753), and radeonsi writes the one-sample locations as zero, noting that only sample 0 is used (si_state_msaa.cL70-73, L265-270).multisample || poly_smooth || line_smooth,si_state.cL967-971) and the sample count separately (L3373-3382), so the bit with one sample is a state the driver produces.gfx10.jsonPA_SC_MODE_CNTL_0.The sources do not say what the bit does to points, lines (it is also the line and polygon smoothing switch in radeonsi), rectangles, alpha-to-coverage or conservative rasterization with one sample, and they do not state that it changes nothing else for filled triangles; that last part is inferred from RADV drawing one-sample triangles in this state, and is recorded in TechnicalDebt.
The change: with one sample, bit 0 is accepted when sample 0 of all four
PA_SC_AA_SAMPLE_LOCS_PIXEL_*_0registers is(0, 0)(the pixel center, where a draw without the bit samples), the draw rasterizes triangles (triangle list, fan or strip, or triangle output from tessellation or a geometry shader), and alpha-to-coverage and conservative rasterization are off. It then decodes to the same state as without the bit. Each other case throws with its own message naming the register: a sample 0 off the center, points, lines, rectangles, alpha-to-coverage, conservative rasterization. Location registers the title never wrote throw as a missing register, because their value is not known.LINE_STIPPLE_ENABLEand the other bits of the register are refused as before, and the draw precheck applies the same rules.The issue only gives the value of
0x292, so I do not know whether the title's draw has its sample at the center or draws triangles. @xXPBSXx, once #3737 and #4044 are in, could you run PPSA07411 with this and say whether it gets past this stop, or post the new message if it names another register?Tested
Linux (CachyOS, GCC, RTX 4090, NVIDIA driver), Release, configured with the CI flags (
-DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON), onmain2ccbd37 (after #2169):agc_driver_graphics(newMsaaEnableSingleSampleTests): the accepted state decodes like the same registers with bit 0 clear and passes the precheck; a sample 0 off the center in any of the four pixels, a missing location register, alpha-to-coverage, conservative rasterization, lines, rectangles, points (precheck) andLINE_STIPPLE_ENABLEare refused; triangle fans and strips are accepted; without the bit, sample locations and alpha-to-coverage are accepted as before.agc_driver_msaa_enable_single_sample(new): one command buffer draws the same triangle, with an edge through the target, into two color targets, with0x292 = 2and0x292 = 3; the two memories are equal byte for byte and partly covered.mainwithscan conversion mode is unsupported (register 0x292 = 0x00000003)and pass with the change.ctest -R "agc|shader": 442 of 442 pass.python3 tools/check_conventions.py --base origin/mainandtools/check_test_registration.pypass.Not tested: PPSA07411 (I do not have the title); a console or an AMD GPU (the behaviour rests on the Mesa sources above); lavapipe and Windows (not installed here; the CI jobs are the test).
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)