From: Dave Airlie Date: Sun, 27 Nov 2011 20:54:34 +0000 (+0000) Subject: format_unpack: add 8/16 rgba/rgb types. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d61d39922b06c234790d055761407eaf4333ccde;p=mesa.git format_unpack: add 8/16 rgba/rgb types. fixing these makes piglit fbo-integer pass on softpipe. modified to re-order things, haven't addressed Eric's concerns, can't find anything in spec that mentions sign extensions, it does say integers aren't clamped or modified. Signed-off-by: Dave Airlie --- diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c index 32d198ce84b..a22ff5a616e 100644 --- a/src/mesa/main/format_unpack.c +++ b/src/mesa/main/format_unpack.c @@ -1580,6 +1580,58 @@ unpack_int_rgba_RGBA_UINT32(const GLuint *src, GLuint dst[][4], GLuint n) memcpy(dst, src, n * 4 * sizeof(GLuint)); } +static void +unpack_int_rgba_RGBA_UINT16(const GLushort *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = src[i * 4 + 0]; + dst[i][1] = src[i * 4 + 1]; + dst[i][2] = src[i * 4 + 2]; + dst[i][3] = src[i * 4 + 3]; + } +} + +static void +unpack_int_rgba_RGBA_INT16(const GLshort *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = src[i * 4 + 0]; + dst[i][1] = src[i * 4 + 1]; + dst[i][2] = src[i * 4 + 2]; + dst[i][3] = src[i * 4 + 3]; + } +} + +static void +unpack_int_rgba_RGBA_UINT8(const GLubyte *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = src[i * 4 + 0]; + dst[i][1] = src[i * 4 + 1]; + dst[i][2] = src[i * 4 + 2]; + dst[i][3] = src[i * 4 + 3]; + } +} + +static void +unpack_int_rgba_RGBA_INT8(const GLbyte *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = src[i * 4 + 0]; + dst[i][1] = src[i * 4 + 1]; + dst[i][2] = src[i * 4 + 2]; + dst[i][3] = src[i * 4 + 3]; + } +} + static void unpack_int_rgba_RGB_UINT32(const GLuint *src, GLuint dst[][4], GLuint n) { @@ -1593,6 +1645,58 @@ unpack_int_rgba_RGB_UINT32(const GLuint *src, GLuint dst[][4], GLuint n) } } +static void +unpack_int_rgba_RGB_UINT16(const GLushort *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = src[i * 3 + 0]; + dst[i][1] = src[i * 3 + 1]; + dst[i][2] = src[i * 3 + 2]; + dst[i][3] = 1; + } +} + +static void +unpack_int_rgba_RGB_INT16(const GLshort *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = src[i * 3 + 0]; + dst[i][1] = src[i * 3 + 1]; + dst[i][2] = src[i * 3 + 2]; + dst[i][3] = 1; + } +} + +static void +unpack_int_rgba_RGB_UINT8(const GLubyte *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = src[i * 3 + 0]; + dst[i][1] = src[i * 3 + 1]; + dst[i][2] = src[i * 3 + 2]; + dst[i][3] = 1; + } +} + +static void +unpack_int_rgba_RGB_INT8(const GLbyte *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = src[i * 3 + 0]; + dst[i][1] = src[i * 3 + 1]; + dst[i][2] = src[i * 3 + 2]; + dst[i][3] = 1; + } +} + static void unpack_int_rgba_RG_UINT32(const GLuint *src, GLuint dst[][4], GLuint n) { @@ -1677,10 +1781,40 @@ _mesa_unpack_int_rgba_row(gl_format format, GLuint n, case MESA_FORMAT_RGBA_INT32: unpack_int_rgba_RGBA_UINT32(src, dst, n); break; + + case MESA_FORMAT_RGBA_UINT16: + unpack_int_rgba_RGBA_UINT16(src, dst, n); + break; + case MESA_FORMAT_RGBA_INT16: + unpack_int_rgba_RGBA_INT16(src, dst, n); + break; + + case MESA_FORMAT_RGBA_UINT8: + unpack_int_rgba_RGBA_UINT8(src, dst, n); + break; + case MESA_FORMAT_RGBA_INT8: + unpack_int_rgba_RGBA_INT8(src, dst, n); + break; + case MESA_FORMAT_RGB_UINT32: case MESA_FORMAT_RGB_INT32: unpack_int_rgba_RGB_UINT32(src, dst, n); break; + + case MESA_FORMAT_RGB_UINT16: + unpack_int_rgba_RGB_UINT16(src, dst, n); + break; + case MESA_FORMAT_RGB_INT16: + unpack_int_rgba_RGB_INT16(src, dst, n); + break; + + case MESA_FORMAT_RGB_UINT8: + unpack_int_rgba_RGB_UINT8(src, dst, n); + break; + case MESA_FORMAT_RGB_INT8: + unpack_int_rgba_RGB_INT8(src, dst, n); + break; + case MESA_FORMAT_RG_UINT32: case MESA_FORMAT_RG_INT32: unpack_int_rgba_RG_UINT32(src, dst, n);