+ dst[i][ACOMP] = 1.0F;
+ }
+}
+
+static void
+unpack_SIGNED_RG88_REV(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] & 0xff) );
+ dst[i][GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 8) );
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = 1.0F;
+ }
+}
+
+static void
+unpack_SIGNED_RGBX8888(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] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 24) );
+ dst[i][GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 16) );
+ dst[i][BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 8) );
+ dst[i][ACOMP] = 1.0f;
+ }
+}
+
+static void
+unpack_SIGNED_RGBA8888(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] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 24) );
+ dst[i][GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 16) );
+ dst[i][BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 8) );
+ dst[i][ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] ) );
+ }
+}
+
+static void
+unpack_SIGNED_RGBA8888_REV(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] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] ) );
+ dst[i][GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 8) );
+ dst[i][BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 16) );
+ dst[i][ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 24) );
+ }
+}
+
+static void
+unpack_SIGNED_R16(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLshort *s = ((const GLshort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = SHORT_TO_FLOAT_TEX( s[i] );
+ dst[i][GCOMP] = 0.0F;
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = 1.0F;
+ }
+}
+
+static void
+unpack_SIGNED_GR1616(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] & 0xffff) );
+ dst[i][GCOMP] = SHORT_TO_FLOAT_TEX( (GLshort) (s[i] >> 16) );
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = 1.0F;
+ }
+}
+
+static void
+unpack_SIGNED_RGB_16(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLshort *s = (const GLshort *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = SHORT_TO_FLOAT_TEX( s[i*3+0] );
+ dst[i][GCOMP] = SHORT_TO_FLOAT_TEX( s[i*3+1] );
+ dst[i][BCOMP] = SHORT_TO_FLOAT_TEX( s[i*3+2] );
+ dst[i][ACOMP] = 1.0F;
+ }
+}
+
+static void
+unpack_SIGNED_RGBA_16(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLshort *s = (const GLshort *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = SHORT_TO_FLOAT_TEX( s[i*4+0] );
+ dst[i][GCOMP] = SHORT_TO_FLOAT_TEX( s[i*4+1] );
+ dst[i][BCOMP] = SHORT_TO_FLOAT_TEX( s[i*4+2] );
+ dst[i][ACOMP] = SHORT_TO_FLOAT_TEX( s[i*4+3] );
+ }
+}
+
+static void
+unpack_RGBA_16(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] = USHORT_TO_FLOAT( s[i*4+0] );
+ dst[i][GCOMP] = USHORT_TO_FLOAT( s[i*4+1] );
+ dst[i][BCOMP] = USHORT_TO_FLOAT( s[i*4+2] );
+ dst[i][ACOMP] = USHORT_TO_FLOAT( s[i*4+3] );
+ }
+}
+
+static void
+unpack_RED_RGTC1(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_SIGNED_RED_RGTC1(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_RG_RGTC2(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_SIGNED_RG_RGTC2(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_L_LATC1(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_SIGNED_L_LATC1(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_LA_LATC2(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_SIGNED_LA_LATC2(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_ETC1_RGB8(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_ETC2_RGB8(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_ETC2_SRGB8(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_ETC2_RGBA8_EAC(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_ETC2_SRGB8_ALPHA8_EAC(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_ETC2_R11_EAC(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_ETC2_RG11_EAC(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_ETC2_SIGNED_R11_EAC(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_ETC2_SIGNED_RG11_EAC(const void *src, GLfloat dst[][4], GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_ETC2_RGB8_PUNCHTHROUGH_ALPHA1(const void *src, GLfloat dst[][4],
+ GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1(const void *src, GLfloat dst[][4],
+ GLuint n)
+{
+ /* XXX to do */
+}
+
+static void
+unpack_SIGNED_A8(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLbyte *s = ((const GLbyte *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = 0.0F;
+ dst[i][GCOMP] = 0.0F;
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = BYTE_TO_FLOAT_TEX( s[i] );
+ }
+}
+
+static void
+unpack_SIGNED_L8(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLbyte *s = ((const GLbyte *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = BYTE_TO_FLOAT_TEX( s[i] );
+ dst[i][ACOMP] = 1.0F;
+ }
+}
+
+static void
+unpack_SIGNED_AL88(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLshort *s = ((const GLshort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] & 0xff) );
+ dst[i][ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 8) );
+ }
+}
+
+static void
+unpack_SIGNED_I8(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLbyte *s = ((const GLbyte *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] =
+ dst[i][ACOMP] = BYTE_TO_FLOAT_TEX( s[i] );
+ }
+}
+
+static void
+unpack_SIGNED_A16(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLshort *s = ((const GLshort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = 0.0F;
+ dst[i][GCOMP] = 0.0F;
+ dst[i][BCOMP] = 0.0F;
+ dst[i][ACOMP] = SHORT_TO_FLOAT_TEX( s[i] );
+ }
+}
+
+static void
+unpack_SIGNED_L16(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLshort *s = ((const GLshort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = SHORT_TO_FLOAT_TEX( s[i] );
+ dst[i][ACOMP] = 1.0F;
+ }
+}
+
+static void
+unpack_SIGNED_AL1616(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLshort *s = (const GLshort *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = SHORT_TO_FLOAT_TEX( s[i*2+0] );
+ dst[i][ACOMP] = SHORT_TO_FLOAT_TEX( s[i*2+1] );
+ }
+}
+
+static void
+unpack_SIGNED_I16(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLshort *s = ((const GLshort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] =
+ dst[i][ACOMP] = SHORT_TO_FLOAT_TEX( s[i] );
+ }
+}
+
+static void
+unpack_RGB9_E5_FLOAT(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLuint *s = (const GLuint *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ rgb9e5_to_float3(s[i], dst[i]);
+ dst[i][ACOMP] = 1.0F;
+ }
+}
+
+static void
+unpack_R11_G11_B10_FLOAT(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLuint *s = (const GLuint *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ r11g11b10f_to_float3(s[i], dst[i]);
+ dst[i][ACOMP] = 1.0F;
+ }
+}
+
+static void
+unpack_XRGB4444_UNORM(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] = ((s[i] >> 8) & 0xf) * (1.0F / 15.0F);
+ dst[i][GCOMP] = ((s[i] >> 4) & 0xf) * (1.0F / 15.0F);
+ dst[i][BCOMP] = ((s[i] ) & 0xf) * (1.0F / 15.0F);
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_XRGB1555_UNORM(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] = ((s[i] >> 10) & 0x1f) * (1.0F / 31.0F);
+ dst[i][GCOMP] = ((s[i] >> 5) & 0x1f) * (1.0F / 31.0F);
+ dst[i][BCOMP] = ((s[i] >> 0) & 0x1f) * (1.0F / 31.0F);
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_XBGR8888_SNORM(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] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] ) );
+ dst[i][GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 8) );
+ dst[i][BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 16) );
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_XBGR8888_SRGB(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] = _mesa_nonlinear_to_linear( (s[i] ) & 0xff );
+ dst[i][GCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 8) & 0xff );
+ dst[i][BCOMP] = _mesa_nonlinear_to_linear( (s[i] >> 16) & 0xff );
+ dst[i][ACOMP] = UBYTE_TO_FLOAT( s[i] >> 24 ); /* linear! */
+ }
+}
+
+static void
+unpack_XBGR8888_UINT(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLbyte *s = (const GLbyte *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = s[i*4+0];
+ dst[i][GCOMP] = s[i*4+1];
+ dst[i][BCOMP] = s[i*4+2];
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_XBGR8888_SINT(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLbyte *s = (const GLbyte *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = s[i*4+0];
+ dst[i][GCOMP] = s[i*4+1];
+ dst[i][BCOMP] = s[i*4+2];
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_XRGB2101010_UNORM(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] >> 20) & 0x3ff) * (1.0F / 1023.0F);
+ dst[i][GCOMP] = ((s[i] >> 10) & 0x3ff) * (1.0F / 1023.0F);
+ dst[i][BCOMP] = ((s[i] >> 0) & 0x3ff) * (1.0F / 1023.0F);
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_XBGR16161616_UNORM(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] = USHORT_TO_FLOAT( s[i*4+0] );
+ dst[i][GCOMP] = USHORT_TO_FLOAT( s[i*4+1] );
+ dst[i][BCOMP] = USHORT_TO_FLOAT( s[i*4+2] );
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_XBGR16161616_SNORM(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLshort *s = (const GLshort *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = SHORT_TO_FLOAT_TEX( s[i*4+0] );
+ dst[i][GCOMP] = SHORT_TO_FLOAT_TEX( s[i*4+1] );
+ dst[i][BCOMP] = SHORT_TO_FLOAT_TEX( s[i*4+2] );
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_XBGR16161616_FLOAT(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLshort *s = (const GLshort *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = _mesa_half_to_float(s[i*4+0]);
+ dst[i][GCOMP] = _mesa_half_to_float(s[i*4+1]);
+ dst[i][BCOMP] = _mesa_half_to_float(s[i*4+2]);
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_XBGR16161616_UINT(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] = (GLfloat) s[i*4+0];
+ dst[i][GCOMP] = (GLfloat) s[i*4+1];
+ dst[i][BCOMP] = (GLfloat) s[i*4+2];
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_XBGR16161616_SINT(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLshort *s = (const GLshort *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLfloat) s[i*4+0];
+ dst[i][GCOMP] = (GLfloat) s[i*4+1];
+ dst[i][BCOMP] = (GLfloat) s[i*4+2];
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_XBGR32323232_FLOAT(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLfloat *s = (const GLfloat *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = s[i*4+0];
+ dst[i][GCOMP] = s[i*4+1];
+ dst[i][BCOMP] = s[i*4+2];
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_XBGR32323232_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*4+0];
+ dst[i][GCOMP] = (GLfloat) s[i*4+1];
+ dst[i][BCOMP] = (GLfloat) s[i*4+2];
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+static void
+unpack_XBGR32323232_SINT(const void *src, GLfloat dst[][4], GLuint n)
+{
+ const GLint *s = (const GLint *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (GLfloat) s[i*4+0];
+ dst[i][GCOMP] = (GLfloat) s[i*4+1];
+ dst[i][BCOMP] = (GLfloat) s[i*4+2];
+ dst[i][ACOMP] = 1.0;
+ }
+}
+
+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.
+ */
+static unpack_rgba_func
+get_unpack_rgba_function(mesa_format format)
+{
+ static unpack_rgba_func table[MESA_FORMAT_COUNT];
+ static GLboolean initialized = GL_FALSE;
+
+ if (!initialized) {
+ table[MESA_FORMAT_NONE] = NULL;
+
+ table[MESA_FORMAT_A8B8G8R8_UNORM] = unpack_RGBA8888;
+ table[MESA_FORMAT_R8G8B8A8_UNORM] = unpack_RGBA8888_REV;
+ table[MESA_FORMAT_B8G8R8A8_UNORM] = unpack_ARGB8888;
+ table[MESA_FORMAT_A8R8G8B8_UNORM] = unpack_ARGB8888_REV;
+ table[MESA_FORMAT_X8B8G8R8_UNORM] = unpack_RGBX8888;
+ table[MESA_FORMAT_R8G8B8X8_UNORM] = unpack_RGBX8888_REV;
+ table[MESA_FORMAT_B8G8R8X8_UNORM] = unpack_XRGB8888;
+ table[MESA_FORMAT_X8R8G8B8_UNORM] = unpack_XRGB8888_REV;
+ table[MESA_FORMAT_BGR_UNORM8] = unpack_RGB888;
+ table[MESA_FORMAT_RGB_UNORM8] = unpack_BGR888;
+ table[MESA_FORMAT_B5G6R5_UNORM] = unpack_RGB565;
+ table[MESA_FORMAT_R5G6B5_UNORM] = unpack_RGB565_REV;
+ table[MESA_FORMAT_B4G4R4A4_UNORM] = unpack_ARGB4444;
+ table[MESA_FORMAT_A4R4G4B4_UNORM] = unpack_ARGB4444_REV;
+ table[MESA_FORMAT_A1B5G5R5_UNORM] = unpack_RGBA5551;
+ table[MESA_FORMAT_B5G5R5A1_UNORM] = unpack_ARGB1555;
+ table[MESA_FORMAT_A1R5G5B5_UNORM] = unpack_ARGB1555_REV;
+ table[MESA_FORMAT_L4A4_UNORM] = unpack_AL44;
+ table[MESA_FORMAT_L8A8_UNORM] = unpack_AL88;
+ table[MESA_FORMAT_A8L8_UNORM] = unpack_AL88_REV;
+ table[MESA_FORMAT_L16A16_UNORM] = unpack_AL1616;
+ table[MESA_FORMAT_A16L16_UNORM] = unpack_AL1616_REV;
+ table[MESA_FORMAT_B2G3R3_UNORM] = unpack_RGB332;
+ table[MESA_FORMAT_A_UNORM8] = unpack_A8;
+ table[MESA_FORMAT_A_UNORM16] = unpack_A16;
+ table[MESA_FORMAT_L_UNORM8] = unpack_L8;
+ table[MESA_FORMAT_L_UNORM16] = unpack_L16;
+ table[MESA_FORMAT_I_UNORM8] = unpack_I8;
+ table[MESA_FORMAT_I_UNORM16] = unpack_I16;
+ table[MESA_FORMAT_YCBCR] = unpack_YCBCR;
+ table[MESA_FORMAT_YCBCR_REV] = unpack_YCBCR_REV;
+ table[MESA_FORMAT_R_UNORM8] = unpack_R8;
+ table[MESA_FORMAT_R8G8_UNORM] = unpack_GR88;
+ table[MESA_FORMAT_G8R8_UNORM] = unpack_RG88;
+ table[MESA_FORMAT_R_UNORM16] = unpack_R16;
+ table[MESA_FORMAT_R16G16_UNORM] = unpack_GR1616;
+ table[MESA_FORMAT_G16R16_UNORM] = unpack_RG1616;
+ table[MESA_FORMAT_B10G10R10A2_UNORM] = unpack_ARGB2101010;
+ table[MESA_FORMAT_B10G10R10A2_UINT] = unpack_ARGB2101010_UINT;
+ table[MESA_FORMAT_R10G10B10A2_UINT] = unpack_ABGR2101010_UINT;
+ table[MESA_FORMAT_S8_UINT_Z24_UNORM] = unpack_Z24_S8;
+ table[MESA_FORMAT_Z24_UNORM_S8_UINT] = unpack_S8_Z24;
+ table[MESA_FORMAT_Z_UNORM16] = unpack_Z16;
+ table[MESA_FORMAT_Z24_UNORM_X8_UINT] = unpack_X8_Z24;
+ table[MESA_FORMAT_X8Z24_UNORM] = unpack_Z24_X8;
+ table[MESA_FORMAT_Z_UNORM32] = unpack_Z32;
+ table[MESA_FORMAT_S_UINT8] = unpack_S8;
+ table[MESA_FORMAT_BGR_SRGB8] = unpack_SRGB8;
+ table[MESA_FORMAT_A8B8G8R8_SRGB] = unpack_SRGBA8;
+ table[MESA_FORMAT_B8G8R8A8_SRGB] = unpack_SARGB8;
+ table[MESA_FORMAT_L_SRGB8] = unpack_SL8;
+ table[MESA_FORMAT_L8A8_SRGB] = unpack_SLA8;
+ table[MESA_FORMAT_SRGB_DXT1] = unpack_SRGB_DXT1;
+ table[MESA_FORMAT_SRGBA_DXT1] = unpack_SRGBA_DXT1;
+ table[MESA_FORMAT_SRGBA_DXT3] = unpack_SRGBA_DXT3;
+ table[MESA_FORMAT_SRGBA_DXT5] = unpack_SRGBA_DXT5;
+
+ table[MESA_FORMAT_RGB_FXT1] = unpack_RGB_FXT1;
+ table[MESA_FORMAT_RGBA_FXT1] = unpack_RGBA_FXT1;
+ table[MESA_FORMAT_RGB_DXT1] = unpack_RGB_DXT1;
+ table[MESA_FORMAT_RGBA_DXT1] = unpack_RGBA_DXT1;
+ table[MESA_FORMAT_RGBA_DXT3] = unpack_RGBA_DXT3;
+ table[MESA_FORMAT_RGBA_DXT5] = unpack_RGBA_DXT5;
+
+ table[MESA_FORMAT_RGBA_FLOAT32] = unpack_RGBA_FLOAT32;
+ table[MESA_FORMAT_RGBA_FLOAT16] = unpack_RGBA_FLOAT16;
+ table[MESA_FORMAT_RGB_FLOAT32] = unpack_RGB_FLOAT32;
+ table[MESA_FORMAT_RGB_FLOAT16] = unpack_RGB_FLOAT16;
+ table[MESA_FORMAT_A_FLOAT32] = unpack_ALPHA_FLOAT32;
+ table[MESA_FORMAT_A_FLOAT16] = unpack_ALPHA_FLOAT16;
+ table[MESA_FORMAT_L_FLOAT32] = unpack_LUMINANCE_FLOAT32;
+ table[MESA_FORMAT_L_FLOAT16] = unpack_LUMINANCE_FLOAT16;
+ table[MESA_FORMAT_LA_FLOAT32] = unpack_LUMINANCE_ALPHA_FLOAT32;
+ table[MESA_FORMAT_LA_FLOAT16] = unpack_LUMINANCE_ALPHA_FLOAT16;
+ table[MESA_FORMAT_I_FLOAT32] = unpack_INTENSITY_FLOAT32;
+ table[MESA_FORMAT_I_FLOAT16] = unpack_INTENSITY_FLOAT16;
+ table[MESA_FORMAT_R_FLOAT32] = unpack_R_FLOAT32;
+ table[MESA_FORMAT_R_FLOAT16] = unpack_R_FLOAT16;
+ table[MESA_FORMAT_RG_FLOAT32] = unpack_RG_FLOAT32;
+ table[MESA_FORMAT_RG_FLOAT16] = unpack_RG_FLOAT16;
+
+ table[MESA_FORMAT_A_UINT8] = unpack_ALPHA_UINT8;
+ table[MESA_FORMAT_A_UINT16] = unpack_ALPHA_UINT16;
+ table[MESA_FORMAT_A_UINT32] = unpack_ALPHA_UINT32;
+ table[MESA_FORMAT_A_SINT8] = unpack_ALPHA_INT8;
+ table[MESA_FORMAT_A_SINT16] = unpack_ALPHA_INT16;
+ table[MESA_FORMAT_A_SINT32] = unpack_ALPHA_INT32;
+
+ table[MESA_FORMAT_I_UINT8] = unpack_INTENSITY_UINT8;
+ table[MESA_FORMAT_I_UINT16] = unpack_INTENSITY_UINT16;
+ table[MESA_FORMAT_I_UINT32] = unpack_INTENSITY_UINT32;
+ table[MESA_FORMAT_I_SINT8] = unpack_INTENSITY_INT8;
+ table[MESA_FORMAT_I_SINT16] = unpack_INTENSITY_INT16;
+ table[MESA_FORMAT_I_SINT32] = unpack_INTENSITY_INT32;
+
+ table[MESA_FORMAT_L_UINT8] = unpack_LUMINANCE_UINT8;
+ table[MESA_FORMAT_L_UINT16] = unpack_LUMINANCE_UINT16;
+ table[MESA_FORMAT_L_UINT32] = unpack_LUMINANCE_UINT32;
+ table[MESA_FORMAT_L_SINT8] = unpack_LUMINANCE_INT8;
+ table[MESA_FORMAT_L_SINT16] = unpack_LUMINANCE_INT16;
+ table[MESA_FORMAT_L_SINT32] = unpack_LUMINANCE_INT32;
+
+ table[MESA_FORMAT_LA_UINT8] = unpack_LUMINANCE_ALPHA_UINT8;
+ table[MESA_FORMAT_LA_UINT16] = unpack_LUMINANCE_ALPHA_UINT16;
+ table[MESA_FORMAT_LA_UINT32] = unpack_LUMINANCE_ALPHA_UINT32;
+ table[MESA_FORMAT_LA_SINT8] = unpack_LUMINANCE_ALPHA_INT8;
+ table[MESA_FORMAT_LA_SINT16] = unpack_LUMINANCE_ALPHA_INT16;
+ table[MESA_FORMAT_LA_SINT32] = unpack_LUMINANCE_ALPHA_INT32;
+
+ table[MESA_FORMAT_R_SINT8] = unpack_R_INT8;
+ table[MESA_FORMAT_RG_SINT8] = unpack_RG_INT8;
+ table[MESA_FORMAT_RGB_SINT8] = unpack_RGB_INT8;
+ table[MESA_FORMAT_RGBA_SINT8] = unpack_RGBA_INT8;
+ table[MESA_FORMAT_R_SINT16] = unpack_R_INT16;
+ table[MESA_FORMAT_RG_SINT16] = unpack_RG_INT16;
+ table[MESA_FORMAT_RGB_SINT16] = unpack_RGB_INT16;
+ table[MESA_FORMAT_RGBA_SINT16] = unpack_RGBA_INT16;
+ table[MESA_FORMAT_R_SINT32] = unpack_R_INT32;
+ table[MESA_FORMAT_RG_SINT32] = unpack_RG_INT32;
+ table[MESA_FORMAT_RGB_SINT32] = unpack_RGB_INT32;
+ table[MESA_FORMAT_RGBA_SINT32] = unpack_RGBA_INT32;
+ table[MESA_FORMAT_R_UINT8] = unpack_R_UINT8;
+ table[MESA_FORMAT_RG_UINT8] = unpack_RG_UINT8;
+ table[MESA_FORMAT_RGB_UINT8] = unpack_RGB_UINT8;
+ table[MESA_FORMAT_RGBA_UINT8] = unpack_RGBA_UINT8;
+ table[MESA_FORMAT_R_UINT16] = unpack_R_UINT16;
+ table[MESA_FORMAT_RG_UINT16] = unpack_RG_UINT16;
+ table[MESA_FORMAT_RGB_UINT16] = unpack_RGB_UINT16;
+ table[MESA_FORMAT_RGBA_UINT16] = unpack_RGBA_UINT16;
+ table[MESA_FORMAT_R_UINT32] = unpack_R_UINT32;
+ table[MESA_FORMAT_RG_UINT32] = unpack_RG_UINT32;
+ table[MESA_FORMAT_RGB_UINT32] = unpack_RGB_UINT32;
+ table[MESA_FORMAT_RGBA_UINT32] = unpack_RGBA_UINT32;
+
+ table[MESA_FORMAT_DUDV8] = unpack_DUDV8;
+ table[MESA_FORMAT_R_SNORM8] = unpack_SIGNED_R8;
+ table[MESA_FORMAT_R8G8_SNORM] = unpack_SIGNED_RG88_REV;
+ table[MESA_FORMAT_X8B8G8R8_SNORM] = unpack_SIGNED_RGBX8888;
+ table[MESA_FORMAT_A8B8G8R8_SNORM] = unpack_SIGNED_RGBA8888;
+ table[MESA_FORMAT_R8G8B8A8_SNORM] = unpack_SIGNED_RGBA8888_REV;
+ table[MESA_FORMAT_R_SNORM16] = unpack_SIGNED_R16;
+ table[MESA_FORMAT_R16G16_SNORM] = unpack_SIGNED_GR1616;
+ table[MESA_FORMAT_RGB_SNORM16] = unpack_SIGNED_RGB_16;
+ table[MESA_FORMAT_RGBA_SNORM16] = unpack_SIGNED_RGBA_16;
+ table[MESA_FORMAT_RGBA_UNORM16] = unpack_RGBA_16;
+
+ table[MESA_FORMAT_R_RGTC1_UNORM] = unpack_RED_RGTC1;
+ table[MESA_FORMAT_R_RGTC1_SNORM] = unpack_SIGNED_RED_RGTC1;
+ table[MESA_FORMAT_RG_RGTC2_UNORM] = unpack_RG_RGTC2;
+ table[MESA_FORMAT_RG_RGTC2_SNORM] = unpack_SIGNED_RG_RGTC2;
+
+ table[MESA_FORMAT_L_LATC1_UNORM] = unpack_L_LATC1;
+ table[MESA_FORMAT_L_LATC1_SNORM] = unpack_SIGNED_L_LATC1;
+ table[MESA_FORMAT_LA_LATC2_UNORM] = unpack_LA_LATC2;
+ table[MESA_FORMAT_LA_LATC2_SNORM] = unpack_SIGNED_LA_LATC2;
+
+ table[MESA_FORMAT_ETC1_RGB8] = unpack_ETC1_RGB8;
+ table[MESA_FORMAT_ETC2_RGB8] = unpack_ETC2_RGB8;
+ table[MESA_FORMAT_ETC2_SRGB8] = unpack_ETC2_SRGB8;
+ table[MESA_FORMAT_ETC2_RGBA8_EAC] = unpack_ETC2_RGBA8_EAC;
+ table[MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC] = unpack_ETC2_SRGB8_ALPHA8_EAC;
+ table[MESA_FORMAT_ETC2_R11_EAC] = unpack_ETC2_R11_EAC;
+ table[MESA_FORMAT_ETC2_RG11_EAC] = unpack_ETC2_RG11_EAC;
+ table[MESA_FORMAT_ETC2_SIGNED_R11_EAC] = unpack_ETC2_SIGNED_R11_EAC;
+ table[MESA_FORMAT_ETC2_SIGNED_RG11_EAC] = unpack_ETC2_SIGNED_RG11_EAC;
+ table[MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1] =
+ unpack_ETC2_RGB8_PUNCHTHROUGH_ALPHA1;
+ table[MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1] =
+ unpack_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1;
+ table[MESA_FORMAT_A_SNORM8] = unpack_SIGNED_A8;
+ table[MESA_FORMAT_L_SNORM8] = unpack_SIGNED_L8;
+ table[MESA_FORMAT_L8A8_SNORM] = unpack_SIGNED_AL88;
+ table[MESA_FORMAT_I_SNORM8] = unpack_SIGNED_I8;
+ table[MESA_FORMAT_A_SNORM16] = unpack_SIGNED_A16;
+ table[MESA_FORMAT_L_SNORM16] = unpack_SIGNED_L16;
+ table[MESA_FORMAT_LA_SNORM16] = unpack_SIGNED_AL1616;
+ table[MESA_FORMAT_I_SNORM16] = unpack_SIGNED_I16;
+
+ table[MESA_FORMAT_R9G9B9E5_FLOAT] = unpack_RGB9_E5_FLOAT;
+ table[MESA_FORMAT_R11G11B10_FLOAT] = unpack_R11_G11_B10_FLOAT;
+
+ table[MESA_FORMAT_Z_FLOAT32] = unpack_Z32_FLOAT;
+ table[MESA_FORMAT_Z32_FLOAT_S8X24_UINT] = unpack_Z32_FLOAT_X24S8;
+
+ table[MESA_FORMAT_B4G4R4X4_UNORM] = unpack_XRGB4444_UNORM;
+ table[MESA_FORMAT_B5G5R5X1_UNORM] = unpack_XRGB1555_UNORM;
+ table[MESA_FORMAT_R8G8B8X8_SNORM] = unpack_XBGR8888_SNORM;
+ table[MESA_FORMAT_R8G8B8X8_SRGB] = unpack_XBGR8888_SRGB;
+ table[MESA_FORMAT_RGBX_UINT8] = unpack_XBGR8888_UINT;
+ table[MESA_FORMAT_RGBX_SINT8] = unpack_XBGR8888_SINT;
+ table[MESA_FORMAT_B10G10R10X2_UNORM] = unpack_XRGB2101010_UNORM;
+ table[MESA_FORMAT_RGBX_UNORM16] = unpack_XBGR16161616_UNORM;
+ table[MESA_FORMAT_RGBX_SNORM16] = unpack_XBGR16161616_SNORM;
+ table[MESA_FORMAT_RGBX_FLOAT16] = unpack_XBGR16161616_FLOAT;
+ table[MESA_FORMAT_RGBX_UINT16] = unpack_XBGR16161616_UINT;
+ table[MESA_FORMAT_RGBX_SINT16] = unpack_XBGR16161616_SINT;
+ table[MESA_FORMAT_RGBX_FLOAT32] = unpack_XBGR32323232_FLOAT;
+ table[MESA_FORMAT_RGBX_UINT32] = unpack_XBGR32323232_UINT;
+ table[MESA_FORMAT_RGBX_SINT32] = unpack_XBGR32323232_SINT;
+
+ table[MESA_FORMAT_R10G10B10A2_UNORM] = unpack_ABGR2101010;
+
+ table[MESA_FORMAT_G8R8_SNORM] = unpack_SIGNED_RG88;
+ table[MESA_FORMAT_G16R16_SNORM] = unpack_SIGNED_RG1616;
+
+ initialized = GL_TRUE;
+ }
+
+ if (table[format] == NULL) {
+ _mesa_problem(NULL, "unsupported unpack for format %s",
+ _mesa_get_format_name(format));
+ }
+
+ return table[format];
+}
+
+
+/**
+ * Unpack rgba colors, returning as GLfloat values.
+ */
+void
+_mesa_unpack_rgba_row(mesa_format format, GLuint n,
+ const void *src, GLfloat dst[][4])
+{
+ unpack_rgba_func unpack = get_unpack_rgba_function(format);
+ unpack(src, dst, n);
+}
+
+
+/**********************************************************************/
+/* Unpack, returning GLubyte colors */
+/**********************************************************************/
+
+
+static void
+unpack_ubyte_RGBA8888(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (s[i] >> 24);
+ dst[i][GCOMP] = (s[i] >> 16) & 0xff;
+ dst[i][BCOMP] = (s[i] >> 8) & 0xff;
+ dst[i][ACOMP] = (s[i] ) & 0xff;
+ }
+}
+
+static void
+unpack_ubyte_RGBA8888_REV(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (s[i] ) & 0xff;
+ dst[i][GCOMP] = (s[i] >> 8) & 0xff;
+ dst[i][BCOMP] = (s[i] >> 16) & 0xff;
+ dst[i][ACOMP] = (s[i] >> 24);
+ }
+}
+
+static void
+unpack_ubyte_ARGB8888(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (s[i] >> 16) & 0xff;
+ dst[i][GCOMP] = (s[i] >> 8) & 0xff;
+ dst[i][BCOMP] = (s[i] ) & 0xff;
+ dst[i][ACOMP] = (s[i] >> 24);
+ }
+}
+
+static void
+unpack_ubyte_ARGB8888_REV(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (s[i] >> 8) & 0xff;
+ dst[i][GCOMP] = (s[i] >> 16) & 0xff;
+ dst[i][BCOMP] = (s[i] >> 24);
+ dst[i][ACOMP] = (s[i] ) & 0xff;
+ }
+}
+
+static void
+unpack_ubyte_RGBX8888(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (s[i] >> 24);
+ dst[i][GCOMP] = (s[i] >> 16) & 0xff;
+ dst[i][BCOMP] = (s[i] >> 8) & 0xff;
+ dst[i][ACOMP] = 0xff;
+ }
+}
+
+static void
+unpack_ubyte_RGBX8888_REV(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (s[i] ) & 0xff;
+ dst[i][GCOMP] = (s[i] >> 8) & 0xff;
+ dst[i][BCOMP] = (s[i] >> 16) & 0xff;
+ dst[i][ACOMP] = 0xff;
+ }
+}
+
+static void
+unpack_ubyte_XRGB8888(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (s[i] >> 16) & 0xff;
+ dst[i][GCOMP] = (s[i] >> 8) & 0xff;
+ dst[i][BCOMP] = (s[i] ) & 0xff;
+ dst[i][ACOMP] = 0xff;
+ }
+}
+
+static void
+unpack_ubyte_XRGB8888_REV(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLuint *s = ((const GLuint *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = (s[i] >> 8) & 0xff;
+ dst[i][GCOMP] = (s[i] >> 16) & 0xff;
+ dst[i][BCOMP] = (s[i] >> 24);
+ dst[i][ACOMP] = 0xff;
+ }
+}
+
+static void
+unpack_ubyte_RGB888(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLubyte *s = (const GLubyte *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = s[i*3+2];
+ dst[i][GCOMP] = s[i*3+1];
+ dst[i][BCOMP] = s[i*3+0];
+ dst[i][ACOMP] = 0xff;
+ }
+}
+
+static void
+unpack_ubyte_BGR888(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLubyte *s = (const GLubyte *) src;
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = s[i*3+0];
+ dst[i][GCOMP] = s[i*3+1];
+ dst[i][BCOMP] = s[i*3+2];
+ dst[i][ACOMP] = 0xff;
+ }
+}
+
+static void
+unpack_ubyte_RGB565(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = EXPAND_5_8((s[i] >> 11) & 0x1f);
+ dst[i][GCOMP] = EXPAND_6_8((s[i] >> 5 ) & 0x3f);
+ dst[i][BCOMP] = EXPAND_5_8( s[i] & 0x1f);
+ dst[i][ACOMP] = 0xff;
+ }
+}
+
+static void
+unpack_ubyte_RGB565_REV(const void *src, GLubyte dst[][4], GLuint n)
+{
+ /* Warning: this function does not match the current Mesa definition
+ * of MESA_FORMAT_R5G6B5_UNORM.
+ */
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLuint t = (s[i] >> 8) | (s[i] << 8); /* byte swap */
+ dst[i][RCOMP] = EXPAND_5_8((t >> 11) & 0x1f);
+ dst[i][GCOMP] = EXPAND_6_8((t >> 5 ) & 0x3f);
+ dst[i][BCOMP] = EXPAND_5_8( t & 0x1f);
+ dst[i][ACOMP] = 0xff;
+ }
+}
+
+static void
+unpack_ubyte_ARGB4444(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = EXPAND_4_8((s[i] >> 8) & 0xf);
+ dst[i][GCOMP] = EXPAND_4_8((s[i] >> 4) & 0xf);
+ dst[i][BCOMP] = EXPAND_4_8((s[i] ) & 0xf);
+ dst[i][ACOMP] = EXPAND_4_8((s[i] >> 12) & 0xf);
+ }
+}
+
+static void
+unpack_ubyte_ARGB4444_REV(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = EXPAND_4_8((s[i] ) & 0xf);
+ dst[i][GCOMP] = EXPAND_4_8((s[i] >> 12) & 0xf);
+ dst[i][BCOMP] = EXPAND_4_8((s[i] >> 8) & 0xf);
+ dst[i][ACOMP] = EXPAND_4_8((s[i] >> 4) & 0xf);
+ }
+}
+
+static void
+unpack_ubyte_RGBA5551(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = EXPAND_5_8((s[i] >> 11) & 0x1f);
+ dst[i][GCOMP] = EXPAND_5_8((s[i] >> 6) & 0x1f);
+ dst[i][BCOMP] = EXPAND_5_8((s[i] >> 1) & 0x1f);
+ dst[i][ACOMP] = EXPAND_1_8((s[i] ) & 0x01);
+ }
+}
+
+static void
+unpack_ubyte_ARGB1555(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = EXPAND_5_8((s[i] >> 10) & 0x1f);
+ dst[i][GCOMP] = EXPAND_5_8((s[i] >> 5) & 0x1f);
+ dst[i][BCOMP] = EXPAND_5_8((s[i] >> 0) & 0x1f);
+ dst[i][ACOMP] = EXPAND_1_8((s[i] >> 15) & 0x01);
+ }
+}
+
+static void
+unpack_ubyte_ARGB1555_REV(const void *src, GLubyte dst[][4], GLuint n)
+{
+ /* Warning: this function does not match the current Mesa definition
+ * of MESA_FORMAT_A1R5G5B5_UNORM.
+ */
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ GLushort tmp = (s[i] << 8) | (s[i] >> 8); /* byteswap */
+ dst[i][RCOMP] = EXPAND_5_8((tmp >> 10) & 0x1f);
+ dst[i][GCOMP] = EXPAND_5_8((tmp >> 5) & 0x1f);
+ dst[i][BCOMP] = EXPAND_5_8((tmp >> 0) & 0x1f);
+ dst[i][ACOMP] = EXPAND_1_8((tmp >> 15) & 0x01);
+ }
+}
+
+static void
+unpack_ubyte_AL44(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLubyte *s = ((const GLubyte *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = EXPAND_4_8(s[i] & 0xf);
+ dst[i][ACOMP] = EXPAND_4_8(s[i] >> 4);
+ }
+}
+
+static void
+unpack_ubyte_AL88(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = EXPAND_4_8(s[i] & 0xff);
+ dst[i][ACOMP] = EXPAND_4_8(s[i] >> 8);
+ }
+}
+
+static void
+unpack_ubyte_AL88_REV(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = EXPAND_4_8(s[i] >> 8);
+ dst[i][ACOMP] = EXPAND_4_8(s[i] & 0xff);
+ }
+}
+
+static void
+unpack_ubyte_RGB332(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLubyte *s = ((const GLubyte *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = EXPAND_3_8((s[i] >> 5) & 0x7);
+ dst[i][GCOMP] = EXPAND_3_8((s[i] >> 2) & 0x7);
+ dst[i][BCOMP] = EXPAND_2_8((s[i] ) & 0x3);
+ dst[i][ACOMP] = 0xff;
+ }
+}
+
+static void
+unpack_ubyte_A8(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLubyte *s = ((const GLubyte *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = 0;
+ dst[i][ACOMP] = s[i];
+ }
+}
+
+static void
+unpack_ubyte_L8(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLubyte *s = ((const GLubyte *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] = s[i];
+ dst[i][ACOMP] = 0xff;
+ }
+}
+
+
+static void
+unpack_ubyte_I8(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLubyte *s = ((const GLubyte *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] =
+ dst[i][GCOMP] =
+ dst[i][BCOMP] =
+ dst[i][ACOMP] = s[i];
+ }
+}
+
+static void
+unpack_ubyte_R8(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLubyte *s = ((const GLubyte *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][0] = s[i];
+ dst[i][1] =
+ dst[i][2] = 0;
+ dst[i][3] = 0xff;
+ }
+}
+
+static void
+unpack_ubyte_GR88(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = s[i] & 0xff;
+ dst[i][GCOMP] = s[i] >> 8;
+ dst[i][BCOMP] = 0;
+ dst[i][ACOMP] = 0xff;
+ }
+}
+
+static void
+unpack_ubyte_RG88(const void *src, GLubyte dst[][4], GLuint n)
+{
+ const GLushort *s = ((const GLushort *) src);
+ GLuint i;
+ for (i = 0; i < n; i++) {
+ dst[i][RCOMP] = s[i] >> 8;
+ dst[i][GCOMP] = s[i] & 0xff;
+ dst[i][BCOMP] = 0;
+ dst[i][ACOMP] = 0xff;
+ }
+}
+
+
+/**
+ * Unpack rgba colors, returning as GLubyte values. This should usually
+ * only be used for unpacking formats that use 8 bits or less per channel.
+ */
+void
+_mesa_unpack_ubyte_rgba_row(mesa_format format, GLuint n,
+ const void *src, GLubyte dst[][4])
+{
+ switch (format) {
+ case MESA_FORMAT_A8B8G8R8_UNORM:
+ unpack_ubyte_RGBA8888(src, dst, n);
+ break;
+ case MESA_FORMAT_R8G8B8A8_UNORM:
+ unpack_ubyte_RGBA8888_REV(src, dst, n);
+ break;
+ case MESA_FORMAT_B8G8R8A8_UNORM:
+ unpack_ubyte_ARGB8888(src, dst, n);
+ break;
+ case MESA_FORMAT_A8R8G8B8_UNORM:
+ unpack_ubyte_ARGB8888_REV(src, dst, n);
+ break;
+ case MESA_FORMAT_X8B8G8R8_UNORM:
+ unpack_ubyte_RGBX8888(src, dst, n);
+ break;
+ case MESA_FORMAT_R8G8B8X8_UNORM:
+ unpack_ubyte_RGBX8888_REV(src, dst, n);
+ break;
+ case MESA_FORMAT_B8G8R8X8_UNORM:
+ unpack_ubyte_XRGB8888(src, dst, n);
+ break;
+ case MESA_FORMAT_X8R8G8B8_UNORM:
+ unpack_ubyte_XRGB8888_REV(src, dst, n);
+ break;
+ case MESA_FORMAT_BGR_UNORM8:
+ unpack_ubyte_RGB888(src, dst, n);
+ break;
+ case MESA_FORMAT_RGB_UNORM8:
+ unpack_ubyte_BGR888(src, dst, n);
+ break;
+ case MESA_FORMAT_B5G6R5_UNORM:
+ unpack_ubyte_RGB565(src, dst, n);
+ break;
+ case MESA_FORMAT_R5G6B5_UNORM:
+ unpack_ubyte_RGB565_REV(src, dst, n);
+ break;
+ case MESA_FORMAT_B4G4R4A4_UNORM:
+ unpack_ubyte_ARGB4444(src, dst, n);
+ break;
+ case MESA_FORMAT_A4R4G4B4_UNORM:
+ unpack_ubyte_ARGB4444_REV(src, dst, n);
+ break;
+ case MESA_FORMAT_A1B5G5R5_UNORM:
+ unpack_ubyte_RGBA5551(src, dst, n);
+ break;
+ case MESA_FORMAT_B5G5R5A1_UNORM:
+ unpack_ubyte_ARGB1555(src, dst, n);
+ break;
+ case MESA_FORMAT_A1R5G5B5_UNORM:
+ unpack_ubyte_ARGB1555_REV(src, dst, n);
+ break;
+ case MESA_FORMAT_L4A4_UNORM:
+ unpack_ubyte_AL44(src, dst, n);
+ break;
+ case MESA_FORMAT_L8A8_UNORM:
+ unpack_ubyte_AL88(src, dst, n);
+ break;
+ case MESA_FORMAT_A8L8_UNORM:
+ unpack_ubyte_AL88_REV(src, dst, n);
+ break;
+ case MESA_FORMAT_B2G3R3_UNORM:
+ unpack_ubyte_RGB332(src, dst, n);
+ break;
+ case MESA_FORMAT_A_UNORM8:
+ unpack_ubyte_A8(src, dst, n);
+ break;
+ case MESA_FORMAT_L_UNORM8:
+ unpack_ubyte_L8(src, dst, n);
+ break;
+ case MESA_FORMAT_I_UNORM8:
+ unpack_ubyte_I8(src, dst, n);
+ break;
+ case MESA_FORMAT_R_UNORM8:
+ unpack_ubyte_R8(src, dst, n);
+ break;
+ case MESA_FORMAT_R8G8_UNORM:
+ unpack_ubyte_GR88(src, dst, n);
+ break;
+ case MESA_FORMAT_G8R8_UNORM:
+ unpack_ubyte_RG88(src, dst, n);
+ break;
+ default:
+ /* get float values, convert to ubyte */
+ {
+ GLfloat *tmp = malloc(n * 4 * sizeof(GLfloat));
+ if (tmp) {
+ GLuint i;
+ _mesa_unpack_rgba_row(format, n, src, (GLfloat (*)[4]) tmp);
+ for (i = 0; i < n; i++) {
+ UNCLAMPED_FLOAT_TO_UBYTE(dst[i][0], tmp[i*4+0]);
+ UNCLAMPED_FLOAT_TO_UBYTE(dst[i][1], tmp[i*4+1]);
+ UNCLAMPED_FLOAT_TO_UBYTE(dst[i][2], tmp[i*4+2]);
+ UNCLAMPED_FLOAT_TO_UBYTE(dst[i][3], tmp[i*4+3]);
+ }
+ free(tmp);
+ }
+ }
+ break;
+ }
+}
+
+
+/**********************************************************************/
+/* Unpack, returning GLuint colors */
+/**********************************************************************/
+
+static void
+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_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;
+
+ 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_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;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i * 2 + 0];
+ dst[i][1] = src[i * 2 + 1];
+ dst[i][2] = 0;
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_RG_UINT16(const GLushort *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i * 2 + 0];
+ dst[i][1] = src[i * 2 + 1];
+ dst[i][2] = 0;
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_RG_INT16(const GLshort *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i * 2 + 0];
+ dst[i][1] = src[i * 2 + 1];
+ dst[i][2] = 0;
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_RG_UINT8(const GLubyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i * 2 + 0];
+ dst[i][1] = src[i * 2 + 1];
+ dst[i][2] = 0;
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_RG_INT8(const GLbyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i * 2 + 0];
+ dst[i][1] = src[i * 2 + 1];
+ dst[i][2] = 0;
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_R_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i];
+ dst[i][1] = 0;
+ dst[i][2] = 0;
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_R_UINT16(const GLushort *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i];
+ dst[i][1] = 0;
+ dst[i][2] = 0;
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_R_INT16(const GLshort *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i];
+ dst[i][1] = 0;
+ dst[i][2] = 0;
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_R_UINT8(const GLubyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i];
+ dst[i][1] = 0;
+ dst[i][2] = 0;
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_R_INT8(const GLbyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = src[i];
+ dst[i][1] = 0;
+ dst[i][2] = 0;
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_ALPHA_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = dst[i][1] = dst[i][2] = 0;
+ dst[i][3] = src[i];
+ }
+}
+
+static void
+unpack_int_rgba_ALPHA_UINT16(const GLushort *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = dst[i][1] = dst[i][2] = 0;
+ dst[i][3] = src[i];
+ }
+}
+
+static void
+unpack_int_rgba_ALPHA_INT16(const GLshort *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = dst[i][1] = dst[i][2] = 0;
+ dst[i][3] = src[i];
+ }
+}
+
+static void
+unpack_int_rgba_ALPHA_UINT8(const GLubyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = dst[i][1] = dst[i][2] = 0;
+ dst[i][3] = src[i];
+ }
+}
+
+static void
+unpack_int_rgba_ALPHA_INT8(const GLbyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = dst[i][1] = dst[i][2] = 0;
+ dst[i][3] = src[i];
+ }
+}
+
+static void
+unpack_int_rgba_LUMINANCE_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = dst[i][1] = dst[i][2] = src[i];
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_LUMINANCE_UINT16(const GLushort *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = dst[i][1] = dst[i][2] = src[i];
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_LUMINANCE_INT16(const GLshort *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = dst[i][1] = dst[i][2] = src[i];
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_LUMINANCE_UINT8(const GLubyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = dst[i][1] = dst[i][2] = src[i];
+ dst[i][3] = 1;
+ }
+}
+
+static void
+unpack_int_rgba_LUMINANCE_INT8(const GLbyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = dst[i][1] = dst[i][2] = src[i];
+ dst[i][3] = 1;
+ }
+}
+
+
+static void
+unpack_int_rgba_LUMINANCE_ALPHA_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = dst[i][1] = dst[i][2] = src[i * 2 + 0];
+ dst[i][3] = src[i * 2 + 1];
+ }
+}
+
+static void
+unpack_int_rgba_LUMINANCE_ALPHA_UINT16(const GLushort *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = dst[i][1] = dst[i][2] = src[i * 2 + 0];
+ dst[i][3] = src[i * 2 + 1];
+ }
+}
+
+static void
+unpack_int_rgba_LUMINANCE_ALPHA_INT16(const GLshort *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = dst[i][1] = dst[i][2] = src[i * 2 + 0];
+ dst[i][3] = src[i * 2 + 1];
+ }
+}
+
+static void
+unpack_int_rgba_LUMINANCE_ALPHA_UINT8(const GLubyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = dst[i][1] = dst[i][2] = src[i * 2 + 0];
+ dst[i][3] = src[i * 2 + 1];
+ }
+}
+
+static void
+unpack_int_rgba_LUMINANCE_ALPHA_INT8(const GLbyte *src, GLuint dst[][4], GLuint n)
+{
+ unsigned int i;
+
+ for (i = 0; i < n; i++) {
+ dst[i][0] = dst[i][1] = dst[i][2] = src[i * 2 + 0];
+ dst[i][3] = src[i * 2 + 1];