From 8f1c580ea164b47644e4dd935e7d30afe5872a96 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Tue, 14 Feb 2017 16:26:01 -0800 Subject: [PATCH] [core] Fix aliased text on mobile GPUs Need highp precision for gamma values on mobile devices. lowp triggers aliasing artifacts at larger font sizes. Note that this change is a hand-edit to the generated shader sources, rather than pulling https://github.com/mapbox/mapbox-gl-js/pull/4275 and running the generator script. The reason for that is that the upstream shader now assumes support for DDS properties that gl-native does not yet support. Once that support lands in gl-native, we can regenerate the shader source. --- src/mbgl/shaders/symbol_sdf.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mbgl/shaders/symbol_sdf.cpp b/src/mbgl/shaders/symbol_sdf.cpp index 5258d792c..755459789 100644 --- a/src/mbgl/shaders/symbol_sdf.cpp +++ b/src/mbgl/shaders/symbol_sdf.cpp @@ -168,7 +168,7 @@ uniform sampler2D u_fadetexture; uniform lowp vec4 u_color; uniform lowp float u_opacity; uniform lowp float u_buffer; -uniform lowp float u_gamma; +uniform highp float u_gamma; varying vec2 v_tex; varying vec2 v_fade_tex; @@ -177,8 +177,8 @@ varying float v_gamma_scale; void main() { lowp float dist = texture2D(u_texture, v_tex).a; lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a; - lowp float gamma = u_gamma * v_gamma_scale; - lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha; + highp float gamma = u_gamma * v_gamma_scale; + highp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha; gl_FragColor = u_color * (alpha * u_opacity);