[cogl/wip/pixel-format-2101010: 4/5] Add support for X101010 and 2101010 pixel formats to fallback OpenGL rendering



commit bae53447182b718f0798e7d0b417c5c7cbc99212
Author: Damien Leone <dleone nvidia com>
Date:   Mon Nov 21 15:41:40 2011 -0800

    Add support for X101010 and 2101010 pixel formats to fallback OpenGL rendering
    
    https://bugzilla.gnome.org/show_bug.cgi?id=660188
    
    Reviewed-by: Robert Bragg <robert linux intel com>

 cogl/cogl-util.c                        |    3 +++
 cogl/driver/gl/cogl-texture-driver-gl.c |   12 ++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/cogl/cogl-util.c b/cogl/cogl-util.c
index cc7f10d..4368930 100644
--- a/cogl/cogl-util.c
+++ b/cogl/cogl-util.c
@@ -130,12 +130,15 @@ _cogl_util_pixel_format_from_masks (unsigned long r_mask,
                                     int byte_order)
 {
 #define MASK_FMT_888(a, b, c) ((a) == 0xff0000 && (b) == 0xff00 && (c) == 0xff)
+#define MASK_FMT_101010(a, b, c) ((a) == 0x3ff00000 && (b) == 0xffc00 && (c) == 0x3ff)
 
   CoglPixelFormat image_format;
 
   /* Determine format from masks */
   if ((depth == 24 || depth == 32) && MASK_FMT_888(r_mask, g_mask, b_mask))
     image_format = COGL_PIXEL_FORMAT_RGB_888;
+  else if ((depth == 30 || depth == 32) && MASK_FMT_101010(b_mask, g_mask, r_mask))
+    image_format = COGL_PIXEL_FORMAT_BGR_101010;
   else
     {
       g_warning ("Could not find a matching pixel format for red mask=0x%lx," \
diff --git a/cogl/driver/gl/cogl-texture-driver-gl.c b/cogl/driver/gl/cogl-texture-driver-gl.c
index 6ab1b3e..5dde557 100644
--- a/cogl/driver/gl/cogl-texture-driver-gl.c
+++ b/cogl/driver/gl/cogl-texture-driver-gl.c
@@ -463,6 +463,18 @@ _cogl_texture_driver_pixel_format_to_gl (CoglPixelFormat  format,
 #endif
       break;
 
+    case COGL_PIXEL_FORMAT_ABGR_2101010:
+      glintformat = GL_RGB10_A2;
+      glformat = GL_BGRA;
+      gltype = GL_UNSIGNED_INT_2_10_10_10_REV;
+      break;
+
+    case COGL_PIXEL_FORMAT_ARGB_2101010:
+      glintformat = GL_RGB10_A2;
+      glformat = GL_RGBA;
+      gltype = GL_UNSIGNED_INT_2_10_10_10_REV;
+      break;
+
       /* The following three types of channel ordering
        * are always defined using system word byte
        * ordering (even according to GLES spec) */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]