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.
macos/v1.5.9
Yaron Cohen-Tal 10 years ago committed by Eric Anholt
parent 227d1312e6
commit a7c270f8e2
  1. 20
      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;

Loading…
Cancel
Save