Repository navigation
Conversation
On GFX10 a CMASK only exists for multisampled targets, so a single-sample target with CB_COLOR_INFO.FAST_CLEAR no longer reads CB_COLOR0_CMASK. The CMASK tests now expect single-sample targets to decode without one and a CB resolve into such a target to be accepted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J4vyrZtvxRFspN1Wyj88Jv
| - [Descriptor pool chain](../../core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp) (libSceAgcDriver) - each pool holds two storage buffer descriptors more than a set can take, as a workaround: RADV (Mesa 26.0 and later) lets a `FREE_DESCRIPTOR_SET` pool place a set up to 32 bytes past the pool's buffer ([`util_vma_heap_init`](https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/amd/vulkan/radv_descriptor_pool.c) is given `bo_size + RADV_POOL_HEAP_OFFSET` as a size), and with a page-multiple pool size those bytes are an unmapped page | ||
| - [CMASK fast clears](../../core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp) (libSceAgcDriver) - each fast-cleared CMASK tile (code 0) is stored as `CB_COLOR_CLEAR_WORD` into its 8x8 texels at the first draw into the target or at its fast-clear eliminate or DCC decompress pass, not as the color block writes the tile, and the CMASK is then stored as expanded (0xF): a texture or copy read of the target after that draw and before the title's eliminate sees the clear value in tiles no draw wrote, where the console keeps their previous bytes. Tile addresses follow the pipe-aligned SW_64KB_Z_X CMASK equation for 16 pipes; other CMASK swizzle modes, codes other than 0 and 0xF, a cleared tile of a DCC target and a fast clear of a mipmapped, 3D or array color target throw. When the clear runs as a compute pass (a resident target whose CMASK is host-imported), an invalid code throws at the next fast-clear materialization, not at the one that read it | ||
| - [CMASK fast clears](../../core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp) (libSceAgcDriver) - no longer reached from the decode, which gives no single-sample target a CMASK. Each fast-cleared CMASK tile (code 0) is stored as `CB_COLOR_CLEAR_WORD` into its 8x8 texels at the first draw into the target or at its fast-clear eliminate or DCC decompress pass, not as the color block writes the tile, and the CMASK is then stored as expanded (0xF): a texture or copy read of the target after that draw and before the title's eliminate sees the clear value in tiles no draw wrote, where the console keeps their previous bytes. Tile addresses follow the pipe-aligned SW_64KB_Z_X CMASK equation for 16 pipes; other CMASK swizzle modes, codes other than 0 and 0xF, a cleared tile of a DCC target and a fast clear of a mipmapped, 3D or array color target throw. When the clear runs as a compute pass (a resident target whose CMASK is host-imported), an invalid code throws at the next fast-clear materialization, not at the one that read it | ||
| - [Single-sample CMASK](../../core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp) (libSceAgcDriver) - a single-sample color target's CMASK is not decoded: CB_COLOR_INFO FAST_CLEAR on a single-sample target is ignored, following Mesa and PAL on GFX10; unverified on PS5 hardware. |
There was a problem hiding this comment.
The current conventions check fails with four errors because these four libSceAgcDriver debt entries are being added to the aggregate docs/dev/TechnicalDebt.md. The trusted convention script now requires debt for a library under docs/dev/debt/<library>.md; this component’s file is docs/dev/debt/libSceAgcDriver.md. Could these entries be moved there? That should also clear the reported CI errors.
There was a problem hiding this comment.
Thanks, the follow-up commit moves the entries to docs/dev/debt/libSceAgcDriver.md. I rechecked the current head: conventions now passes.
There was a problem hiding this comment.
Thanks! Rebased onto current main: the four entries are now in docs/dev/debt/libSceAgcDriver.md, and the conventions check passes. Full CI on my fork after the rebase is green.
b1374d1 to
2870780
Compare
|
A data point that may cut against this, from Kena: Bridge of Spirits (PPSA01802, UE4), on a local stack of main + #425 + #3763 + #4031 + #4041 + #4500 + #4586. RADV, RX 9070 XT.
So at least this title's AGC path fast-clears single-sample targets through CMASK on the PS5, whatever Mesa and PAL do on desktop GFX10. The caveat: Kena's runs vary a lot from run to run, so this is two runs each way, not a clean A/B. I can log the CB_COLOR*_INFO and CMASK registers of those targets if that would help. |
|
This is a concrete counterexample to the assumption that these single-sample targets can ignore CMASK. Could you share the matching |
|
Thanks for the Kena data point, that settles it: a title that zero-fills its CMASK and relies on the fast clear of single-sample targets rules out ignoring the CMASK. I checked The Pathless (PPSA01825) on Details for The Pathless on #4041: #4041 (comment) |
What
DecodeColorBufferdecodes a CMASK only for multisampled color targets. A single-sample target withCB_COLOR_INFO.FAST_CLEAR(bit 13) now decodes without one:cmaskAddressstays 0 andCB_COLOR0_CMASKis not read. Multisampled targets are unchanged.This follows what AMD's two public drivers do on GFX10. The PS5 GPU is GFX10-family.
1b75efe0):ac_surface.cL3031-3036 computes a single-sample CMASK only forgfx_level <= GFX9("CMASK -- on GFX10 only for FMASK");ac_descriptors.hL57-58:CMASK_NOAA_COLOR_CLEAR_REGandCMASK_NOAA_COLOR_EXPANDEDare "only valid on gfx6-9".c5e80007):Gfx9Cmask::UseCmaskForImage,gfx9MaskRam.cppL4874-4882 gives a GFX10 image a CMASK only for EQAA orsamples > 1;gfx9ColorTargetView.cppnever setsFAST_CLEARon GFX10 and setsCOMPRESSIONonly with CMASK/FMASK.Neither driver measures what the color block does with
FAST_CLEARset on a single-sample target. Nothing here is measured on PS5 hardware either.Why
The Pathless (PPSA01825, own dump, 02.000.000) aborts at its first present:
Its two 3840x2160 display buffers are single-sample, have no DCC and set
FAST_CLEAR(CB_COLOR_INFO 0xa828). TheirCB_COLOR0_CMASK(0x1010480000,0x10140d0000) points into memory the title uses as a CPU heap. I measured this with temporary local traces, not committed:sceKernelEnableDmemAliasingis never called.libc.prxcopies data in.89 50 4E 47), and every nibble value 0 to 15 occurs.APS5_NO_FILL_HLE=1gives the same abort.So nothing ever fast-clears that CMASK. Reading it as one gives meaning to PNG bytes. Code 0 nibbles would store the clear value over what the title draws, and the other codes abort.
To reach this point, The Pathless needs #4491 (PlayGo chunk ids without a chunk table). Without it, it stops earlier, out of memory.
Tests changed
cmaskTests(#1072, #2470) and one check ofmultisampleTests(#419) encoded a single-sample CMASK model that was never measured on hardware. They now expect the new decode, and each still checks something:FAST_CLEARtarget decodes without a CMASK. The same registers with 2 samples decode the CMASK.FMASK_SW_MODE/CMASK_PIPE_ALIGNEDrefusal is checked on the 2-sample target, since a single-sample target no longer reaches it. The mipmapped and misaligned-CMASK refusals were single-sample only and are gone with that path. A missing CMASK address is still refused for multisampled targets inmultisampleTests.FAST_CLEARtarget leaves its texels and the memoryCB_COLOR0_CMASKpoints at untouched.agc_driver_cmask_fast_clearalready does.FAST_CLEARdestination now decodes, with no CMASK, instead of throwing.agc_driver_cmask_fast_clearis unchanged and passes.TechnicalDebt
docs/dev/debt/libSceAgcDriver.md:FAST_CLEARis ignored, following Mesa and PAL, and that this is unverified on PS5 hardware;Unused code
materializeCmaskClear,CmaskLayout,CmaskClear.compandTextureDetiler::DispatchCmaskClearare now reached only by the tests: no decoded target has a single-sample CMASK any more. This PR leaves them in place. If you agree with the decode change, I can remove them in a separate PR.Related
#4041 (PPSA18391, a CMASK the title never initialized) handles codes other than 0 and 15 in the single-sample path. With this change that path is no longer reached from a decoded target. Both PRs edit
cmaskTests.Tested
main2a5eca1, and again after the rebase ontomain1acfa7f (the AGC tests andcheck_conventions).mainwithout this change:agc_driver_flat_loads*,agc_driver_global_loads*,agc_driver_flat_apertures_2/_5,agc_driver_pixel_interlock,agc_driver_wave32_subgroup.agc_driver_graphicsfails without theState.cppchange ("a single-sample FAST_CLEAR target decoded a CMASK").tools/check_conventions.pypasses.storage image access to depth/stencil surface ... is not implementedin another.--to-intel), the title of feat(agc): render into CMASK fast-clear color targets #1072:APS5_DUMP_FRAMESwithAPS5_NO_GPU_DUMP=1, every 5th present). Both show the same loading screen: a black frame with the same spinner, about 1440 to 1475 non-black pixels in the same box, with no trace of earlier frames. Then both present black frames.color views of several array slices are unsupported, so I could not compare the intro that feat(agc): render into CMASK fast-clear color targets #1072 checked.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)