From de3939532af08c37e709d1bae8cf50a57d6f63be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 26 Aug 2009 10:54:33 +0200 Subject: Added missing precision specifiers to custom shader effect. The precision specifiers need to be there on OpenGL ES 2.0. Reviewed-by: Tom --- examples/effects/customshader/customshadereffect.cpp | 2 +- src/opengl/gl2paintengineex/qglengineshadermanager_p.h | 2 +- src/opengl/gl2paintengineex/qglengineshadersource_p.h | 2 +- src/opengl/qglpixmapfilter.cpp | 2 +- src/opengl/qgraphicsshadereffect.cpp | 10 +++++----- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/effects/customshader/customshadereffect.cpp b/examples/effects/customshader/customshadereffect.cpp index 08e4324..69fdb15 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 d5241a8..ace6b63 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 cf930f3..a8e2e72 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 e1ee61a..df7811e 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 sampleOffsets; QVector weights; diff --git a/src/opengl/qgraphicsshadereffect.cpp b/src/opengl/qgraphicsshadereffect.cpp index d3f52f6..5e37d62 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 -- cgit v0.12