diff options
-rw-r--r-- | src/opengl/qgl.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 161e099..ca16cca 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -95,9 +95,9 @@ #ifdef Q_OS_SYMBIAN #include <private/qgltexturepool_p.h> +#include <private/qeglcontext_p.h> #endif - QT_BEGIN_NAMESPACE #if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) @@ -3426,8 +3426,25 @@ void QGLContext::setInitialized(bool on) const QGLContext* QGLContext::currentContext() { QGLThreadContext *threadContext = qgl_context_storage.localData(); - if (threadContext) + if (threadContext) { +#ifdef Q_OS_SYMBIAN + // Query the current context and return null if it is different. + // This is needed to support mixed VG-GL rendering. + // QtOpenVG is free to make a QEglContext current at any time and + // QGLContext gets no notification that its underlying QEglContext is + // not current anymore. We query directly from EGL to be thread-safe. + // QEglContext does not store all the contexts per-thread. + if (threadContext->context) { + QEglContext *eglcontext = threadContext->context->d_func()->eglContext; + if (eglcontext) { + EGLContext ctx = eglcontext->context(); + if (ctx != eglGetCurrentContext()) + return 0; + } + } +#endif return threadContext->context; + } return 0; } |