summaryrefslogtreecommitdiffstats
path: root/src/opengl/qglshaderprogram.cpp
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2010-08-13 00:50:31 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2010-08-13 00:50:31 (GMT)
commit6155050f68cc86c445552da61a5f240c16f5e2cd (patch)
treeeccb560efebc61a949f13e4a3e124460c001eb8e /src/opengl/qglshaderprogram.cpp
parentb0d2a439314bc86e6e15fe033c1edaee471b4b95 (diff)
downloadQt-6155050f68cc86c445552da61a5f240c16f5e2cd.zip
Qt-6155050f68cc86c445552da61a5f240c16f5e2cd.tar.gz
Qt-6155050f68cc86c445552da61a5f240c16f5e2cd.tar.bz2
Don't define highp/mediump/lowp if desktop GL has them
OpenGL 4.0 systems now have compatibility with ES2, including support for the precision qualifiers. If the GL_ARB_ES2_compatibility extension is present, then we don't define highp/mediump/lowp to the empty string. Task-number: QTBUG-12862 Reviewed-by: Sarah Smith
Diffstat (limited to 'src/opengl/qglshaderprogram.cpp')
-rw-r--r--src/opengl/qglshaderprogram.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp
index edbb635..9bfe027 100644
--- a/src/opengl/qglshaderprogram.cpp
+++ b/src/opengl/qglshaderprogram.cpp
@@ -97,6 +97,10 @@ QT_BEGIN_NAMESPACE
to just features that are present in GLSL/ES, and avoid
standard variable names that only work on the desktop.
+ If the \c{GL_ARB_ES2_compatibility} extension is present,
+ then the above prefix is not added because the desktop OpenGL
+ implementation supports precision qualifiers.
+
\section1 Simple shader example
\snippet doc/src/snippets/code/src_opengl_qglshaderprogram.cpp 1
@@ -390,8 +394,10 @@ bool QGLShader::compileSourceCode(const char *source)
srclen.append(GLint(headerLen));
}
#ifdef QGL_DEFINE_QUALIFIERS
- src.append(qualifierDefines);
- srclen.append(GLint(sizeof(qualifierDefines) - 1));
+ if (!(QGLExtensions::glExtensions() & QGLExtensions::ES2Compatibility)) {
+ src.append(qualifierDefines);
+ srclen.append(GLint(sizeof(qualifierDefines) - 1));
+ }
#endif
#ifdef QGL_REDEFINE_HIGHP
if (d->shaderType == Fragment) {