summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2012-01-22 16:52:19 +0000
committerDave Airlie <[email protected]>2012-01-23 09:16:17 +0000
commit4b6dc4c1b3d8055e4504562ce3c0211086ced915 (patch)
treee85ab4e0be0085841ce35bb563ab574253cc045f /src/gallium
parent0d6f7b181fb617cec177a407735eab4371be6f9a (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]> (cherry picked from commit a9d8809f16feb7f6d5d723f2afa2cfbea60cae55)
Diffstat (limited to 'src/gallium')
-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)