diff options
author | Paul Olav Tvete <paul.tvete@theqtcompany.com> | 2015-11-17 10:24:12 +0100 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@theqtcompany.com> | 2015-11-27 11:16:04 +0000 |
commit | f0670e5b5da985804f1b50a8f69d6612b150ee87 (patch) | |
tree | 82f2b23b90e9765db3840c86c48f1bd0edb998e8 /src | |
parent | a3cde0b1ac8f825bedd15e5426af72ae0527ae0c (diff) |
Create proper offscreen surface the first time
Make sure the context is correct the first time we create the
offscreenSurface, so we don't have to destroy it immediately
afterwards and create a new one. This causes problems with
some (probably buggy) drivers.
Task-number: QTBUG-48440
Change-Id: I4790e1b02738fc84aca201430548934d8054e2b2
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/quickwidgets/qquickwidget.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index cc7ece9c5b..1703ba1199 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -705,6 +705,7 @@ void QQuickWidgetPrivate::handleContextCreationFailure(const QSurfaceFormat &for void QQuickWidgetPrivate::createContext() { + Q_Q(QQuickWidget); // On hide-show we invalidate() but our context is kept. // We nonetheless need to initialize() again. const bool reinit = context && !offscreenWindow->openglContext(); @@ -716,10 +717,11 @@ void QQuickWidgetPrivate::createContext() context = new QOpenGLContext; context->setFormat(offscreenWindow->requestedFormat()); - if (qt_gl_global_share_context()) { + if (qt_gl_global_share_context()) context->setShareContext(qt_gl_global_share_context()); - context->setScreen(context->shareContext()->screen()); - } + else + context->setShareContext(QWidgetPrivate::get(q->window())->shareContext()); + context->setScreen(context->shareContext()->screen()); if (!context->create()) { const bool isEs = context->isOpenGLES(); |