aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/format_unpack.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2011-11-27 20:54:34 +0000
committerDave Airlie <[email protected]>2011-12-22 12:25:32 +0000
commitd61d39922b06c234790d055761407eaf4333ccde (patch)
treea0addacc8352b1b4ce720fe6e5ec8e38bfccf011 /src/mesa/main/format_unpack.c
parentf1d89638c02afafbf82ef657cd6ba9965dad6738 (diff)
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 <[email protected]>
Diffstat (limited to 'src/mesa/main/format_unpack.c')
-rw-r--r--src/mesa/main/format_unpack.c134
1 files changed, 134 insertions, 0 deletions
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
@@ -1581,6 +1581,58 @@ unpack_int_rgba_RGBA_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
}
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)
{
unsigned int i;
@@ -1594,6 +1646,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)
{
unsigned int i;
@@ -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);