Update 2:
Writing v_texCoords.x to the separate float and using it in mix() fixes this bug but only for desktop when #version 100 is also used:
#version 100
uniform sampler2D u_texture;
varying vec4 v_color;
varying vec2 v_texCoords;
uniform float u_smoothing;
void main() {
float x = v_texCoords.x; // Writing to the separate float
// SDF
float distance = texture2D(u_texture, v_texCoords).a;
float alpha = smoothstep(0.5 - u_smoothing, 0.5 + u_smoothing, distance);
vec4 sdfColor = vec4(v_color.rgb, alpha * v_color.a);
// Regular
vec4 regularColor = v_color * texture2D(u_texture, v_texCoords);
// Making a choice
gl_FragColor = mix(regularColor, sdfColor, step(1.0, x)); // Using x instead of v_texCoords.x
}
It doesn't fix the problem on Moto G. Also when I move float x = v_texCoords.x; to the line right before gl_FragColor = ... the problem remains on desktop:
void main() {
// SDF
float distance = texture2D(u_texture, v_texCoords).a;
float alpha = smoothstep(0.5 - u_smoothing, 0.5 + u_smoothing, distance);
vec4 sdfColor = vec4(v_color.rgb, alpha * v_color.a);
// Regular
vec4 regularColor = v_color * texture2D(u_texture, v_texCoords);
// Making a choice
float x = v_texCoords.x; // Writing to the separate float, this time it doesn't fix the bug
gl_FragColor = mix(regularColor, sdfColor, step(1.0, x)); // Using x instead of v_texCoords.x
}