From 7090b34ca574950bdaa1db3b2569e6a1ee067b4b Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sat, 18 Mar 2023 18:16:40 -0400 Subject: [PATCH] asahi: Compress more texture targets They should already work, we just need it enabled. The comment here claimed (incorrectly) that there is no hardware support for linear 2D arrays. In fact, there is support, it's just not advertised in the public Metal API. With some awful tricks, I managed to reverse-engineer the hardware interface and hooked it up, so we can take advantage of it now. In fact, we can stop checking the target explicitly at all. The only case where we can't compress is 1D/buffer textures, which are necessarily less than 16 height so will be dropped in the next check. When I originally wrote this cuhange, dolphin's MeltyMoltenGalaxy trace with specialized shaders at 4K was helped from 28fps to 43fps, which is massive :-) Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/asahi/agx_pipe.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c index 01277af454f..90a58569999 100644 --- a/src/gallium/drivers/asahi/agx_pipe.c +++ b/src/gallium/drivers/asahi/agx_pipe.c @@ -423,16 +423,6 @@ agx_compression_allowed(const struct agx_resource *pres) assert(!util_format_is_compressed(pres->base.format) && "block-compressed formats are not renderable"); - /* TODO: Compression of arrays/cubes currently fails because it would require - * arrayed linear staging resources, which the hardware doesn't support. This - * could be worked around with more sophisticated blit code. - */ - if (pres->base.target != PIPE_TEXTURE_2D && - pres->base.target != PIPE_TEXTURE_RECT) { - rsrc_debug(pres, "No compression: array/cube\n"); - return false; - } - /* Small textures cannot (should not?) be compressed */ if (pres->base.width0 < 16 || pres->base.height0 < 16) { rsrc_debug(pres, "No compression: too small\n");