aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@qt.io>2018-01-26 11:40:09 +0100
committerEirik Aavitsland <eirik.aavitsland@qt.io>2018-01-26 13:23:20 +0000
commit16cd1f8d24f011d30d3fc7baf7750700af14d9c5 (patch)
tree17fa12737c1a781b78583dc52225f2c452ee8b84
parent598a5dd899e7c3cc77441baeff2630608ffde89a (diff)
Fix uploading of compressed textures of ETC2_EAC type
The call to glCompressedTexImage2D would fail since the code did not account for the fact that the ETC2_EAC scheme uses twice the number of bytes as other ETC schemes. Change-Id: I93502f5848b112cac2f798453a0d32a2c0a2a20b Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r--src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp b/src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp
index bb8fce046d..62066a136a 100644
--- a/src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp
+++ b/src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp
@@ -125,9 +125,10 @@ void QEtcTexture::bind()
QOpenGLContext *ctx = QOpenGLContext::currentContext();
Q_ASSERT(ctx != 0);
+ const int compFactor = m_type == GL_COMPRESSED_RGBA8_ETC2_EAC ? 1 : 2;
ctx->functions()->glCompressedTexImage2D(GL_TEXTURE_2D, 0, m_type,
m_size.width(), m_size.height(), 0,
- (m_paddedSize.width() * m_paddedSize.height()) / 2,
+ (m_paddedSize.width() * m_paddedSize.height()) / compFactor,
m_data.data() + headerSize);
#ifndef QT_NO_DEBUG