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>
This commit is contained in:
parent
c615dcc441
commit
812e23cea2
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user