Commit 340667e7 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Aleix Pol Gonzalez
Browse files

PipeWireSourceItem: The texture received may have an alpha channel

Tell QQuickWindow when there is an alpha channel, otherwise it's
considered opaque and Qt/mesa renders it disregarding what's underneath.

Sometimes windows will have translucent areas and we want these to be
rendered cleanly on top of the scene. Alternatively it shows weird
noise.
parent bee08091
......@@ -260,7 +260,7 @@ void PipeWireSourceItem::updateTextureDmaBuf(const QVector<DmaBufPlane> &planes,
return;
}
m_createNextTexture = [this, size] {
m_createNextTexture = [this, size, format] {
if (!m_texture) {
m_texture.reset(new QOpenGLTexture(QOpenGLTexture::Target2D));
bool created = m_texture->create();
......@@ -277,7 +277,8 @@ void PipeWireSourceItem::updateTextureDmaBuf(const QVector<DmaBufPlane> &planes,
m_texture->setSize(size.width(), size.height());
int textureId = m_texture->textureId();
return window()->createTextureFromNativeObject(QQuickWindow::NativeObjectTexture, &textureId, 0 /*a vulkan thing?*/, size, {});
QQuickWindow::CreateTextureOption textureOption = format == DRM_FORMAT_ARGB8888 ? QQuickWindow::TextureHasAlphaChannel : QQuickWindow::TextureIsOpaque;
return window()->createTextureFromNativeObject(QQuickWindow::NativeObjectTexture, &textureId, 0 /*a vulkan thing?*/, size, textureOption);
};
if (window()->isVisible()) {
update();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment