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>
bb10
Bernd Weimer 2014-02-21 17:37:11 +01:00 committed by The Qt Project
parent 58b928aca8
commit e2d21a0483
2 changed files with 11 additions and 8 deletions

View File

@ -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;
}

View File

@ -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);