summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-02-14 16:26:01 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-02-15 11:22:41 -0600
commit8f1c580ea164b47644e4dd935e7d30afe5872a96 (patch)
tree8ae51b510c748f2257f2a63e40cbeaaa3b4acc51
parentf030da5ccd08fd552b62d0c68eeddb2ac0b2ac1a (diff)
downloadqtlocation-mapboxgl-8f1c580ea164b47644e4dd935e7d30afe5872a96.tar.gz
[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.
-rw-r--r--src/mbgl/shaders/symbol_sdf.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mbgl/shaders/symbol_sdf.cpp b/src/mbgl/shaders/symbol_sdf.cpp
index 5258d792c9..7554597893 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);