summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaron Cohen-Tal <yaronct@gmail.com>2015-07-09 13:44:52 +0300
committerEric Anholt <eric@anholt.net>2015-07-15 14:07:06 -0700
commita7c270f8e2b8dcbf9874632e18a0948255de49d3 (patch)
tree339983c8fb6b9d5ffeb3eef0017208d1b19898ea
parent227d1312e6a7d5ec46d29ad4d13d434736e70f71 (diff)
downloadlibepoxy-a7c270f8e2b8dcbf9874632e18a0948255de49d3.tar.gz
Fix epoxy_egl_get_current_gl_context_api() on non-conformant ES.
According to the OpenGL ES standard, "glGetString(GL_VERSION)" should return a string starting with "OpenGL ES". However, PowerVR's OpenGL ES implementation (and perhaps others) don't comply with the standard here. If our context happend to be bound using EGL, then we can just ask EGL what kind of context it was, avoiding the glGetString() check.
-rw-r--r--src/dispatch_common.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/dispatch_common.c b/src/dispatch_common.c
index 483782c..df167d4 100644
--- a/src/dispatch_common.c
+++ b/src/dispatch_common.c
@@ -192,6 +192,8 @@ static struct api api = {
static bool library_initialized;
+static bool epoxy_current_context_is_glx(void);
+
#if PLATFORM_HAS_EGL
static EGLenum
epoxy_egl_get_current_gl_context_api(void);
@@ -269,6 +271,24 @@ epoxy_is_desktop_gl(void)
const char *es_prefix = "OpenGL ES";
const char *version;
+#if PLATFORM_HAS_EGL
+ /* PowerVR's OpenGL ES implementation (and perhaps other) don't
+ * comply with the standard, which states that
+ * "glGetString(GL_VERSION)" should return a string starting with
+ * "OpenGL ES". Therefore, to distinguish desktop OpenGL from
+ * OpenGL ES, we must also check the context type through EGL (we
+ * can do that as PowerVR is only usable through EGL).
+ */
+ if (!epoxy_current_context_is_glx()) {
+ switch (epoxy_egl_get_current_gl_context_api()) {
+ case EGL_OPENGL_API: return true;
+ case EGL_OPENGL_ES_API: return false;
+ case EGL_NONE:
+ default: break;
+ }
+ }
+#endif
+
if (api.begin_count)
return true;