[cogl] Check for GL_EXT_packed_depth_stencil



commit b52d24c933359ee8133f0d7402cecc4d3ea18b91
Author: Neil Roberts <neil linux intel com>
Date:   Wed Feb 22 16:55:34 2012 +0000

    Check for GL_EXT_packed_depth_stencil
    
    The GL_DEPTH_STENCIL format for renderbuffers is defined in a separate
    extension from GL_EXT_framebuffer_object so we probably shouldn't
    being trying to use it unless that extension is advertised. This just
    replaces the check for whether the driver is GL for a check for a
    private feature flag before trying GL_DEPTH_STENCIL. The private
    feature flag is set if the extension is available on GL.
    
    Reviewed-by: Robert Bragg <robert linux intel com>

 cogl/cogl-framebuffer.c  |    5 ++---
 cogl/cogl-internal.h     |    3 ++-
 cogl/driver/gl/cogl-gl.c |    3 +++
 3 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index 5c7dbdb..7ae769e 100644
--- a/cogl/cogl-framebuffer.c
+++ b/cogl/cogl-framebuffer.c
@@ -1006,10 +1006,9 @@ _cogl_offscreen_allocate (CoglOffscreen *offscreen,
     {
       if ((have_working_flags &&
            try_creating_fbo (offscreen, flags)) ||
-#ifdef HAVE_COGL_GL
-          (ctx->driver == COGL_DRIVER_GL &&
+          ((ctx->private_feature_flags &
+            COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL) &&
            try_creating_fbo (offscreen, flags = _TRY_DEPTH_STENCIL)) ||
-#endif
           try_creating_fbo (offscreen, flags = _TRY_DEPTH | _TRY_STENCIL) ||
           try_creating_fbo (offscreen, flags = _TRY_STENCIL) ||
           try_creating_fbo (offscreen, flags = _TRY_DEPTH) ||
diff --git a/cogl/cogl-internal.h b/cogl/cogl-internal.h
index 7957786..b42c6c7 100644
--- a/cogl/cogl-internal.h
+++ b/cogl/cogl-internal.h
@@ -105,7 +105,8 @@ typedef enum
   COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT = 1L<<3,
   COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES = 1L<<4,
   COGL_PRIVATE_FEATURE_PBOS = 1L<<5,
-  COGL_PRIVATE_FEATURE_VBOS = 1L<<6
+  COGL_PRIVATE_FEATURE_VBOS = 1L<<6,
+  COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL = 1L<<7
 } CoglPrivateFeatureFlags;
 
 /* Sometimes when evaluating pipelines, either during comparisons or
diff --git a/cogl/driver/gl/cogl-gl.c b/cogl/driver/gl/cogl-gl.c
index e5dc155..b35ddbe 100644
--- a/cogl/driver/gl/cogl-gl.c
+++ b/cogl/driver/gl/cogl-gl.c
@@ -266,6 +266,9 @@ _cogl_gl_update_features (CoglContext *context,
   if (context->glEGLImageTargetTexture2D)
     private_flags |= COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE;
 
+  if (_cogl_check_extension ("GL_EXT_packed_depth_stencil", gl_extensions))
+    private_flags |= COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL;
+
   /* Cache features */
   context->private_feature_flags |= private_flags;
   context->feature_flags |= flags;



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