From a9d8809f16feb7f6d5d723f2afa2cfbea60cae55 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sun, 22 Jan 2012 16:52:19 +0000 Subject: [PATCH] r600g: srgb mode is only valid on certain format types. "If set, forces degamma on XYZ if format is FMT_8_8_8_8, FMT_BC1, FMT_BC2, or FMT_BC3" Don't claim support for sRGB on any other formts. This fixes glean texture_srgb. Signed-off-by: Dave Airlie --- src/gallium/drivers/r600/r600_texture.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index decd9415225..6692aa6bb54 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -869,6 +869,7 @@ uint32_t r600_translate_texformat(struct pipe_screen *screen, const struct util_format_description *desc; boolean uniform = TRUE; static int r600_enable_s3tc = -1; + bool is_srgb_valid = FALSE; int i; const uint32_t sign_bit[4] = { @@ -980,14 +981,17 @@ uint32_t r600_translate_texformat(struct pipe_screen *screen, case PIPE_FORMAT_DXT1_SRGB: case PIPE_FORMAT_DXT1_SRGBA: result = FMT_BC1; + is_srgb_valid = TRUE; goto out_word4; case PIPE_FORMAT_DXT3_RGBA: case PIPE_FORMAT_DXT3_SRGBA: result = FMT_BC2; + is_srgb_valid = TRUE; goto out_word4; case PIPE_FORMAT_DXT5_RGBA: case PIPE_FORMAT_DXT5_SRGBA: result = FMT_BC3; + is_srgb_valid = TRUE; goto out_word4; default: goto out_unknown; @@ -1095,6 +1099,7 @@ uint32_t r600_translate_texformat(struct pipe_screen *screen, goto out_word4; case 4: result = FMT_8_8_8_8; + is_srgb_valid = TRUE; goto out_word4; } goto out_unknown; @@ -1158,6 +1163,9 @@ uint32_t r600_translate_texformat(struct pipe_screen *screen, } out_word4: + + if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB && !is_srgb_valid) + return ~0; if (word4_p) *word4_p = word4; if (yuv_format_p) -- 2.30.2