aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/format_unpack.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main/format_unpack.c')
-rw-r--r--mesalib/src/mesa/main/format_unpack.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c
index 0a8b8b183..28a50f31e 100644
--- a/mesalib/src/mesa/main/format_unpack.c
+++ b/mesalib/src/mesa/main/format_unpack.c
@@ -2268,6 +2268,44 @@ unpack_XBGR32323232_SINT(const void *src, GLfloat dst[][4], GLuint n)
}
}
+static void
+unpack_ABGR2101010(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] = ((s[i] >> 0) & 0x3ff) * (1.0F / 1023.0F);
+ dst[i][GCOMP] = ((s[i] >> 10) & 0x3ff) * (1.0F / 1023.0F);
+ dst[i][BCOMP] = ((s[i] >> 20) & 0x3ff) * (1.0F / 1023.0F);
+ dst[i][ACOMP] = ((s[i] >> 30) & 0x03) * (1.0F / 3.0F);
+ }
+}
+
+static void
+unpack_SIGNED_RG88(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 8) );
+ dst[i][GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] & 0xff) );
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = 1.0F;
+ }
+}
+
+static void
+unpack_SIGNED_RG1616(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] = SHORT_TO_FLOAT_TEX( (GLshort) (s[i] >> 16) );
+ dst[i][GCOMP] = SHORT_TO_FLOAT_TEX( (GLshort) (s[i] & 0xffff) );
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = 1.0F;
+ }
+}
/**
* Return the unpacker function for the given format.
@@ -2481,6 +2519,11 @@ get_unpack_rgba_function(gl_format format)
table[MESA_FORMAT_XBGR32323232_UINT] = unpack_XBGR32323232_UINT;
table[MESA_FORMAT_XBGR32323232_SINT] = unpack_XBGR32323232_SINT;
+ table[MESA_FORMAT_ABGR2101010] = unpack_ABGR2101010;
+
+ table[MESA_FORMAT_SIGNED_RG88] = unpack_SIGNED_RG88;
+ table[MESA_FORMAT_SIGNED_RG1616] = unpack_SIGNED_RG1616;
+
initialized = GL_TRUE;
}
@@ -3582,6 +3625,20 @@ unpack_int_rgba_XBGR32323232_UINT(const GLuint *src, GLuint dst[][4], GLuint n)
}
}
+static void
+unpack_int_rgba_ABGR2101010(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])
@@ -3782,6 +3839,10 @@ _mesa_unpack_uint_rgba_row(gl_format format, GLuint n,
unpack_int_rgba_XBGR32323232_UINT(src, dst, n);
break;
+ case MESA_FORMAT_ABGR2101010:
+ unpack_int_rgba_ABGR2101010(src, dst, n);
+ break;
+
default:
_mesa_problem(NULL, "%s: bad format %s", __FUNCTION__,
_mesa_get_format_name(format));