rhi: gl: Fix broken bgra textures on GLES

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 <christian.stromme@qt.io>
bb10
Laszlo Agocs 2019-08-07 20:22:51 +02:00
parent 0a36001a13
commit 959ff0d378
1 changed files with 4 additions and 3 deletions

View File

@ -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;