mesa: Fix core GL genned-name handling for glBeginQuery().
[mesa.git] / src / mesa / main / format_pack.c
index ff08ac561121a4e21b4adab1d7ac0ff2f1cdfc87..be6c026e8c2f4cb90ddb7c3e6251eef2b3a4540a 100644 (file)
@@ -1005,6 +1005,32 @@ pack_float_ARGB2101010(const GLfloat src[4], void *dst)
 }
 
 
+/* MESA_FORMAT_ABGR2101010_UINT */
+
+static void
+pack_ubyte_ABGR2101010_UINT(const GLubyte src[4], void *dst)
+{
+   GLuint *d = ((GLuint *) dst);
+   GLushort r = UBYTE_TO_USHORT(src[RCOMP]);
+   GLushort g = UBYTE_TO_USHORT(src[GCOMP]);
+   GLushort b = UBYTE_TO_USHORT(src[BCOMP]);
+   GLushort a = UBYTE_TO_USHORT(src[ACOMP]);
+   *d = PACK_COLOR_2101010_US(a, b, g, r);
+}
+
+static void
+pack_float_ABGR2101010_UINT(const GLfloat src[4], void *dst)
+{
+   GLuint *d = ((GLuint *) dst);
+   GLushort r, g, b, a;
+   UNCLAMPED_FLOAT_TO_USHORT(r, src[RCOMP]);
+   UNCLAMPED_FLOAT_TO_USHORT(g, src[GCOMP]);
+   UNCLAMPED_FLOAT_TO_USHORT(b, src[BCOMP]);
+   UNCLAMPED_FLOAT_TO_USHORT(a, src[ACOMP]);
+   *d = PACK_COLOR_2101010_US(a, b, g, r);
+}
+
+
 /* MESA_FORMAT_SRGB8 */
 
 static void
@@ -1696,6 +1722,7 @@ _mesa_get_pack_ubyte_rgba_function(gl_format format)
       table[MESA_FORMAT_RG1616] = pack_ubyte_RG1616;
       table[MESA_FORMAT_RG1616_REV] = pack_ubyte_RG1616_REV;
       table[MESA_FORMAT_ARGB2101010] = pack_ubyte_ARGB2101010;
+      table[MESA_FORMAT_ABGR2101010_UINT] = pack_ubyte_ABGR2101010_UINT;
 
       /* should never convert RGBA to these formats */
       table[MESA_FORMAT_Z24_S8] = NULL;
@@ -1841,6 +1868,7 @@ _mesa_get_pack_float_rgba_function(gl_format format)
       table[MESA_FORMAT_RG1616] = pack_float_RG1616;
       table[MESA_FORMAT_RG1616_REV] = pack_float_RG1616_REV;
       table[MESA_FORMAT_ARGB2101010] = pack_float_ARGB2101010;
+      table[MESA_FORMAT_ABGR2101010_UINT] = pack_float_ABGR2101010_UINT;
 
       /* should never convert RGBA to these formats */
       table[MESA_FORMAT_Z24_S8] = NULL;
@@ -2605,7 +2633,7 @@ _mesa_pack_colormask(gl_format format, const GLubyte colorMask[4], void *dst)
          if (bits == 8) {
             GLubyte *d = (GLubyte *) dst;
             for (i = 0; i < bytes; i++) {
-               d[i] = d[i] ? 0xffff : 0x0;
+               d[i] = d[i] ? 0xff : 0x0;
             }
          }
          else if (bits == 16) {