From 16cd1f8d24f011d30d3fc7baf7750700af14d9c5 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Fri, 26 Jan 2018 11:40:09 +0100 Subject: 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 --- src/quick/scenegraph/compressedtexture/qsgpkmhandler.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/quick/scenegraph') 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 -- cgit v1.2.3