aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-03-28 15:36:55 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-04 13:49:51 +0200
commit82e4ee03918a8abef4479ae67f259bfae4e6b79c (patch)
treec77602160612f0affc7090ac0da30b119255dafd
parent841e81c7bd184969ae93c30b6f5730b78b54211a (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>
-rw-r--r--src/quick/items/qquickwindow.cpp2
-rw-r--r--src/quick/scenegraph/qsgcontext.cpp18
-rw-r--r--src/quick/scenegraph/qsgcontext_p.h3
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp4
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp4
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop.cpp4
-rw-r--r--src/quickwidgets/qquickwidget.cpp4
-rw-r--r--tools/qmlscene/main.cpp4
8 files changed, 11 insertions, 32 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();
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index ddb2124542..e71da7e7ec 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -586,8 +586,8 @@ void QQuickWidgetPrivate::createContext()
context = new QOpenGLContext;
context->setFormat(offscreenWindow->requestedFormat());
- if (QSGContext::sharedOpenGLContext())
- context->setShareContext(QSGContext::sharedOpenGLContext()); // ??? is this correct
+ if (QOpenGLContextPrivate::globalShareContext())
+ context->setShareContext(QOpenGLContextPrivate::globalShareContext());
if (!context->create()) {
const bool isEs = context->isES();
delete context;
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp
index f128e399b5..7512b5482f 100644
--- a/tools/qmlscene/main.cpp
+++ b/tools/qmlscene/main.cpp
@@ -58,7 +58,7 @@
#include <QtQuick/qquickview.h>
#include <private/qabstractanimation_p.h>
-#include <private/qsgcontext_p.h>
+#include <private/qopenglcontext_p.h>
#ifdef QT_WIDGETS_LIB
#include <QtWidgets/QApplication>
@@ -460,7 +460,7 @@ int main(int argc, char ** argv)
if (options.contextSharing) {
shareContext.reset(new QOpenGLContext);
shareContext->create();
- QSGContext::setSharedOpenGLContext(shareContext.data());
+ QOpenGLContextPrivate::setGlobalShareContext(shareContext.data());
}
int exitCode = 0;