summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/eglconvenience
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@jollamobile.com>2013-08-01 13:37:21 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-05 05:52:53 +0200
commit812e23cea2d746641a57c697c2494e8db96fca34 (patch)
tree4377d57919a6c31224a234d171a2a4b63d7ae114 /src/platformsupport/eglconvenience
parentc615dcc44168d8e8e1e2134d69c3bd9607c603ea (diff)
Bypass eglMakeCurrent where possible.
This has the possibility to be very slow on some GPUs. A nicer alternative would have been to fix this in QOpenGLContext, but with makeCurrent and updateContext having been merged in Qt 5, makeCurrent is required every frame call, and thus cannot be fixed there. Change-Id: Ib17dbb3a1e4e89c60dfd4f12a55eeff353f9075f Done-with: Carsten Munk <carsten.munk@jollamobile.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/platformsupport/eglconvenience')
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcontext.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
index 8152f74067..34ba21afdc 100644
--- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
+++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
@@ -106,6 +106,14 @@ bool QEGLPlatformContext::makeCurrent(QPlatformSurface *surface)
EGLSurface eglSurface = eglSurfaceForPlatformSurface(surface);
+ // shortcut: on some GPUs, eglMakeCurrent is not a cheap operation
+ if (eglGetCurrentContext() == m_eglContext &&
+ eglGetCurrentDisplay() == m_eglDisplay &&
+ eglGetCurrentSurface(EGL_READ) == eglSurface &&
+ eglGetCurrentSurface(EGL_DRAW) == eglSurface) {
+ return true;
+ }
+
bool ok = eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_eglContext);
if (!ok)
qWarning("QEGLPlatformContext::makeCurrent: eglError: %x, this: %p \n", eglGetError(), this);