aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/util/qsgopenglatlastexture.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/util/qsgopenglatlastexture.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/util/qsgopenglatlastexture.cpp')
-rw-r--r--src/quick/scenegraph/util/qsgopenglatlastexture.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/quick/scenegraph/util/qsgopenglatlastexture.cpp b/src/quick/scenegraph/util/qsgopenglatlastexture.cpp
index ae7d9cf8cc..75a874424a 100644
--- a/src/quick/scenegraph/util/qsgopenglatlastexture.cpp
+++ b/src/quick/scenegraph/util/qsgopenglatlastexture.cpp
@@ -150,6 +150,10 @@ QSGTexture *Manager::create(const QSGCompressedTextureFactory *factory)
case QOpenGLTexture::RGB8_ETC2:
case QOpenGLTexture::RGBA8_ETC2_EAC:
case QOpenGLTexture::RGB8_PunchThrough_Alpha1_ETC2:
+ case QOpenGLTexture::RGB_DXT1:
+ case QOpenGLTexture::RGBA_DXT1:
+ case QOpenGLTexture::RGBA_DXT3:
+ case QOpenGLTexture::RGBA_DXT5:
break;
default:
return t;
@@ -158,8 +162,12 @@ QSGTexture *Manager::create(const QSGCompressedTextureFactory *factory)
QSize size = factory->m_textureData.size();
if (size.width() < m_atlas_size_limit && size.height() < m_atlas_size_limit) {
QHash<unsigned int, QSGCompressedAtlasTexture::Atlas*>::iterator i = m_atlases.find(format);
- if (i == m_atlases.end())
- i = m_atlases.insert(format, new QSGCompressedAtlasTexture::Atlas(m_atlas_size, format));
+ if (i == m_atlases.end()) {
+ // must be multiple of 4
+ QSize paddedSize(((m_atlas_size.width() + 3) / 4) * 4, ((m_atlas_size.height() + 3) / 4) * 4);
+ i = m_atlases.insert(format, new QSGCompressedAtlasTexture::Atlas(paddedSize, format));
+ }
+
// must be multiple of 4
QSize paddedSize(((size.width() + 3) / 4) * 4, ((size.height() + 3) / 4) * 4);
QByteArray data = factory->m_textureData.data();