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 <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22891>
This commit is contained in:
Alyssa Rosenzweig 2023-03-18 18:16:40 -04:00
parent 9f39bbdee9
commit 7090b34ca5

View file

@ -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");