diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-03-28 15:38:34 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-02 10:06:00 +0200 |
commit | f7971d37cbc7e2f25d0fac382f33f3c270c10598 (patch) | |
tree | 4bd669d621cbc3ba0d1ccd2b352bcddc2c458746 /src/gui | |
parent | 7672f25f44357e854575cd04f9e9969ec2831dfa (diff) |
Add a way to share context between QtQuick and QtWidgets
This will replace QSGContext::setSharedOpenGLContext.
To be able to allow sharing the Chromium GL context with both
QWebEngineView and QQuickWebEngineView, we need some way of setting
the sharing within QtWidgets and QtQuick. Since they don't depend
on one another this patch allows the sharing context to be set
through QtGui.
Change-Id: I91b365dd06ec925b4c5a99ac82c222778781fe8e
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qopenglcontext.cpp | 20 | ||||
-rw-r--r-- | src/gui/kernel/qopenglcontext_p.h | 3 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index e258218e85..55fe036fe0 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -230,6 +230,7 @@ public: }; static QThreadStorage<QGuiGLThreadContext *> qwindow_context_storage; +static QOpenGLContext *global_share_context = 0; #ifndef QT_NO_DEBUG QHash<QOpenGLContext *, bool> QOpenGLContextPrivate::makeCurrentTracker; @@ -330,6 +331,25 @@ QOpenGLContext *QOpenGLContextPrivate::setCurrentContext(QOpenGLContext *context return previous; } +/*! + \internal + + 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 QOpenGLContextPrivate::setGlobalShareContext(QOpenGLContext *context) +{ + global_share_context = context; +} + +/*! + \internal +*/ +QOpenGLContext *QOpenGLContextPrivate::globalShareContext() +{ + return global_share_context; +} + int QOpenGLContextPrivate::maxTextureSize() { if (max_texture_size != -1) diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h index 23c13b2e24..b21ff67068 100644 --- a/src/gui/kernel/qopenglcontext_p.h +++ b/src/gui/kernel/qopenglcontext_p.h @@ -244,6 +244,9 @@ public: static QOpenGLContext *setCurrentContext(QOpenGLContext *context); + static void setGlobalShareContext(QOpenGLContext *context); + static QOpenGLContext *globalShareContext(); + int maxTextureSize(); static QOpenGLContextPrivate *get(QOpenGLContext *context) |