summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl/qopengltexturecache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/opengl/qopengltexturecache.cpp')
-rw-r--r--src/gui/opengl/qopengltexturecache.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gui/opengl/qopengltexturecache.cpp b/src/gui/opengl/qopengltexturecache.cpp
index 4a4a36d7e5..055974d5a4 100644
--- a/src/gui/opengl/qopengltexturecache.cpp
+++ b/src/gui/opengl/qopengltexturecache.cpp
@@ -49,6 +49,10 @@
QT_BEGIN_NAMESPACE
+#ifndef GL_RGB10_A2
+#define GL_RGB10_A2 0x8059
+#endif
+
#ifndef GL_BGR
#define GL_BGR 0x80E0
#endif
@@ -61,6 +65,10 @@ QT_BEGIN_NAMESPACE
#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
#endif
+#ifndef GL_UNSIGNED_INT_2_10_10_10_REV
+#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
+#endif
+
class QOpenGLTextureCacheWrapper
{
public:
@@ -228,6 +236,29 @@ GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, qint64 key, con
}
targetFormat = image.format();
break;
+ case QImage::Format_BGR30:
+ case QImage::Format_A2BGR30_Premultiplied:
+ if (isOpenGL12orBetter || (context->isOpenGLES() && context->format().majorVersion() >= 3)) {
+ pixelType = GL_UNSIGNED_INT_2_10_10_10_REV;
+ externalFormat = GL_RGBA;
+ internalFormat = GL_RGB10_A2;
+ targetFormat = image.format();
+ }
+ break;
+ case QImage::Format_RGB30:
+ case QImage::Format_A2RGB30_Premultiplied:
+ if (isOpenGL12orBetter) {
+ pixelType = GL_UNSIGNED_INT_2_10_10_10_REV;
+ externalFormat = GL_BGRA;
+ internalFormat = GL_RGB10_A2;
+ targetFormat = image.format();
+ } else if (context->isOpenGLES() && context->format().majorVersion() >= 3) {
+ pixelType = GL_UNSIGNED_INT_2_10_10_10_REV;
+ externalFormat = GL_RGBA;
+ internalFormat = GL_RGB10_A2;
+ targetFormat = QImage::Format_A2BGR30_Premultiplied;
+ }
+ break;
case QImage::Format_RGB444:
case QImage::Format_RGB555:
case QImage::Format_RGB16: