Revert "Simplify the redundant meaning of format layout."
authorMichal Krol <michal@vmware.com>
Wed, 9 Dec 2009 13:22:30 +0000 (14:22 +0100)
committerMichal Krol <michal@vmware.com>
Wed, 9 Dec 2009 13:22:30 +0000 (14:22 +0100)
This reverts commit eb926ddf9eee1095c7fc12013f0b8375bbaeca6f.

src/gallium/auxiliary/util/u_format.h
src/gallium/auxiliary/util/u_format_table.py
src/gallium/drivers/llvmpipe/lp_screen.c
src/gallium/drivers/r300/r300_state_inlines.h
src/mesa/state_tracker/st_format.c

index bb7c2add5c6a85a590075471ba4d2c22f7aa525f..25a06a8f7db0f8404d544c8b69335243c1d881ca 100644 (file)
 
 
 enum util_format_layout {
-   UTIL_FORMAT_LAYOUT_PLAIN = 0, /*< RGB, depth-stencil */
-   UTIL_FORMAT_LAYOUT_DXT = 1
+   UTIL_FORMAT_LAYOUT_SCALAR = 0,
+   UTIL_FORMAT_LAYOUT_ARITH = 1,
+   UTIL_FORMAT_LAYOUT_ARRAY = 2,
+   UTIL_FORMAT_LAYOUT_YUV = 3,
+   UTIL_FORMAT_LAYOUT_DXT = 4
 };
 
 
index c772a75e615ece46b9c4699983407e97408835e6..8713594376639fd5487149ffc4311a7b59fa25fc 100755 (executable)
@@ -35,12 +35,8 @@ import sys
 from u_format_parse import *
 
 
-layout_map = {
-    'arith': 'UTIL_FORMAT_LAYOUT_PLAIN',
-    'array': 'UTIL_FORMAT_LAYOUT_PLAIN',
-    'yuv':   'UTIL_FORMAT_LAYOUT_PLAIN',
-    'dxt':   'UTIL_FORMAT_LAYOUT_DXT',
-}
+def layout_map(layout):
+    return 'UTIL_FORMAT_LAYOUT_' + str(layout).upper()
 
 
 def colorspace_map(colorspace):
@@ -108,7 +104,7 @@ def write_format_table(formats):
         print "      %s," % (format.name,)
         print "      \"%s\"," % (format.name,)
         print "      {%u, %u, %u}, /* block */" % (format.block_width, format.block_height, format.block_size())
-        print "      %s," % (layout_map[format.layout],)
+        print "      %s," % (layout_map(format.layout),)
         print "      {"
         for i in range(4):
             type = format.in_types[i]
index 3641e1dccbdd9e2c122fe5f2e138e2222022523e..a6ecaa0b2bea83d84c9763fc6d2486bce35f0ffd 100644 (file)
@@ -158,7 +158,9 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
          format_desc->block.height != 1)
          return FALSE;
 
-      if(format_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN)
+      if(format_desc->layout != UTIL_FORMAT_LAYOUT_SCALAR &&
+         format_desc->layout != UTIL_FORMAT_LAYOUT_ARITH &&
+         format_desc->layout != UTIL_FORMAT_LAYOUT_ARRAY)
          return FALSE;
 
       if(format_desc->colorspace != UTIL_FORMAT_COLORSPACE_RGB &&
@@ -186,7 +188,9 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
          format_desc->block.height != 1)
          return FALSE;
 
-      if(format_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN)
+      if(format_desc->layout != UTIL_FORMAT_LAYOUT_SCALAR &&
+         format_desc->layout != UTIL_FORMAT_LAYOUT_ARITH &&
+         format_desc->layout != UTIL_FORMAT_LAYOUT_ARRAY)
          return FALSE;
 
       if(format_desc->colorspace != UTIL_FORMAT_COLORSPACE_RGB &&
index c71305edc27429de6295cb1456f64fe30b164a6d..7cd1f87630ecdbd92e8bc0564177ef593773b2b8 100644 (file)
@@ -476,7 +476,8 @@ r300_translate_vertex_data_type(enum pipe_format format) {
 
     desc = util_format_description(format);
 
-    if (desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) {
+    if (desc->layout != UTIL_FORMAT_LAYOUT_ARITH &&
+        desc->layout != UTIL_FORMAT_LAYOUT_ARRAY) {
         debug_printf("r300: Bad format %s in %s:%d\n", pf_name(format),
             __FUNCTION__, __LINE__);
         assert(0);
@@ -540,7 +541,8 @@ r300_translate_vertex_data_swizzle(enum pipe_format format) {
 
     assert(format);
 
-    if (desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) {
+    if (desc->layout != UTIL_FORMAT_LAYOUT_ARITH &&
+        desc->layout != UTIL_FORMAT_LAYOUT_ARRAY) {
         debug_printf("r300: Bad format %s in %s:%d\n",
             pf_name(format), __FUNCTION__, __LINE__);
         return 0;
index 2056dce7fb1e82fcb5e8c35341107983ed2c245a..329ae03db2003655c01f05d701e0ba5231edcfd8 100644 (file)
@@ -83,7 +83,8 @@ st_get_format_info(enum pipe_format format, struct pipe_format_info *pinfo)
    desc = util_format_description(format);
    assert(desc);
 
-   if (desc->layout == UTIL_FORMAT_LAYOUT_PLAIN) {
+   if (desc->layout == UTIL_FORMAT_LAYOUT_ARITH ||
+       desc->layout == UTIL_FORMAT_LAYOUT_ARRAY) {
 #if 0
       printf("%s\n", pf_name( format ) );
 #endif
@@ -146,7 +147,7 @@ st_get_format_info(enum pipe_format format, struct pipe_format_info *pinfo)
 
       pinfo->mesa_format = st_pipe_format_to_mesa_format(format);
    }
-   else if (desc->colorspace == UTIL_FORMAT_COLORSPACE_YUV) {
+   else if (desc->layout == UTIL_FORMAT_LAYOUT_YUV) {
       pinfo->mesa_format = MESA_FORMAT_YCBCR;
       pinfo->datatype = GL_UNSIGNED_SHORT;
       pinfo->size = 2; /* two bytes per "texel" */