summaryrefslogtreecommitdiffstats
path: root/src/compositor/compositor_api/qwaylandquickitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compositor/compositor_api/qwaylandquickitem.cpp')
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.cpp76
1 files changed, 45 insertions, 31 deletions
diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp
index 7b0d5c5d5..996177be4 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.cpp
+++ b/src/compositor/compositor_api/qwaylandquickitem.cpp
@@ -73,6 +73,7 @@
QT_BEGIN_NAMESPACE
+#if QT_CONFIG(opengl)
static const struct {
const char * const vertexShaderSourceFile;
const char * const fragmentShaderSourceFile;
@@ -259,6 +260,7 @@ void QWaylandBufferMaterial::ensureTextures(int count)
m_textures << nullptr;
}
}
+#endif // QT_CONFIG(opengl)
QMutex *QWaylandQuickItemPrivate::mutex = nullptr;
@@ -284,10 +286,12 @@ public:
if (m_ref.hasBuffer()) {
if (buffer.isSharedMemory()) {
m_sgTex = surfaceItem->window()->createTextureFromImage(buffer.image());
- if (m_sgTex) {
+#if QT_CONFIG(opengl)
+ if (m_sgTex)
m_sgTex->bind();
- }
+#endif
} else {
+#if QT_CONFIG(opengl)
QQuickWindow::CreateTextureOptions opt;
QWaylandQuickSurface *surface = qobject_cast<QWaylandQuickSurface *>(surfaceItem->surface());
if (surface && surface->useTextureAlpha()) {
@@ -297,6 +301,9 @@ public:
auto texture = buffer.toOpenGLTexture();
auto size = surface->bufferSize();
m_sgTex = surfaceItem->window()->createTextureFromId(texture->textureId(), size, opt);
+#else
+ qCWarning(qLcWaylandCompositor) << "Without OpenGL support only shared memory textures are supported";
+#endif
}
}
emit textureChanged();
@@ -1327,7 +1334,11 @@ QSGNode *QWaylandQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat
const QRectF rect = invertY ? QRectF(0, height(), width(), -height())
: QRectF(0, 0, width(), height());
- if (ref.isSharedMemory() || bufferTypes[ref.bufferFormatEgl()].canProvideTexture) {
+ if (ref.isSharedMemory()
+#if QT_CONFIG(opengl)
+ || bufferTypes[ref.bufferFormatEgl()].canProvideTexture
+#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);
@@ -1353,45 +1364,48 @@ QSGNode *QWaylandQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat
node->setSourceRect(QRectF(source.topLeft() * scale, source.size() * scale));
return node;
- } else {
- Q_ASSERT(!d->provider);
+ }
- QSGGeometryNode *node = static_cast<QSGGeometryNode *>(oldNode);
+#if QT_CONFIG(opengl)
+ Q_ASSERT(!d->provider);
- if (!node) {
- node = new QSGGeometryNode;
- d->newTexture = true;
- }
+ QSGGeometryNode *node = static_cast<QSGGeometryNode *>(oldNode);
- QSGGeometry *geometry = node->geometry();
- QWaylandBufferMaterial *material = static_cast<QWaylandBufferMaterial *>(node->material());
+ if (!node) {
+ node = new QSGGeometryNode;
+ d->newTexture = true;
+ }
- if (!geometry)
- geometry = new QSGGeometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4);
+ QSGGeometry *geometry = node->geometry();
+ QWaylandBufferMaterial *material = static_cast<QWaylandBufferMaterial *>(node->material());
- if (!material)
- material = new QWaylandBufferMaterial(ref.bufferFormatEgl());
+ if (!geometry)
+ geometry = new QSGGeometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4);
- 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();
- }
+ if (!material)
+ material = new QWaylandBufferMaterial(ref.bufferFormatEgl());
- QSGGeometry::updateTexturedRectGeometry(geometry, rect, QRectF(0, 0, 1, 1));
+ 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();
+ }
- node->setGeometry(geometry);
- node->setFlag(QSGNode::OwnsGeometry, true);
+ QSGGeometry::updateTexturedRectGeometry(geometry, rect, QRectF(0, 0, 1, 1));
- node->setMaterial(material);
- node->setFlag(QSGNode::OwnsMaterial, true);
+ node->setGeometry(geometry);
+ node->setFlag(QSGNode::OwnsGeometry, true);
- return node;
- }
+ node->setMaterial(material);
+ node->setFlag(QSGNode::OwnsMaterial, true);
- Q_UNREACHABLE();
+ return node;
+#else
+ qCWarning(qLcWaylandCompositor) << "Without OpenGL support only shared memory textures are supported";
+ return nullptr;
+#endif // QT_CONFIG(opengl)
}
void QWaylandQuickItem::setTouchEventsEnabled(bool enabled)