r300g: fix RGTC2_SNORM
authorMarek Olšák <maraeo@gmail.com>
Tue, 1 Mar 2011 04:16:34 +0000 (05:16 +0100)
committerMarek Olšák <maraeo@gmail.com>
Tue, 1 Mar 2011 04:25:33 +0000 (05:25 +0100)
ATI engineers have probably chosen those sign bits by a dice roll.

src/gallium/drivers/r300/r300_state_derived.c
src/gallium/drivers/r300/r300_texture.c

index 7e06958972b232e7bc6376fd52efde9790acdd7b..a1e116f4b61882d772272eeb43b12794c7278ba5 100644 (file)
@@ -650,6 +650,9 @@ static uint32_t r300_get_border_color(enum pipe_format format,
             util_pack_color(border_swizzled, PIPE_FORMAT_B4G4R4A4_UNORM, &uc);
             return uc.ui;
         case PIPE_FORMAT_RGTC2_SNORM:
+            border_swizzled[0] = border_swizzled[2];
+            util_pack_color(border_swizzled, PIPE_FORMAT_R8G8B8A8_SNORM, &uc);
+            return uc.ui;
         case PIPE_FORMAT_RGTC2_UNORM:
             util_pack_color(border_swizzled, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
             return uc.ui;
index 6ed3125e49b337dfbaf48c78722ec6e05dd676ff..da06847bbe068db1b4f949e41ebce8faf2aaadf1 100644 (file)
@@ -213,7 +213,7 @@ uint32_t r300_translate_texformat(enum pipe_format format,
             case PIPE_FORMAT_RGTC1_UNORM:
                 return R500_TX_FORMAT_ATI1N | result;
             case PIPE_FORMAT_RGTC2_SNORM:
-                result |= sign_bit[0] | sign_bit[1];
+                result |= sign_bit[2] | sign_bit[3];
             case PIPE_FORMAT_RGTC2_UNORM:
                 return R400_TX_FORMAT_ATI2N | result;
             default: