aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/format_unpack.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-07-31 10:17:14 +0200
committermarha <marha@users.sourceforge.net>2012-07-31 10:17:14 +0200
commit83da3ad0287bc51cd16ee6911fe73dc98ebe000b (patch)
tree48d48590a0b0a3770006aeda8ec2b2a45054d1f1 /mesalib/src/mesa/main/format_unpack.c
parent00e30605ffc7ac3cf1a091ff2c1f46cfefb780d7 (diff)
parentbd27b3d008b0abf9ae2edcb127302728808533e4 (diff)
downloadvcxsrv-83da3ad0287bc51cd16ee6911fe73dc98ebe000b.tar.gz
vcxsrv-83da3ad0287bc51cd16ee6911fe73dc98ebe000b.tar.bz2
vcxsrv-83da3ad0287bc51cd16ee6911fe73dc98ebe000b.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/mesa/main/format_unpack.c')
-rw-r--r--mesalib/src/mesa/main/format_unpack.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c
index c42bac19c..529c416a8 100644
--- a/mesalib/src/mesa/main/format_unpack.c
+++ b/mesalib/src/mesa/main/format_unpack.c
@@ -610,6 +610,20 @@ unpack_ARGB2101010(const void *src, GLfloat dst[][4], GLuint n)
static void
+unpack_ABGR2101010_UINT(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLfloat)((s[i] >> 0) & 0x3ff);
+ dst[i][GCOMP] = (GLfloat)((s[i] >> 10) & 0x3ff);
+ dst[i][BCOMP] = (GLfloat)((s[i] >> 20) & 0x3ff);
+ dst[i][ACOMP] = (GLfloat)((s[i] >> 30) & 0x03);
+ }
+}
+
+
+static void
unpack_Z24_S8(const void *src, GLfloat dst[][4], GLuint n)
{
/* only return Z, not stencil data */
@@ -1499,6 +1513,7 @@ get_unpack_rgba_function(gl_format format)
table[MESA_FORMAT_RG1616] = unpack_RG1616;
table[MESA_FORMAT_RG1616_REV] = unpack_RG1616_REV;
table[MESA_FORMAT_ARGB2101010] = unpack_ARGB2101010;
+ table[MESA_FORMAT_ABGR2101010_UINT] = unpack_ABGR2101010_UINT;
table[MESA_FORMAT_Z24_S8] = unpack_Z24_S8;
table[MESA_FORMAT_S8_Z24] = unpack_S8_Z24;
table[MESA_FORMAT_Z16] = unpack_Z16;
@@ -2139,6 +2154,32 @@ unpack_int_rgba_RGBA_INT8(const GLbyte *src, GLuint dst[][4], GLuint n)
}
static void
+unpack_int_rgba_ARGB8888(const GLbyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLubyte) src[i * 4 + 2];
+ dst[i][GCOMP] = (GLubyte) src[i * 4 + 1];
+ dst[i][BCOMP] = (GLubyte) src[i * 4 + 0];
+ dst[i][ACOMP] = (GLubyte) src[i * 4 + 3];
+ }
+}
+
+static void
+unpack_int_rgba_XRGB8888(const GLbyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLubyte) src[i * 4 + 2];
+ dst[i][GCOMP] = (GLubyte) src[i * 4 + 1];
+ dst[i][BCOMP] = (GLubyte) src[i * 4 + 0];
+ dst[i][ACOMP] = (GLubyte) 0xff;
+ }
+}
+
+static void
unpack_int_rgba_RGB_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
{
unsigned int i;
@@ -2563,6 +2604,20 @@ unpack_int_rgba_ARGB2101010_UINT(const GLuint *src, GLuint dst[][4], GLuint n)
}
}
+static void
+unpack_int_rgba_ABGR2101010_UINT(const GLuint *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ GLuint tmp = src[i];
+ dst[i][0] = (tmp >> 0) & 0x3ff;
+ dst[i][1] = (tmp >> 10) & 0x3ff;
+ dst[i][2] = (tmp >> 20) & 0x3ff;
+ dst[i][3] = (tmp >> 30) & 0x3;
+ }
+}
+
void
_mesa_unpack_uint_rgba_row(gl_format format, GLuint n,
const void *src, GLuint dst[][4])
@@ -2590,6 +2645,14 @@ _mesa_unpack_uint_rgba_row(gl_format format, GLuint n,
unpack_int_rgba_RGBA_INT8(src, dst, n);
break;
+ case MESA_FORMAT_ARGB8888:
+ unpack_int_rgba_ARGB8888(src, dst, n);
+ break;
+
+ case MESA_FORMAT_XRGB8888:
+ unpack_int_rgba_XRGB8888(src, dst, n);
+ break;
+
case MESA_FORMAT_RGB_UINT32:
case MESA_FORMAT_RGB_INT32:
unpack_int_rgba_RGB_UINT32(src, dst, n);
@@ -2725,6 +2788,11 @@ _mesa_unpack_uint_rgba_row(gl_format format, GLuint n,
case MESA_FORMAT_ARGB2101010_UINT:
unpack_int_rgba_ARGB2101010_UINT(src, dst, n);
break;
+
+ case MESA_FORMAT_ABGR2101010_UINT:
+ unpack_int_rgba_ABGR2101010_UINT(src, dst, n);
+ break;
+
default:
_mesa_problem(NULL, "%s: bad format %s", __FUNCTION__,
_mesa_get_format_name(format));