diff mbox

[17/21] gl: Fix build issues for GLES2

Message ID 1311602208-5973-17-git-send-email-alexandros.frantzis@linaro.org
State Accepted
Headers show

Commit Message

alexandros.frantzis@linaro.org July 25, 2011, 1:56 p.m. UTC
From: Alexandros Frantzis <alexandros.frantzis@linaro.org>

The glReadBuffer/glDrawBuffer functions are not present in GLES2, only
a single buffer is supported.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 src/cairo-gl-device.c           |    4 ++++
 src/cairo-gl-ext-def-private.h  |    4 ++++
 src/cairo-gl-gradient-private.h |    5 +++++
 src/cairo-gl-private.h          |    6 ++++++
 src/cairo-gl.h                  |    2 +-
 5 files changed, 20 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/src/cairo-gl-device.c b/src/cairo-gl-device.c
index 3b60a54..c94e36f 100644
--- a/src/cairo-gl-device.c
+++ b/src/cairo-gl-device.c
@@ -261,8 +261,10 @@  _cairo_gl_ensure_framebuffer (cairo_gl_context_t *ctx,
 				    ctx->tex_target,
 				    surface->tex,
 				    0);
+#if CAIRO_HAS_GL_SURFACE
     glDrawBuffer (GL_COLOR_ATTACHMENT0);
     glReadBuffer (GL_COLOR_ATTACHMENT0);
+#endif
 
     status = dispatch->CheckFramebufferStatus (GL_FRAMEBUFFER);
     if (status != GL_FRAMEBUFFER_COMPLETE) {
@@ -342,8 +344,10 @@  _cairo_gl_context_set_destination (cairo_gl_context_t *ctx,
     } else {
         ctx->make_current (ctx, surface);
         ctx->dispatch.BindFramebuffer (GL_FRAMEBUFFER, 0);
+#if CAIRO_HAS_GL_SURFACE
         glDrawBuffer (GL_BACK_LEFT);
         glReadBuffer (GL_BACK_LEFT);
+#endif
     }
 
     glViewport (0, 0, surface->width, surface->height);
diff --git a/src/cairo-gl-ext-def-private.h b/src/cairo-gl-ext-def-private.h
index 97e42c1..a261947 100644
--- a/src/cairo-gl-ext-def-private.h
+++ b/src/cairo-gl-ext-def-private.h
@@ -136,4 +136,8 @@ 
 #define GL_UNPACK_ROW_LENGTH 0x0CF2
 #endif
 
+#ifndef GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
+#endif
+
 #endif /* CAIRO_GL_EXT_DEF_PRIVATE_H */
diff --git a/src/cairo-gl-gradient-private.h b/src/cairo-gl-gradient-private.h
index 9e34847..3d7b047 100644
--- a/src/cairo-gl-gradient-private.h
+++ b/src/cairo-gl-gradient-private.h
@@ -50,8 +50,13 @@ 
 
 #include "cairo-gl.h"
 
+#if CAIRO_HAS_GL_SURFACE
 #include <GL/gl.h>
 #include <GL/glext.h>
+#elif CAIRO_HAS_GLESV2_SURFACE
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#endif
 
 #define CAIRO_GL_GRADIENT_CACHE_SIZE 4096
 
diff --git a/src/cairo-gl-private.h b/src/cairo-gl-private.h
index 433a40b..3f3153e 100644
--- a/src/cairo-gl-private.h
+++ b/src/cairo-gl-private.h
@@ -58,8 +58,14 @@ 
 
 #include "cairo-gl.h"
 
+#if CAIRO_HAS_GL_SURFACE
 #include <GL/gl.h>
 #include <GL/glext.h>
+#elif CAIRO_HAS_GLESV2_SURFACE
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#endif
+
 #include "cairo-gl-ext-def-private.h"
 
 #define DEBUG_GL 0
diff --git a/src/cairo-gl.h b/src/cairo-gl.h
index d23cea7..d23b8a5 100644
--- a/src/cairo-gl.h
+++ b/src/cairo-gl.h
@@ -62,7 +62,7 @@ 
 
 #include "cairo.h"
 
-#if CAIRO_HAS_GL_SURFACE
+#if CAIRO_HAS_GL_SURFACE || CAIRO_HAS_GLESV2_SURFACE
 
 CAIRO_BEGIN_DECLS