summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qopenglcontext.cpp
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-09-04 15:54:18 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-09-09 11:10:38 +0000
commit8b3a6cfbfb21a71b8efc2e3a91006712238db6fe (patch)
treebfe101293c06470b6a5ad65d9712b975001d40ec /src/gui/kernel/qopenglcontext.cpp
parent1205f4a2292b9b63d714baeaa17cbf5ff5d8093b (diff)
Update QOpenGLContext::currentContext after QPlatformOpenGLContext::makeCurrent
Instead of doing it up front and then restoring the current context if the makeCurrent call failed. By delaying the update, QPlatformOpenGLContext::makeCurrent has the option to check which context was current before the call. Change-Id: I458f5c00d7c820acbe2f8552b0513fce99b9b683 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/kernel/qopenglcontext.cpp')
-rw-r--r--src/gui/kernel/qopenglcontext.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index d64d31a9e8..c5d5490ea0 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -984,11 +984,15 @@ bool QOpenGLContext::makeCurrent(QSurface *surface)
#endif
}
- QOpenGLContext *previous = QOpenGLContextPrivate::setCurrentContext(this);
- if (!d->platformGLContext->makeCurrent(surface->surfaceHandle())) {
- QOpenGLContextPrivate::setCurrentContext(previous);
+ if (!d->platformGLContext->makeCurrent(surface->surfaceHandle()))
return false;
- }
+
+ QOpenGLContextPrivate::setCurrentContext(this);
+#ifndef QT_NO_DEBUG
+ QOpenGLContextPrivate::toggleMakeCurrentTracker(this, true);
+#endif
+
+ d->surface = surface;
static bool needsWorkaroundSet = false;
static bool needsWorkaround = false;
@@ -1030,14 +1034,8 @@ bool QOpenGLContext::makeCurrent(QSurface *surface)
if (needsWorkaround)
d->workaround_brokenFBOReadBack = true;
- d->surface = surface;
-
d->shareGroup->d_func()->deletePendingResources(this);
-#ifndef QT_NO_DEBUG
- QOpenGLContextPrivate::toggleMakeCurrentTracker(this, true);
-#endif
-
return true;
}