summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-12-06 12:55:41 +0100
committerQt by Nokia <qt-info@nokia.com>2011-12-07 11:15:28 +0100
commitbab5329437e6e80da7e9f30d6422ac53f4f33f6d (patch)
tree4003aab018d087c5c7862ba1c6f6e831bf0b4435 /src/platformsupport/eglconvenience/qeglplatformcontext.cpp
parent77fb1c71bf9bb576cfb3d7f5bf887325841ebd75 (diff)
Better handling of GLX / EGL errors.
If context creation fails, try again without a shared context. Added QPlatformOpenGLContext::isSharing() and QPlatformOpenGLContext::isValid() to propagate whether the platform context was successfully created with or without sharing. Change-Id: I37080b645f531fd207946441057be6d3f6be3f6e Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/platformsupport/eglconvenience/qeglplatformcontext.cpp')
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcontext.cpp11
1 files changed, 5 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());
}
}