Commit b06128e4 authored by Laszlo Agocs's avatar Laszlo Agocs
Browse files

gl: Fix asserting on compressed textures

parent cf408458
......@@ -2137,9 +2137,17 @@ bool QGles2Texture::prepareBuild(QSize *adjustedSize)
const bool isCompressed = rhiD->isCompressedFormat(m_format);
target = isCube ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D;
mipLevelCount = hasMipMaps ? rhiD->q->mipLevelsForSize(size) : 1;
gltype = GL_UNSIGNED_BYTE;
if (isCompressed) {
glintformat = toGlCompressedTextureFormat(m_format, m_flags);
if (!glintformat) {
qWarning("Compressed format %d not mappable to GL compressed format", m_format);
return false;
}
glformat = GL_RGBA;
} else {
switch (m_format) {
case QRhiTexture::RGBA8:
glintformat = GL_RGBA;
......@@ -2169,15 +2177,6 @@ bool QGles2Texture::prepareBuild(QSize *adjustedSize)
glformat = GL_RGBA;
break;
}
mipLevelCount = hasMipMaps ? rhiD->q->mipLevelsForSize(size) : 1;
if (isCompressed) {
glintformat = toGlCompressedTextureFormat(m_format, m_flags);
if (!glintformat) {
qWarning("Compressed format %d not mappable to GL compressed format", m_format);
return false;
}
}
if (adjustedSize)
......
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