diff options
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_surface_formats.c | 3 | ||||
-rw-r--r-- | src/mesa/main/format_pack.c | 60 | ||||
-rw-r--r-- | src/mesa/main/format_unpack.c | 42 | ||||
-rw-r--r-- | src/mesa/main/formats.c | 16 | ||||
-rw-r--r-- | src/mesa/main/formats.csv | 3 | ||||
-rw-r--r-- | src/mesa/main/formats.h | 3 | ||||
-rw-r--r-- | src/mesa/main/texformat.c | 10 | ||||
-rw-r--r-- | src/mesa/swrast/s_texfetch.c | 3 | ||||
-rw-r--r-- | src/mesa/swrast/s_texfetch_tmp.h | 24 |
9 files changed, 164 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_surface_formats.c b/src/mesa/drivers/dri/i965/brw_surface_formats.c index b726c273fda..5407ef65576 100644 --- a/src/mesa/drivers/dri/i965/brw_surface_formats.c +++ b/src/mesa/drivers/dri/i965/brw_surface_formats.c @@ -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, diff --git a/src/mesa/main/format_pack.c b/src/mesa/main/format_pack.c index 8fc6043a6d5..31c9f776797 100644 --- a/src/mesa/main/format_pack.c +++ b/src/mesa/main/format_pack.c @@ -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; } diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c index cfa6a60becc..d5628a9e7cb 100644 --- a/src/mesa/main/format_unpack.c +++ b/src/mesa/main/format_unpack.c @@ -770,6 +770,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) { const GLuint *s = ((const GLuint *) src); @@ -2132,6 +2145,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) { const GLbyte *s = (const GLbyte *) src; @@ -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; } diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 8fd36a08209..58c32e23b30 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -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; } diff --git a/src/mesa/main/formats.csv b/src/mesa/main/formats.csv index b4d16deb9d2..39bcdbdd260 100644 --- a/src/mesa/main/formats.csv +++ b/src/mesa/main/formats.csv @@ -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 diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index 86717380e90..213ab563d2a 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -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 */ diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 09e307c08f0..832e66128d8 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -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: diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c index dfba19096f2..0f6da919dae 100644 --- a/src/mesa/swrast/s_texfetch.c +++ b/src/mesa/swrast/s_texfetch.c @@ -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), diff --git a/src/mesa/swrast/s_texfetch_tmp.h b/src/mesa/swrast/s_texfetch_tmp.h index f6888994aa7..7ff30f6b4ae 100644 --- a/src/mesa/swrast/s_texfetch_tmp.h +++ b/src/mesa/swrast/s_texfetch_tmp.h @@ -769,6 +769,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) { @@ -793,6 +805,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) { |