diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2012-05-18 09:36:15 +0200 |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2012-05-18 15:57:33 +0200 |
commit | 581fcfcea081cdc80e09b09a13b336d7cf9d9ef6 (patch) | |
tree | 5334ba7845519d01cc0331f5b3374a6b814780ef /src/plugins | |
parent | 6816fb64eeefbafda994d7f5070c619637a62cec (diff) |
Fixed context sharing in wayland_egl backend.
Properly implement isSharing() and isValid().
Change-Id: I7ec9bd8a1e6d4af87a418568f1d5d18a9153eafc
Reviewed-by: Laszlo Agocs <laszlo.p.agocs@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp | 19 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.h | 4 |
2 files changed, 21 insertions, 2 deletions
diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp index 665944d43..143bcb7f5 100644 --- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp +++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp @@ -56,7 +56,7 @@ QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QSurfaceFormat , m_config(q_configFromGLFormat(m_eglDisplay, format, true)) , m_format(q_glFormatFromConfig(m_eglDisplay, m_config)) { - EGLContext shareEGLContext = share ? static_cast<QWaylandGLContext *>(share)->eglContext() : EGL_NO_CONTEXT; + m_shareEGLContext = share ? static_cast<QWaylandGLContext *>(share)->eglContext() : EGL_NO_CONTEXT; eglBindAPI(EGL_OPENGL_ES_API); @@ -65,7 +65,12 @@ QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QSurfaceFormat eglContextAttrs.append(format.majorVersion() == 1 ? 1 : 2); eglContextAttrs.append(EGL_NONE); - m_context = eglCreateContext(m_eglDisplay, m_config, shareEGLContext, eglContextAttrs.constData()); + m_context = eglCreateContext(m_eglDisplay, m_config, m_shareEGLContext, eglContextAttrs.constData()); + + if (m_context == EGL_NO_CONTEXT) { + m_context = eglCreateContext(m_eglDisplay, m_config, EGL_NO_CONTEXT, eglContextAttrs.constData()); + m_shareEGLContext = EGL_NO_CONTEXT; + } } QWaylandGLContext::~QWaylandGLContext() @@ -90,6 +95,16 @@ void QWaylandGLContext::swapBuffers(QPlatformSurface *surface) eglSwapBuffers(m_eglDisplay, eglSurface); } +bool QWaylandGLContext::isSharing() const +{ + return m_shareEGLContext != EGL_NO_CONTEXT; +} + +bool QWaylandGLContext::isValid() const +{ + return m_context != EGL_NO_CONTEXT; +} + void (*QWaylandGLContext::getProcAddress(const QByteArray &procName)) () { return eglGetProcAddress(procName.constData()); diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.h b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.h index 7dbba2509..56b862ec2 100644 --- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.h +++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.h @@ -61,6 +61,9 @@ public: bool makeCurrent(QPlatformSurface *surface); void doneCurrent(); + bool isSharing() const; + bool isValid() const; + void (*getProcAddress(const QByteArray &procName)) (); QSurfaceFormat format() const { return m_format; } @@ -72,6 +75,7 @@ private: EGLDisplay m_eglDisplay; EGLContext m_context; + EGLContext m_shareEGLContext; EGLConfig m_config; QSurfaceFormat m_format; }; |