From 7304b9486d95da4c4456821f816445157cdeb397 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 9 Nov 2009 12:58:48 +1000 Subject: Mark both the new and original EGL contexts as sharing If we succeed in creating a shared context, then mark the original as shared as well. Reviewed-by: Sarah Smith (cherry picked from commit 09a123c7f9df37f82a4baab0e7ec70ebfe5444d3) --- src/opengl/qgl_qws.cpp | 2 ++ src/opengl/qgl_wince.cpp | 2 ++ src/opengl/qgl_x11egl.cpp | 2 ++ tests/auto/qgl/tst_qgl.cpp | 1 + 4 files changed, 7 insertions(+) diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp index de9c6ae..a189c20 100644 --- a/src/opengl/qgl_qws.cpp +++ b/src/opengl/qgl_qws.cpp @@ -207,6 +207,8 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) return false; } d->sharing = d->eglContext->isSharing(); + if (d->sharing && shareContext) + const_cast(shareContext)->d_func()->sharing = true; #if defined(EGL_VERSION_1_1) if (d->glFormat.swapInterval() != -1 && devType == QInternal::Widget) diff --git a/src/opengl/qgl_wince.cpp b/src/opengl/qgl_wince.cpp index 86fe3ba..2553110 100644 --- a/src/opengl/qgl_wince.cpp +++ b/src/opengl/qgl_wince.cpp @@ -167,6 +167,8 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) return false; } d->sharing = d->eglContext->isSharing(); + if (d->sharing && shareContext) + const_cast(shareContext)->d_func()->sharing = true; #if defined(EGL_VERSION_1_1) if (d->glFormat.swapInterval() != -1 && devType == QInternal::Widget) diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index 5325451..b51c239 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -116,6 +116,8 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) return false; } d->sharing = d->eglContext->isSharing(); + if (d->sharing && shareContext) + const_cast(shareContext)->d_func()->sharing = true; #if defined(EGL_VERSION_1_1) if (d->glFormat.swapInterval() != -1 && devType == QInternal::Widget) diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index 3745230..c25c05c 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -1729,6 +1729,7 @@ void tst_QGL::shareRegister() delete glw1; QSKIP("Context sharing is not supported", SkipSingle); } + QVERIFY(glw1->isSharing()); QVERIFY(glw1->context() != glw2->context()); // Check that the first context's resource is also on the second. -- cgit v0.12