diff mbox

[15/21] gl: Require the GL_OES_texture_npot extension for GLES2

Message ID 1311602208-5973-15-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 default support for GLES2 NPOT textures is very limited. We need the
additional features provided by the GL_OES_texture_npot extension.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 src/cairo-gl-device.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/src/cairo-gl-device.c b/src/cairo-gl-device.c
index fb0a7dd..3b60a54 100644
--- a/src/cairo-gl-device.c
+++ b/src/cairo-gl-device.c
@@ -167,12 +167,20 @@  _cairo_gl_context_init (cairo_gl_context_t *ctx)
 	return _cairo_error (CAIRO_STATUS_DEVICE_ERROR);
 
     /* Check for required extensions */
-    if (_cairo_gl_has_extension ("GL_ARB_texture_non_power_of_two"))
-	ctx->tex_target = GL_TEXTURE_2D;
-    else if (_cairo_gl_has_extension ("GL_ARB_texture_rectangle"))
-	ctx->tex_target = GL_TEXTURE_RECTANGLE;
-    else
-	return _cairo_error (CAIRO_STATUS_DEVICE_ERROR);
+    if (gl_flavor == CAIRO_GL_FLAVOR_DESKTOP) {
+	if (_cairo_gl_has_extension ("GL_ARB_texture_non_power_of_two"))
+	    ctx->tex_target = GL_TEXTURE_2D;
+	else if (_cairo_gl_has_extension ("GL_ARB_texture_rectangle"))
+	    ctx->tex_target = GL_TEXTURE_RECTANGLE;
+	else
+	    return _cairo_error (CAIRO_STATUS_DEVICE_ERROR);
+    }
+    else {
+	if (_cairo_gl_has_extension ("GL_OES_texture_npot"))
+	    ctx->tex_target = GL_TEXTURE_2D;
+	else
+	    return _cairo_error (CAIRO_STATUS_DEVICE_ERROR);
+    }
 
     if (gl_flavor == CAIRO_GL_FLAVOR_DESKTOP &&
 	gl_version < CAIRO_GL_VERSION_ENCODE (2, 1) &&