Repository navigation
fix(agc): rasterize a multisampled depth target without MSAA_ENABLE at the pixel center - #6014
Conversation
…pixel center A draw with PA_SC_AA_CONFIG.MSAA_NUM_SAMPLES > 0 and PA_SC_MODE_CNTL_0.MSAA_ENABLE clear threw. On GFX10 and later the bit is what makes the rasterizer use the programmed sample locations; with it clear the draw now keeps the target's sample count with every sample at the pixel center. Points, lines, a depth target and alpha-to-coverage still throw. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…MSAA_ENABLE Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Peace Walker (PPSA18216) with this PR: draw B passes, draw C is nextLinux, RTX 3080 Ti (NVIDIA 615.71.09). Build:
The frame then ends at draw C with Note: this PR is built on #5882's earlier head d9d8fb7. On #5882's current head (e10ec39, which adds AI-assisted; the runs are from my machine. |
Draw B registers (Peace Walker, PPSA18216)The first presentation gets past draw B with #5915, #5882 and this PR (details in my earlier comment); the frame then ends at draw C. Registers read at draw B (the
My reading of the fields (please check): AI-assisted; the runs are from my machine. |
…t the pixel center A draw with PA_SC_AA_CONFIG.MSAA_NUM_SAMPLES 2 (4x) and MSAA_ENABLE clear into a 4x depth/stencil and color pair threw "multisampled targets rasterized without MSAA_ENABLE are unsupported for points, lines, a depth target or alpha-to-coverage", which stops METAL GEAR SOLID: Peace Walker (PPSA18216) at its first presentation (draw B on boykopovar#5268). A depth target with the same sample count now gets the same pixel center samples as the color targets, so each depth and stencil sample is tested and written with the depth at the pixel center, as GL allows when multisampling is disabled. DB_EQAA Z interpolation or overrasterization and a sample-mask export with a depth target throw on this path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
82d90b0 to
4ef2af6
Compare
|
@mrfelek Thanks for the run and for the draw B registers! I've restacked this PR onto #5882's current head |
|
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.
|
|
Checked the decode of a multisampled depth/stencil target without MSAA_ENABLE: |
|
@adriadam10 #6014 dropped out of the Build batches after 02:44Z without being merged, and I couldn't tell why. Run 38994273700, with #6014 first at 4ef2af6, was green on every job at 02:43Z. In the smaller run 38994264368, Linux failed only The head hasn't changed, it still merges cleanly into current AI-assisted: yes (Claude Code) |
|
Intel and AMD Windows data: no failures from this change. Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built, This head Full CTest ( AI-assisted: yes (Claude Code) |
…zer without MSAA_ENABLE as one sample With boykopovar#6014 merged, the first draw of METAL GEAR SOLID: Peace Walker's (PPSA18216) opening movie stops on "the depth target's sample count differs from the rasterizer's" (mrfelek on boykopovar#6196). The state he reported is a 4x PA_SC_AA_CONFIG, MSAA_ENABLE clear, a one-sample 1440x810 depth target and no color target; on main alone it throws earlier, on "a depth target". Like the one-sample color targets of bb87779, such a depth target, with or without one-sample color targets, is now drawn as a one-sample draw at the pixel center, before the multisampled-target check and instead of the sample-0 path, which needs MSAA_ENABLE. Points, lines, alpha-to-coverage, a sample-mask export and DB_EQAA Z interpolation or overrasterization throw on this path, and so do PS_ITER_SAMPLE and ANCILLARY or SAMPLE_COVERAGE pixel inputs when the pixel program runs. A skipped pixel program is replaced by the null program, which uses neither. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
#5882 is merged (7b20318). This branch was built on #5882's head
e10ec3904, whichmainnow contains, so this PR has only its own commit. GitHub's commit list may still show #5882's two commits until the next push. billythemenace2 asked for this follow-up.With #5915 (draw A), #5882 and #5439, METAL GEAR SOLID: Peace Walker (PPSA18216) stops at draw B of its first presentation:
mrfelek posted the registers of draw B:
PA_SC_AA_CONFIGPA_SC_MODE_CNTL_0MSAA_ENABLEclear)DB_Z_INFODB_EQAADB_DEPTH_CONTROLCB_COLOR0_ATTRIBOnly 0x711 binds the depth/stencil target, through its stencil test. That is the draw #5882 refuses. mrfelek posted its stencil registers too:
DB_STENCIL_INFO0x20000181 (an 8-bit stencil plane);DB_STENCIL_CONTROL0x333 andDB_STENCILREFMASK0x00ff0000: the fail, depth-fail and pass ops replace with the test value 0, write mask 0xff;0x622ae6ae) in all four pixels.So every sample of the 4x target that draw B covers gets stencil 0, which mrfelek reads as a stencil clear.
With #5439, #5915, #5882's
e10ec3904and this PR, merged by hand the way it is now restacked, mrfelek's run gets past draw B. The first presentation then stops at draw C, a one-sample color target under the same stale 4xPA_SC_AA_CONFIG. #6196 handles that.#5882 rasterizes a multisampled target without
MSAA_ENABLEwith the target's sample count and every sample at the pixel center, and it refuses a depth target. A depth/stencil target with the same sample count now goes the same way. Its samples are at the pixel center too, so each depth and stencil sample is tested and written with the depth at the pixel center.GL allows this when multisampling is disabled. Every sample may take the single-sample depth (ARB_multisample L185-L190), and the fragment may be treated as in multisampling with full coverage (L422-L425). #5915 uses the same rule for a single-sample rasterizer.
These throw:
DB_EQAAZ interpolation or overrasterization (bits 18-19 and 24-27). Draw B'sDB_EQAAhas neither.#5915 also refuses a pixel program reading the sample index, because it widens a single-sample rasterizer to the depth target's count. Here the rasterizer already has that count, so #5882's rules for a multisampled target apply unchanged.
Not measured on hardware, and recorded in #5882's debt entry, which this extends:
PA_SC_AA_SAMPLE_LOCS_PIXEL_*) withoutMSAA_ENABLE. As in fix(agc): rasterize a multisampled target without MSAA_ENABLE at the pixel center #5882, this is inferred from RADV.Tested
Ubuntu 24.04, GCC 13.3, Release with
BUILD_TESTING=ON, on #5882's heade10ec3904(basemainfa539dd). Locally, the libusb lines were removed fromCMakeLists.txt, because the libusb submodule isn't checked out here.agc_driver_graphics(tests/Graphics.cpp) gainsmsaaEnableClearDepthTests. It uses draw B's posted registers, including the stencil registers and sample locations.DB_DEPTH_CONTROL0x711D32_SFLOAT_S8_UINT, with its stencil test decoding toALWAYS,REPLACEwith reference 0 and write mask 0xff). It puts every sample at the pixel center and passes the draw precheck.DB_DEPTH_CONTROL0x710DB_EQAAZ interpolation (bit 18 or 19) or overrasterizationDB_EQAAZ interpolation with no depth target#5882's own refusal test is updated for the shorter message. With #5882 alone, the new test fails at draw B with the message above. With this commit it passes, 5 runs out of 5.
Other checks:
cteston the RTX 3050 Ti: 1,201 of 1,203 pass, 12 of them skipping themselves:agc_driver_stencil_ref_exporton this GPU, and the VideoOut flip tests, which need a display. The other 2,patched_librariesandguest_usbd, are Not Run because the libusb submodule isn't checked out. All 420agc_drivertests pass apart from that skip.mainwith fix(agc): rasterize a single-sample scan into a multisampled depth target at the pixel center #5915 (draw A) and fix(agc): rasterize into one-sample targets as one sample when MSAA_ENABLE is clear #6196 (draw C): fullctestgives 1,214 of 1,216, with the same 12 skips and the same 2 Not Run, andagc_driver_graphicsruns all three new test functions.e10ec3904clearssampleLocationGridin the block this PR extends, so a depth target drawn this way gets no grid either.main5d9dcc4 the branch merges cleanly, both on its own and with each of fix(agc): rasterize a single-sample scan into a multisampled depth target at the pixel center #5915, fix(agc): rasterize into one-sample targets as one sample when MSAA_ENABLE is clear #6196, feat(agc): rasterize a multisampled draw into one-sample targets at sample 0's locations #5907 and feat(agc): import uniform multisampled DCC fast clears #5939 (feat(agc): emulate PA_SC_AA_MASK sample masks #6015 has merged since). The overlap check finds one conflict, with fix(agc): allow MSAA_ENABLE single-sample rect lists #6563. It rewrites the entry just above this PR's indocs/dev/debt/libSceAgcDriver.md, so the two adjacent lines conflict, whileState.cppandtests/Graphics.cppmerge automatically. Whichever PR merges second keeps both entries.tools/check_conventions.pyfrommainpasses with this title and body.@mrfelek, thanks for the run and for the stencil registers. The test now uses them.
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)ctest; the new checks are host-side decode tests)🤖 Generated with Claude Code