[Mesa-dev] [PATCH 03/13] gallium: Introduce 32-bit bytewise format names

Richard Sandiford rsandifo at linux.vnet.ibm.com
Tue Jun 4 02:47:10 PDT 2013


Jose Fonseca <jfonseca at vmware.com> writes:
> Let me look again into this again...

Thanks.  FWIW, here's a WIP patch for just the general gallium bits
(no llvmpipe).  The main changes from the original version are:

(1) it keeps the original "array" names as the canonical ones and
    defines the new names as aliases

(2) it uses PIPE_FORMAT_INT_* names with the lsb first rather than the
    mesa-like ones with msb first.  (I'm happy to change the names to
    something else though.)

The patch isn't in a submittable state yet.  I just thought it was worth
posting because the lsb-first names do make the change look a bit more
obvious/less scary :-)

I'd like to get rid of the sys.byteorder thing from u_format_parse.py
as well, either by passing the endianness of the target into python
somehow, or by making the output of the scripts use preprocessor
conditions to choose the right value.  (I'll probably go for the latter
if you don't have a preference.)

Thanks,
Richard


diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index e4b9c36..3a04d89 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -132,6 +132,7 @@ struct util_format_channel_description
    unsigned normalized:1;
    unsigned pure_integer:1;
    unsigned size:9;        /**< bits per channel */
+   unsigned shift:16;      /** number of bits from lsb */
 };
 
 
@@ -178,9 +179,31 @@ struct util_format_description
    unsigned is_mixed:1;
 
    /**
-    * Input channel description.
+    * Input channel description, in the order XYZW.
     *
     * Only valid for UTIL_FORMAT_LAYOUT_PLAIN formats.
+    *
+    * If each channel is accessed as an individual N-byte value, X is always
+    * at the lowest address in memory, Y is always next, and so on.  For all
+    * currently-defined formats, the N-byte value has native endianness.
+    *
+    * If instead a group of channels is accessed as a single N-byte value,
+    * the order of the channels within that value depends on endianness.
+    * For big-endian targets, X is the most significant subvalue,
+    * otherwise it is the least significant one.
+    *
+    * For example, if X is 8 bits and Y is 24 bits, the memory order is:
+    *
+    *                 0  1  2  3
+    *  little-endian: X  Yl Ym Yu    (l = lower, m = middle, u = upper)
+    *  big-endian:    X  Yu Ym Yl
+    *
+    * If X is 5 bits, Y is 5 bits, Z is 5 bits and W is 1 bit, the layout is:
+    *
+    *                        0        1
+    *                 msb  lsb msb  lsb
+    *  little-endian: YYYXXXXX WZZZZZYY
+    *  big-endian:    XXXXXYYY YYZZZZZW
     */
    struct util_format_channel_description channel[4];
 
diff --git a/src/gallium/auxiliary/util/u_format_pack.py b/src/gallium/auxiliary/util/u_format_pack.py
index 565d059..d1f68c8 100644
--- a/src/gallium/auxiliary/util/u_format_pack.py
+++ b/src/gallium/auxiliary/util/u_format_pack.py
@@ -99,15 +99,6 @@ def generate_format_type(format):
     print
 
 
-def bswap_format(format):
-    '''Generate a structure that describes the format.'''
-
-    if format.is_bitmask() and not format.is_array() and format.block_size() > 8:
-        print '#ifdef PIPE_ARCH_BIG_ENDIAN'
-        print '   pixel.value = util_bswap%u(pixel.value);' % format.block_size()
-        print '#endif'
-
-
 def is_format_supported(format):
     '''Determines whether we actually have the plumbing necessary to generate the 
     to read/write to/from this format.'''
@@ -423,16 +414,11 @@ def generate_unpack_kernel(format, dst_channel, dst_native_type):
             elif src_channel.type == SIGNED:
                 print '         int%u_t %s;' % (depth, src_channel.name)
 
-        if depth > 8:
-            print '#ifdef PIPE_ARCH_BIG_ENDIAN'
-            print '         value = util_bswap%u(value);' % depth
-            print '#endif'
-
         # Compute the intermediate unshifted values 
-        shift = 0
         for i in range(format.nr_channels()):
             src_channel = format.channels[i]
             value = 'value'
+            shift = src_channel.shift
             if src_channel.type == UNSIGNED:
                 if shift:
                     value = '%s >> %u' % (value, shift)
@@ -455,8 +441,6 @@ def generate_unpack_kernel(format, dst_channel, dst_native_type):
             if value is not None:
                 print '         %s = %s;' % (src_channel.name, value)
                 
-            shift += src_channel.size
-
         # Convert, swizzle, and store final values
         for i in range(4):
             swizzle = format.swizzles[i]
@@ -484,7 +468,6 @@ def generate_unpack_kernel(format, dst_channel, dst_native_type):
     else:
         print '         union util_format_%s pixel;' % format.short_name()
         print '         memcpy(&pixel, src, sizeof pixel);'
-        bswap_format(format)
     
         for i in range(4):
             swizzle = format.swizzles[i]
@@ -525,9 +508,9 @@ def generate_pack_kernel(format, src_channel, src_native_type):
         depth = format.block_size()
         print '         uint%u_t value = 0;' % depth 
 
-        shift = 0
         for i in range(4):
             dst_channel = format.channels[i]
+            shift = dst_channel.shift
             if inv_swizzle[i] is not None:
                 value ='src[%u]' % inv_swizzle[i]
                 dst_colorspace = format.colorspace
@@ -551,13 +534,6 @@ def generate_pack_kernel(format, src_channel, src_native_type):
                 if value is not None:
                     print '         value |= %s;' % (value)
                 
-            shift += dst_channel.size
-
-        if depth > 8:
-            print '#ifdef PIPE_ARCH_BIG_ENDIAN'
-            print '         value = util_bswap%u(value);' % depth
-            print '#endif'
-        
         print '         *(uint%u_t *)dst = value;' % depth 
 
     else:
@@ -579,7 +555,6 @@ def generate_pack_kernel(format, src_channel, src_native_type):
                                     dst_colorspace = dst_colorspace)
             print '         pixel.chan.%s = %s;' % (dst_channel.name, value)
     
-        bswap_format(format)
         print '         memcpy(dst, &pixel, sizeof pixel);'
     
 
diff --git a/src/gallium/auxiliary/util/u_format_parse.py b/src/gallium/auxiliary/util/u_format_parse.py
index 07052b9..e202099 100755
--- a/src/gallium/auxiliary/util/u_format_parse.py
+++ b/src/gallium/auxiliary/util/u_format_parse.py
@@ -30,6 +30,8 @@
 '''
 
 
+import sys
+
 VOID, UNSIGNED, SIGNED, FIXED, FLOAT = range(5)
 
 SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W, SWIZZLE_0, SWIZZLE_1, SWIZZLE_NONE, = range(7)
@@ -42,6 +44,9 @@ YUV = 'yuv'
 ZS = 'zs'
 
 
+# Not cross-compiler friendly
+is_big_endian = sys.byteorder == 'big'
+
 def is_pot(x):
    return (x & (x - 1)) == 0
 
@@ -307,6 +312,11 @@ def parse(filename):
             channel = Channel(type, norm, pure, size, names[i])
             channels.append(channel)
 
+        shift = 0
+        for channel in channels[3::-1] if is_big_endian else channels:
+            channel.shift = shift
+            shift += channel.size
+
         format = Format(name, layout, block_width, block_height, channels, swizzles, colorspace)
         formats.append(format)
     return formats
diff --git a/src/gallium/auxiliary/util/u_format_table.py b/src/gallium/auxiliary/util/u_format_table.py
index 8edb505..9d44cf3 100755
--- a/src/gallium/auxiliary/util/u_format_table.py
+++ b/src/gallium/auxiliary/util/u_format_table.py
@@ -114,9 +114,9 @@ def write_format_table(formats):
             else:
                 sep = ""
             if channel.size:
-                print "      {%s, %s, %s, %u}%s\t/* %s = %s */" % (type_map[channel.type], bool_map(channel.norm), bool_map(channel.pure), channel.size, sep, "xyzw"[i], channel.name)
+                print "      {%s, %s, %s, %u, %u}%s\t/* %s = %s */" % (type_map[channel.type], bool_map(channel.norm), bool_map(channel.pure), channel.size, channel.shift, sep, "xyzw"[i], channel.name)
             else:
-                print "      {0, 0, 0, 0}%s" % (sep,)
+                print "      {0, 0, 0, 0, 0}%s" % (sep,)
         print "   },"
         print "   {"
         for i in range(4):
diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h
index 1f6a56a..c35d539 100644
--- a/src/gallium/auxiliary/util/u_pack_color.h
+++ b/src/gallium/auxiliary/util/u_pack_color.h
@@ -65,32 +65,32 @@ util_pack_color_ub(ubyte r, ubyte g, ubyte b, ubyte a,
                    enum pipe_format format, union util_color *uc)
 {
    switch (format) {
-   case PIPE_FORMAT_A8B8G8R8_UNORM:
+   case PIPE_FORMAT_INT_A8B8G8R8_UNORM:
       {
          uc->ui = (r << 24) | (g << 16) | (b << 8) | a;
       }
       return;
-   case PIPE_FORMAT_X8B8G8R8_UNORM:
+   case PIPE_FORMAT_INT_X8B8G8R8_UNORM:
       {
          uc->ui = (r << 24) | (g << 16) | (b << 8) | 0xff;
       }
       return;
-   case PIPE_FORMAT_B8G8R8A8_UNORM:
+   case PIPE_FORMAT_INT_B8G8R8A8_UNORM:
       {
          uc->ui = (a << 24) | (r << 16) | (g << 8) | b;
       }
       return;
-   case PIPE_FORMAT_B8G8R8X8_UNORM:
+   case PIPE_FORMAT_INT_B8G8R8X8_UNORM:
       {
          uc->ui = (0xff << 24) | (r << 16) | (g << 8) | b;
       }
       return;
-   case PIPE_FORMAT_A8R8G8B8_UNORM:
+   case PIPE_FORMAT_INT_A8R8G8B8_UNORM:
       {
          uc->ui = (b << 24) | (g << 16) | (r << 8) | a;
       }
       return;
-   case PIPE_FORMAT_X8R8G8B8_UNORM:
+   case PIPE_FORMAT_INT_X8R8G8B8_UNORM:
       {
          uc->ui = (b << 24) | (g << 16) | (r << 8) | 0xff;
       }
@@ -166,7 +166,7 @@ util_unpack_color_ub(enum pipe_format format, union util_color *uc,
                      ubyte *r, ubyte *g, ubyte *b, ubyte *a)
 {
    switch (format) {
-   case PIPE_FORMAT_A8B8G8R8_UNORM:
+   case PIPE_FORMAT_INT_A8B8G8R8_UNORM:
       {
          uint p = uc->ui;
          *r = (ubyte) ((p >> 24) & 0xff);
@@ -175,7 +175,7 @@ util_unpack_color_ub(enum pipe_format format, union util_color *uc,
          *a = (ubyte) ((p >>  0) & 0xff);
       }
       return;
-   case PIPE_FORMAT_X8B8G8R8_UNORM:
+   case PIPE_FORMAT_INT_X8B8G8R8_UNORM:
       {
          uint p = uc->ui;
          *r = (ubyte) ((p >> 24) & 0xff);
@@ -184,7 +184,7 @@ util_unpack_color_ub(enum pipe_format format, union util_color *uc,
          *a = (ubyte) 0xff;
       }
       return;
-   case PIPE_FORMAT_B8G8R8A8_UNORM:
+   case PIPE_FORMAT_INT_B8G8R8A8_UNORM:
       {
          uint p = uc->ui;
          *r = (ubyte) ((p >> 16) & 0xff);
@@ -193,7 +193,7 @@ util_unpack_color_ub(enum pipe_format format, union util_color *uc,
          *a = (ubyte) ((p >> 24) & 0xff);
       }
       return;
-   case PIPE_FORMAT_B8G8R8X8_UNORM:
+   case PIPE_FORMAT_INT_B8G8R8X8_UNORM:
       {
          uint p = uc->ui;
          *r = (ubyte) ((p >> 16) & 0xff);
@@ -202,7 +202,7 @@ util_unpack_color_ub(enum pipe_format format, union util_color *uc,
          *a = (ubyte) 0xff;
       }
       return;
-   case PIPE_FORMAT_A8R8G8B8_UNORM:
+   case PIPE_FORMAT_INT_A8R8G8B8_UNORM:
       {
          uint p = uc->ui;
          *r = (ubyte) ((p >>  8) & 0xff);
@@ -211,7 +211,7 @@ util_unpack_color_ub(enum pipe_format format, union util_color *uc,
          *a = (ubyte) ((p >>  0) & 0xff);
       }
       return;
-   case PIPE_FORMAT_X8R8G8B8_UNORM:
+   case PIPE_FORMAT_INT_X8R8G8B8_UNORM:
       {
          uint p = uc->ui;
          *r = (ubyte) ((p >>  8) & 0xff);
@@ -350,32 +350,32 @@ util_pack_color(const float rgba[4], enum pipe_format format, union util_color *
    }
 
    switch (format) {
-   case PIPE_FORMAT_A8B8G8R8_UNORM:
+   case PIPE_FORMAT_INT_A8B8G8R8_UNORM:
       {
          uc->ui = (r << 24) | (g << 16) | (b << 8) | a;
       }
       return;
-   case PIPE_FORMAT_X8B8G8R8_UNORM:
+   case PIPE_FORMAT_INT_X8B8G8R8_UNORM:
       {
          uc->ui = (r << 24) | (g << 16) | (b << 8) | 0xff;
       }
       return;
-   case PIPE_FORMAT_B8G8R8A8_UNORM:
+   case PIPE_FORMAT_INT_B8G8R8A8_UNORM:
       {
          uc->ui = (a << 24) | (r << 16) | (g << 8) | b;
       }
       return;
-   case PIPE_FORMAT_B8G8R8X8_UNORM:
+   case PIPE_FORMAT_INT_B8G8R8X8_UNORM:
       {
          uc->ui = (0xff << 24) | (r << 16) | (g << 8) | b;
       }
       return;
-   case PIPE_FORMAT_A8R8G8B8_UNORM:
+   case PIPE_FORMAT_INT_A8R8G8B8_UNORM:
       {
          uc->ui = (b << 24) | (g << 16) | (r << 8) | a;
       }
       return;
-   case PIPE_FORMAT_X8R8G8B8_UNORM:
+   case PIPE_FORMAT_INT_X8R8G8B8_UNORM:
       {
          uc->ui = (b << 24) | (g << 16) | (r << 8) | 0xff;
       }
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index 098b25b..b0648f1 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -33,6 +33,7 @@
 extern "C" {
 #endif
 
+#include "p_config.h"
 
 enum pipe_type {
    PIPE_TYPE_UNORM = 0,
@@ -343,6 +344,27 @@ enum pipe_format {
    PIPE_FORMAT_COUNT
 };
 
+#if defined(PIPE_ARCH_LITTLE_ENDIAN)
+#define PIPE_FORMAT_INT_R8G8B8A8_UNORM PIPE_FORMAT_R8G8B8A8_UNORM
+#define PIPE_FORMAT_INT_R8G8B8X8_UNORM PIPE_FORMAT_R8G8B8X8_UNORM
+#define PIPE_FORMAT_INT_B8G8R8X8_UNORM PIPE_FORMAT_B8G8R8X8_UNORM
+#define PIPE_FORMAT_INT_B8G8R8A8_UNORM PIPE_FORMAT_B8G8R8A8_UNORM
+#define PIPE_FORMAT_INT_B8G8R8X8_UNORM PIPE_FORMAT_B8G8R8X8_UNORM
+#define PIPE_FORMAT_INT_A8R8G8B8_UNORM PIPE_FORMAT_A8R8G8B8_UNORM
+#define PIPE_FORMAT_INT_X8R8G8B8_UNORM PIPE_FORMAT_X8R8G8B8_UNORM
+#define PIPE_FORMAT_INT_A8B8G8R8_UNORM PIPE_FORMAT_A8B8G8R8_UNORM
+#define PIPE_FORMAT_INT_X8B8G8R8_UNORM PIPE_FORMAT_X8B8G8R8_UNORM
+#elif defined(PIPE_ARCH_BIG_ENDIAN)
+#define PIPE_FORMAT_INT_A8B8G8R8_UNORM PIPE_FORMAT_R8G8B8A8_UNORM
+#define PIPE_FORMAT_INT_X8B8G8R8_UNORM PIPE_FORMAT_R8G8B8X8_UNORM
+#define PIPE_FORMAT_INT_A8R8G8B8_UNORM PIPE_FORMAT_B8G8R8A8_UNORM
+#define PIPE_FORMAT_INT_X8R8G8B8_UNORM PIPE_FORMAT_B8G8R8X8_UNORM
+#define PIPE_FORMAT_INT_B8G8R8A8_UNORM PIPE_FORMAT_A8R8G8B8_UNORM
+#define PIPE_FORMAT_INT_B8G8R8X8_UNORM PIPE_FORMAT_X8R8G8B8_UNORM
+#define PIPE_FORMAT_INT_R8G8B8A8_UNORM PIPE_FORMAT_A8B8G8R8_UNORM
+#define PIPE_FORMAT_INT_R8G8B8X8_UNORM PIPE_FORMAT_X8B8G8R8_UNORM
+#endif
+
 enum pipe_video_chroma_format
 {
    PIPE_VIDEO_CHROMA_FORMAT_420,
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c
index e09fe1d..2f5658e 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -87,8 +87,8 @@ dri_fill_in_modes(struct dri_screen *screen)
       MESA_FORMAT_RGB565,
    };
    static const enum pipe_format pipe_formats[3] = {
-      PIPE_FORMAT_B8G8R8A8_UNORM,
-      PIPE_FORMAT_B8G8R8X8_UNORM,
+      PIPE_FORMAT_INT_B8G8R8A8_UNORM,
+      PIPE_FORMAT_INT_B8G8R8X8_UNORM,
       PIPE_FORMAT_B5G6R5_UNORM,
    };
    gl_format format;
@@ -250,9 +250,9 @@ dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen,
 
    if (mode->redBits == 8) {
       if (mode->alphaBits == 8)
-         stvis->color_format = PIPE_FORMAT_B8G8R8A8_UNORM;
+         stvis->color_format = PIPE_FORMAT_INT_B8G8R8A8_UNORM;
       else
-         stvis->color_format = PIPE_FORMAT_B8G8R8X8_UNORM;
+         stvis->color_format = PIPE_FORMAT_INT_B8G8R8X8_UNORM;
    } else {
       stvis->color_format = PIPE_FORMAT_B5G6R5_UNORM;
    }
diff --git a/src/gallium/state_trackers/gbm/gbm_drm.c b/src/gallium/state_trackers/gbm/gbm_drm.c
index 8490480..cb3775e 100644
--- a/src/gallium/state_trackers/gbm/gbm_drm.c
+++ b/src/gallium/state_trackers/gbm/gbm_drm.c
@@ -45,9 +45,9 @@ gbm_format_to_gallium(enum gbm_bo_format format)
 {
    switch (format) {
    case GBM_BO_FORMAT_XRGB8888:
-      return PIPE_FORMAT_B8G8R8X8_UNORM;
+      return PIPE_FORMAT_INT_B8G8R8X8_UNORM;
    case GBM_BO_FORMAT_ARGB8888:
-      return PIPE_FORMAT_B8G8R8A8_UNORM;
+      return PIPE_FORMAT_INT_B8G8R8A8_UNORM;
    default:
       return PIPE_FORMAT_NONE;
    }
@@ -145,10 +145,10 @@ gbm_gallium_drm_bo_import(struct gbm_device *gbm,
    bo->base.base.height = resource->height0;
 
    switch (resource->format) {
-   case PIPE_FORMAT_B8G8R8X8_UNORM:
+   case PIPE_FORMAT_INT_B8G8R8X8_UNORM:
       bo->base.base.format = GBM_BO_FORMAT_XRGB8888;
       break;
-   case PIPE_FORMAT_B8G8R8A8_UNORM:
+   case PIPE_FORMAT_INT_B8G8R8A8_UNORM:
       bo->base.base.format = GBM_BO_FORMAT_ARGB8888;
       break;
    default:
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index e426192..41c005f 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -329,10 +329,10 @@ choose_pixel_format(XMesaVisual v)
        && v->BitsPerPixel == 32) {
       if (native_byte_order) {
          /* no byteswapping needed */
-         return PIPE_FORMAT_R8G8B8A8_UNORM;
+         return PIPE_FORMAT_INT_R8G8B8A8_UNORM;
       }
       else {
-         return PIPE_FORMAT_A8B8G8R8_UNORM;
+         return PIPE_FORMAT_INT_A8B8G8R8_UNORM;
       }
    }
    else if (   GET_REDMASK(v)   == 0xff0000
@@ -341,10 +341,10 @@ choose_pixel_format(XMesaVisual v)
             && v->BitsPerPixel == 32) {
       if (native_byte_order) {
          /* no byteswapping needed */
-         return PIPE_FORMAT_B8G8R8A8_UNORM;
+         return PIPE_FORMAT_INT_B8G8R8A8_UNORM;
       }
       else {
-         return PIPE_FORMAT_A8R8G8B8_UNORM;
+         return PIPE_FORMAT_INT_A8R8G8B8_UNORM;
       }
    }
    else if (   GET_REDMASK(v)   == 0x0000ff00
@@ -353,10 +353,10 @@ choose_pixel_format(XMesaVisual v)
             && v->BitsPerPixel == 32) {
       if (native_byte_order) {
          /* no byteswapping needed */
-         return PIPE_FORMAT_A8R8G8B8_UNORM;
+         return PIPE_FORMAT_INT_A8R8G8B8_UNORM;
       }
       else {
-         return PIPE_FORMAT_B8G8R8A8_UNORM;
+         return PIPE_FORMAT_INT_B8G8R8A8_UNORM;
       }
    }
    else if (   GET_REDMASK(v)   == 0xf800
diff --git a/src/gallium/targets/graw-xlib/graw_xlib.c b/src/gallium/targets/graw-xlib/graw_xlib.c
index 2827747..e5f5069 100644
--- a/src/gallium/targets/graw-xlib/graw_xlib.c
+++ b/src/gallium/targets/graw-xlib/graw_xlib.c
@@ -89,13 +89,13 @@ graw_create_window_and_screen( int x,
    if (visinfo->red_mask == 0xff0000 &&
        visinfo->green_mask == 0xff00 &&
        visinfo->blue_mask == 0xff) {
-      if (format != PIPE_FORMAT_B8G8R8A8_UNORM)
+      if (format != PIPE_FORMAT_INT_B8G8R8A8_UNORM)
          goto fail;
    }
    else if (visinfo->red_mask == 0xff &&
             visinfo->green_mask == 0xff00 &&
             visinfo->blue_mask == 0xff0000) {
-      if (format != PIPE_FORMAT_R8G8B8A8_UNORM)
+      if (format != PIPE_FORMAT_INT_R8G8B8A8_UNORM)
          goto fail;
    }
    else {
diff --git a/src/gallium/tests/graw/graw_util.h b/src/gallium/tests/graw/graw_util.h
index 84456b4..98e698d 100644
--- a/src/gallium/tests/graw/graw_util.h
+++ b/src/gallium/tests/graw/graw_util.h
@@ -226,7 +226,7 @@ graw_util_create_tex2d(const struct graw_info *info,
    struct pipe_box box;
 
    temp.target = PIPE_TEXTURE_2D;
-   temp.format = PIPE_FORMAT_B8G8R8A8_UNORM;
+   temp.format = format;
    temp.width0 = width;
    temp.height0 = height;
    temp.depth0 = 1;
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index 56f3a4a..906376f 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -55,21 +55,21 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat)
 {
    switch (mesaFormat) {
    case MESA_FORMAT_RGBA8888:
-      return PIPE_FORMAT_A8B8G8R8_UNORM;
+      return PIPE_FORMAT_INT_A8B8G8R8_UNORM;
    case MESA_FORMAT_RGBA8888_REV:
-      return PIPE_FORMAT_R8G8B8A8_UNORM;
+      return PIPE_FORMAT_INT_R8G8B8A8_UNORM;
    case MESA_FORMAT_ARGB8888:
-      return PIPE_FORMAT_B8G8R8A8_UNORM;
+      return PIPE_FORMAT_INT_B8G8R8A8_UNORM;
    case MESA_FORMAT_ARGB8888_REV:
-      return PIPE_FORMAT_A8R8G8B8_UNORM;
+      return PIPE_FORMAT_INT_A8R8G8B8_UNORM;
    case MESA_FORMAT_RGBX8888:
-      return PIPE_FORMAT_X8B8G8R8_UNORM;
+      return PIPE_FORMAT_INT_X8B8G8R8_UNORM;
    case MESA_FORMAT_RGBX8888_REV:
-      return PIPE_FORMAT_R8G8B8X8_UNORM;
+      return PIPE_FORMAT_INT_R8G8B8X8_UNORM;
    case MESA_FORMAT_XRGB8888:
-      return PIPE_FORMAT_B8G8R8X8_UNORM;
+      return PIPE_FORMAT_INT_B8G8R8X8_UNORM;
    case MESA_FORMAT_XRGB8888_REV:
-      return PIPE_FORMAT_X8R8G8B8_UNORM;
+      return PIPE_FORMAT_INT_X8R8G8B8_UNORM;
    case MESA_FORMAT_ARGB1555:
       return PIPE_FORMAT_B5G5R5A1_UNORM;
    case MESA_FORMAT_ARGB4444:
@@ -401,21 +401,21 @@ gl_format
 st_pipe_format_to_mesa_format(enum pipe_format format)
 {
    switch (format) {
-   case PIPE_FORMAT_A8B8G8R8_UNORM:
+   case PIPE_FORMAT_INT_A8B8G8R8_UNORM:
       return MESA_FORMAT_RGBA8888;
-   case PIPE_FORMAT_R8G8B8A8_UNORM:
+   case PIPE_FORMAT_INT_R8G8B8A8_UNORM:
       return MESA_FORMAT_RGBA8888_REV;
-   case PIPE_FORMAT_B8G8R8A8_UNORM:
+   case PIPE_FORMAT_INT_B8G8R8A8_UNORM:
       return MESA_FORMAT_ARGB8888;
-   case PIPE_FORMAT_A8R8G8B8_UNORM:
+   case PIPE_FORMAT_INT_A8R8G8B8_UNORM:
       return MESA_FORMAT_ARGB8888_REV;
-   case PIPE_FORMAT_X8B8G8R8_UNORM:
+   case PIPE_FORMAT_INT_X8B8G8R8_UNORM:
       return MESA_FORMAT_RGBX8888;
-   case PIPE_FORMAT_R8G8B8X8_UNORM:
+   case PIPE_FORMAT_INT_R8G8B8X8_UNORM:
       return MESA_FORMAT_RGBX8888_REV;
-   case PIPE_FORMAT_B8G8R8X8_UNORM:
+   case PIPE_FORMAT_INT_B8G8R8X8_UNORM:
       return MESA_FORMAT_XRGB8888;
-   case PIPE_FORMAT_X8R8G8B8_UNORM:
+   case PIPE_FORMAT_INT_X8R8G8B8_UNORM:
       return MESA_FORMAT_XRGB8888_REV;
    case PIPE_FORMAT_B5G5R5A1_UNORM:
       return MESA_FORMAT_ARGB1555;
@@ -1521,12 +1521,12 @@ struct exact_format_mapping
 
 static const struct exact_format_mapping rgba8888_tbl[] =
 {
-   { GL_RGBA,     GL_UNSIGNED_INT_8_8_8_8,        PIPE_FORMAT_A8B8G8R8_UNORM },
-   { GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8_REV,    PIPE_FORMAT_A8B8G8R8_UNORM },
-   { GL_RGBA,     GL_UNSIGNED_INT_8_8_8_8_REV,    PIPE_FORMAT_R8G8B8A8_UNORM },
-   { GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8,        PIPE_FORMAT_R8G8B8A8_UNORM },
-   { GL_BGRA,     GL_UNSIGNED_INT_8_8_8_8,        PIPE_FORMAT_A8R8G8B8_UNORM },
-   { GL_BGRA,     GL_UNSIGNED_INT_8_8_8_8_REV,    PIPE_FORMAT_B8G8R8A8_UNORM },
+   { GL_RGBA,     GL_UNSIGNED_INT_8_8_8_8,        PIPE_FORMAT_INT_A8B8G8R8_UNORM },
+   { GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8_REV,    PIPE_FORMAT_INT_A8B8G8R8_UNORM },
+   { GL_RGBA,     GL_UNSIGNED_INT_8_8_8_8_REV,    PIPE_FORMAT_INT_R8G8B8A8_UNORM },
+   { GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8,        PIPE_FORMAT_INT_R8G8B8A8_UNORM },
+   { GL_BGRA,     GL_UNSIGNED_INT_8_8_8_8,        PIPE_FORMAT_INT_A8R8G8B8_UNORM },
+   { GL_BGRA,     GL_UNSIGNED_INT_8_8_8_8_REV,    PIPE_FORMAT_INT_B8G8R8A8_UNORM },
    { GL_RGBA,     GL_UNSIGNED_BYTE,               PIPE_FORMAT_R8G8B8A8_UNORM },
    { GL_ABGR_EXT, GL_UNSIGNED_BYTE,               PIPE_FORMAT_A8B8G8R8_UNORM },
    { GL_BGRA,     GL_UNSIGNED_BYTE,               PIPE_FORMAT_B8G8R8A8_UNORM },
@@ -1535,15 +1535,15 @@ static const struct exact_format_mapping rgba8888_tbl[] =
 
 static const struct exact_format_mapping rgbx8888_tbl[] =
 {
-   { GL_BGRA,     GL_UNSIGNED_INT_8_8_8_8,        PIPE_FORMAT_X8R8G8B8_UNORM },
-   { GL_BGRA,     GL_UNSIGNED_INT_8_8_8_8_REV,    PIPE_FORMAT_B8G8R8X8_UNORM },
-   { GL_BGRA,     GL_UNSIGNED_BYTE,               PIPE_FORMAT_B8G8R8X8_UNORM },
-   { GL_RGBA,     GL_UNSIGNED_INT_8_8_8_8,        PIPE_FORMAT_X8B8G8R8_UNORM },
-   { GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8_REV,    PIPE_FORMAT_X8B8G8R8_UNORM },
-   { GL_RGBA,     GL_UNSIGNED_INT_8_8_8_8_REV,    PIPE_FORMAT_R8G8B8X8_UNORM },
-   { GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8,        PIPE_FORMAT_R8G8B8X8_UNORM },
+   { GL_RGBA,     GL_UNSIGNED_INT_8_8_8_8,        PIPE_FORMAT_INT_X8B8G8R8_UNORM },
+   { GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8_REV,    PIPE_FORMAT_INT_X8B8G8R8_UNORM },
+   { GL_RGBA,     GL_UNSIGNED_INT_8_8_8_8_REV,    PIPE_FORMAT_INT_R8G8B8X8_UNORM },
+   { GL_ABGR_EXT, GL_UNSIGNED_INT_8_8_8_8,        PIPE_FORMAT_INT_R8G8B8X8_UNORM },
+   { GL_BGRA,     GL_UNSIGNED_INT_8_8_8_8,        PIPE_FORMAT_INT_X8R8G8B8_UNORM },
+   { GL_BGRA,     GL_UNSIGNED_INT_8_8_8_8_REV,    PIPE_FORMAT_INT_B8G8R8X8_UNORM },
    { GL_RGBA,     GL_UNSIGNED_BYTE,               PIPE_FORMAT_R8G8B8X8_UNORM },
    { GL_ABGR_EXT, GL_UNSIGNED_BYTE,               PIPE_FORMAT_X8B8G8R8_UNORM },
+   { GL_BGRA,     GL_UNSIGNED_BYTE,               PIPE_FORMAT_B8G8R8X8_UNORM },
    { 0,           0,                              0                          }
 };
 



More information about the mesa-dev mailing list