From 43b31fc6fcee6deb52a8bd033dada62e9ce67ecb Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 19 Feb 2009 12:56:56 +0000 Subject: util: Support PIPE_FORMAT_Z32_FLOAT in pipe_tile_raw_to_rgba --- src/gallium/auxiliary/util/u_tile.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/gallium/auxiliary/util') diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c index 853c503f4f..788cc560e4 100644 --- a/src/gallium/auxiliary/util/u_tile.c +++ b/src/gallium/auxiliary/util/u_tile.c @@ -769,6 +769,32 @@ z24s8_get_tile_rgba(const unsigned *src, } +/*** PIPE_FORMAT_Z32_FLOAT ***/ + +/** + * Return each Z value as four floats. + */ +static void +z32f_get_tile_rgba(const float *src, + unsigned w, unsigned h, + float *p, + unsigned dst_stride) +{ + unsigned i, j; + + for (i = 0; i < h; i++) { + float *pRow = p; + for (j = 0; j < w; j++, pRow += 4) { + pRow[0] = + pRow[1] = + pRow[2] = + pRow[3] = *src++; + } + p += dst_stride; + } +} + + /*** PIPE_FORMAT_YCBCR / PIPE_FORMAT_YCBCR_REV ***/ /** @@ -913,6 +939,9 @@ pipe_tile_raw_to_rgba(enum pipe_format format, case PIPE_FORMAT_Z24S8_UNORM: z24s8_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride); break; + case PIPE_FORMAT_Z32_FLOAT: + z32f_get_tile_rgba((float *) src, w, h, dst, dst_stride); + break; case PIPE_FORMAT_YCBCR: ycbcr_get_tile_rgba((ushort *) src, w, h, dst, dst_stride, FALSE); break; -- cgit v1.2.3 From 77388559886dd84c69aaffc9a385ad87c410afa9 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 20 Feb 2009 16:48:45 +0000 Subject: util: Use a checkboard pattern instead of asserting for unknown formats. Useful to replay traces which use DXTC textures... --- src/gallium/auxiliary/util/u_tile.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'src/gallium/auxiliary/util') diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c index 788cc560e4..336c7714d4 100644 --- a/src/gallium/auxiliary/util/u_tile.c +++ b/src/gallium/auxiliary/util/u_tile.c @@ -883,6 +883,27 @@ ycbcr_get_tile_rgba(const ushort *src, } +static void +fake_get_tile_rgba(const ushort *src, + unsigned w, unsigned h, + float *p, + unsigned dst_stride) +{ + unsigned i, j; + + for (i = 0; i < h; i++) { + float *pRow = p; + for (j = 0; j < w; j++, pRow += 4) { + pRow[0] = + pRow[1] = + pRow[2] = + pRow[3] = (i ^ j) & 1 ? 1.0f : 0.0f; + } + p += dst_stride; + } +} + + void pipe_tile_raw_to_rgba(enum pipe_format format, void *src, @@ -949,7 +970,8 @@ pipe_tile_raw_to_rgba(enum pipe_format format, ycbcr_get_tile_rgba((ushort *) src, w, h, dst, dst_stride, TRUE); break; default: - assert(0); + debug_printf("%s: unsupported format %s\n", __FUNCTION__, pf_name(format)); + fake_get_tile_rgba(src, w, h, dst, dst_stride); } } @@ -1051,7 +1073,7 @@ pipe_put_tile_rgba(struct pipe_surface *ps, /*z24s8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);*/ break; default: - assert(0); + debug_printf("%s: unsupported format %s\n", __FUNCTION__, pf_name(ps->format)); } pipe_put_tile_raw(ps, x, y, w, h, packed, 0); -- cgit v1.2.3