summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-11-25 04:04:28 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-11-25 04:04:28 (GMT)
commit410ed81027232e669bf6a28699fa833e56a27ef7 (patch)
tree1b457ae77fa23fa50dbdc3d3e4bb73732532a36e
parent346887e731df4143699ce0c2310ded4fec849d30 (diff)
downloadQt-410ed81027232e669bf6a28699fa833e56a27ef7.zip
Qt-410ed81027232e669bf6a28699fa833e56a27ef7.tar.gz
Qt-410ed81027232e669bf6a28699fa833e56a27ef7.tar.bz2
Bind the EGL API type before calling eglMakeCurrent()
When mixing GL and VG in the same thread, some devices require that eglBindAPI() be called before eglMakeCurrent() when switching between context types. The EGL spec indicates that this shouldn't be required unless the context parameter is EGL_NO_CONTEXT, but it isn't a big deal to work around slightly non-compliant devices. Reviewed-by: Tom Cooksey
-rw-r--r--src/gui/egl/qegl.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index c0e4890..cf28dc4 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -236,6 +236,18 @@ bool QEglContext::makeCurrent(EGLSurface surface)
currentSurface = surface;
setCurrentContext(apiType, this);
+ // Force the right API to be bound before making the context current.
+ // The EGL implementation should be able to figure this out from ctx,
+ // but some systems require the API to be explicitly set anyway.
+#ifdef EGL_OPENGL_ES_API
+ if (apiType == QEgl::OpenGL)
+ eglBindAPI(EGL_OPENGL_ES_API);
+#endif
+#ifdef EGL_OPENVG_API
+ if (apiType == QEgl::OpenVG)
+ eglBindAPI(EGL_OPENVG_API);
+#endif
+
bool ok = eglMakeCurrent(dpy, surface, surface, ctx);
if (!ok)
qWarning() << "QEglContext::makeCurrent():" << errorString(eglGetError());