From 02e29bdea4693376bda03e43fb4aab42cd2de873 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 27 Oct 2024 14:39:52 -0400 Subject: [PATCH] libagx: don't rely on loop unroll in txs silly, should reduce memory footprint. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/lib/shaders/texture.cl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/asahi/lib/shaders/texture.cl b/src/asahi/lib/shaders/texture.cl index af9d432a2c6..b56b7e31c69 100644 --- a/src/asahi/lib/shaders/texture.cl +++ b/src/asahi/lib/shaders/texture.cl @@ -43,8 +43,13 @@ libagx_txs(constant struct agx_texture_packed *ptr, uint16_t lod, size.y = size.z; /* Adjust for LOD, do not adjust array size */ - for (uint c = 0; c < (nr_comps - (uint)is_array); ++c) - size[c] = max(size[c] >> lod, 1u); + size.x = max(size.x >> lod, 1u); + + if (nr_comps - (uint)is_array >= 2) + size.y = max(size.y >> lod, 1u); + + if (nr_comps - (uint)is_array >= 3) + size.z = max(size.z >> lod, 1u); /* Cube maps have equal width and height, we save some instructions by only * reading one. Dead code elimination will remove the redundant instructions.