summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJere Tuliniemi <jere.tuliniemi@qt.io>2019-06-05 13:42:19 +0300
committerJere Tuliniemi <jere.tuliniemi@qt.io>2019-06-05 13:44:12 +0300
commitac8b2f7c7b2db8860f8414175e1509b6361f3634 (patch)
tree47e4d43f9b28d2240b25988deb879405b20b1da9
parent765dcd24261026c3fc625cabaf25d7aad35e00c5 (diff)
Fix distance field shaders on OpenGL ES
The shaders contained unnecessary highps and declared fragColor even though the engine automatically adds fragOutput to internal shaders. Change-Id: Ic23b4741aa11e4d52c55fdd82ee79dd919919aeb Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r--src/Runtime/ogl-runtime/res/effectlib/distancefieldtext_core.frag4
-rw-r--r--src/Runtime/ogl-runtime/res/effectlib/distancefieldtext_dropshadow.vert6
-rw-r--r--src/Runtime/ogl-runtime/res/effectlib/distancefieldtext_dropshadow_core.frag4
3 files changed, 5 insertions, 9 deletions
diff --git a/src/Runtime/ogl-runtime/res/effectlib/distancefieldtext_core.frag b/src/Runtime/ogl-runtime/res/effectlib/distancefieldtext_core.frag
index bf60f874..f11dcc1d 100644
--- a/src/Runtime/ogl-runtime/res/effectlib/distancefieldtext_core.frag
+++ b/src/Runtime/ogl-runtime/res/effectlib/distancefieldtext_core.frag
@@ -1,7 +1,5 @@
in vec2 sampleCoord;
-out vec4 fragColor;
-
uniform sampler2D _qt_texture;
uniform vec4 color;
@@ -9,5 +7,5 @@ void main()
{
float distance = texture(_qt_texture, sampleCoord).r;
float f = fwidth(distance);
- fragColor = color * smoothstep(0.5 - f, 0.5, distance);
+ fragOutput = color * smoothstep(0.5 - f, 0.5, distance);
}
diff --git a/src/Runtime/ogl-runtime/res/effectlib/distancefieldtext_dropshadow.vert b/src/Runtime/ogl-runtime/res/effectlib/distancefieldtext_dropshadow.vert
index 835d34dd..5939a8c9 100644
--- a/src/Runtime/ogl-runtime/res/effectlib/distancefieldtext_dropshadow.vert
+++ b/src/Runtime/ogl-runtime/res/effectlib/distancefieldtext_dropshadow.vert
@@ -76,13 +76,13 @@ void main()
alphas = alphaRange(scale);
#endif
- highp vec2 textureSizeMultiplier = vec2(1.0 / highp float(textureWidth),
+ highp vec2 textureSizeMultiplier = vec2(1.0 / float(textureWidth),
1.0 / float(textureHeight));
sampleCoord = tCoord * textureSizeMultiplier;
shadowSampleCoord = (tCoord - shadowOffset) * textureSizeMultiplier;
- normalizedTextureBounds = highp vec4(textureBounds.xy * textureSizeMultiplier,
- textureBounds.zw * textureSizeMultiplier);
+ normalizedTextureBounds = vec4(textureBounds.xy * textureSizeMultiplier,
+ textureBounds.zw * textureSizeMultiplier);
gl_Position = mvp * vec4(vCoord, 1.0);
}
diff --git a/src/Runtime/ogl-runtime/res/effectlib/distancefieldtext_dropshadow_core.frag b/src/Runtime/ogl-runtime/res/effectlib/distancefieldtext_dropshadow_core.frag
index 51aae5a7..e13182ef 100644
--- a/src/Runtime/ogl-runtime/res/effectlib/distancefieldtext_dropshadow_core.frag
+++ b/src/Runtime/ogl-runtime/res/effectlib/distancefieldtext_dropshadow_core.frag
@@ -2,8 +2,6 @@ in vec2 sampleCoord;
in vec2 shadowSampleCoord;
in vec4 normalizedTextureBounds;
-out vec4 fragColor;
-
uniform sampler2D _qt_texture;
uniform vec4 color;
uniform vec4 shadowColor;
@@ -26,5 +24,5 @@ void main()
float textAlpha = smoothstep(0.5 - textDistanceD, 0.5, textDistance);
vec4 textPixel = color * textAlpha;
- fragColor = mix(shadowPixel, textPixel, textPixel.a);
+ fragOutput = mix(shadowPixel, textPixel, textPixel.a);
}