feat(agc): render into CMASK fast-clear color targets #1072
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1072"
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 alfalfa-star on 2026-10-07T08:38:28Z.
What
Draws into a color target with
CB_COLOR_INFO.FAST_CLEAR(bit 13) are no longer rejected. The fast clear is modeled on its CMASK:DecodeColorBufferreads the CMASK address (CB_COLOR0_CMASK,CB_COLOR0_CMASK_BASE_EXT) and the bytes one nibble per 8x8 tile spans (ColorTarget::cmaskAddress,cmaskBytes).RunColorMetadataPass), a CMASK whose nibbles are all 0 (fast-cleared) is materialized. The whole target is filled with theCB_COLOR_CLEAR_WORDtexel:FillClearon its resident image, else guest memory on the CPU. The CMASK bytes are then stored as expanded (0xF nibbles). The final pixels are those of the draw followed by the eliminate pass.The CMASK reads and stores reuse the DCC key paths, because expanded nibbles and "uncompressed" keys are both 0xFF bytes.
CurrentDccKeyswaits for recorded work that writes the range (the title's fast-clear fill may still be pending on the GPU), andMarkDccUncompressedrecords the store into the open batch when the memory is imported. A TechnicalDebt line records what is not modeled. The CMASK layout is not decoded, which is why only uniform CMASKs are accepted.materializeCmaskClearruns after the resident lookup's try block, so a refused CMASK fails the draw instead of leaving the target non-resident with the clear skipped.Tested
Linux 7.2.9 (Arch), Mesa 26.2.4 RADV, RX 9070 XT.
CB_COLOR_INFO 0xa024, CMASK right after the texels, clear words 0). Its final composite into the display buffer was dropped on every frame, so only black was presented (344 of 344 presents in a 150 s run). With this change, the PlayStation Studios logo and the intro render. A 200 s run has no CMASK refusals.cmaskTestsinagc_driver_graphicscover the decode (address, size, the DCC, mipmapped and missing-address refusals) and the eliminate pass: a cleared CMASK becomes clear texels with an expanded CMASK, an expanded one leaves the texels alone, and a mixed one throws without changing them.ctest: 386 of 386 pass.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-07T08:54:54Z.
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/TechnicalDebt.mdL255core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppL2077-2085core/libs/prx/libSceAgcDriver/Graphics/src/State.cppL644core/libs/prx/libSceAgcDriver/tests/Graphics.cppL765, L2149core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppL1529core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppL1529core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppL1529Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-07T11:04:41Z.
On the overlap with #419: both PRs decode
CB_COLOR0_CMASK/CMASK_BASE_EXTintoColorTarget::cmaskAddress. They cover different cases and use different models:CurrentDccKeyswaits for recorded work.Whichever PR merges second keeps both: one
cmaskAddressfield, the multisampled decode from #419 and the single-sample decode from here. I'm happy to do that rebase if #419 lands first.New commit
44d855a6: @ThisIsAkill reported on #419 that PPSA21567's DCC targets (CB_COLOR_INFO 0x10042730) set FAST_CLEAR, fill their CMASK with0xffffffff, and keep the clear in the DCC keys, which is what radv does (radv_get_cmask_fast_clear_value). Those targets now decode, and the existing DCC path materializes their clear. A DCC target's CMASK that is not all expanded still throws.cmaskTestscovers both cases, and the throw is checked to fail without the guard.ctest: 386 of 386 pass. I have not run PPSA21567 itself.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T06:08:59Z.
Checked the CMASK decode (address, size, refusals), the eliminate pass (cleared / expanded / mixed CMASK, DCC under an expanded CMASK) and
cmaskTests; the TechnicalDebt line is in "Functional". Rebased onto currentmain(only a TechnicalDebt adjacency conflict); build is green andctestpasses exceptaudio_out2_port_layouts, an unrelated flake that passes 3/3 on its own.This overlaps #419 (both decode
CB_COLOR0_CMASKintoColorTarget::cmaskAddress), so this one lands first and #419 rebases on top of this CMASK decode. Merging.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-08T06:35:21Z.
cmaskBytes(State.cpp:698) packs one nibble per 8x8 tile, but the CMASK is laid out in 4 KiB metablocks of 1024x512 pixels with the nibbles swizzled inside them, so at 1920x1080 it spans 0x6000 bytes, not 16200, and the all-cleared check and the expanded store miss the lower-right tiles. Please take1c848903afrom #1237 (theCmaskBytessize and its tests, without the mixed-CMASK commits after it) into this PR before it lands.