summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcontext.cpp11
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcontext_p.h3
2 files changed, 8 insertions, 6 deletions
diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
index dfa0bacd35..1f1f215494 100644
--- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
+++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
@@ -56,7 +56,7 @@ QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatform
EGLConfig config = q_configFromGLFormat(display, format, true);
m_format = q_glFormatFromConfig(display, config);
- EGLContext shareContext = share ? static_cast<QEGLPlatformContext *>(share)->m_eglContext : 0;
+ m_shareContext = share ? static_cast<QEGLPlatformContext *>(share)->m_eglContext : 0;
QVector<EGLint> contextAttrs;
contextAttrs.append(EGL_CONTEXT_CLIENT_VERSION);
@@ -64,11 +64,10 @@ QEGLPlatformContext::QEGLPlatformContext(const QSurfaceFormat &format, QPlatform
contextAttrs.append(EGL_NONE);
eglBindAPI(m_eglApi);
- m_eglContext = eglCreateContext(m_eglDisplay, config, shareContext, contextAttrs.constData());
- if (m_eglContext == EGL_NO_CONTEXT) {
- qWarning("Could not create the egl context\n");
- eglTerminate(m_eglDisplay);
- qFatal("EGL error");
+ m_eglContext = eglCreateContext(m_eglDisplay, config, m_shareContext, contextAttrs.constData());
+ if (m_eglContext == EGL_NO_CONTEXT && m_shareContext != EGL_NO_CONTEXT) {
+ m_shareContext = 0;
+ m_eglContext = eglCreateContext(m_eglDisplay, config, 0, contextAttrs.constData());
}
}
diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
index c38af1dfda..7002c8b9c2 100644
--- a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
+++ b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
@@ -59,6 +59,8 @@ public:
void (*getProcAddress(const QByteArray &procName)) ();
QSurfaceFormat format() const;
+ bool isSharing() const { return m_shareContext != EGL_NO_CONTEXT; }
+ bool isValid() const { return m_eglContext != EGL_NO_CONTEXT; }
EGLContext eglContext() const;
@@ -67,6 +69,7 @@ protected:
private:
EGLContext m_eglContext;
+ EGLContext m_shareContext;
EGLDisplay m_eglDisplay;
EGLenum m_eglApi;