mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-23 00:53:02 -05:00
Draws into a color target with CB_COLOR_INFO FAST_CLEAR (bit 13) were rejected. The CMASK keeps one nibble per 8x8 tile: 0 means the tile is fast-cleared and reads as CB_COLOR_CLEAR_WORD, 0xF means expanded (the texels hold the color). The texture units and display scanout do not read it, so a title runs a fast-clear eliminate pass before sampling or flipping such a target. DecodeColorBuffer now takes the CMASK address (CB_COLOR0_CMASK and CB_COLOR0_CMASK_BASE_EXT) and the bytes one nibble per 8x8 tile spans. Before a draw renders into the target, and in a fast-clear eliminate pass, a CMASK whose nibbles are all 0 is materialized: the target is filled with the clear texel (FillClear on its resident image, else guest memory on the CPU) and the CMASK bytes are stored as expanded, through the same GPU-ordered store as the DCC "uncompressed" keys (0xFF either way). The result equals the draw followed by the eliminate pass. An all-expanded CMASK changes nothing; a mixed one throws, as do fast clears of DCC, mipmapped, 3D and array targets. PPSA14632 (LEGO Horizon Adventures) fast-clears its two 3840x2160 display buffers through CMASK, so its final composite draw was dropped on every frame and only black was presented. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>