diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-03-28 15:36:55 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-04 13:49:51 +0200 |
commit | 82e4ee03918a8abef4479ae67f259bfae4e6b79c (patch) | |
tree | c77602160612f0affc7090ac0da30b119255dafd /src/quick | |
parent | 841e81c7bd184969ae93c30b6f5730b78b54211a (diff) |
Use global context sharing from QtGui instead of QSGContext
This removes QSGContext::sharedOpenGLContext and replace its uses
with QOpenGLContextPrivate::globalShareContext, which is also going
to be used by QOpenGLWidget and QQuickWidget.
Change-Id: I1e296c3e6832f717caaf31ba7d7b27c06249219b
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgcontext.cpp | 18 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgcontext_p.h | 3 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgrenderloop.cpp | 4 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop.cpp | 4 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgwindowsrenderloop.cpp | 4 |
6 files changed, 7 insertions, 28 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 6e825a89db..4592be3af8 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -2977,7 +2977,7 @@ QImage QQuickWindow::grabWindow() QOpenGLContext context; context.setFormat(requestedFormat()); - context.setShareContext(QSGContext::sharedOpenGLContext()); + context.setShareContext(QOpenGLContextPrivate::globalShareContext()); context.create(); context.makeCurrent(this); d->context->initialize(&context); diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index 835eeb1c36..2d2b643e37 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -113,12 +113,8 @@ public: bool distanceFieldDisabled; QSGDistanceFieldGlyphNode::AntialiasingMode distanceFieldAntialiasing; bool distanceFieldAntialiasingDecided; - - static QOpenGLContext *sharedOpenGLContext; }; -QOpenGLContext *QSGContextPrivate::sharedOpenGLContext = 0; - class QSGTextureCleanupEvent : public QEvent { public: @@ -177,20 +173,6 @@ QSGRenderContext *QSGContext::createRenderContext() return new QSGRenderContext(this); } -/*! - * This function is used by the Qt WebEngine to set up context sharing - * across multiple windows. Do not use it for any other purpose. - */ -void QSGContext::setSharedOpenGLContext(QOpenGLContext *context) -{ - QSGContextPrivate::sharedOpenGLContext = context; -} - -QOpenGLContext *QSGContext::sharedOpenGLContext() -{ - return QSGContextPrivate::sharedOpenGLContext; -} - void QSGContext::renderContextInitialized(QSGRenderContext *renderContext) { Q_D(QSGContext); diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h index 2ab78ce289..ac372b9718 100644 --- a/src/quick/scenegraph/qsgcontext_p.h +++ b/src/quick/scenegraph/qsgcontext_p.h @@ -168,9 +168,6 @@ public: virtual QSize minimumFBOSize() const; virtual QSurfaceFormat defaultSurfaceFormat() const; - static void setSharedOpenGLContext(QOpenGLContext *context); - static QOpenGLContext *sharedOpenGLContext(); - void setDistanceFieldEnabled(bool enabled); bool isDistanceFieldEnabled() const; diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index 2ef84980a3..808bf07cfc 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -329,8 +329,8 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window) if (!gl) { gl = new QOpenGLContext(); gl->setFormat(window->requestedFormat()); - if (QSGContext::sharedOpenGLContext()) - gl->setShareContext(QSGContext::sharedOpenGLContext()); + if (QOpenGLContextPrivate::globalShareContext()) + gl->setShareContext(QOpenGLContextPrivate::globalShareContext()); if (!gl->create()) { const bool isEs = gl->isES(); delete gl; diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index 9edca87d70..3ded6b8ca2 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -950,8 +950,8 @@ void QSGThreadedRenderLoop::handleExposure(Window *w) if (!w->thread->gl) { w->thread->gl = new QOpenGLContext(); - if (QSGContext::sharedOpenGLContext()) - w->thread->gl->setShareContext(QSGContext::sharedOpenGLContext()); + if (QOpenGLContextPrivate::globalShareContext()) + w->thread->gl->setShareContext(QOpenGLContextPrivate::globalShareContext()); w->thread->gl->setFormat(w->window->requestedFormat()); if (!w->thread->gl->create()) { const bool isEs = w->thread->gl->isES(); diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp index 9605eb8acc..531f7c7551 100644 --- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp +++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp @@ -179,8 +179,8 @@ void QSGWindowsRenderLoop::show(QQuickWindow *window) RLDEBUG(" - creating GL context"); m_gl = new QOpenGLContext(); m_gl->setFormat(window->requestedFormat()); - if (QSGContext::sharedOpenGLContext()) - m_gl->setShareContext(QSGContext::sharedOpenGLContext()); + if (QOpenGLContextPrivate::globalShareContext()) + m_gl->setShareContext(QOpenGLContextPrivate::globalShareContext()); bool created = m_gl->create(); if (!created) { const bool isEs = m_gl->isES(); |