diff options
Diffstat (limited to 'src/gui/opengl/qopenglshaderprogram.cpp')
-rw-r--r-- | src/gui/opengl/qopenglshaderprogram.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp index ecc38b902c..06f40eafd0 100644 --- a/src/gui/opengl/qopenglshaderprogram.cpp +++ b/src/gui/opengl/qopenglshaderprogram.cpp @@ -175,13 +175,15 @@ public: #endif { #ifndef QT_OPENGL_ES_2 - QSurfaceFormat f = ctx->format(); - - // Geometry shaders require OpenGL >= 3.2 - if (shaderType & QOpenGLShader::Geometry) - supportsGeometryShaders = (f.version() >= qMakePair<int, int>(3, 2)); - else if (shaderType & (QOpenGLShader::TessellationControl | QOpenGLShader::TessellationEvaluation)) - supportsTessellationShaders = (f.version() >= qMakePair<int, int>(4, 0)); + if (!QOpenGLFunctions::isES()) { + QSurfaceFormat f = ctx->format(); + + // Geometry shaders require OpenGL >= 3.2 + if (shaderType & QOpenGLShader::Geometry) + supportsGeometryShaders = (f.version() >= qMakePair<int, int>(3, 2)); + else if (shaderType & (QOpenGLShader::TessellationControl | QOpenGLShader::TessellationEvaluation)) + supportsTessellationShaders = (f.version() >= qMakePair<int, int>(4, 0)); + } #endif } ~QOpenGLShaderPrivate(); @@ -441,7 +443,8 @@ bool QOpenGLShader::compileSourceCode(const char *source) } #ifdef QOpenGL_REDEFINE_HIGHP - if (d->shaderType == Fragment && !ctx_d->workaround_missingPrecisionQualifiers) { + if (d->shaderType == Fragment && !ctx_d->workaround_missingPrecisionQualifiers + && QOpenGLFunctions::isES()) { src.append(redefineHighp); srclen.append(GLint(sizeof(redefineHighp) - 1)); } @@ -650,7 +653,8 @@ bool QOpenGLShaderProgram::init() #ifndef QT_OPENGL_ES_2 // Resolve OpenGL 4 functions for tessellation shader support QSurfaceFormat format = context->format(); - if (format.version() >= qMakePair<int, int>(4, 0)) { + if (!QOpenGLFunctions::isES() + && format.version() >= qMakePair<int, int>(4, 0)) { d->tessellationFuncs = context->versionFunctions<QOpenGLFunctions_4_0_Core>(); d->tessellationFuncs->initializeOpenGLFunctions(); } @@ -3248,14 +3252,16 @@ bool QOpenGLShader::hasOpenGLShaders(ShaderType type, QOpenGLContext *context) #ifndef QT_OPENGL_ES_2 // Geometry shaders require OpenGL 3.2 or newer QSurfaceFormat format = context->format(); - return (format.version() >= qMakePair<int, int>(3, 2)); + return (!QOpenGLFunctions::isES()) + && (format.version() >= qMakePair<int, int>(3, 2)); #else // No geometry shader support in OpenGL ES2 return false; #endif } else if (type == TessellationControl || type == TessellationEvaluation) { #if !defined(QT_OPENGL_ES_2) - return (format.version() >= qMakePair<int, int>(4, 0)); + return (!QOpenGLFunctions::isES()) + && (format.version() >= qMakePair<int, int>(4, 0)); #else // No tessellation shader support in OpenGL ES2 return false; |