diff options
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qopenglcontext.cpp | 10 | ||||
-rw-r--r-- | src/gui/kernel/qplatformopenglcontext_qpa.h | 3 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 3549f647b5..6a9cb43028 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -164,6 +164,8 @@ bool QOpenGLContext::create() Q_D(QOpenGLContext); d->platformGLContext = QGuiApplicationPrivate::platformIntegration()->createPlatformOpenGLContext(this); d->platformGLContext->setContext(this); + if (!d->platformGLContext->isSharing()) + d->shareContext = 0; d->shareGroup = d->shareContext ? d->shareContext->shareGroup() : new QOpenGLContextGroup; d->shareGroup->d_func()->addContext(this); return d->platformGLContext; @@ -197,7 +199,7 @@ QOpenGLContext::~QOpenGLContext() bool QOpenGLContext::isValid() const { Q_D(const QOpenGLContext); - return d->platformGLContext != 0; + return d->platformGLContext && d->platformGLContext->isValid(); } /*! @@ -225,7 +227,7 @@ QOpenGLFunctions *QOpenGLContext::functions() const bool QOpenGLContext::makeCurrent(QSurface *surface) { Q_D(QOpenGLContext); - if (!d->platformGLContext) + if (!isValid()) return false; if (thread() != QThread::currentThread()) @@ -257,7 +259,7 @@ bool QOpenGLContext::makeCurrent(QSurface *surface) void QOpenGLContext::doneCurrent() { Q_D(QOpenGLContext); - if (!d->platformGLContext) + if (!isValid()) return; if (QOpenGLContext::currentContext() == this) @@ -282,7 +284,7 @@ QSurface *QOpenGLContext::surface() const void QOpenGLContext::swapBuffers(QSurface *surface) { Q_D(QOpenGLContext); - if (!d->platformGLContext) + if (!isValid()) return; if (!surface) { diff --git a/src/gui/kernel/qplatformopenglcontext_qpa.h b/src/gui/kernel/qplatformopenglcontext_qpa.h index fc1b404b91..1b3bfc9a34 100644 --- a/src/gui/kernel/qplatformopenglcontext_qpa.h +++ b/src/gui/kernel/qplatformopenglcontext_qpa.h @@ -68,6 +68,9 @@ public: virtual bool makeCurrent(QPlatformSurface *surface) = 0; virtual void doneCurrent() = 0; + virtual bool isSharing() const { return false; } + virtual bool isValid() const { return true; } + virtual QFunctionPointer getProcAddress(const QByteArray &procName) = 0; QOpenGLContext *context() const; |