[cogl/cogl-1.14] Don't #ifdef the call to glDiscardFramebuffer



commit f79e78f6489b95151031a323f2ff272d6f00445a
Author: Neil Roberts <neil linux intel com>
Date:   Mon Feb 11 17:03:09 2013 +0000

    Don't #ifdef the call to glDiscardFramebuffer
    
    When Cogl is compiled with support for both the GL and GLES drivers it
    only includes the GL header and not the GLES header. That means in
    that case it would not compile in the code for the
    GL_EXT_discard_framebuffer extension even though it could be used on
    the GLES driver. This patch makes it use the standard names for the
    GL_COLOR, GL_STENCIL etc names instead of the _EXT suffixed names and
    manually defines them if we are using the GLES headers. That way the
    discard code can be used unconditionally.
    
    Reviewed-by: Robert Bragg <robert linux intel com>
    
    (cherry picked from commit 59c30292d0f3c28d6e0e08bc5bf3b4b10545d856)

 cogl/driver/gl/cogl-framebuffer-gl.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/driver/gl/cogl-framebuffer-gl.c
index 64cfdf5..12eed43 100644
--- a/cogl/driver/gl/cogl-framebuffer-gl.c
+++ b/cogl/driver/gl/cogl-framebuffer-gl.c
@@ -98,6 +98,17 @@
 #define GL_PACK_INVERT_MESA 0x8758
 #endif
 
+#ifndef GL_COLOR
+#define GL_COLOR 0x1800
+#endif
+#ifndef GL_DEPTH
+#define GL_DEPTH 0x1801
+#endif
+#ifndef GL_STENCIL
+#define GL_STENCIL 0x1802
+#endif
+
+
 static void
 _cogl_framebuffer_gl_flush_viewport_state (CoglFramebuffer *framebuffer)
 {
@@ -996,7 +1007,6 @@ void
 _cogl_framebuffer_gl_discard_buffers (CoglFramebuffer *framebuffer,
                                       unsigned long buffers)
 {
-#ifdef GL_EXT_discard_framebuffer
   CoglContext *ctx = framebuffer->context;
 
   if (ctx->glDiscardFramebuffer)
@@ -1007,11 +1017,11 @@ _cogl_framebuffer_gl_discard_buffers (CoglFramebuffer *framebuffer,
       if (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN)
         {
           if (buffers & COGL_BUFFER_BIT_COLOR)
-            attachments[i++] = GL_COLOR_EXT;
+            attachments[i++] = GL_COLOR;
           if (buffers & COGL_BUFFER_BIT_DEPTH)
-            attachments[i++] = GL_DEPTH_EXT;
+            attachments[i++] = GL_DEPTH;
           if (buffers & COGL_BUFFER_BIT_STENCIL)
-            attachments[i++] = GL_STENCIL_EXT;
+            attachments[i++] = GL_STENCIL;
         }
       else
         {
@@ -1028,7 +1038,6 @@ _cogl_framebuffer_gl_discard_buffers (CoglFramebuffer *framebuffer,
                                      COGL_FRAMEBUFFER_STATE_BIND);
       GE (ctx, glDiscardFramebuffer (GL_FRAMEBUFFER, i, attachments));
     }
-#endif /* GL_EXT_discard_framebuffer */
 }
 
 void


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