From 959ff0d378c8d31216a70bf38726deac3c7051ff Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 7 Aug 2019 20:22:51 +0200 Subject: rhi: gl: Fix broken bgra textures on GLES MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switching TexImage2D to the sized internal format was a bad idea. Go with what we do without the RHI in QtGui and elsewhere, and just pass the unsized GL_RGBA or GL_BGRA. Change-Id: I8216c0e49813355fa5e2594b24f06c64bc8e3873 Reviewed-by: Christian Strømme --- src/gui/rhi/qrhigles2.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index 0d7f8224af..eabc550447 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -3115,18 +3115,19 @@ bool QGles2Texture::build() for (int layer = 0, layerCount = isCube ? 6 : 1; layer != layerCount; ++layer) { for (int level = 0; level != mipLevelCount; ++level) { const QSize mipSize = rhiD->q->sizeForMipLevel(level, size); - rhiD->f->glTexImage2D(faceTargetBase + layer, level, glsizedintformat, + rhiD->f->glTexImage2D(faceTargetBase + layer, level, glintformat, mipSize.width(), mipSize.height(), 0, glformat, gltype, nullptr); } } } else { - rhiD->f->glTexImage2D(target, 0, glsizedintformat, size.width(), size.height(), + rhiD->f->glTexImage2D(target, 0, glintformat, size.width(), size.height(), 0, glformat, gltype, nullptr); } } else { // Must be specified with immutable storage functions otherwise - // bindImageTexture may fail. + // bindImageTexture may fail. Also, the internal format must be a + // sized format here. rhiD->f->glTexStorage2D(target, mipLevelCount, glsizedintformat, size.width(), size.height()); } specified = true; -- cgit v1.2.3