summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2012-01-22 16:52:19 +0000
committerDave Airlie <[email protected]>2012-01-22 16:53:46 +0000
commita9d8809f16feb7f6d5d723f2afa2cfbea60cae55 (patch)
treee6dffb70658f6404523ee03f3ec354e0ca8bed67
parent9783bba9bdd56cc52f987056ba8dc3da77d0078e (diff)
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 <[email protected]>
-rw-r--r--src/gallium/drivers/r600/r600_texture.c8
1 files changed, 8 insertions, 0 deletions
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)