diff options
author | Tom Cooksey <thomas.cooksey@nokia.com> | 2010-04-28 12:18:25 (GMT) |
---|---|---|
committer | Tom Cooksey <thomas.cooksey@nokia.com> | 2010-04-28 12:27:34 (GMT) |
commit | f2d647aa0a203e3598b37abcd69c65aec0d3ef21 (patch) | |
tree | c437b92d18d5e0f0bf7f43667382c445e0810864 /src/opengl/gl2paintengineex | |
parent | 8bde410a6d0b1510d182a365d769db182b1c07dd (diff) | |
download | Qt-f2d647aa0a203e3598b37abcd69c65aec0d3ef21.zip Qt-f2d647aa0a203e3598b37abcd69c65aec0d3ef21.tar.gz Qt-f2d647aa0a203e3598b37abcd69c65aec0d3ef21.tar.bz2 |
Fix crash in styles example when running with opengl graphicssystem
When drawing text using glyphs, the shader manager will select the
"MaskFragmentShader" which requires a varying called "textureCoords"
which is used to sample the glyph from the glyph texture. That's
fine, except when you try to use one of the pattern brushes or a
texture brush, because the src pixel fragment shader snippets for
those brushes also sample from a texture (the brush texture) and name
the verying they use "textureCoords" too. This led to textureCoords
being defined twice, which in turn caused a shader compile error
which then casued the seg-fault. This patch simply renames the
varying used to pass the coordinates for the brush texture so it
doesn't conflict.
Reviewed-By: Kim
Task-Number: QTBUG-9522
Diffstat (limited to 'src/opengl/gl2paintengineex')
-rw-r--r-- | src/opengl/gl2paintengineex/qglengineshadersource_p.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h index 3379296..8dba951 100644 --- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h @@ -282,7 +282,7 @@ static const char* const qglslPositionWithTextureBrushVertexShader = "\n\ uniform mediump vec2 halfViewportSize; \n\ uniform highp vec2 invertedTextureSize; \n\ uniform highp mat3 brushTransform; \n\ - varying highp vec2 textureCoords; \n\ + varying highp vec2 brushTextureCoords; \n\ void setPosition(void) \n\ { \n\ highp mat3 pmvMatrix = mat3(pmvMatrix1, pmvMatrix2, pmvMatrix3); \n\ @@ -292,7 +292,7 @@ static const char* const qglslPositionWithTextureBrushVertexShader = "\n\ mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \n\ mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\ gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\ - textureCoords.xy = (hTexCoords.xy * invertedTextureSize) * gl_Position.w; \n\ + brushTextureCoords.xy = (hTexCoords.xy * invertedTextureSize) * gl_Position.w; \n\ }\n"; static const char* const qglslAffinePositionWithTextureBrushVertexShader @@ -303,28 +303,28 @@ static const char* const qglslAffinePositionWithTextureBrushVertexShader // we emulate GL_REPEAT by only taking the fractional part of the texture coords. // TODO: Special case POT textures which don't need this emulation static const char* const qglslTextureBrushSrcFragmentShader = "\n\ - varying highp vec2 textureCoords; \n\ + varying highp vec2 brushTextureCoords; \n\ uniform lowp sampler2D brushTexture; \n\ lowp vec4 srcPixel() { \n\ - return texture2D(brushTexture, fract(textureCoords)); \n\ + return texture2D(brushTexture, fract(brushTextureCoords)); \n\ }\n"; #else static const char* const qglslTextureBrushSrcFragmentShader = "\n\ - varying highp vec2 textureCoords; \n\ + varying highp vec2 brushTextureCoords; \n\ uniform lowp sampler2D brushTexture; \n\ lowp vec4 srcPixel() \n\ { \n\ - return texture2D(brushTexture, textureCoords); \n\ + return texture2D(brushTexture, brushTextureCoords); \n\ }\n"; #endif static const char* const qglslTextureBrushSrcWithPatternFragmentShader = "\n\ - varying highp vec2 textureCoords; \n\ + varying highp vec2 brushTextureCoords; \n\ uniform lowp vec4 patternColor; \n\ uniform lowp sampler2D brushTexture; \n\ lowp vec4 srcPixel() \n\ { \n\ - return patternColor * (1.0 - texture2D(brushTexture, textureCoords).r); \n\ + return patternColor * (1.0 - texture2D(brushTexture, brushTextureCoords).r); \n\ }\n"; // Solid Fill Brush |