GLShader appends the ES specific commands to the shaders

This commit is contained in:
Martin Gräßlin 2010-12-12 09:56:19 +01:00
parent e4b26daef5
commit 69044f10c5
6 changed files with 10 additions and 17 deletions

View file

@ -873,7 +873,11 @@ bool GLShader::load(const QString& vertexsource, const QString& fragmentsource)
// Create shader object
vertexshader = glCreateShader(GL_VERTEX_SHADER);
// Load it
const QByteArray& srcba = vertexsource.toLatin1();
QByteArray srcba;
#ifdef KWIN_HAVE_OPENGLES
srcba.append("#ifdef GL_ES\nprecision highp float;\n#endif\n");
#endif
srcba.append(vertexsource.toLatin1());
const char* src = srcba.data();
glShaderSource(vertexshader, 1, &src, NULL);
// Compile the shader
@ -905,7 +909,11 @@ bool GLShader::load(const QString& vertexsource, const QString& fragmentsource)
{
fragmentshader = glCreateShader(GL_FRAGMENT_SHADER);
// Load it
const QByteArray& srcba = fragmentsource.toLatin1();
QByteArray srcba;
#ifdef KWIN_HAVE_OPENGLES
srcba.append("#ifdef GL_ES\nprecision highp float;\n#endif\n");
#endif
srcba.append(fragmentsource.toLatin1());
const char* src = srcba.data();
glShaderSource(fragmentshader, 1, &src, NULL);
//glShaderSource(fragmentshader, 1, &fragmentsrc.latin1(), NULL);

View file

@ -1,6 +1,3 @@
#ifdef GL_ES
precision highp float;
#endif
uniform vec4 geometryColor;
void main() {

View file

@ -1,6 +1,3 @@
#ifdef GL_ES
precision highp float;
#endif
// size of the complete display in pixels, x==width, y==height
uniform vec2 displaySize;
// geometry of the window/texture to be rendered: x, y, width, height in display geometry

View file

@ -1,6 +1,3 @@
#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D sample;
uniform float textureWidth;
uniform float textureHeight;

View file

@ -1,6 +1,3 @@
#ifdef GL_ES
precision highp float;
#endif
uniform mat4 projection;
uniform mat4 modelview;
uniform mat4 screenTransformation;

View file

@ -1,6 +1,3 @@
#ifdef GL_ES
precision highp float;
#endif
// size of the complete display in pixels, x==width, y==height
uniform vec2 displaySize;
// geometry of the window/texture to be rendered: x, y, width, height in display geometry