summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300/r300_state_derived.c
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2011-03-01 03:21:23 +0100
committerMarek Olšák <maraeo@gmail.com>2011-03-01 03:24:55 +0100
commit7a61957424a457f416d20c2b366232fb4bbc7761 (patch)
tree13868fb09b7e2846bb100c78703bf23a93f68fda /src/gallium/drivers/r300/r300_state_derived.c
parent9c16fcc617b8c5c4db825ed290f994e535de8c65 (diff)
downloadexternal_mesa3d-7a61957424a457f416d20c2b366232fb4bbc7761.zip
external_mesa3d-7a61957424a457f416d20c2b366232fb4bbc7761.tar.gz
external_mesa3d-7a61957424a457f416d20c2b366232fb4bbc7761.tar.bz2
r300g: fix RGTC1_UNORM and RGTC2_UNORM
Signs don't work the way I'd like...
Diffstat (limited to 'src/gallium/drivers/r300/r300_state_derived.c')
-rw-r--r--src/gallium/drivers/r300/r300_state_derived.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index 7776ab5..7e06958 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -641,8 +641,22 @@ static uint32_t r300_get_border_color(enum pipe_format format,
/* Compressed formats. */
if (util_format_is_compressed(format)) {
- util_pack_color(border_swizzled, PIPE_FORMAT_R8G8B8A8_UNORM, &uc);
- return uc.ui;
+ switch (format) {
+ case PIPE_FORMAT_RGTC1_SNORM:
+ case PIPE_FORMAT_RGTC1_UNORM:
+ /* Add 1/32 to round the border color instead of truncating. */
+ /* The Y component is used for the border color. */
+ border_swizzled[1] = border_swizzled[2] + 1.0f/32;
+ util_pack_color(border_swizzled, PIPE_FORMAT_B4G4R4A4_UNORM, &uc);
+ return uc.ui;
+ case PIPE_FORMAT_RGTC2_SNORM:
+ case PIPE_FORMAT_RGTC2_UNORM:
+ util_pack_color(border_swizzled, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
+ return uc.ui;
+ default:
+ util_pack_color(border_swizzled, PIPE_FORMAT_R8G8B8A8_UNORM, &uc);
+ return uc.ui;
+ }
}
switch (desc->channel[0].size) {