AnyPS5/core/libs/prx/libSceAgcDriver/Graphics/include
Dean Galvin 9c3a35b867 fix(agc): apply CMASK fast clears per tile
A CMASK that was neither all fast-cleared nor all expanded threw, so a
title that fast clears a target and then draws over part of it before the
eliminate could not run past it.

The CMASK is now decoded tile by tile: one nibble per 8x8 tile in
1024x512 metablocks of 4 KiB, addressed with the pipe-aligned
SW_64KB_Z_X CMASK equation for 16 pipes (addrlib
GFX10_CMASK_SW_PATTERN, Gfx10Lib::HwlComputeCmaskAddrFromCoord). Code 0
stores CB_COLOR_CLEAR_WORD into the tile's texels, 0xF keeps them; any
other code, a cleared tile of a DCC target and any other CMASK swizzle
mode throw. Edge tiles are included and the CMASK is then stored as
expanded.

For a resident target whose CMASK is host-imported the clear is a
compute pass recorded in stream order: it reads the nibbles from the
import, stores the clear into the cleared tiles through a UINT view of
the image and fills the CMASK expanded, so nothing waits for pending GPU
writes of the CMASK. Invalid codes it reads set a bit that the next
materialization throws on. Otherwise the CPU reads the CMASK and stores
the cleared tiles into guest memory, or fills the resident image when
every tile is cleared. A CMASK nothing has stored over since it was
expanded is skipped.

The decode requires CB_COLOR_ATTRIB3 FMASK_SW_MODE SW_64KB_Z_X with
CMASK_PIPE_ALIGNED, a 4 KiB aligned writable CMASK and texels of at most
64 bits, and CMASK_BASE_EXT is part of the draw key.

Tests: CMASK sizes and nibble addresses against addrlib; decode
rejections and draw key coverage; CPU eliminate of full, partial,
out-of-range-nibble and DCC decompress cases and invalid codes. The new
agc_driver_cmask_fast_clear GPU test draws over fast-cleared and partly
fast-cleared linear and SW_64KB_R_X targets, eliminates partial, edge
and checkerboard CMASKs through the compute pass and checks that an
invalid code it reads throws.
2026-10-10 18:20:06 +13:00
..
BdaResources.hpp style: drop the branch's code comments per CONVENTIONS.md 2026-09-29 21:25:29 +03:00
BufferPool.hpp perf(agc): pool device staging buffers by size class 2026-10-09 14:58:21 +02:00
ColorTargetLayout.hpp fix(agc): apply CMASK fast clears per tile 2026-10-10 18:20:06 +13:00
ColorTargetTransfer.hpp feat(agc): support tiled color target layout 2026-09-23 13:15:30 +03:00
Context.hpp feat(agc): bind storage buffers update-after-bind above the per-stage limit 2026-10-10 02:08:15 +02:00
DccMetadata.hpp fix(agc): store and read DCC keys over the console's metadata extent 2026-10-08 15:24:43 +02:00
DepthSurface.hpp fix(agc): color targets with gaps between written MRT slots, depth array slices 2026-10-01 23:21:58 +02:00
Draw.hpp fix(agc): bind a null index buffer to non-indexed mesh draws 2026-10-07 15:18:10 +02:00
GpuColorTransfer.hpp perf(agc): keep the 10-bit scanout resident and present it with the guest path's pixels 2026-10-03 08:49:27 +13:00
GuestBufferMemory.hpp Merge pull request #2176 from oneandonlydean/up639/adjusted-regions 2026-10-10 10:49:12 +13:00
GuestSamplerResource.hpp feat(agc): accept samplers that force sRGB decoding of sRGB textures 2026-10-10 01:38:17 +02:00
GuestTextureResource.hpp fix(agc): store and read DCC keys over the console's metadata extent 2026-10-08 15:24:43 +02:00
Pipeline.hpp feat(agc): accept 64-bit atomics in graphics shaders when the device enables them 2026-10-08 20:16:01 +02:00
PipelineCache.hpp feat(agc): persistent shader disk cache and Vulkan pipeline cache 2026-09-30 12:01:25 +03:00
PipelineSpecialization.hpp fix(shader): validate and serialize pipeline specialization constants (wip) 2026-10-08 17:28:35 +03:00
Recorder.hpp Merge pull request #2469 from oneandonlydean/up639/occlusion-in-pass 2026-10-10 17:47:42 +13:00
Resources.hpp perf(agc): dispatch and draw recipes, data-only cache hits, unit shadows, bindless image tables 2026-09-26 19:00:40 -07:00
Sampler.hpp feat(agc): accept samplers that force sRGB decoding of sRGB textures 2026-10-10 01:38:17 +02:00
ShaderInputState.hpp refactor(shader): separate artifact preparation from draw and dispatch 2026-10-08 17:26:40 +03:00
ShaderResources.hpp Merge pull request #1865 from fisherjoey/perf/texture-key-ignore-feedback 2026-10-10 17:16:09 +13:00
Shaders.hpp feat(shader): translate NGG geometry programs to mesh shaders 2026-09-30 23:57:47 +13:00
State.hpp fix(agc): apply CMASK fast clears per tile 2026-10-10 18:20:06 +13:00
Texture.hpp fix(agc): apply CMASK fast clears per tile 2026-10-10 18:20:06 +13:00
TextureCache.hpp perf(agc): keep render targets on gpu across draws 2026-09-24 21:30:00 +03:00
TextureDetiler.hpp fix(agc): apply CMASK fast clears per tile 2026-10-10 18:20:06 +13:00
TextureFormat.hpp feat(agc): accept samplers that force sRGB decoding of sRGB textures 2026-10-10 01:38:17 +02:00
TextureSwizzleEquations.hpp fix(agc): lay out 3D SW_64KB_D_X textures as thick volumes 2026-10-08 18:28:19 -04:00
TextureTiling.hpp feat(agc): thick mip tails of mipmapped 3D textures 2026-10-05 21:32:06 +13:00
UnitShadow.hpp fix(agc): keep the guest's bytes in the padding a storage write-back stores 2026-10-05 20:51:34 +13:00
VertexInput.hpp Merge pull request #1968 from lubaxe/fix/agc-skip-primitive-restart-index 2026-10-10 17:43:21 +13:00