diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-08-05 12:01:51 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-08-06 07:30:57 +0000 |
commit | 4e6e71aa8dcfbd18004e31aa10b1f0f71db99bd6 (patch) | |
tree | ce5ce5dcde5dea4d478f4edeadd8a28c33fc72a0 /src/gui/opengl | |
parent | 4d39da87349d4930a4fd97af3afaacc1fd838c9f (diff) |
Add ETC1 to QOpenGLTexture formats
On mobile and embedded ETC1 (via GL_OES_compressed_ETC1_RGB8_texture) is
still the most common (and sometimes the only) option for compressed textures,
at least until GLES3 (with ETC2) becomes widely available.
Note that we treat this format as unsized to prevent going on the immutable storage
path as there is no word on glTexStorage and friends in the extension so that may
just fail as well.
Change-Id: Icbc3c6f62f314d63c4df289ef456f047c5e84cf3
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/gui/opengl')
-rw-r--r-- | src/gui/opengl/qopengltexture.cpp | 7 | ||||
-rw-r--r-- | src/gui/opengl/qopengltexture.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index 5edaddcd6a..84a70f0e90 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -400,6 +400,9 @@ static bool isSizedTextureFormat(QOpenGLTexture::TextureFormat internalFormat) case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: return true; + case QOpenGLTexture::RGB8_ETC1: + return false; + case QOpenGLTexture::DepthFormat: case QOpenGLTexture::AlphaFormat: @@ -662,6 +665,7 @@ static QOpenGLTexture::PixelFormat pixelFormatCompatibleWithInternalFormat(QOpen case QOpenGLTexture::SRGB_Alpha_DXT3: case QOpenGLTexture::SRGB_Alpha_DXT5: case QOpenGLTexture::SRGB_BP_UNorm: + case QOpenGLTexture::RGB8_ETC1: return QOpenGLTexture::RGBA; case QOpenGLTexture::R11_EAC_UNorm: @@ -839,6 +843,7 @@ static QOpenGLTexture::PixelType pixelTypeCompatibleWithInternalFormat(QOpenGLTe case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: case QOpenGLTexture::RGBA8_ETC2_EAC: case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: + case QOpenGLTexture::RGB8_ETC1: return QOpenGLTexture::UInt8; case QOpenGLTexture::DepthFormat: @@ -1856,6 +1861,7 @@ QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target \value SRGB8_PunchThrough_Alpha1_ETC2 Equivalent to GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 \value RGBA8_ETC2_EAC Equivalent to GL_COMPRESSED_RGBA8_ETC2_EAC \value SRGB8_Alpha8_ETC2_EAC Equivalent to GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC + \value RGB8_ETC1 Equivalent to GL_ETC1_RGB8_OES \value SRGB8 Equivalent to GL_SRGB8 \value SRGB8_Alpha8 Equivalent to GL_SRGB8_ALPHA8 @@ -2393,6 +2399,7 @@ void QOpenGLTexture::setFormat(TextureFormat format) case QOpenGLTexture::SRGB8_PunchThrough_Alpha1_ETC2: case QOpenGLTexture::RGBA8_ETC2_EAC: case QOpenGLTexture::SRGB8_Alpha8_ETC2_EAC: + case QOpenGLTexture::RGB8_ETC1: case RG3B2: case R5G6B5: case RGB5A1: diff --git a/src/gui/opengl/qopengltexture.h b/src/gui/opengl/qopengltexture.h index baab2d634f..ec52a192fa 100644 --- a/src/gui/opengl/qopengltexture.h +++ b/src/gui/opengl/qopengltexture.h @@ -196,6 +196,7 @@ public: SRGB8_PunchThrough_Alpha1_ETC2 = 0x9277, // GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 RGBA8_ETC2_EAC = 0x9278, // GL_COMPRESSED_RGBA8_ETC2_EAC SRGB8_Alpha8_ETC2_EAC = 0x9279, // GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC + RGB8_ETC1 = 0x8D64, // GL_ETC1_RGB8_OES // sRGB formats SRGB8 = 0x8C41, // GL_SRGB8 |