summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-10-26 01:03:53 +0200
committerMarek Olšák <[email protected]>2012-10-26 01:27:05 +0200
commit8fb4b1dce156d02a0907925364d8945915c29bcf (patch)
tree469b6cd76cfbefecdb0cf367352e8937704b875a /src/gallium/drivers
parentb45a68eebf3cf7227fc70082cb1e796041fc81ab (diff)
r300g: fix texture border color for sRGB formats
NOTE: This is a candidate for the stable branches.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/r300/r300_state_derived.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index 940179c6e9d..3ccf396b741 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -655,6 +655,12 @@ static uint32_t r300_get_border_color(enum pipe_format format,
case PIPE_FORMAT_LATC2_UNORM:
util_pack_color(border_swizzled, PIPE_FORMAT_R8G8B8A8_UNORM, &uc);
return uc.ui;
+ case PIPE_FORMAT_DXT1_SRGB:
+ case PIPE_FORMAT_DXT1_SRGBA:
+ case PIPE_FORMAT_DXT3_SRGBA:
+ case PIPE_FORMAT_DXT5_SRGBA:
+ util_pack_color(border_swizzled, PIPE_FORMAT_B8G8R8A8_SRGB, &uc);
+ return uc.ui;
default:
util_pack_color(border_swizzled, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
return uc.ui;
@@ -685,10 +691,18 @@ static uint32_t r300_get_border_color(enum pipe_format format,
default:
case 8:
- if (desc->channel[0].type == UTIL_FORMAT_TYPE_SIGNED)
- util_pack_color(border_swizzled, PIPE_FORMAT_R8G8B8A8_SNORM, &uc);
- else
- util_pack_color(border_swizzled, PIPE_FORMAT_R8G8B8A8_UNORM, &uc);
+ if (desc->channel[0].type == UTIL_FORMAT_TYPE_SIGNED) {
+ util_pack_color(border_swizzled, PIPE_FORMAT_R8G8B8A8_SNORM, &uc);
+ } else if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) {
+ if (desc->nr_channels == 2) {
+ border_swizzled[3] = border_swizzled[1];
+ util_pack_color(border_swizzled, PIPE_FORMAT_L8A8_SRGB, &uc);
+ } else {
+ util_pack_color(border_swizzled, PIPE_FORMAT_R8G8B8A8_SRGB, &uc);
+ }
+ } else {
+ util_pack_color(border_swizzled, PIPE_FORMAT_R8G8B8A8_UNORM, &uc);
+ }
break;
case 10: