diff options
Diffstat (limited to 'src/compositor/compositor_api')
-rw-r--r-- | src/compositor/compositor_api/qwaylandquickitem.cpp | 15 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandquickitem_p.h | 2 |
2 files changed, 13 insertions, 4 deletions
diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp index 95bf0f91..3064a20e 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.cpp +++ b/src/compositor/compositor_api/qwaylandquickitem.cpp @@ -253,6 +253,16 @@ void QWaylandBufferMaterial::ensureTextures(int count) m_textures << nullptr; } } + +void QWaylandBufferMaterial::setBufferRef(QWaylandQuickItem *surfaceItem, const QWaylandBufferRef &ref) +{ + Q_UNUSED(surfaceItem); + m_bufferRef = ref; + for (int plane = 0; plane < bufferTypes[ref.bufferFormatEgl()].planeCount; plane++) + if (auto texture = ref.toOpenGLTexture(plane)) + setTextureForPlane(plane, texture); + bind(); +} #endif // QT_CONFIG(opengl) QMutex *QWaylandQuickItemPrivate::mutex = nullptr; @@ -1411,10 +1421,7 @@ QSGNode *QWaylandQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat if (d->newTexture) { d->newTexture = false; - for (int plane = 0; plane < bufferTypes[ref.bufferFormatEgl()].planeCount; plane++) - if (auto texture = ref.toOpenGLTexture(plane)) - material->setTextureForPlane(plane, texture); - material->bind(); + material->setBufferRef(this, ref); } const QSize surfaceSize = ref.size() / surface()->bufferScale(); diff --git a/src/compositor/compositor_api/qwaylandquickitem_p.h b/src/compositor/compositor_api/qwaylandquickitem_p.h index 1c7ce55c..e8a4f0b6 100644 --- a/src/compositor/compositor_api/qwaylandquickitem_p.h +++ b/src/compositor/compositor_api/qwaylandquickitem_p.h @@ -80,6 +80,7 @@ public: ~QWaylandBufferMaterial() override; void setTextureForPlane(int plane, QOpenGLTexture *texture); + void setBufferRef(QWaylandQuickItem *surfaceItem, const QWaylandBufferRef &ref); void bind(); @@ -92,6 +93,7 @@ private: const QWaylandBufferRef::BufferFormatEgl m_format; QVarLengthArray<QOpenGLTexture*, 3> m_textures; + QWaylandBufferRef m_bufferRef; }; #endif // QT_CONFIG(opengl) |