summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-08-26 10:54:33 +0200
committerSamuel Rødal <sroedal@trolltech.com>2009-08-26 13:44:42 +0200
commitde3939532af08c37e709d1bae8cf50a57d6f63be (patch)
tree9cb6e27b36249f870838620d234e82aadc77192d
parent5a22a926f8f10597a431036533550f05fdf52d85 (diff)
Added missing precision specifiers to custom shader effect.
The precision specifiers need to be there on OpenGL ES 2.0. Reviewed-by: Tom
-rw-r--r--examples/effects/customshader/customshadereffect.cpp2
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadersource_p.h2
-rw-r--r--src/opengl/qglpixmapfilter.cpp2
-rw-r--r--src/opengl/qgraphicsshadereffect.cpp10
5 files changed, 9 insertions, 9 deletions
diff --git a/examples/effects/customshader/customshadereffect.cpp b/examples/effects/customshader/customshadereffect.cpp
index 08e4324e06..69fdb15474 100644
--- a/examples/effects/customshader/customshadereffect.cpp
+++ b/examples/effects/customshader/customshadereffect.cpp
@@ -44,7 +44,7 @@
static char const colorizeShaderCode[] =
"uniform lowp vec4 effectColor;\n"
- "mediump vec4 customShader(sampler2D imageTexture, vec2 textureCoords) {\n"
+ "mediump vec4 customShader(lowp sampler2D imageTexture, highp vec2 textureCoords) {\n"
" vec4 src = texture2D(imageTexture, textureCoords);\n"
" float gray = dot(src.rgb, vec3(0.212671, 0.715160, 0.072169));\n"
" vec4 colorize = 1.0-((1.0-gray)*(1.0-effectColor));\n"
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
index d5241a83c1..ace6b63285 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
@@ -209,7 +209,7 @@
(QGLCustomShaderStage). The shader will implement a pre-defined method name
which Qt's fragment pipeline will call:
- lowp vec4 customShader(sampler2d src, vec2 srcCoords)
+ lowp vec4 customShader(lowp sampler2d imageTexture, highp vec2 textureCoords)
The provided src and srcCoords parameters can be used to sample from the
source image.
diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h
index cf930f32d3..a8e2e72368 100644
--- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h
@@ -293,7 +293,7 @@ static const char* const qglslImageSrcFragmentShader = "\
static const char* const qglslCustomSrcFragmentShader = "\
varying highp vec2 textureCoords; \
uniform sampler2D imageTexture; \
- lowp vec4 customShader(sampler2D texture, vec2 coords); \
+ lowp vec4 customShader(lowp sampler2D texture, highp vec2 coords); \
lowp vec4 srcPixel() { \
return customShader(imageTexture, textureCoords); \
}";
diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp
index e1ee61ae4c..df7811e36e 100644
--- a/src/opengl/qglpixmapfilter.cpp
+++ b/src/opengl/qglpixmapfilter.cpp
@@ -418,7 +418,7 @@ QByteArray QGLPixmapBlurFilter::generateBlurShader(int radius, bool gaussianBlur
source.append("uniform highp vec4 clip;\n");
}
- source.append("lowp vec4 customShader(sampler2D src, vec2 srcCoords) {\n");
+ source.append("lowp vec4 customShader(lowp sampler2D src, highp vec2 srcCoords) {\n");
QVector<qreal> sampleOffsets;
QVector<qreal> weights;
diff --git a/src/opengl/qgraphicsshadereffect.cpp b/src/opengl/qgraphicsshadereffect.cpp
index d3f52f6937..5e37d62135 100644
--- a/src/opengl/qgraphicsshadereffect.cpp
+++ b/src/opengl/qgraphicsshadereffect.cpp
@@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE
The specific effect is defined by a fragment of GLSL source code
supplied to setPixelShaderFragment(). This source code must define a
function with the signature
- \c{lowp vec4 customShader(sampler2D imageTexture, vec2 textureCoords)}
+ \c{lowp vec4 customShader(lowp sampler2D imageTexture, highp vec2 textureCoords)}
that returns the source pixel value
to use in the paint engine's shader program. The shader fragment
is linked with the regular shader code used by the GL2 paint engine
@@ -77,7 +77,7 @@ QT_BEGIN_NAMESPACE
\code
static char const colorizeShaderCode[] =
"uniform lowp vec4 effectColor;\n"
- "lowp vec4 customShader(sampler2D imageTexture, vec2 textureCoords) {\n"
+ "lowp vec4 customShader(lowp sampler2D imageTexture, highp vec2 textureCoords) {\n"
" vec4 src = texture2D(imageTexture, textureCoords);\n"
" float gray = dot(src.rgb, vec3(0.212671, 0.715160, 0.072169));\n"
" vec4 colorize = 1.0-((1.0-gray)*(1.0-effectColor));\n"
@@ -130,7 +130,7 @@ QT_BEGIN_NAMESPACE
*/
static const char qglslDefaultImageFragmentShader[] = "\
- lowp vec4 customShader(sampler2D imageTexture, vec2 textureCoords) { \
+ lowp vec4 customShader(lowp sampler2D imageTexture, highp vec2 textureCoords) { \
return texture2D(imageTexture, textureCoords); \
}\n";
@@ -215,13 +215,13 @@ QByteArray QGraphicsShaderEffect::pixelShaderFragment() const
this shader effect to \a code.
The \a code must define a GLSL function with the signature
- \c{lowp vec4 customShader(sampler2D imageTexture, vec2 textureCoords)}
+ \c{lowp vec4 customShader(lowp sampler2D imageTexture, highp vec2 textureCoords)}
that returns the source pixel value to use in the paint engine's
shader program. The following is the default pixel shader fragment,
which draws a pixmap with no effect applied:
\code
- lowp vec4 customShader(sampler2D imageTexture, vec2 textureCoords) {
+ lowp vec4 customShader(lowp sampler2D imageTexture, highp vec2 textureCoords) {
return texture2D(imageTexture, textureCoords);
}
\endcode