From 725b27135bd8d0e8b6597db98405a5ec63894cfd Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 1 Jul 2020 16:48:54 -0700 Subject: [PATCH] gallium/util: Move the Z/S handling to the outside of get_tile(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This lets us drop the special case for S8_UINT, and makes our read_4 path just like other callers. Reviewed-by: Marek Olšák Part-of: --- src/gallium/auxiliary/util/u_tile.c | 97 ++++++++++++++--------------- 1 file changed, 46 insertions(+), 51 deletions(-) diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c index c7cea07c870..58be4f1526f 100644 --- a/src/gallium/auxiliary/util/u_tile.c +++ b/src/gallium/auxiliary/util/u_tile.c @@ -414,60 +414,55 @@ pipe_get_tile_rgba(struct pipe_transfer *pt, pipe_get_tile_raw(pt, src, x, y, w, h, packed, 0); - /* softpipe's S8_UINT texture cache fetch needs to take the rgba_format - * path, not ui (since there's no ui unpack for s8, but it's technically - * pure integer). - */ - if (util_format_is_pure_uint(format) && - !util_format_is_depth_or_stencil(format)) { - util_format_read_4ui(format, - dst, dst_stride * sizeof(float), - packed, util_format_get_stride(format, w), - 0, 0, w, h); - } else if (util_format_is_pure_sint(format)) { - util_format_read_4i(format, - dst, dst_stride * sizeof(float), - packed, util_format_get_stride(format, w), - 0, 0, w, h); - } else { - switch (format) { - case PIPE_FORMAT_Z16_UNORM: - z16_get_tile_rgba((ushort *) packed, w, h, dst, dst_stride); - break; - case PIPE_FORMAT_Z32_UNORM: - z32_get_tile_rgba((unsigned *) packed, w, h, dst, dst_stride); - break; - case PIPE_FORMAT_Z24_UNORM_S8_UINT: - case PIPE_FORMAT_Z24X8_UNORM: - s8z24_get_tile_rgba((unsigned *) packed, w, h, dst, dst_stride); - break; - case PIPE_FORMAT_S8_UINT: - s8_get_tile_rgba((unsigned char *) packed, w, h, dst, dst_stride); - break; - case PIPE_FORMAT_X24S8_UINT: - s8x24_get_tile_rgba((unsigned *) packed, w, h, dst, dst_stride); - break; - case PIPE_FORMAT_S8_UINT_Z24_UNORM: - case PIPE_FORMAT_X8Z24_UNORM: - z24s8_get_tile_rgba((unsigned *) packed, w, h, dst, dst_stride); - break; - case PIPE_FORMAT_S8X24_UINT: - x24s8_get_tile_rgba((unsigned *) packed, w, h, dst, dst_stride); - break; - case PIPE_FORMAT_Z32_FLOAT: - z32f_get_tile_rgba((float *) packed, w, h, dst, dst_stride); - break; - case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: - z32f_x24s8_get_tile_rgba((float *) packed, w, h, dst, dst_stride); - break; - case PIPE_FORMAT_X32_S8X24_UINT: - x32_s8_get_tile_rgba((unsigned *) packed, w, h, dst, dst_stride); - break; - default: - util_format_read_4f(format, + switch (format) { + case PIPE_FORMAT_Z16_UNORM: + z16_get_tile_rgba((ushort *) packed, w, h, dst, dst_stride); + break; + case PIPE_FORMAT_Z32_UNORM: + z32_get_tile_rgba((unsigned *) packed, w, h, dst, dst_stride); + break; + case PIPE_FORMAT_Z24_UNORM_S8_UINT: + case PIPE_FORMAT_Z24X8_UNORM: + s8z24_get_tile_rgba((unsigned *) packed, w, h, dst, dst_stride); + break; + case PIPE_FORMAT_S8_UINT: + s8_get_tile_rgba((unsigned char *) packed, w, h, dst, dst_stride); + break; + case PIPE_FORMAT_X24S8_UINT: + s8x24_get_tile_rgba((unsigned *) packed, w, h, dst, dst_stride); + break; + case PIPE_FORMAT_S8_UINT_Z24_UNORM: + case PIPE_FORMAT_X8Z24_UNORM: + z24s8_get_tile_rgba((unsigned *) packed, w, h, dst, dst_stride); + break; + case PIPE_FORMAT_S8X24_UINT: + x24s8_get_tile_rgba((unsigned *) packed, w, h, dst, dst_stride); + break; + case PIPE_FORMAT_Z32_FLOAT: + z32f_get_tile_rgba((float *) packed, w, h, dst, dst_stride); + break; + case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: + z32f_x24s8_get_tile_rgba((float *) packed, w, h, dst, dst_stride); + break; + case PIPE_FORMAT_X32_S8X24_UINT: + x32_s8_get_tile_rgba((unsigned *) packed, w, h, dst, dst_stride); + break; + default: + if (util_format_is_pure_uint(format)) { + util_format_read_4ui(format, + dst, dst_stride * sizeof(float), + packed, util_format_get_stride(format, w), + 0, 0, w, h); + } else if (util_format_is_pure_sint(format)) { + util_format_read_4i(format, dst, dst_stride * sizeof(float), packed, util_format_get_stride(format, w), 0, 0, w, h); + } else { + util_format_read_4f(format, + dst, dst_stride * sizeof(float), + packed, util_format_get_stride(format, w), + 0, 0, w, h); } } -- 2.30.2