diff options
Diffstat (limited to 'src/gui/opengl')
-rw-r--r-- | src/gui/opengl/qopenglprogrambinarycache.cpp | 3 | ||||
-rw-r--r-- | src/gui/opengl/qopengltextureuploader.cpp | 18 |
2 files changed, 20 insertions, 1 deletions
diff --git a/src/gui/opengl/qopenglprogrambinarycache.cpp b/src/gui/opengl/qopenglprogrambinarycache.cpp index 1f1ac1fd80..8d4d8ed183 100644 --- a/src/gui/opengl/qopenglprogrambinarycache.cpp +++ b/src/gui/opengl/qopenglprogrambinarycache.cpp @@ -40,6 +40,7 @@ #include "qopenglprogrambinarycache_p.h" #include <QOpenGLContext> #include <QOpenGLExtraFunctions> +#include <QSysInfo> #include <QStandardPaths> #include <QDir> #include <QSaveFile> @@ -102,7 +103,7 @@ static inline bool qt_ensureWritableDir(const QString &name) QOpenGLProgramBinaryCache::QOpenGLProgramBinaryCache() : m_cacheWritable(false) { - const QString subPath = QLatin1String("/qtshadercache/"); + const QString subPath = QLatin1String("/qtshadercache-") + QSysInfo::buildAbi() + QLatin1Char('/'); const QString sharedCachePath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation); if (!sharedCachePath.isEmpty()) { m_cacheDir = sharedCachePath + subPath; diff --git a/src/gui/opengl/qopengltextureuploader.cpp b/src/gui/opengl/qopengltextureuploader.cpp index d9d5403cf3..9e393bc47a 100644 --- a/src/gui/opengl/qopengltextureuploader.cpp +++ b/src/gui/opengl/qopengltextureuploader.cpp @@ -65,6 +65,10 @@ #define GL_RGBA16 0x805B #endif +#ifndef GL_BGR +#define GL_BGR 0x80E0 +#endif + #ifndef GL_BGRA #define GL_BGRA 0x80E1 #endif @@ -202,6 +206,20 @@ qsizetype QOpenGLTextureUploader::textureImage(GLenum target, const QImage &imag pixelType = GL_UNSIGNED_BYTE; targetFormat = QImage::Format_RGB888; break; + case QImage::Format_BGR888: + if (isOpenGL12orBetter) { + externalFormat = GL_BGR; + internalFormat = GL_RGB; + pixelType = GL_UNSIGNED_BYTE; + targetFormat = QImage::Format_BGR888; + } else if (funcs->hasOpenGLExtension(QOpenGLExtensions::TextureSwizzle)) { + funcs->glTexParameteri(target, GL_TEXTURE_SWIZZLE_B, GL_RED); + funcs->glTexParameteri(target, GL_TEXTURE_SWIZZLE_R, GL_BLUE); + externalFormat = internalFormat = GL_RGB; + pixelType = GL_UNSIGNED_BYTE; + targetFormat = QImage::Format_BGR888; + } + break; case QImage::Format_RGBX8888: case QImage::Format_RGBA8888: case QImage::Format_RGBA8888_Premultiplied: |