diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2018-10-09 10:22:25 +0200 |
---|---|---|
committer | Andy Nichols <andy.nichols@qt.io> | 2018-10-16 07:20:12 +0000 |
commit | e0b1c39bed0a70445529ec249688ff1ac5f3a199 (patch) | |
tree | 09d97178a7402dbce7a64cac734c0f576bc41c6e /src/gui/opengl/qopenglprogrambinarycache.cpp | |
parent | 402efef57bb6a04ad778d3139100becc2cba31eb (diff) |
Drop cached shaders when arch is different
According to reports Intel on Windows gets confused when feeding
program binaries retrieved from x86 and x64 builds into each other.
Task-number: QTBUG-64697
Change-Id: Ia7748f532ad06942a92c6fbfc4c9d1ad16bc785a
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/gui/opengl/qopenglprogrambinarycache.cpp')
-rw-r--r-- | src/gui/opengl/qopenglprogrambinarycache.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gui/opengl/qopenglprogrambinarycache.cpp b/src/gui/opengl/qopenglprogrambinarycache.cpp index 0f03101329..c96021a969 100644 --- a/src/gui/opengl/qopenglprogrambinarycache.cpp +++ b/src/gui/opengl/qopenglprogrambinarycache.cpp @@ -63,7 +63,7 @@ Q_DECLARE_LOGGING_CATEGORY(DBG_SHADER_CACHE) #endif const quint32 BINSHADER_MAGIC = 0x5174; -const quint32 BINSHADER_VERSION = 0x2; +const quint32 BINSHADER_VERSION = 0x3; const quint32 BINSHADER_QTVERSION = QT_VERSION; namespace { @@ -120,7 +120,7 @@ QString QOpenGLProgramBinaryCache::cacheFileName(const QByteArray &cacheKey) con return m_cacheDir + QString::fromUtf8(cacheKey); } -#define BASE_HEADER_SIZE (int(3 * sizeof(quint32))) +#define BASE_HEADER_SIZE (int(4 * sizeof(quint32))) #define FULL_HEADER_SIZE(stringsSize) (BASE_HEADER_SIZE + 12 + stringsSize + 8) #define PADDING_SIZE(fullHeaderSize) (((fullHeaderSize + 3) & ~3) - fullHeaderSize) @@ -159,6 +159,10 @@ bool QOpenGLProgramBinaryCache::verifyHeader(const QByteArray &buf) const qCDebug(DBG_SHADER_CACHE, "Qt version does not match"); return false; } + if (readUInt(&p) != sizeof(quintptr)) { + qCDebug(DBG_SHADER_CACHE, "Architecture does not match"); + return false; + } return true; } @@ -371,6 +375,7 @@ void QOpenGLProgramBinaryCache::save(const QByteArray &cacheKey, uint programId) writeUInt(&p, BINSHADER_MAGIC); writeUInt(&p, BINSHADER_VERSION); writeUInt(&p, BINSHADER_QTVERSION); + writeUInt(&p, sizeof(quintptr)); writeStr(&p, info.glvendor); writeStr(&p, info.glrenderer); |