summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dist/changes-4.6.45
-rw-r--r--src/opengl/qgl.cpp3
-rw-r--r--src/opengl/qgl_p.h3
-rw-r--r--src/opengl/qglshaderprogram.cpp10
4 files changed, 16 insertions, 5 deletions
diff --git a/dist/changes-4.6.4 b/dist/changes-4.6.4
index 381023f..ab59dc5 100644
--- a/dist/changes-4.6.4
+++ b/dist/changes-4.6.4
@@ -63,8 +63,9 @@ QtNetwork
QtOpenGL
--------
- - foo
- * bar
+ - QGLShaderProgram
+ * [QTBUG-12862] Don't #define highp/mediump/lowp if the desktop OpenGL
+ implementation has the GL_ARB_ES2_compatibility extension.
QtScript
--------
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 0521bab..0137c85 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -4923,6 +4923,8 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions()
glExtensions |= FragmentProgram;
if (extensions.match("GL_ARB_fragment_shader"))
glExtensions |= FragmentShader;
+ if (extensions.match("GL_ARB_ES2_compatibility"))
+ glExtensions |= ES2Compatibility;
if (extensions.match("GL_ARB_texture_mirrored_repeat"))
glExtensions |= MirroredRepeat;
if (extensions.match("GL_EXT_framebuffer_object"))
@@ -4941,6 +4943,7 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions()
glExtensions |= FramebufferObject;
glExtensions |= GenerateMipmap;
glExtensions |= FragmentShader;
+ glExtensions |= ES2Compatibility;
#endif
#if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_1_CL)
if (extensions.match("GL_OES_framebuffer_object"))
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 4facb65..1603ca1 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -291,7 +291,8 @@ public:
DDSTextureCompression = 0x00008000,
ETC1TextureCompression = 0x00010000,
PVRTCTextureCompression = 0x00020000,
- FragmentShader = 0x00040000
+ FragmentShader = 0x00040000,
+ ES2Compatibility = 0x00080000
};
Q_DECLARE_FLAGS(Extensions, Extension)
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) {