mesa: Add MESA_FORMAT_{A8R8G8B8, X8R8G8B8, X8B8G8R8}_SRGB (v2)
authorRichard Sandiford <rsandifo@linux.vnet.ibm.com>
Tue, 22 Jul 2014 10:02:10 +0000 (11:02 +0100)
committerDave Airlie <airlied@redhat.com>
Wed, 17 Sep 2014 03:19:45 +0000 (13:19 +1000)
This means that each 8888 SRGB format has a reversed counterpart,
which is necessary for handling big-endian mesa<->gallium mappings.

v2: fix missing i965 additions. (Jason)
fix 127->255 max alpha for SRGB formats. (Jason)

v1: Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/mesa/drivers/dri/i965/brw_surface_formats.c
src/mesa/main/format_pack.c
src/mesa/main/format_unpack.c
src/mesa/main/formats.c
src/mesa/main/formats.csv
src/mesa/main/formats.h
src/mesa/main/texformat.c
src/mesa/swrast/s_texfetch.c
src/mesa/swrast/s_texfetch_tmp.h

index b726c273fda35ed22591d472ee0b9b19e11f378f..5407ef65576fdcd78639720f3e68b0ff971a4aea 100644 (file)
@@ -368,7 +368,9 @@ brw_format_for_mesa_format(mesa_format mesa_format)
       [MESA_FORMAT_BGR_SRGB8] = 0,
       [MESA_FORMAT_A8B8G8R8_SRGB] = 0,
       [MESA_FORMAT_B8G8R8A8_SRGB] = BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB,
+      [MESA_FORMAT_A8R8G8B8_SRGB] = 0,
       [MESA_FORMAT_R8G8B8A8_SRGB] = BRW_SURFACEFORMAT_R8G8B8A8_UNORM_SRGB,
+      [MESA_FORMAT_X8R8G8B8_SRGB] = 0,
       [MESA_FORMAT_L_SRGB8] = BRW_SURFACEFORMAT_L8_UNORM_SRGB,
       [MESA_FORMAT_L8A8_SRGB] = BRW_SURFACEFORMAT_L8A8_UNORM_SRGB,
       [MESA_FORMAT_A8L8_SRGB] = 0,
@@ -517,6 +519,7 @@ brw_format_for_mesa_format(mesa_format mesa_format)
       [MESA_FORMAT_B5G5R5X1_UNORM] = BRW_SURFACEFORMAT_B5G5R5X1_UNORM,
       [MESA_FORMAT_R8G8B8X8_SNORM] = 0,
       [MESA_FORMAT_R8G8B8X8_SRGB] = 0,
+      [MESA_FORMAT_X8B8G8R8_SRGB] = 0,
       [MESA_FORMAT_RGBX_UINT8] = 0,
       [MESA_FORMAT_RGBX_SINT8] = 0,
       [MESA_FORMAT_B10G10R10X2_UNORM] = BRW_SURFACEFORMAT_B10G10R10X2_UNORM,
index 8fc6043a6d5c3915b6feffd99ea93845859d52dd..31c9f776797eef4a543c26117ea7c0b2b1cb37d1 100644 (file)
@@ -1076,6 +1076,31 @@ pack_float_B8G8R8A8_SRGB(const GLfloat src[4], void *dst)
 }
 
 
+/* MESA_FORMAT_A8R8G8B8_SRGB */
+
+static void
+pack_ubyte_A8R8G8B8_SRGB(const GLubyte src[4], void *dst)
+{
+   GLuint *d = ((GLuint *) dst);
+   GLubyte r = util_format_linear_to_srgb_8unorm(src[RCOMP]);
+   GLubyte g = util_format_linear_to_srgb_8unorm(src[GCOMP]);
+   GLubyte b = util_format_linear_to_srgb_8unorm(src[BCOMP]);
+   *d = PACK_COLOR_8888(b, g, r, src[ACOMP]);
+}
+
+static void
+pack_float_A8R8G8B8_SRGB(const GLfloat src[4], void *dst)
+{
+   GLuint *d = ((GLuint *) dst);
+   GLubyte r, g, b, a;
+   r = util_format_linear_float_to_srgb_8unorm(src[RCOMP]);
+   g = util_format_linear_float_to_srgb_8unorm(src[GCOMP]);
+   b = util_format_linear_float_to_srgb_8unorm(src[BCOMP]);
+   UNCLAMPED_FLOAT_TO_UBYTE(a, src[ACOMP]);
+   *d = PACK_COLOR_8888(b, g, r, a);
+}
+
+
 /* MESA_FORMAT_R8G8B8A8_SRGB */
 
 static void
@@ -1750,6 +1775,21 @@ pack_float_R8G8B8X8_SRGB(const GLfloat src[4], void *dst)
 }
 
 
+/*
+ * MESA_FORMAT_X8B8G8R8_SRGB
+ */
+
+static void
+pack_float_X8B8G8R8_SRGB(const GLfloat src[4], void *dst)
+{
+   GLuint *d = (GLuint *) dst;
+   GLubyte r = util_format_linear_float_to_srgb_8unorm(src[RCOMP]);
+   GLubyte g = util_format_linear_float_to_srgb_8unorm(src[GCOMP]);
+   GLubyte b = util_format_linear_float_to_srgb_8unorm(src[BCOMP]);
+   *d = PACK_COLOR_8888(r, g, b, 255);
+}
+
+
 /* MESA_FORMAT_B10G10R10X2_UNORM */
 
 static void
@@ -1899,6 +1939,20 @@ pack_float_B8G8R8X8_SRGB(const GLfloat src[4], void *dst)
    *d = PACK_COLOR_8888(127, r, g, b);
 }
 
+/*
+ * MESA_FORMAT_X8R8G8B8_SRGB
+ */
+
+static void
+pack_float_X8R8G8B8_SRGB(const GLfloat src[4], void *dst)
+{
+   GLuint *d = (GLuint *) dst;
+   GLubyte r = util_format_linear_float_to_srgb_8unorm(src[RCOMP]);
+   GLubyte g = util_format_linear_float_to_srgb_8unorm(src[GCOMP]);
+   GLubyte b = util_format_linear_float_to_srgb_8unorm(src[BCOMP]);
+   *d = PACK_COLOR_8888(b, g, r, 255);
+}
+
 /**
  * Return a function that can pack a GLubyte rgba[4] color.
  */
@@ -1966,6 +2020,7 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format)
       table[MESA_FORMAT_BGR_SRGB8] = pack_ubyte_BGR_SRGB8;
       table[MESA_FORMAT_A8B8G8R8_SRGB] = pack_ubyte_A8B8G8R8_SRGB;
       table[MESA_FORMAT_B8G8R8A8_SRGB] = pack_ubyte_B8G8R8A8_SRGB;
+      table[MESA_FORMAT_A8R8G8B8_SRGB] = pack_ubyte_A8R8G8B8_SRGB;
       table[MESA_FORMAT_R8G8B8A8_SRGB] = pack_ubyte_R8G8B8A8_SRGB;
       table[MESA_FORMAT_L_SRGB8] = pack_ubyte_L_SRGB8;
       table[MESA_FORMAT_L8A8_SRGB] = pack_ubyte_L8A8_SRGB;
@@ -2040,6 +2095,7 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format)
       table[MESA_FORMAT_B5G5R5X1_UNORM] = pack_ubyte_XRGB1555_UNORM;
       table[MESA_FORMAT_R8G8B8X8_SNORM] = NULL;
       table[MESA_FORMAT_R8G8B8X8_SRGB] = NULL;
+      table[MESA_FORMAT_X8B8G8R8_SRGB] = NULL;
       table[MESA_FORMAT_RGBX_UINT8] = NULL;
       table[MESA_FORMAT_RGBX_SINT8] = NULL;
       table[MESA_FORMAT_B10G10R10X2_UNORM] = pack_ubyte_B10G10R10X2_UNORM;
@@ -2055,6 +2111,7 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format)
       table[MESA_FORMAT_R10G10B10A2_UNORM] = pack_ubyte_R10G10B10A2_UNORM;
 
       table[MESA_FORMAT_B8G8R8X8_SRGB] = NULL;
+      table[MESA_FORMAT_X8R8G8B8_SRGB] = NULL;
 
       initialized = GL_TRUE;
    }
@@ -2131,6 +2188,7 @@ _mesa_get_pack_float_rgba_function(mesa_format format)
       table[MESA_FORMAT_BGR_SRGB8] = pack_float_BGR_SRGB8;
       table[MESA_FORMAT_A8B8G8R8_SRGB] = pack_float_A8B8G8R8_SRGB;
       table[MESA_FORMAT_B8G8R8A8_SRGB] = pack_float_B8G8R8A8_SRGB;
+      table[MESA_FORMAT_A8R8G8B8_SRGB] = pack_float_A8R8G8B8_SRGB;
       table[MESA_FORMAT_R8G8B8A8_SRGB] = pack_float_R8G8B8A8_SRGB;
       table[MESA_FORMAT_L_SRGB8] = pack_float_L_SRGB8;
       table[MESA_FORMAT_L8A8_SRGB] = pack_float_L8A8_SRGB;
@@ -2203,6 +2261,7 @@ _mesa_get_pack_float_rgba_function(mesa_format format)
       table[MESA_FORMAT_B5G5R5X1_UNORM] = pack_float_XRGB1555_UNORM;
       table[MESA_FORMAT_R8G8B8X8_SNORM] = pack_float_XBGR8888_SNORM;
       table[MESA_FORMAT_R8G8B8X8_SRGB] = pack_float_R8G8B8X8_SRGB;
+      table[MESA_FORMAT_X8B8G8R8_SRGB] = pack_float_X8B8G8R8_SRGB;
       table[MESA_FORMAT_RGBX_UINT8] = NULL;
       table[MESA_FORMAT_RGBX_SINT8] = NULL;
       table[MESA_FORMAT_B10G10R10X2_UNORM] = pack_float_B10G10R10X2_UNORM;
@@ -2221,6 +2280,7 @@ _mesa_get_pack_float_rgba_function(mesa_format format)
       table[MESA_FORMAT_G16R16_SNORM] = pack_float_G16R16_SNORM;
 
       table[MESA_FORMAT_B8G8R8X8_SRGB] = pack_float_B8G8R8X8_SRGB;
+      table[MESA_FORMAT_X8R8G8B8_SRGB] = pack_float_X8R8G8B8_SRGB;
 
       initialized = GL_TRUE;
    }
index cfa6a60becc2077f5cf7510ab32aff87257714de..d5628a9e7cba235b173b21a134e988bc2f474929 100644 (file)
@@ -769,6 +769,19 @@ unpack_B8G8R8A8_SRGB(const void *src, GLfloat dst[][4], GLuint n)
    }
 }
 
+static void
+unpack_A8R8G8B8_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] = util_format_srgb_8unorm_to_linear_float( (s[i] >>  8) & 0xff );
+      dst[i][GCOMP] = util_format_srgb_8unorm_to_linear_float( (s[i] >> 16) & 0xff );
+      dst[i][BCOMP] = util_format_srgb_8unorm_to_linear_float( (s[i] >> 24) );
+      dst[i][ACOMP] = UBYTE_TO_FLOAT( s[i] & 0xff ); /* linear! */
+   }
+}
+
 static void
 unpack_R8G8B8A8_SRGB(const void *src, GLfloat dst[][4], GLuint n)
 {
@@ -2131,6 +2144,19 @@ unpack_R8G8B8X8_SRGB(const void *src, GLfloat dst[][4], GLuint n)
    }
 }
 
+static void
+unpack_X8B8G8R8_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] = util_format_srgb_8unorm_to_linear_float( (s[i] >> 24) );
+      dst[i][GCOMP] = util_format_srgb_8unorm_to_linear_float( (s[i] >> 16) & 0xff );
+      dst[i][BCOMP] = util_format_srgb_8unorm_to_linear_float( (s[i] >>  8) & 0xff );
+      dst[i][ACOMP] = 1.0f;
+   }
+}
+
 static void
 unpack_XBGR8888_UINT(const void *src, GLfloat dst[][4], GLuint n)
 {
@@ -2326,6 +2352,19 @@ unpack_B8G8R8X8_SRGB(const void *src, GLfloat dst[][4], GLuint n)
    }
 }
 
+static void
+unpack_X8R8G8B8_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] = util_format_srgb_8unorm_to_linear_float( (s[i] >>  8) & 0xff );
+      dst[i][GCOMP] = util_format_srgb_8unorm_to_linear_float( (s[i] >> 16) & 0xff );
+      dst[i][BCOMP] = util_format_srgb_8unorm_to_linear_float( (s[i] >> 24) );
+      dst[i][ACOMP] = 1.0F;
+   }
+}
+
 /**
  * Return the unpacker function for the given format.
  */
@@ -2388,6 +2427,7 @@ get_unpack_rgba_function(mesa_format format)
       table[MESA_FORMAT_BGR_SRGB8] = unpack_BGR_SRGB8;
       table[MESA_FORMAT_A8B8G8R8_SRGB] = unpack_A8B8G8R8_SRGB;
       table[MESA_FORMAT_B8G8R8A8_SRGB] = unpack_B8G8R8A8_SRGB;
+      table[MESA_FORMAT_A8R8G8B8_SRGB] = unpack_A8R8G8B8_SRGB;
       table[MESA_FORMAT_R8G8B8A8_SRGB] = unpack_R8G8B8A8_SRGB;
       table[MESA_FORMAT_L_SRGB8] = unpack_L_SRGB8;
       table[MESA_FORMAT_L8A8_SRGB] = unpack_L8A8_SRGB;
@@ -2528,6 +2568,7 @@ get_unpack_rgba_function(mesa_format format)
       table[MESA_FORMAT_B5G5R5X1_UNORM] = unpack_XRGB1555_UNORM;
       table[MESA_FORMAT_R8G8B8X8_SNORM] = unpack_R8G8B8X8_SNORM;
       table[MESA_FORMAT_R8G8B8X8_SRGB] = unpack_R8G8B8X8_SRGB;
+      table[MESA_FORMAT_X8B8G8R8_SRGB] = unpack_X8B8G8R8_SRGB;
       table[MESA_FORMAT_RGBX_UINT8] = unpack_XBGR8888_UINT;
       table[MESA_FORMAT_RGBX_SINT8] = unpack_XBGR8888_SINT;
       table[MESA_FORMAT_B10G10R10X2_UNORM] = unpack_B10G10R10X2_UNORM;
@@ -2546,6 +2587,7 @@ get_unpack_rgba_function(mesa_format format)
       table[MESA_FORMAT_G16R16_SNORM] = unpack_G16R16_SNORM;
 
       table[MESA_FORMAT_B8G8R8X8_SRGB] = unpack_B8G8R8X8_SRGB;
+      table[MESA_FORMAT_X8R8G8B8_SRGB] = unpack_X8R8G8B8_SRGB;
 
       initialized = GL_TRUE;
    }
index 8fd36a08209097f955c6904d7c4603879066514e..58c32e23b309aa939bea1c02c57e904a110f19e9 100644 (file)
@@ -357,6 +357,7 @@ _mesa_get_format_color_encoding(mesa_format format)
    case MESA_FORMAT_BGR_SRGB8:
    case MESA_FORMAT_A8B8G8R8_SRGB:
    case MESA_FORMAT_B8G8R8A8_SRGB:
+   case MESA_FORMAT_A8R8G8B8_SRGB:
    case MESA_FORMAT_R8G8B8A8_SRGB:
    case MESA_FORMAT_L_SRGB8:
    case MESA_FORMAT_L8A8_SRGB:
@@ -420,6 +421,9 @@ _mesa_get_srgb_format_linear(mesa_format format)
    case MESA_FORMAT_B8G8R8A8_SRGB:
       format = MESA_FORMAT_B8G8R8A8_UNORM;
       break;
+   case MESA_FORMAT_A8R8G8B8_SRGB:
+      format = MESA_FORMAT_A8R8G8B8_UNORM;
+      break;
    case MESA_FORMAT_R8G8B8A8_SRGB:
       format = MESA_FORMAT_R8G8B8A8_UNORM;
       break;
@@ -447,6 +451,9 @@ _mesa_get_srgb_format_linear(mesa_format format)
    case MESA_FORMAT_R8G8B8X8_SRGB:
       format = MESA_FORMAT_R8G8B8X8_UNORM;
       break;
+   case MESA_FORMAT_X8B8G8R8_SRGB:
+      format = MESA_FORMAT_X8B8G8R8_UNORM;
+      break;
    case MESA_FORMAT_ETC2_SRGB8:
       format = MESA_FORMAT_ETC2_RGB8;
       break;
@@ -462,6 +469,9 @@ _mesa_get_srgb_format_linear(mesa_format format)
    case MESA_FORMAT_B8G8R8X8_SRGB:
       format = MESA_FORMAT_B8G8R8X8_UNORM;
       break;
+   case MESA_FORMAT_X8R8G8B8_SRGB:
+      format = MESA_FORMAT_X8R8G8B8_UNORM;
+      break;
    default:
       break;
    }
@@ -966,6 +976,7 @@ _mesa_format_to_type_and_comps(mesa_format format,
       return;
    case MESA_FORMAT_A8B8G8R8_SRGB:
    case MESA_FORMAT_B8G8R8A8_SRGB:
+   case MESA_FORMAT_A8R8G8B8_SRGB:
    case MESA_FORMAT_R8G8B8A8_SRGB:
       *datatype = GL_UNSIGNED_BYTE;
       *comps = 4;
@@ -1241,6 +1252,7 @@ _mesa_format_to_type_and_comps(mesa_format format,
       return;
 
    case MESA_FORMAT_R8G8B8X8_SRGB:
+   case MESA_FORMAT_X8B8G8R8_SRGB:
    case MESA_FORMAT_RGBX_UINT8:
       *datatype = GL_UNSIGNED_BYTE;
       *comps = 4;
@@ -1305,6 +1317,7 @@ _mesa_format_to_type_and_comps(mesa_format format,
       return;
 
    case MESA_FORMAT_B8G8R8X8_SRGB:
+   case MESA_FORMAT_X8R8G8B8_SRGB:
       *datatype = GL_UNSIGNED_BYTE;
       *comps = 4;
       return;
@@ -1420,6 +1433,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
       return GL_FALSE;
 
    case MESA_FORMAT_A8R8G8B8_UNORM:
+   case MESA_FORMAT_A8R8G8B8_SRGB:
       if (format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8 && !swapBytes)
          return GL_TRUE;
 
@@ -1849,6 +1863,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
    case MESA_FORMAT_B5G5R5X1_UNORM:
    case MESA_FORMAT_R8G8B8X8_SNORM:
    case MESA_FORMAT_R8G8B8X8_SRGB:
+   case MESA_FORMAT_X8B8G8R8_SRGB:
    case MESA_FORMAT_RGBX_UINT8:
    case MESA_FORMAT_RGBX_SINT8:
    case MESA_FORMAT_B10G10R10X2_UNORM:
@@ -1875,6 +1890,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
          !swapBytes;
 
    case MESA_FORMAT_B8G8R8X8_SRGB:
+   case MESA_FORMAT_X8R8G8B8_SRGB:
       return GL_FALSE;
    }
 
index b4d16deb9d2e60876f56e365d98283887b325b32..39bcdbdd260335a1437ff679c24283c39376aaaa 100644 (file)
@@ -138,9 +138,12 @@ MESA_FORMAT_RGBX_SNORM16                  , array , 1, 1, sn16, sn16, sn16, x16
 # Packed sRGB formats
 MESA_FORMAT_A8B8G8R8_SRGB                 , packed, 1, 1, un8 , un8 , un8 , un8 , wzyx, srgb
 MESA_FORMAT_B8G8R8A8_SRGB                 , packed, 1, 1, un8 , un8 , un8 , un8 , zyxw, srgb
+MESA_FORMAT_A8R8G8B8_SRGB                 , packed, 1, 1, un8 , un8 , un8 , un8 , yzwx, srgb
 MESA_FORMAT_B8G8R8X8_SRGB                 , packed, 1, 1, un8 , un8 , un8 , x8  , zyx1, srgb
+MESA_FORMAT_X8R8G8B8_SRGB                 , packed, 1, 1, x8  , un8 , un8 , un8 , yzw1, srgb
 MESA_FORMAT_R8G8B8A8_SRGB                 , packed, 1, 1, un8 , un8 , un8 , un8 , xyzw, srgb
 MESA_FORMAT_R8G8B8X8_SRGB                 , packed, 1, 1, un8 , un8 , un8 , x8  , xyz1, srgb
+MESA_FORMAT_X8B8G8R8_SRGB                 , packed, 1, 1, x8  , un8 , un8 , un8 , wzy1, srgb
 MESA_FORMAT_L8A8_SRGB                     , packed, 1, 1, un8 , un8 ,     ,     , xxxy, srgb
 MESA_FORMAT_A8L8_SRGB                     , packed, 1, 1, un8 , un8 ,     ,     , yyyx, srgb
 
index 86717380e9066b2862935b3f8291b4b1fecaaf89..213ab563d2a552a7d96c2d1fe71b351e819f373f 100644 (file)
@@ -284,9 +284,12 @@ typedef enum
    /* Packed sRGB formats */
    MESA_FORMAT_A8B8G8R8_SRGB,    /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
    MESA_FORMAT_B8G8R8A8_SRGB,    /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
+   MESA_FORMAT_A8R8G8B8_SRGB,    /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */
    MESA_FORMAT_B8G8R8X8_SRGB,    /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */
+   MESA_FORMAT_X8R8G8B8_SRGB,    /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */
    MESA_FORMAT_R8G8B8A8_SRGB,    /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
    MESA_FORMAT_R8G8B8X8_SRGB,    /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */
+   MESA_FORMAT_X8B8G8R8_SRGB,    /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
    MESA_FORMAT_L8A8_SRGB,                            /* AAAA AAAA LLLL LLLL */
    MESA_FORMAT_A8L8_SRGB,                            /* LLLL LLLL AAAA AAAA */
 
index 09e307c08f07f764d470ef9beb97b8e0edd7a0fb..832e66128d81de3eb326de4f54f236fd1609ffd5 100644 (file)
@@ -540,6 +540,9 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
 
       RETURN_IF_SUPPORTED(MESA_FORMAT_BGR_SRGB8);
       RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB);
+
+      RETURN_IF_SUPPORTED(MESA_FORMAT_X8B8G8R8_SRGB);
+      RETURN_IF_SUPPORTED(MESA_FORMAT_A8R8G8B8_SRGB);
       break;
    case GL_SRGB_ALPHA_EXT:
    case GL_SRGB8_ALPHA8_EXT:
@@ -547,38 +550,45 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
 
       RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SRGB);
       RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB);
+      RETURN_IF_SUPPORTED(MESA_FORMAT_A8R8G8B8_SRGB);
       break;
    case GL_SLUMINANCE_EXT:
    case GL_SLUMINANCE8_EXT:
       RETURN_IF_SUPPORTED(MESA_FORMAT_L_SRGB8);
       RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB);
+      RETURN_IF_SUPPORTED(MESA_FORMAT_A8R8G8B8_SRGB);
       break;
    case GL_SLUMINANCE_ALPHA_EXT:
    case GL_SLUMINANCE8_ALPHA8_EXT:
       RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_SRGB);
       RETURN_IF_SUPPORTED(MESA_FORMAT_A8L8_SRGB);
       RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB);
+      RETURN_IF_SUPPORTED(MESA_FORMAT_A8R8G8B8_SRGB);
       break;
    case GL_COMPRESSED_SLUMINANCE_EXT:
       RETURN_IF_SUPPORTED(MESA_FORMAT_L_SRGB8);
       RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB);
+      RETURN_IF_SUPPORTED(MESA_FORMAT_A8R8G8B8_SRGB);
       break;
    case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
       RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_SRGB);
       RETURN_IF_SUPPORTED(MESA_FORMAT_A8L8_SRGB);
       RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB);
+      RETURN_IF_SUPPORTED(MESA_FORMAT_A8R8G8B8_SRGB);
       break;
    case GL_COMPRESSED_SRGB_EXT:
       if (ctx->Mesa_DXTn)
          RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB_DXT1);
       RETURN_IF_SUPPORTED(MESA_FORMAT_BGR_SRGB8);
       RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB);
+      RETURN_IF_SUPPORTED(MESA_FORMAT_A8R8G8B8_SRGB);
       break;
    case GL_COMPRESSED_SRGB_ALPHA_EXT:
       if (ctx->Mesa_DXTn)
          RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT3); /* Not srgba_dxt1, see spec */
       RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SRGB);
       RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB);
+      RETURN_IF_SUPPORTED(MESA_FORMAT_A8R8G8B8_SRGB);
       break;
 
    case GL_ALPHA8UI_EXT:
index dfba19096f29ce834a5d5ef351692051abf98b07..0f6da919dae09db656e7ca03bbabeb383b0b0d61 100644 (file)
@@ -229,9 +229,12 @@ texfetch_funcs[] =
    /* Packed sRGB formats */
    FETCH_FUNCS(A8B8G8R8_SRGB),
    FETCH_FUNCS(B8G8R8A8_SRGB),
+   FETCH_FUNCS(A8R8G8B8_SRGB),
    FETCH_NULL(B8G8R8X8_SRGB),
+   FETCH_NULL(X8R8G8B8_SRGB),
    FETCH_FUNCS(R8G8B8A8_SRGB),
    FETCH_FUNCS(R8G8B8X8_SRGB),
+   FETCH_FUNCS(X8B8G8R8_SRGB),
    FETCH_FUNCS(L8A8_SRGB),
    FETCH_FUNCS(A8L8_SRGB),
 
index f6888994aa7cd507144b328e72dd2c5fbc681051..7ff30f6b4aef326370b3e1e2dca40cf2bb52ff3a 100644 (file)
@@ -768,6 +768,18 @@ FETCH(B8G8R8A8_SRGB)(const struct swrast_texture_image *texImage,
 }
 
 
+static void
+FETCH(A8R8G8B8_SRGB)(const struct swrast_texture_image *texImage,
+                     GLint i, GLint j, GLint k, GLfloat *texel)
+{
+   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   texel[RCOMP] = util_format_srgb_8unorm_to_linear_float( (s >>  8) & 0xff );
+   texel[GCOMP] = util_format_srgb_8unorm_to_linear_float( (s >> 16) & 0xff );
+   texel[BCOMP] = util_format_srgb_8unorm_to_linear_float( (s >> 24) );
+   texel[ACOMP] = UBYTE_TO_FLOAT( s & 0xff ); /* linear! */
+}
+
+
 static void
 FETCH(R8G8B8A8_SRGB)(const struct swrast_texture_image *texImage,
                      GLint i, GLint j, GLint k, GLfloat *texel)
@@ -792,6 +804,18 @@ FETCH(R8G8B8X8_SRGB)(const struct swrast_texture_image *texImage,
 }
 
 
+static void
+FETCH(X8B8G8R8_SRGB)(const struct swrast_texture_image *texImage,
+                     GLint i, GLint j, GLint k, GLfloat *texel)
+{
+   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   texel[RCOMP] = util_format_srgb_8unorm_to_linear_float( (s >> 24) );
+   texel[GCOMP] = util_format_srgb_8unorm_to_linear_float( (s >> 16) & 0xff );
+   texel[BCOMP] = util_format_srgb_8unorm_to_linear_float( (s >>  8) & 0xff );
+   texel[ACOMP] = 1.0f;
+}
+
+
 static void
 FETCH(L_SRGB8)(const struct swrast_texture_image *texImage,
                GLint i, GLint j, GLint k, GLfloat *texel)