summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/format_unpack.c
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2013-11-22 19:49:58 -0800
committerFrancisco Jerez <[email protected]>2014-01-15 16:42:07 +0100
commit7510c10209d95458ededf01234b644bf2020d768 (patch)
tree817d5a1b7d5cde0579746a2a081a0d10b2f8820f /src/mesa/main/format_unpack.c
parent87942749a327725014b0d160b3e48d6d83723ac2 (diff)
mesa: Add MESA_FORMAT_SIGNED_RG88 and _RG1616.
Including pack/unpack and texstore code. ARB_shader_image_load_store requires support for the GL_RG8_SNORM and GL_RG16_SNORM formats, which map to MESA_FORMAT_SIGNED_GR88 and MESA_FORMAT_SIGNED_GR1616 on little-endian hosts, and MESA_FORMAT_SIGNED_RG88 and MESA_FORMAT_SIGNED_RG1616 respectively on big-endian hosts -- only the former were already present, add support for the latter. Acked-by: Chris Forbes <[email protected]> Reviewed-by: Paul Berry <[email protected]>
Diffstat (limited to 'src/mesa/main/format_unpack.c')
-rw-r--r--src/mesa/main/format_unpack.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c
index fa559300d03..28a50f31ee4 100644
--- a/src/mesa/main/format_unpack.c
+++ b/src/mesa/main/format_unpack.c
@@ -2281,6 +2281,32 @@ unpack_ABGR2101010(const void *src, GLfloat dst[][4], GLuint n)
}
}
+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.
*/
@@ -2495,6 +2521,9 @@ get_unpack_rgba_function(gl_format format)
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;
}