From 9b531b319d263bf917c1e0a3d35de5b45de15ad0 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 16 Jun 2017 11:29:09 +0200 Subject: Set texture size and format in WaylandEglClientBuffer::toOpenGLTexture Change-Id: I26e3ac4224fb54e1d3fddeef8847f9556effe324 Reviewed-by: Giulio Camuffo --- .../wayland-egl/waylandeglclientbufferintegration.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp index 116c97295..c9133a227 100644 --- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp +++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp @@ -456,6 +456,17 @@ static QWaylandBufferRef::BufferFormatEgl formatFromEglFormat(EGLint format) { return QWaylandBufferRef::BufferFormatEgl_RGBA; } +static QOpenGLTexture::TextureFormat openGLFormatFromEglFormat(EGLint format) { + switch (format) { + case EGL_TEXTURE_RGB: + return QOpenGLTexture::RGBFormat; + case EGL_TEXTURE_RGBA: + return QOpenGLTexture::RGBAFormat; + default: + return QOpenGLTexture::NoFormat; + } +} + QWaylandBufferRef::BufferFormatEgl WaylandEglClientBuffer::bufferFormatEgl() const { return formatFromEglFormat(d->egl_format); @@ -472,6 +483,8 @@ QOpenGLTexture *WaylandEglClientBuffer::toOpenGlTexture(int plane) : GL_TEXTURE_2D); if (!texture) { texture = new QOpenGLTexture(target); + texture->setFormat(openGLFormatFromEglFormat(d->egl_format)); + texture->setSize(d->size.width(), d->size.height()); texture->create(); d->textures[plane] = texture; } -- cgit v1.2.3