diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-10-03 19:24:50 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-10-05 12:34:23 +0000 |
commit | 8e70241dccaf5a9e5c79c8d6da5665b881c5914d (patch) | |
tree | 99d69b1a932b76f476df48418b39f171d3348012 /src/platformsupport | |
parent | aeee3be166aff737990fe2cade05bff7b39dfebc (diff) |
Let QPlatformBackingStore handle its own QOpenGLContext
The resources allocated by QPlatformBackingStore are owned by the class,
and should be allocated in a context the class also owns. This removes
the asymmetry of having to pass in a context to composeAndFlush, while
having to make the same context current before destroying the platform
backingstore.
The context owned by QPlatformBackingStore is shared with the associated
window though a new QWindowPrivate::shareContext() API.
The result is that on e.g. iOS, the backingstore does not need to tie
the resource allocation of QPlatformBackingStore to the global share
context, but can instead tie them to the per-window context, and hence
clean them up after each window is closed.
Task-number: QTBUG-56653
Change-Id: Ic1bcae50dafeeafaa8d16a7febd83b840ec6367a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/platformsupport')
-rw-r--r-- | src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp | 5 | ||||
-rw-r--r-- | src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp index b24491b187..e938020437 100644 --- a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp +++ b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp @@ -202,14 +202,13 @@ void QOpenGLCompositorBackingStore::flush(QWindow *window, const QRegion ®ion } void QOpenGLCompositorBackingStore::composeAndFlush(QWindow *window, const QRegion ®ion, const QPoint &offset, - QPlatformTextureList *textures, QOpenGLContext *context, + QPlatformTextureList *textures, bool translucentBackground) { // QOpenGLWidget/QQuickWidget content provided as textures. The raster content goes on top. Q_UNUSED(region); Q_UNUSED(offset); - Q_UNUSED(context); Q_UNUSED(translucentBackground); QOpenGLCompositor *compositor = QOpenGLCompositor::instance(); @@ -218,7 +217,7 @@ void QOpenGLCompositorBackingStore::composeAndFlush(QWindow *window, const QRegi // The compositor's context and the context to which QOpenGLWidget/QQuickWidget // textures belong are not the same. They share resources, though. - Q_ASSERT(context->shareGroup() == dstCtx->shareGroup()); + Q_ASSERT(qt_window_private(window)->shareContext()->shareGroup() == dstCtx->shareGroup()); QWindow *dstWin = compositor->targetWindow(); if (!dstWin) diff --git a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h index 0b025e4304..da68b90e92 100644 --- a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h +++ b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h @@ -75,7 +75,7 @@ public: QImage toImage() const Q_DECL_OVERRIDE; void composeAndFlush(QWindow *window, const QRegion ®ion, const QPoint &offset, - QPlatformTextureList *textures, QOpenGLContext *context, + QPlatformTextureList *textures, bool translucentBackground) Q_DECL_OVERRIDE; const QPlatformTextureList *textures() const { return m_textures; } |