summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2017-06-16 11:29:09 +0200
committerJohan Helsing <johan.helsing@qt.io>2017-06-22 09:32:49 +0000
commit9b531b319d263bf917c1e0a3d35de5b45de15ad0 (patch)
tree5f299d182ec5dbc75b2924d4732838b0f01deecb
parent79788e11605cf037b4e8e74f1e17039e4baab6c5 (diff)
Set texture size and format in WaylandEglClientBuffer::toOpenGLTexture
Change-Id: I26e3ac4224fb54e1d3fddeef8847f9556effe324 Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
-rw-r--r--src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp13
1 files changed, 13 insertions, 0 deletions
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;
}