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)
This commit is contained in:
Neil Roberts 2013-02-11 17:03:09 +00:00
parent 7d9e075917
commit f79e78f648

View File

@ -98,6 +98,17 @@
#define GL_PACK_INVERT_MESA 0x8758 #define GL_PACK_INVERT_MESA 0x8758
#endif #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 static void
_cogl_framebuffer_gl_flush_viewport_state (CoglFramebuffer *framebuffer) _cogl_framebuffer_gl_flush_viewport_state (CoglFramebuffer *framebuffer)
{ {
@ -996,7 +1007,6 @@ void
_cogl_framebuffer_gl_discard_buffers (CoglFramebuffer *framebuffer, _cogl_framebuffer_gl_discard_buffers (CoglFramebuffer *framebuffer,
unsigned long buffers) unsigned long buffers)
{ {
#ifdef GL_EXT_discard_framebuffer
CoglContext *ctx = framebuffer->context; CoglContext *ctx = framebuffer->context;
if (ctx->glDiscardFramebuffer) if (ctx->glDiscardFramebuffer)
@ -1007,11 +1017,11 @@ _cogl_framebuffer_gl_discard_buffers (CoglFramebuffer *framebuffer,
if (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN) if (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN)
{ {
if (buffers & COGL_BUFFER_BIT_COLOR) if (buffers & COGL_BUFFER_BIT_COLOR)
attachments[i++] = GL_COLOR_EXT; attachments[i++] = GL_COLOR;
if (buffers & COGL_BUFFER_BIT_DEPTH) if (buffers & COGL_BUFFER_BIT_DEPTH)
attachments[i++] = GL_DEPTH_EXT; attachments[i++] = GL_DEPTH;
if (buffers & COGL_BUFFER_BIT_STENCIL) if (buffers & COGL_BUFFER_BIT_STENCIL)
attachments[i++] = GL_STENCIL_EXT; attachments[i++] = GL_STENCIL;
} }
else else
{ {
@ -1028,7 +1038,6 @@ _cogl_framebuffer_gl_discard_buffers (CoglFramebuffer *framebuffer,
COGL_FRAMEBUFFER_STATE_BIND); COGL_FRAMEBUFFER_STATE_BIND);
GE (ctx, glDiscardFramebuffer (GL_FRAMEBUFFER, i, attachments)); GE (ctx, glDiscardFramebuffer (GL_FRAMEBUFFER, i, attachments));
} }
#endif /* GL_EXT_discard_framebuffer */
} }
void void