diff options
| author | Tor Arne Vestbø <[email protected]> | 2018-09-04 15:54:18 +0200 | 
|---|---|---|
| committer | Tor Arne Vestbø <[email protected]> | 2018-09-09 11:10:38 +0000 | 
| commit | 8b3a6cfbfb21a71b8efc2e3a91006712238db6fe (patch) | |
| tree | bfe101293c06470b6a5ad65d9712b975001d40ec | |
| parent | 1205f4a2292b9b63d714baeaa17cbf5ff5d8093b (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 <[email protected]>
Reviewed-by: Laszlo Agocs <[email protected]>
| -rw-r--r-- | src/gui/kernel/qopenglcontext.cpp | 18 | 
1 files changed, 8 insertions, 10 deletions
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index d64d31a9e84..c5d5490ea0f 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;  }  | 
