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>
This commit is contained in:
Jocelyn Turcotte 2014-03-28 15:38:34 +01:00 committed by The Qt Project
parent 7672f25f44
commit f7971d37cb
2 changed files with 23 additions and 0 deletions

View File

@ -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)

View File

@ -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)