r600g: attempt to turn on DXTn formats
authorKeith Whitwell <keithw@vmware.com>
Wed, 3 Nov 2010 14:23:45 +0000 (14:23 +0000)
committerKeith Whitwell <keithw@vmware.com>
Tue, 9 Nov 2010 20:12:46 +0000 (20:12 +0000)
Seems to sort-of work for non-mipmapped textures.  Better than just
black anyway.

src/gallium/drivers/r600/eg_state_inlines.h
src/gallium/drivers/r600/r600_state_inlines.h
src/gallium/drivers/r600/r600_texture.c

index be81c28..5964197 100644 (file)
@@ -473,7 +473,7 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format)
        case PIPE_FORMAT_UYVY:
        case PIPE_FORMAT_YUYV:
        default:
-               R600_ERR("unsupported color format %d\n", format);
+               //R600_ERR("unsupported color format %d\n", format);
                return ~0; /* Unsupported. */
        }
 }
index 1c1978f..1be5b15 100644 (file)
@@ -472,7 +472,7 @@ static INLINE uint32_t r600_translate_colorformat(enum pipe_format format)
        case PIPE_FORMAT_UYVY:
        case PIPE_FORMAT_YUYV:
        default:
-               R600_ERR("unsupported color format %d %s\n", format, util_format_name(format));
+               //R600_ERR("unsupported color format %d %s\n", format, util_format_name(format));
                return ~0; /* Unsupported. */
        }
 }
index 06d17f7..02160fd 100644 (file)
@@ -806,7 +806,7 @@ uint32_t r600_translate_texformat(enum pipe_format format,
                        result = FMT_24_8;
                        goto out_word4;
                case PIPE_FORMAT_S8_USCALED:
-                       result = V_0280A0_COLOR_8;
+                       result = FMT_8;
                        word4 |= S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_INT);
                        goto out_word4;
                default:
@@ -835,7 +835,20 @@ uint32_t r600_translate_texformat(enum pipe_format format,
 
        /* S3TC formats. TODO */
        if (desc->layout == UTIL_FORMAT_LAYOUT_S3TC) {
-               goto out_unknown;
+               switch (format) {
+               case PIPE_FORMAT_DXT1_RGB:
+               case PIPE_FORMAT_DXT1_RGBA:
+                        result = FMT_BC1;
+                        goto out_word4;
+               case PIPE_FORMAT_DXT3_RGBA:
+                        result = FMT_BC2;
+                        goto out_word4;
+               case PIPE_FORMAT_DXT5_RGBA:
+                        result = FMT_BC3;
+                        goto out_word4;
+                default:
+                        goto out_unknown;
+                }
        }