diff options
author | Liang Qi <liang.qi@qt.io> | 2016-09-29 12:58:32 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-09-29 12:58:41 +0200 |
commit | e66d181e659a08d19ab7d144c3ba0619d537de83 (patch) | |
tree | 7367e93797cb9a2a331f0741baed5a1cad2c96b6 /src/gui/opengl/qopenglshaderprogram.cpp | |
parent | 4758555f3e44af3425f0b691dc38fb40f3c9413d (diff) | |
parent | 75aea3ff5eec4a5c8f4184e14a90f4a5e3a577b0 (diff) |
Merge remote-tracking branch 'origin/5.8' into dev
Change-Id: I3b51bb706e401edfda09a433c67aa58e44f33e83
Diffstat (limited to 'src/gui/opengl/qopenglshaderprogram.cpp')
-rw-r--r-- | src/gui/opengl/qopenglshaderprogram.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp index c0c0bb0a03..6f5aff14aa 100644 --- a/src/gui/opengl/qopenglshaderprogram.cpp +++ b/src/gui/opengl/qopenglshaderprogram.cpp @@ -584,16 +584,26 @@ bool QOpenGLShader::compileSourceCode(const char *source) QVarLengthArray<const char *, 5> sourceChunks; QVarLengthArray<GLint, 5> sourceChunkLengths; + QOpenGLContext *ctx = QOpenGLContext::currentContext(); if (versionDirectivePosition.hasPosition()) { - // Append source up to #version directive + // Append source up to and including the #version directive sourceChunks.append(source); sourceChunkLengths.append(GLint(versionDirectivePosition.position)); + } else { + // QTBUG-55733: Intel on Windows with Compatibility profile requires a #version always + if (ctx->format().profile() == QSurfaceFormat::CompatibilityProfile) { + const char *vendor = reinterpret_cast<const char *>(ctx->functions()->glGetString(GL_VENDOR)); + if (vendor && !strcmp(vendor, "Intel")) { + static const char version110[] = "#version 110\n"; + sourceChunks.append(version110); + sourceChunkLengths.append(GLint(sizeof(version110)) - 1); + } + } } // The precision qualifiers are useful on OpenGL/ES systems, // but usually not present on desktop systems. - QOpenGLContext *ctx = QOpenGLContext::currentContext(); const QSurfaceFormat currentSurfaceFormat = ctx->format(); QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(QOpenGLContext::currentContext()); if (currentSurfaceFormat.renderableType() == QSurfaceFormat::OpenGL |