aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@live.com>2019-09-28 21:31:19 -0500
committerMichael Brasser <michael.brasser@live.com>2019-10-17 08:21:48 -0500
commit5001f79c4f98e22d9a301ae6519a67d1135f7312 (patch)
tree8faaa311c7d094feea13320db6720f8d6fd3b630 /src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp
parent0c1716e9f61631c67f34bb429611a34c287308ec (diff)
Support DXT1/3/5 in compressed texture atlasv5.14.0-beta2
Change-Id: I791adbfce96481aea71bb285e48b89cb5db08e1c Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp')
-rw-r--r--src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp b/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp
index d3dc4978f2..46b2c6386c 100644
--- a/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp
+++ b/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp
@@ -88,10 +88,20 @@ Texture *Atlas::create(const QByteArray &data, int dataLength, int dataOffset, c
void Atlas::generateTexture()
{
+ int bytesPerBlock = 8;
+ switch (m_format) {
+ case QOpenGLTexture::RGBA8_ETC2_EAC:
+ case QOpenGLTexture::RGBA_DXT3:
+ case QOpenGLTexture::RGBA_DXT5:
+ bytesPerBlock = 16;
+ default:
+ break;
+ }
+
QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
funcs->glCompressedTexImage2D(GL_TEXTURE_2D, 0, m_format,
m_size.width(), m_size.height(), 0,
- (m_size.width() * m_size.height()) / 2,
+ (m_size.width() / 4 * m_size.height() / 4) * bytesPerBlock,
nullptr);
}