r300g: fix texture border color for float formats
authorMarek Olšák <maraeo@gmail.com>
Wed, 16 Feb 2011 04:28:40 +0000 (05:28 +0100)
committerMarek Olšák <maraeo@gmail.com>
Wed, 16 Feb 2011 06:46:36 +0000 (07:46 +0100)
src/gallium/drivers/r300/r300_state_derived.c

index 5e86d18a746cfb91b917fec61f5e8248c2f76943..003fe9a58cd3db889ab97a4c6ad5ceef12cc974c 100644 (file)
@@ -677,7 +677,20 @@ static uint32_t r300_get_border_color(enum pipe_format format,
         case 16:
             if (desc->nr_channels <= 2) {
                 border_swizzled[0] = border_swizzled[2];
-                util_pack_color(border_swizzled, PIPE_FORMAT_R16G16_UNORM, &uc);
+                if (desc->channel[0].type == UTIL_FORMAT_TYPE_FLOAT) {
+                    util_pack_color(border_swizzled, PIPE_FORMAT_R16G16_FLOAT, &uc);
+                } else {
+                    util_pack_color(border_swizzled, PIPE_FORMAT_R16G16_UNORM, &uc);
+                }
+            } else {
+                util_pack_color(border_swizzled, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
+            }
+            break;
+
+        case 32:
+            if (desc->nr_channels == 1) {
+                border_swizzled[0] = border_swizzled[2];
+                util_pack_color(border_swizzled, PIPE_FORMAT_R32_FLOAT, &uc);
             } else {
                 util_pack_color(border_swizzled, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
             }