Gallium xlib: Add support for BGRA visuals.
authorMichel Dänzer <daenzer@vmware.com>
Mon, 31 Aug 2009 08:22:19 +0000 (10:22 +0200)
committerMichel Dänzer <daenzer@vmware.com>
Mon, 31 Aug 2009 08:22:19 +0000 (10:22 +0200)
src/gallium/state_trackers/glx/xlib/xm_api.c

index f4c5893427d54e42942bc9b4a53149292d3c7c0f..651a9a9fea7d9ed27a87c11c91a97cf36701bf98 100644 (file)
@@ -286,6 +286,18 @@ choose_pixel_format(XMesaVisual v)
          return PIPE_FORMAT_B8G8R8A8_UNORM;
       }
    }
+   else if (   GET_REDMASK(v)   == 0x0000ff00
+            && GET_GREENMASK(v) == 0x00ff0000
+            && GET_BLUEMASK(v)  == 0xff000000
+            && v->BitsPerPixel == 32) {
+      if (native_byte_order) {
+         /* no byteswapping needed */
+         return PIPE_FORMAT_B8G8R8A8_UNORM;
+      }
+      else {
+         return PIPE_FORMAT_A8R8G8B8_UNORM;
+      }
+   }
    else if (   GET_REDMASK(v)   == 0xf800
             && GET_GREENMASK(v) == 0x07e0
             && GET_BLUEMASK(v)  == 0x001f