diff options
author | Jaeyoon Jung <jaeyoon.jung@lge.com> | 2021-02-10 09:32:05 +0900 |
---|---|---|
committer | Jaeyoon Jung <jaeyoon.jung@lge.com> | 2021-02-10 18:12:12 +0900 |
commit | eefb755dd6e241ede1e10ab91e8ba5bb891e67f4 (patch) | |
tree | ff35fa53e4ad6a0510d2b153e385e3185da691ff /src | |
parent | 4bfd45db0f9a53f53c989a4f34ed25ca075cbd3c (diff) |
Create a new node when switched from the different node types
In QWaylandQuickItem::updatePaintNode there are two different QSGNode
types used as per the buffer type and format. When it changes, oldNode
should be destroyed so that a new QSGNode can be created.
Change-Id: I3240e17838b3878c7d7d3a6fd6eb580a77274346
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/compositor/compositor_api/qwaylandquickitem.cpp | 15 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandquickitem_p.h | 3 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp index cf0994ba7..52338e1ca 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.cpp +++ b/src/compositor/compositor_api/qwaylandquickitem.cpp @@ -1341,6 +1341,14 @@ QSGNode *QWaylandQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat || bufferTypes[ref.bufferFormatEgl()].canProvideTexture #endif ) { +#if QT_CONFIG(opengl) + if (oldNode && !d->paintByProvider) { + // Need to re-create a node + delete oldNode; + oldNode = nullptr; + } + d->paintByProvider = true; +#endif // This case could covered by the more general path below, but this is more efficient (especially when using ShaderEffect items). QSGSimpleTextureNode *node = static_cast<QSGSimpleTextureNode *>(oldNode); @@ -1371,6 +1379,13 @@ QSGNode *QWaylandQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat #if QT_CONFIG(opengl) Q_ASSERT(!d->provider); + if (oldNode && d->paintByProvider) { + // Need to re-create a node + delete oldNode; + oldNode = nullptr; + } + d->paintByProvider = false; + QSGGeometryNode *node = static_cast<QSGGeometryNode *>(oldNode); if (!node) { diff --git a/src/compositor/compositor_api/qwaylandquickitem_p.h b/src/compositor/compositor_api/qwaylandquickitem_p.h index 4ee3ca056..216b1c5ec 100644 --- a/src/compositor/compositor_api/qwaylandquickitem_p.h +++ b/src/compositor/compositor_api/qwaylandquickitem_p.h @@ -162,6 +162,9 @@ public: bool newTexture = false; bool focusOnClick = true; bool belowParent = false; +#if QT_CONFIG(opengl) + bool paintByProvider = false; +#endif QPointF hoverPos; QMatrix4x4 lastMatrix; |