diff options
author | Bernd Weimer <bweimer@blackberry.com> | 2014-02-21 17:37:11 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-28 22:57:26 +0100 |
commit | e2d21a0483530d3d306a9f3505834b71f84236fb (patch) | |
tree | a989ed8dec033b23f1c417ca9486498eab266225 /src/plugins/platforms | |
parent | 58b928aca8029a4ebc63b0120a7afb93db4e8691 (diff) |
QNX: Report if GL context is shared
This fixes the tst_qopengl sharedResourceCleanup auto test
Change-Id: I0ac6f45797f656b637254f01c2cb8073436b45b2
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/qnx/qqnxglcontext.cpp | 17 | ||||
-rw-r--r-- | src/plugins/platforms/qnx/qqnxglcontext.h | 2 |
2 files changed, 11 insertions, 8 deletions
diff --git a/src/plugins/platforms/qnx/qqnxglcontext.cpp b/src/plugins/platforms/qnx/qqnxglcontext.cpp index 3a365be408..23db7f09f3 100644 --- a/src/plugins/platforms/qnx/qqnxglcontext.cpp +++ b/src/plugins/platforms/qnx/qqnxglcontext.cpp @@ -124,15 +124,11 @@ QQnxGLContext::QQnxGLContext(QOpenGLContext *glContext) if (m_eglConfig == 0) qFatal("QQnxGLContext: failed to find EGL config"); - EGLContext shareContext = EGL_NO_CONTEXT; - if (m_glContext) { - QQnxGLContext *qshareContext = dynamic_cast<QQnxGLContext*>(m_glContext->shareHandle()); - if (qshareContext) { - shareContext = qshareContext->m_eglContext; - } - } + QQnxGLContext *glShareContext = static_cast<QQnxGLContext*>(m_glContext->shareHandle()); + m_eglShareContext = glShareContext ? glShareContext->m_eglContext : EGL_NO_CONTEXT; - m_eglContext = eglCreateContext(ms_eglDisplay, m_eglConfig, shareContext, contextAttrs(format)); + m_eglContext = eglCreateContext(ms_eglDisplay, m_eglConfig, m_eglShareContext, + contextAttrs(format)); if (m_eglContext == EGL_NO_CONTEXT) { checkEGLError("eglCreateContext"); qFatal("QQnxGLContext: failed to create EGL context, err=%d", eglGetError()); @@ -271,6 +267,11 @@ QFunctionPointer QQnxGLContext::getProcAddress(const QByteArray &procName) return static_cast<QFunctionPointer>(eglGetProcAddress(procName.constData())); } +bool QQnxGLContext::isSharing() const +{ + return m_eglShareContext != EGL_NO_CONTEXT; +} + EGLDisplay QQnxGLContext::getEglDisplay() { return ms_eglDisplay; } diff --git a/src/plugins/platforms/qnx/qqnxglcontext.h b/src/plugins/platforms/qnx/qqnxglcontext.h index af89586bd5..d12de7342b 100644 --- a/src/plugins/platforms/qnx/qqnxglcontext.h +++ b/src/plugins/platforms/qnx/qqnxglcontext.h @@ -72,6 +72,7 @@ public: QFunctionPointer getProcAddress(const QByteArray &procName); virtual QSurfaceFormat format() const { return m_windowFormat; } + bool isSharing() const; static EGLDisplay getEglDisplay(); EGLConfig getEglConfig() const { return m_eglConfig;} @@ -86,6 +87,7 @@ private: EGLConfig m_eglConfig; EGLContext m_eglContext; + EGLContext m_eglShareContext; EGLSurface m_currentEglSurface; static EGLint *contextAttrs(const QSurfaceFormat &format); |