diff options
author | Eric Anholt <[email protected]> | 2020-07-01 16:48:54 -0700 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-07-07 18:19:22 +0000 |
commit | 725b27135bd8d0e8b6597db98405a5ec63894cfd (patch) | |
tree | ba74b247c424f268fb40be706b056a48605d13a2 /src | |
parent | a2b74a5d8a199eafdd4697088e16e99947f8a75e (diff) |
gallium/util: Move the Z/S handling to the outside of get_tile().
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 <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5728>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/util/u_tile.c | 97 |
1 files 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); } } |