u_format: fix RGTC support in fits 8unorm.
authorDave Airlie <airlied@redhat.com>
Sun, 6 Nov 2011 19:32:22 +0000 (19:32 +0000)
committerDave Airlie <airlied@redhat.com>
Sun, 6 Nov 2011 22:32:04 +0000 (22:32 +0000)
Signed RGTC won't fit in a unorm, so don't allow them.

Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/auxiliary/util/u_format.c

index e07462a75d0c71f699dbfcb0682c3a3cfdd64cf9..cfc4a17a062e41560e9169dc74f58c88617c4c79 100644 (file)
@@ -443,11 +443,16 @@ util_format_fits_8unorm(const struct util_format_description *format_desc)
    switch (format_desc->layout) {
 
    case UTIL_FORMAT_LAYOUT_S3TC:
-   case UTIL_FORMAT_LAYOUT_RGTC:
       /*
        * These are straight forward.
        */
-
+      return TRUE;
+   case UTIL_FORMAT_LAYOUT_RGTC:
+      if (format_desc->format == PIPE_FORMAT_RGTC1_SNORM ||
+          format_desc->format == PIPE_FORMAT_RGTC2_SNORM ||
+          format_desc->format == PIPE_FORMAT_LATC1_SNORM ||
+          format_desc->format == PIPE_FORMAT_LATC2_SNORM)
+         return FALSE;
       return TRUE;
 
    case UTIL_FORMAT_LAYOUT_PLAIN: