summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2018-09-19 13:21:02 -0700
committerChris Loer <chris.loer@mapbox.com>2018-09-19 16:19:28 -0700
commitf7a69d15ab1f43598caaa9498cc7e8aa7a11af0c (patch)
treed02c7a07078e91123e0763f8c7ac120cff223777
parent9b09ec1e6a4de3acfddd8dcd83e9c8596c60e0e0 (diff)
downloadqtlocation-mapboxgl-f7a69d15ab1f43598caaa9498cc7e8aa7a11af0c.tar.gz
[docs] Include uncompressed shader source in .cpp comments
This is meant to (1) Make it easier for new developers to find the source (2) Make it easier to look at shader diffs when the GL JS pin changes
-rwxr-xr-xscripts/generate-shaders.js10
-rw-r--r--src/mbgl/shaders/background.cpp27
-rw-r--r--src/mbgl/shaders/background_pattern.cpp58
-rw-r--r--src/mbgl/shaders/circle.cpp280
-rw-r--r--src/mbgl/shaders/clipping_mask.cpp20
-rw-r--r--src/mbgl/shaders/collision_box.cpp56
-rw-r--r--src/mbgl/shaders/collision_circle.cpp80
-rw-r--r--src/mbgl/shaders/debug.cpp22
-rw-r--r--src/mbgl/shaders/extrusion_texture.cpp32
-rw-r--r--src/mbgl/shaders/fill.cpp84
-rw-r--r--src/mbgl/shaders/fill_extrusion.cpp157
-rw-r--r--src/mbgl/shaders/fill_extrusion_pattern.cpp216
-rw-r--r--src/mbgl/shaders/fill_outline.cpp92
-rw-r--r--src/mbgl/shaders/fill_outline_pattern.cpp166
-rw-r--r--src/mbgl/shaders/fill_pattern.cpp154
-rw-r--r--src/mbgl/shaders/heatmap.cpp121
-rw-r--r--src/mbgl/shaders/heatmap_texture.cpp35
-rw-r--r--src/mbgl/shaders/hillshade.cpp73
-rw-r--r--src/mbgl/shaders/hillshade_prepare.cpp93
-rw-r--r--src/mbgl/shaders/line.cpp233
-rw-r--r--src/mbgl/shaders/line_gradient.cpp215
-rw-r--r--src/mbgl/shaders/line_pattern.cpp302
-rw-r--r--src/mbgl/shaders/line_sdf.cpp295
-rw-r--r--src/mbgl/shaders/raster.cpp83
-rw-r--r--src/mbgl/shaders/symbol_icon.cpp142
-rw-r--r--src/mbgl/shaders/symbol_sdf.cpp297
26 files changed, 3343 insertions, 0 deletions
diff --git a/scripts/generate-shaders.js b/scripts/generate-shaders.js
index ddfdd036a3..a3246c92d9 100755
--- a/scripts/generate-shaders.js
+++ b/scripts/generate-shaders.js
@@ -136,6 +136,16 @@ const char* ${shaderName}::name = "${shaderName}";
const char* ${shaderName}::vertexSource = ${sourceOffset(key, 'vertex')};
const char* ${shaderName}::fragmentSource = ${sourceOffset(key, 'fragment')};
+// Uncompressed source of ${shaderName}.vertex.glsl:
+/*
+${shaders[key].vertexSource}
+*/
+
+// Uncompressed source of ${shaderName}.fragment.glsl:
+/*
+${shaders[key].fragmentSource}
+*/
+
} // namespace shaders
} // namespace mbgl
`);
diff --git a/src/mbgl/shaders/background.cpp b/src/mbgl/shaders/background.cpp
index f03e58b577..0c765baa55 100644
--- a/src/mbgl/shaders/background.cpp
+++ b/src/mbgl/shaders/background.cpp
@@ -10,5 +10,32 @@ const char* background::name = "background";
const char* background::vertexSource = source() + 2739;
const char* background::fragmentSource = source() + 2851;
+// Uncompressed source of background.vertex.glsl:
+/*
+attribute vec2 a_pos;
+
+uniform mat4 u_matrix;
+
+void main() {
+ gl_Position = u_matrix * vec4(a_pos, 0, 1);
+}
+
+*/
+
+// Uncompressed source of background.fragment.glsl:
+/*
+uniform vec4 u_color;
+uniform float u_opacity;
+
+void main() {
+ gl_FragColor = u_color * u_opacity;
+
+#ifdef OVERDRAW_INSPECTOR
+ gl_FragColor = vec4(1.0);
+#endif
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/background_pattern.cpp b/src/mbgl/shaders/background_pattern.cpp
index ded8dd57d0..c3e6303ff4 100644
--- a/src/mbgl/shaders/background_pattern.cpp
+++ b/src/mbgl/shaders/background_pattern.cpp
@@ -10,5 +10,63 @@ const char* background_pattern::name = "background_pattern";
const char* background_pattern::vertexSource = source() + 3020;
const char* background_pattern::fragmentSource = source() + 3664;
+// Uncompressed source of background_pattern.vertex.glsl:
+/*
+uniform mat4 u_matrix;
+uniform vec2 u_pattern_size_a;
+uniform vec2 u_pattern_size_b;
+uniform vec2 u_pixel_coord_upper;
+uniform vec2 u_pixel_coord_lower;
+uniform float u_scale_a;
+uniform float u_scale_b;
+uniform float u_tile_units_to_pixels;
+
+attribute vec2 a_pos;
+
+varying vec2 v_pos_a;
+varying vec2 v_pos_b;
+
+void main() {
+ gl_Position = u_matrix * vec4(a_pos, 0, 1);
+
+ v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, a_pos);
+ v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, a_pos);
+}
+
+*/
+
+// Uncompressed source of background_pattern.fragment.glsl:
+/*
+uniform vec2 u_pattern_tl_a;
+uniform vec2 u_pattern_br_a;
+uniform vec2 u_pattern_tl_b;
+uniform vec2 u_pattern_br_b;
+uniform vec2 u_texsize;
+uniform float u_mix;
+uniform float u_opacity;
+
+uniform sampler2D u_image;
+
+varying vec2 v_pos_a;
+varying vec2 v_pos_b;
+
+void main() {
+ vec2 imagecoord = mod(v_pos_a, 1.0);
+ vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord);
+ vec4 color1 = texture2D(u_image, pos);
+
+ vec2 imagecoord_b = mod(v_pos_b, 1.0);
+ vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b);
+ vec4 color2 = texture2D(u_image, pos2);
+
+ gl_FragColor = mix(color1, color2, u_mix) * u_opacity;
+
+#ifdef OVERDRAW_INSPECTOR
+ gl_FragColor = vec4(1.0);
+#endif
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/circle.cpp b/src/mbgl/shaders/circle.cpp
index e027975533..6027c1773f 100644
--- a/src/mbgl/shaders/circle.cpp
+++ b/src/mbgl/shaders/circle.cpp
@@ -10,5 +10,285 @@ const char* circle::name = "circle";
const char* circle::vertexSource = source() + 4416;
const char* circle::fragmentSource = source() + 8666;
+// Uncompressed source of circle.vertex.glsl:
+/*
+uniform mat4 u_matrix;
+uniform bool u_scale_with_map;
+uniform bool u_pitch_with_map;
+uniform vec2 u_extrude_scale;
+uniform highp float u_camera_to_center_distance;
+
+attribute vec2 a_pos;
+
+
+#ifndef HAS_UNIFORM_u_color
+uniform lowp float a_color_t;
+attribute highp vec4 a_color;
+varying highp vec4 color;
+#else
+uniform highp vec4 u_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_radius
+uniform lowp float a_radius_t;
+attribute mediump vec2 a_radius;
+varying mediump float radius;
+#else
+uniform mediump float u_radius;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_blur
+uniform lowp float a_blur_t;
+attribute lowp vec2 a_blur;
+varying lowp float blur;
+#else
+uniform lowp float u_blur;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+uniform lowp float a_opacity_t;
+attribute lowp vec2 a_opacity;
+varying lowp float opacity;
+#else
+uniform lowp float u_opacity;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_stroke_color
+uniform lowp float a_stroke_color_t;
+attribute highp vec4 a_stroke_color;
+varying highp vec4 stroke_color;
+#else
+uniform highp vec4 u_stroke_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_stroke_width
+uniform lowp float a_stroke_width_t;
+attribute mediump vec2 a_stroke_width;
+varying mediump float stroke_width;
+#else
+uniform mediump float u_stroke_width;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_stroke_opacity
+uniform lowp float a_stroke_opacity_t;
+attribute lowp vec2 a_stroke_opacity;
+varying lowp float stroke_opacity;
+#else
+uniform lowp float u_stroke_opacity;
+#endif
+
+
+varying vec3 v_data;
+
+void main(void) {
+
+#ifndef HAS_UNIFORM_u_color
+ color = unpack_mix_color(a_color, a_color_t);
+#else
+ highp vec4 color = u_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_radius
+ radius = unpack_mix_vec2(a_radius, a_radius_t);
+#else
+ mediump float radius = u_radius;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_blur
+ blur = unpack_mix_vec2(a_blur, a_blur_t);
+#else
+ lowp float blur = u_blur;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+ opacity = unpack_mix_vec2(a_opacity, a_opacity_t);
+#else
+ lowp float opacity = u_opacity;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_stroke_color
+ stroke_color = unpack_mix_color(a_stroke_color, a_stroke_color_t);
+#else
+ highp vec4 stroke_color = u_stroke_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_stroke_width
+ stroke_width = unpack_mix_vec2(a_stroke_width, a_stroke_width_t);
+#else
+ mediump float stroke_width = u_stroke_width;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_stroke_opacity
+ stroke_opacity = unpack_mix_vec2(a_stroke_opacity, a_stroke_opacity_t);
+#else
+ lowp float stroke_opacity = u_stroke_opacity;
+#endif
+
+
+ // unencode the extrusion vector that we snuck into the a_pos vector
+ vec2 extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0);
+
+ // multiply a_pos by 0.5, since we had it * 2 in order to sneak
+ // in extrusion data
+ vec2 circle_center = floor(a_pos * 0.5);
+ if (u_pitch_with_map) {
+ vec2 corner_position = circle_center;
+ if (u_scale_with_map) {
+ corner_position += extrude * (radius + stroke_width) * u_extrude_scale;
+ } else {
+ // Pitching the circle with the map effectively scales it with the map
+ // To counteract the effect for pitch-scale: viewport, we rescale the
+ // whole circle based on the pitch scaling effect at its central point
+ vec4 projected_center = u_matrix * vec4(circle_center, 0, 1);
+ corner_position += extrude * (radius + stroke_width) * u_extrude_scale * (projected_center.w / u_camera_to_center_distance);
+ }
+
+ gl_Position = u_matrix * vec4(corner_position, 0, 1);
+ } else {
+ gl_Position = u_matrix * vec4(circle_center, 0, 1);
+
+ if (u_scale_with_map) {
+ gl_Position.xy += extrude * (radius + stroke_width) * u_extrude_scale * u_camera_to_center_distance;
+ } else {
+ gl_Position.xy += extrude * (radius + stroke_width) * u_extrude_scale * gl_Position.w;
+ }
+ }
+
+ // This is a minimum blur distance that serves as a faux-antialiasing for
+ // the circle. since blur is a ratio of the circle's size and the intent is
+ // to keep the blur at roughly 1px, the two are inversely related.
+ lowp float antialiasblur = 1.0 / DEVICE_PIXEL_RATIO / (radius + stroke_width);
+
+ v_data = vec3(extrude.x, extrude.y, antialiasblur);
+}
+
+*/
+
+// Uncompressed source of circle.fragment.glsl:
+/*
+
+#ifndef HAS_UNIFORM_u_color
+varying highp vec4 color;
+#else
+uniform highp vec4 u_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_radius
+varying mediump float radius;
+#else
+uniform mediump float u_radius;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_blur
+varying lowp float blur;
+#else
+uniform lowp float u_blur;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+varying lowp float opacity;
+#else
+uniform lowp float u_opacity;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_stroke_color
+varying highp vec4 stroke_color;
+#else
+uniform highp vec4 u_stroke_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_stroke_width
+varying mediump float stroke_width;
+#else
+uniform mediump float u_stroke_width;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_stroke_opacity
+varying lowp float stroke_opacity;
+#else
+uniform lowp float u_stroke_opacity;
+#endif
+
+
+varying vec3 v_data;
+
+void main() {
+
+#ifdef HAS_UNIFORM_u_color
+ highp vec4 color = u_color;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_radius
+ mediump float radius = u_radius;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_blur
+ lowp float blur = u_blur;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_opacity
+ lowp float opacity = u_opacity;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_stroke_color
+ highp vec4 stroke_color = u_stroke_color;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_stroke_width
+ mediump float stroke_width = u_stroke_width;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_stroke_opacity
+ lowp float stroke_opacity = u_stroke_opacity;
+#endif
+
+
+ vec2 extrude = v_data.xy;
+ float extrude_length = length(extrude);
+
+ lowp float antialiasblur = v_data.z;
+ float antialiased_blur = -max(blur, antialiasblur);
+
+ float opacity_t = smoothstep(0.0, antialiased_blur, extrude_length - 1.0);
+
+ float color_t = stroke_width < 0.01 ? 0.0 : smoothstep(
+ antialiased_blur,
+ 0.0,
+ extrude_length - radius / (radius + stroke_width)
+ );
+
+ gl_FragColor = opacity_t * mix(color * opacity, stroke_color * stroke_opacity, color_t);
+
+#ifdef OVERDRAW_INSPECTOR
+ gl_FragColor = vec4(1.0);
+#endif
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/clipping_mask.cpp b/src/mbgl/shaders/clipping_mask.cpp
index 9a06ed0f85..767ccb5c86 100644
--- a/src/mbgl/shaders/clipping_mask.cpp
+++ b/src/mbgl/shaders/clipping_mask.cpp
@@ -10,5 +10,25 @@ const char* clipping_mask::name = "clipping_mask";
const char* clipping_mask::vertexSource = source() + 10633;
const char* clipping_mask::fragmentSource = source() + 10745;
+// Uncompressed source of clipping_mask.vertex.glsl:
+/*
+attribute vec2 a_pos;
+
+uniform mat4 u_matrix;
+
+void main() {
+ gl_Position = u_matrix * vec4(a_pos, 0, 1);
+}
+
+*/
+
+// Uncompressed source of clipping_mask.fragment.glsl:
+/*
+void main() {
+ gl_FragColor = vec4(1.0);
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/collision_box.cpp b/src/mbgl/shaders/collision_box.cpp
index 224918c7e8..36e70d0faa 100644
--- a/src/mbgl/shaders/collision_box.cpp
+++ b/src/mbgl/shaders/collision_box.cpp
@@ -10,5 +10,61 @@ const char* collision_box::name = "collision_box";
const char* collision_box::vertexSource = source() + 14428;
const char* collision_box::fragmentSource = source() + 15252;
+// Uncompressed source of collision_box.vertex.glsl:
+/*
+attribute vec2 a_pos;
+attribute vec2 a_anchor_pos;
+attribute vec2 a_extrude;
+attribute vec2 a_placed;
+
+uniform mat4 u_matrix;
+uniform vec2 u_extrude_scale;
+uniform float u_camera_to_center_distance;
+
+varying float v_placed;
+varying float v_notUsed;
+
+void main() {
+ vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1);
+ highp float camera_to_anchor_distance = projectedPoint.w;
+ highp float collision_perspective_ratio = clamp(
+ 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance),
+ 0.0, // Prevents oversized near-field boxes in pitched/overzoomed tiles
+ 4.0);
+
+ gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0);
+ gl_Position.xy += a_extrude * u_extrude_scale * gl_Position.w * collision_perspective_ratio;
+
+ v_placed = a_placed.x;
+ v_notUsed = a_placed.y;
+}
+
+*/
+
+// Uncompressed source of collision_box.fragment.glsl:
+/*
+
+varying float v_placed;
+varying float v_notUsed;
+
+void main() {
+
+ float alpha = 0.5;
+
+ // Red = collision, hide label
+ gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;
+
+ // Blue = no collision, label is showing
+ if (v_placed > 0.5) {
+ gl_FragColor = vec4(0.0, 0.0, 1.0, 0.5) * alpha;
+ }
+
+ if (v_notUsed > 0.5) {
+ // This box not used, fade it out
+ gl_FragColor *= .1;
+ }
+}
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/collision_circle.cpp b/src/mbgl/shaders/collision_circle.cpp
index bcbe569a09..be8b93ba44 100644
--- a/src/mbgl/shaders/collision_circle.cpp
+++ b/src/mbgl/shaders/collision_circle.cpp
@@ -10,5 +10,85 @@ const char* collision_circle::name = "collision_circle";
const char* collision_circle::vertexSource = source() + 15671;
const char* collision_circle::fragmentSource = source() + 16977;
+// Uncompressed source of collision_circle.vertex.glsl:
+/*
+attribute vec2 a_pos;
+attribute vec2 a_anchor_pos;
+attribute vec2 a_extrude;
+attribute vec2 a_placed;
+
+uniform mat4 u_matrix;
+uniform vec2 u_extrude_scale;
+uniform float u_camera_to_center_distance;
+
+varying float v_placed;
+varying float v_notUsed;
+varying float v_radius;
+
+varying vec2 v_extrude;
+varying vec2 v_extrude_scale;
+
+void main() {
+ vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1);
+ highp float camera_to_anchor_distance = projectedPoint.w;
+ highp float collision_perspective_ratio = clamp(
+ 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance),
+ 0.0, // Prevents oversized near-field circles in pitched/overzoomed tiles
+ 4.0);
+
+ gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0);
+
+ highp float padding_factor = 1.2; // Pad the vertices slightly to make room for anti-alias blur
+ gl_Position.xy += a_extrude * u_extrude_scale * padding_factor * gl_Position.w * collision_perspective_ratio;
+
+ v_placed = a_placed.x;
+ v_notUsed = a_placed.y;
+ v_radius = abs(a_extrude.y); // We don't pitch the circles, so both units of the extrusion vector are equal in magnitude to the radius
+
+ v_extrude = a_extrude * padding_factor;
+ v_extrude_scale = u_extrude_scale * u_camera_to_center_distance * collision_perspective_ratio;
+}
+
+*/
+
+// Uncompressed source of collision_circle.fragment.glsl:
+/*
+uniform float u_overscale_factor;
+
+varying float v_placed;
+varying float v_notUsed;
+varying float v_radius;
+varying vec2 v_extrude;
+varying vec2 v_extrude_scale;
+
+void main() {
+ float alpha = 0.5;
+
+ // Red = collision, hide label
+ vec4 color = vec4(1.0, 0.0, 0.0, 1.0) * alpha;
+
+ // Blue = no collision, label is showing
+ if (v_placed > 0.5) {
+ color = vec4(0.0, 0.0, 1.0, 0.5) * alpha;
+ }
+
+ if (v_notUsed > 0.5) {
+ // This box not used, fade it out
+ color *= .2;
+ }
+
+ float extrude_scale_length = length(v_extrude_scale);
+ float extrude_length = length(v_extrude) * extrude_scale_length;
+ float stroke_width = 15.0 * extrude_scale_length / u_overscale_factor;
+ float radius = v_radius * extrude_scale_length;
+
+ float distance_to_edge = abs(extrude_length - radius);
+ float opacity_t = smoothstep(-stroke_width, 0.0, -distance_to_edge);
+
+ gl_FragColor = opacity_t * color;
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/debug.cpp b/src/mbgl/shaders/debug.cpp
index 164387178d..95aaede24f 100644
--- a/src/mbgl/shaders/debug.cpp
+++ b/src/mbgl/shaders/debug.cpp
@@ -10,5 +10,27 @@ const char* debug::name = "debug";
const char* debug::vertexSource = source() + 17919;
const char* debug::fragmentSource = source() + 18031;
+// Uncompressed source of debug.vertex.glsl:
+/*
+attribute vec2 a_pos;
+
+uniform mat4 u_matrix;
+
+void main() {
+ gl_Position = u_matrix * vec4(a_pos, 0, 1);
+}
+
+*/
+
+// Uncompressed source of debug.fragment.glsl:
+/*
+uniform highp vec4 u_color;
+
+void main() {
+ gl_FragColor = u_color;
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/extrusion_texture.cpp b/src/mbgl/shaders/extrusion_texture.cpp
index f529d37625..a3e857c289 100644
--- a/src/mbgl/shaders/extrusion_texture.cpp
+++ b/src/mbgl/shaders/extrusion_texture.cpp
@@ -10,5 +10,37 @@ const char* extrusion_texture::name = "extrusion_texture";
const char* extrusion_texture::vertexSource = source() + 35603;
const char* extrusion_texture::fragmentSource = source() + 35819;
+// Uncompressed source of extrusion_texture.vertex.glsl:
+/*
+uniform mat4 u_matrix;
+uniform vec2 u_world;
+attribute vec2 a_pos;
+varying vec2 v_pos;
+
+void main() {
+ gl_Position = u_matrix * vec4(a_pos * u_world, 0, 1);
+
+ v_pos.x = a_pos.x;
+ v_pos.y = 1.0 - a_pos.y;
+}
+
+*/
+
+// Uncompressed source of extrusion_texture.fragment.glsl:
+/*
+uniform sampler2D u_image;
+uniform float u_opacity;
+varying vec2 v_pos;
+
+void main() {
+ gl_FragColor = texture2D(u_image, v_pos) * u_opacity;
+
+#ifdef OVERDRAW_INSPECTOR
+ gl_FragColor = vec4(0.0);
+#endif
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/fill.cpp b/src/mbgl/shaders/fill.cpp
index 5d38c30e85..94a5191c00 100644
--- a/src/mbgl/shaders/fill.cpp
+++ b/src/mbgl/shaders/fill.cpp
@@ -10,5 +10,89 @@ const char* fill::name = "fill";
const char* fill::vertexSource = source() + 18105;
const char* fill::fragmentSource = source() + 18811;
+// Uncompressed source of fill.vertex.glsl:
+/*
+attribute vec2 a_pos;
+
+uniform mat4 u_matrix;
+
+
+#ifndef HAS_UNIFORM_u_color
+uniform lowp float a_color_t;
+attribute highp vec4 a_color;
+varying highp vec4 color;
+#else
+uniform highp vec4 u_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+uniform lowp float a_opacity_t;
+attribute lowp vec2 a_opacity;
+varying lowp float opacity;
+#else
+uniform lowp float u_opacity;
+#endif
+
+
+void main() {
+
+#ifndef HAS_UNIFORM_u_color
+ color = unpack_mix_color(a_color, a_color_t);
+#else
+ highp vec4 color = u_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+ opacity = unpack_mix_vec2(a_opacity, a_opacity_t);
+#else
+ lowp float opacity = u_opacity;
+#endif
+
+
+ gl_Position = u_matrix * vec4(a_pos, 0, 1);
+}
+
+*/
+
+// Uncompressed source of fill.fragment.glsl:
+/*
+
+#ifndef HAS_UNIFORM_u_color
+varying highp vec4 color;
+#else
+uniform highp vec4 u_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+varying lowp float opacity;
+#else
+uniform lowp float u_opacity;
+#endif
+
+
+void main() {
+
+#ifdef HAS_UNIFORM_u_color
+ highp vec4 color = u_color;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_opacity
+ lowp float opacity = u_opacity;
+#endif
+
+
+ gl_FragColor = color * opacity;
+
+#ifdef OVERDRAW_INSPECTOR
+ gl_FragColor = vec4(1.0);
+#endif
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/fill_extrusion.cpp b/src/mbgl/shaders/fill_extrusion.cpp
index f1b13b2f33..752b2c7ad7 100644
--- a/src/mbgl/shaders/fill_extrusion.cpp
+++ b/src/mbgl/shaders/fill_extrusion.cpp
@@ -10,5 +10,162 @@ const char* fill_extrusion::name = "fill_extrusion";
const char* fill_extrusion::vertexSource = source() + 27816;
const char* fill_extrusion::fragmentSource = source() + 30616;
+// Uncompressed source of fill_extrusion.vertex.glsl:
+/*
+uniform mat4 u_matrix;
+uniform vec3 u_lightcolor;
+uniform lowp vec3 u_lightpos;
+uniform lowp float u_lightintensity;
+
+attribute vec2 a_pos;
+attribute vec4 a_normal_ed;
+
+varying vec4 v_color;
+
+
+#ifndef HAS_UNIFORM_u_base
+uniform lowp float a_base_t;
+attribute lowp vec2 a_base;
+varying lowp float base;
+#else
+uniform lowp float u_base;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_height
+uniform lowp float a_height_t;
+attribute lowp vec2 a_height;
+varying lowp float height;
+#else
+uniform lowp float u_height;
+#endif
+
+
+
+#ifndef HAS_UNIFORM_u_color
+uniform lowp float a_color_t;
+attribute highp vec4 a_color;
+varying highp vec4 color;
+#else
+uniform highp vec4 u_color;
+#endif
+
+
+void main() {
+
+#ifndef HAS_UNIFORM_u_base
+ base = unpack_mix_vec2(a_base, a_base_t);
+#else
+ lowp float base = u_base;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_height
+ height = unpack_mix_vec2(a_height, a_height_t);
+#else
+ lowp float height = u_height;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_color
+ color = unpack_mix_color(a_color, a_color_t);
+#else
+ highp vec4 color = u_color;
+#endif
+
+
+ vec3 normal = a_normal_ed.xyz;
+
+ base = max(0.0, base);
+ height = max(0.0, height);
+
+ float t = mod(normal.x, 2.0);
+
+ gl_Position = u_matrix * vec4(a_pos, t > 0.0 ? height : base, 1);
+
+ // Relative luminance (how dark/bright is the surface color?)
+ float colorvalue = color.r * 0.2126 + color.g * 0.7152 + color.b * 0.0722;
+
+ v_color = vec4(0.0, 0.0, 0.0, 1.0);
+
+ // Add slight ambient lighting so no extrusions are totally black
+ vec4 ambientlight = vec4(0.03, 0.03, 0.03, 1.0);
+ color += ambientlight;
+
+ // Calculate cos(theta), where theta is the angle between surface normal and diffuse light ray
+ float directional = clamp(dot(normal / 16384.0, u_lightpos), 0.0, 1.0);
+
+ // Adjust directional so that
+ // the range of values for highlight/shading is narrower
+ // with lower light intensity
+ // and with lighter/brighter surface colors
+ directional = mix((1.0 - u_lightintensity), max((1.0 - colorvalue + u_lightintensity), 1.0), directional);
+
+ // Add gradient along z axis of side surfaces
+ if (normal.y != 0.0) {
+ directional *= clamp((t + base) * pow(height / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0);
+ }
+
+ // Assign final color based on surface + ambient light color, diffuse light directional, and light color
+ // with lower bounds adjusted to hue of light
+ // so that shading is tinted with the complementary (opposite) color to the light color
+ v_color.r += clamp(color.r * directional * u_lightcolor.r, mix(0.0, 0.3, 1.0 - u_lightcolor.r), 1.0);
+ v_color.g += clamp(color.g * directional * u_lightcolor.g, mix(0.0, 0.3, 1.0 - u_lightcolor.g), 1.0);
+ v_color.b += clamp(color.b * directional * u_lightcolor.b, mix(0.0, 0.3, 1.0 - u_lightcolor.b), 1.0);
+}
+
+*/
+
+// Uncompressed source of fill_extrusion.fragment.glsl:
+/*
+varying vec4 v_color;
+
+#ifndef HAS_UNIFORM_u_base
+varying lowp float base;
+#else
+uniform lowp float u_base;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_height
+varying lowp float height;
+#else
+uniform lowp float u_height;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_color
+varying highp vec4 color;
+#else
+uniform highp vec4 u_color;
+#endif
+
+
+void main() {
+
+#ifdef HAS_UNIFORM_u_base
+ lowp float base = u_base;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_height
+ lowp float height = u_height;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_color
+ highp vec4 color = u_color;
+#endif
+
+
+ gl_FragColor = v_color;
+
+#ifdef OVERDRAW_INSPECTOR
+ gl_FragColor = vec4(1.0);
+#endif
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/fill_extrusion_pattern.cpp b/src/mbgl/shaders/fill_extrusion_pattern.cpp
index aca5563073..083de6c264 100644
--- a/src/mbgl/shaders/fill_extrusion_pattern.cpp
+++ b/src/mbgl/shaders/fill_extrusion_pattern.cpp
@@ -10,5 +10,221 @@ const char* fill_extrusion_pattern::name = "fill_extrusion_pattern";
const char* fill_extrusion_pattern::vertexSource = source() + 30748;
const char* fill_extrusion_pattern::fragmentSource = source() + 34026;
+// Uncompressed source of fill_extrusion_pattern.vertex.glsl:
+/*
+uniform mat4 u_matrix;
+uniform vec2 u_pixel_coord_upper;
+uniform vec2 u_pixel_coord_lower;
+uniform float u_height_factor;
+uniform vec4 u_scale;
+
+uniform vec3 u_lightcolor;
+uniform lowp vec3 u_lightpos;
+uniform lowp float u_lightintensity;
+
+attribute vec2 a_pos;
+attribute vec4 a_normal_ed;
+
+varying vec2 v_pos_a;
+varying vec2 v_pos_b;
+varying vec4 v_lighting;
+
+
+#ifndef HAS_UNIFORM_u_base
+uniform lowp float a_base_t;
+attribute lowp vec2 a_base;
+varying lowp float base;
+#else
+uniform lowp float u_base;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_height
+uniform lowp float a_height_t;
+attribute lowp vec2 a_height;
+varying lowp float height;
+#else
+uniform lowp float u_height;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_from
+uniform lowp float a_pattern_from_t;
+attribute lowp vec4 a_pattern_from;
+varying lowp vec4 pattern_from;
+#else
+uniform lowp vec4 u_pattern_from;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_to
+uniform lowp float a_pattern_to_t;
+attribute lowp vec4 a_pattern_to;
+varying lowp vec4 pattern_to;
+#else
+uniform lowp vec4 u_pattern_to;
+#endif
+
+
+void main() {
+
+#ifndef HAS_UNIFORM_u_base
+ base = unpack_mix_vec2(a_base, a_base_t);
+#else
+ lowp float base = u_base;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_height
+ height = unpack_mix_vec2(a_height, a_height_t);
+#else
+ lowp float height = u_height;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_from
+ pattern_from = a_pattern_from;
+#else
+ mediump vec4 pattern_from = u_pattern_from;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_to
+ pattern_to = a_pattern_to;
+#else
+ mediump vec4 pattern_to = u_pattern_to;
+#endif
+
+
+ vec2 pattern_tl_a = pattern_from.xy;
+ vec2 pattern_br_a = pattern_from.zw;
+ vec2 pattern_tl_b = pattern_to.xy;
+ vec2 pattern_br_b = pattern_to.zw;
+
+ float pixelRatio = u_scale.x;
+ float tileRatio = u_scale.y;
+ float fromScale = u_scale.z;
+ float toScale = u_scale.w;
+
+ vec3 normal = a_normal_ed.xyz;
+ float edgedistance = a_normal_ed.w;
+
+ vec2 display_size_a = vec2((pattern_br_a.x - pattern_tl_a.x) / pixelRatio, (pattern_br_a.y - pattern_tl_a.y) / pixelRatio);
+ vec2 display_size_b = vec2((pattern_br_b.x - pattern_tl_b.x) / pixelRatio, (pattern_br_b.y - pattern_tl_b.y) / pixelRatio);
+
+ base = max(0.0, base);
+ height = max(0.0, height);
+
+ float t = mod(normal.x, 2.0);
+ float z = t > 0.0 ? height : base;
+
+ gl_Position = u_matrix * vec4(a_pos, z, 1);
+
+ vec2 pos = normal.x == 1.0 && normal.y == 0.0 && normal.z == 16384.0
+ ? a_pos // extrusion top
+ : vec2(edgedistance, z * u_height_factor); // extrusion side
+
+ v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, fromScale * display_size_a, tileRatio, pos);
+ v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, toScale * display_size_b, tileRatio, pos);
+
+ v_lighting = vec4(0.0, 0.0, 0.0, 1.0);
+ float directional = clamp(dot(normal / 16383.0, u_lightpos), 0.0, 1.0);
+ directional = mix((1.0 - u_lightintensity), max((0.5 + u_lightintensity), 1.0), directional);
+
+ if (normal.y != 0.0) {
+ directional *= clamp((t + base) * pow(height / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0);
+ }
+
+ v_lighting.rgb += clamp(directional * u_lightcolor, mix(vec3(0.0), vec3(0.3), 1.0 - u_lightcolor), vec3(1.0));
+}
+
+*/
+
+// Uncompressed source of fill_extrusion_pattern.fragment.glsl:
+/*
+uniform vec2 u_texsize;
+uniform float u_fade;
+
+uniform sampler2D u_image;
+
+varying vec2 v_pos_a;
+varying vec2 v_pos_b;
+varying vec4 v_lighting;
+
+
+#ifndef HAS_UNIFORM_u_base
+varying lowp float base;
+#else
+uniform lowp float u_base;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_height
+varying lowp float height;
+#else
+uniform lowp float u_height;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_from
+varying lowp vec4 pattern_from;
+#else
+uniform lowp vec4 u_pattern_from;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_to
+varying lowp vec4 pattern_to;
+#else
+uniform lowp vec4 u_pattern_to;
+#endif
+
+
+void main() {
+
+#ifdef HAS_UNIFORM_u_base
+ lowp float base = u_base;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_height
+ lowp float height = u_height;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_pattern_from
+ mediump vec4 pattern_from = u_pattern_from;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_pattern_to
+ mediump vec4 pattern_to = u_pattern_to;
+#endif
+
+
+ vec2 pattern_tl_a = pattern_from.xy;
+ vec2 pattern_br_a = pattern_from.zw;
+ vec2 pattern_tl_b = pattern_to.xy;
+ vec2 pattern_br_b = pattern_to.zw;
+
+ vec2 imagecoord = mod(v_pos_a, 1.0);
+ vec2 pos = mix(pattern_tl_a / u_texsize, pattern_br_a / u_texsize, imagecoord);
+ vec4 color1 = texture2D(u_image, pos);
+
+ vec2 imagecoord_b = mod(v_pos_b, 1.0);
+ vec2 pos2 = mix(pattern_tl_b / u_texsize, pattern_br_b / u_texsize, imagecoord_b);
+ vec4 color2 = texture2D(u_image, pos2);
+
+ vec4 mixedColor = mix(color1, color2, u_fade);
+
+ gl_FragColor = mixedColor * v_lighting;
+
+#ifdef OVERDRAW_INSPECTOR
+ gl_FragColor = vec4(1.0);
+#endif
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/fill_outline.cpp b/src/mbgl/shaders/fill_outline.cpp
index bcb332d0cb..d56e7139c7 100644
--- a/src/mbgl/shaders/fill_outline.cpp
+++ b/src/mbgl/shaders/fill_outline.cpp
@@ -10,5 +10,97 @@ const char* fill_outline::name = "fill_outline";
const char* fill_outline::vertexSource = source() + 19280;
const char* fill_outline::fragmentSource = source() + 20185;
+// Uncompressed source of fill_outline.vertex.glsl:
+/*
+attribute vec2 a_pos;
+
+uniform mat4 u_matrix;
+uniform vec2 u_world;
+
+varying vec2 v_pos;
+
+
+#ifndef HAS_UNIFORM_u_outline_color
+uniform lowp float a_outline_color_t;
+attribute highp vec4 a_outline_color;
+varying highp vec4 outline_color;
+#else
+uniform highp vec4 u_outline_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+uniform lowp float a_opacity_t;
+attribute lowp vec2 a_opacity;
+varying lowp float opacity;
+#else
+uniform lowp float u_opacity;
+#endif
+
+
+void main() {
+
+#ifndef HAS_UNIFORM_u_outline_color
+ outline_color = unpack_mix_color(a_outline_color, a_outline_color_t);
+#else
+ highp vec4 outline_color = u_outline_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+ opacity = unpack_mix_vec2(a_opacity, a_opacity_t);
+#else
+ lowp float opacity = u_opacity;
+#endif
+
+
+ gl_Position = u_matrix * vec4(a_pos, 0, 1);
+ v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;
+}
+
+*/
+
+// Uncompressed source of fill_outline.fragment.glsl:
+/*
+
+#ifndef HAS_UNIFORM_u_outline_color
+varying highp vec4 outline_color;
+#else
+uniform highp vec4 u_outline_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+varying lowp float opacity;
+#else
+uniform lowp float u_opacity;
+#endif
+
+
+varying vec2 v_pos;
+
+void main() {
+
+#ifdef HAS_UNIFORM_u_outline_color
+ highp vec4 outline_color = u_outline_color;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_opacity
+ lowp float opacity = u_opacity;
+#endif
+
+
+ float dist = length(v_pos - gl_FragCoord.xy);
+ float alpha = 1.0 - smoothstep(0.0, 1.0, dist);
+ gl_FragColor = outline_color * (alpha * opacity);
+
+#ifdef OVERDRAW_INSPECTOR
+ gl_FragColor = vec4(1.0);
+#endif
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/fill_outline_pattern.cpp b/src/mbgl/shaders/fill_outline_pattern.cpp
index 8ea5aee66b..0505f55fee 100644
--- a/src/mbgl/shaders/fill_outline_pattern.cpp
+++ b/src/mbgl/shaders/fill_outline_pattern.cpp
@@ -10,5 +10,171 @@ const char* fill_outline_pattern::name = "fill_outline_pattern";
const char* fill_outline_pattern::vertexSource = source() + 20843;
const char* fill_outline_pattern::fragmentSource = source() + 22928;
+// Uncompressed source of fill_outline_pattern.vertex.glsl:
+/*
+uniform mat4 u_matrix;
+uniform vec2 u_world;
+uniform vec2 u_pixel_coord_upper;
+uniform vec2 u_pixel_coord_lower;
+uniform vec4 u_scale;
+
+attribute vec2 a_pos;
+
+varying vec2 v_pos_a;
+varying vec2 v_pos_b;
+varying vec2 v_pos;
+
+
+#ifndef HAS_UNIFORM_u_opacity
+uniform lowp float a_opacity_t;
+attribute lowp vec2 a_opacity;
+varying lowp float opacity;
+#else
+uniform lowp float u_opacity;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_from
+uniform lowp float a_pattern_from_t;
+attribute lowp vec4 a_pattern_from;
+varying lowp vec4 pattern_from;
+#else
+uniform lowp vec4 u_pattern_from;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_to
+uniform lowp float a_pattern_to_t;
+attribute lowp vec4 a_pattern_to;
+varying lowp vec4 pattern_to;
+#else
+uniform lowp vec4 u_pattern_to;
+#endif
+
+
+void main() {
+
+#ifndef HAS_UNIFORM_u_opacity
+ opacity = unpack_mix_vec2(a_opacity, a_opacity_t);
+#else
+ lowp float opacity = u_opacity;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_from
+ pattern_from = a_pattern_from;
+#else
+ mediump vec4 pattern_from = u_pattern_from;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_to
+ pattern_to = a_pattern_to;
+#else
+ mediump vec4 pattern_to = u_pattern_to;
+#endif
+
+
+ vec2 pattern_tl_a = pattern_from.xy;
+ vec2 pattern_br_a = pattern_from.zw;
+ vec2 pattern_tl_b = pattern_to.xy;
+ vec2 pattern_br_b = pattern_to.zw;
+
+ float pixelRatio = u_scale.x;
+ float tileRatio = u_scale.y;
+ float fromScale = u_scale.z;
+ float toScale = u_scale.w;
+
+ gl_Position = u_matrix * vec4(a_pos, 0, 1);
+
+ vec2 display_size_a = vec2((pattern_br_a.x - pattern_tl_a.x) / pixelRatio, (pattern_br_a.y - pattern_tl_a.y) / pixelRatio);
+ vec2 display_size_b = vec2((pattern_br_b.x - pattern_tl_b.x) / pixelRatio, (pattern_br_b.y - pattern_tl_b.y) / pixelRatio);
+
+ v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, fromScale * display_size_a, tileRatio, a_pos);
+ v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, toScale * display_size_b, tileRatio, a_pos);
+
+ v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;
+}
+
+*/
+
+// Uncompressed source of fill_outline_pattern.fragment.glsl:
+/*
+
+uniform vec2 u_texsize;
+uniform sampler2D u_image;
+uniform float u_fade;
+
+varying vec2 v_pos_a;
+varying vec2 v_pos_b;
+varying vec2 v_pos;
+
+
+#ifndef HAS_UNIFORM_u_opacity
+varying lowp float opacity;
+#else
+uniform lowp float u_opacity;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_from
+varying lowp vec4 pattern_from;
+#else
+uniform lowp vec4 u_pattern_from;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_to
+varying lowp vec4 pattern_to;
+#else
+uniform lowp vec4 u_pattern_to;
+#endif
+
+
+void main() {
+
+#ifdef HAS_UNIFORM_u_opacity
+ lowp float opacity = u_opacity;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_pattern_from
+ mediump vec4 pattern_from = u_pattern_from;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_pattern_to
+ mediump vec4 pattern_to = u_pattern_to;
+#endif
+
+
+ vec2 pattern_tl_a = pattern_from.xy;
+ vec2 pattern_br_a = pattern_from.zw;
+ vec2 pattern_tl_b = pattern_to.xy;
+ vec2 pattern_br_b = pattern_to.zw;
+
+ vec2 imagecoord = mod(v_pos_a, 1.0);
+ vec2 pos = mix(pattern_tl_a / u_texsize, pattern_br_a / u_texsize, imagecoord);
+ vec4 color1 = texture2D(u_image, pos);
+
+ vec2 imagecoord_b = mod(v_pos_b, 1.0);
+ vec2 pos2 = mix(pattern_tl_b / u_texsize, pattern_br_b / u_texsize, imagecoord_b);
+ vec4 color2 = texture2D(u_image, pos2);
+
+ // find distance to outline for alpha interpolation
+
+ float dist = length(v_pos - gl_FragCoord.xy);
+ float alpha = 1.0 - smoothstep(0.0, 1.0, dist);
+
+
+ gl_FragColor = mix(color1, color2, u_fade) * alpha * opacity;
+
+#ifdef OVERDRAW_INSPECTOR
+ gl_FragColor = vec4(1.0);
+#endif
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/fill_pattern.cpp b/src/mbgl/shaders/fill_pattern.cpp
index 27e43a54c4..705b5a0b49 100644
--- a/src/mbgl/shaders/fill_pattern.cpp
+++ b/src/mbgl/shaders/fill_pattern.cpp
@@ -10,5 +10,159 @@ const char* fill_pattern::name = "fill_pattern";
const char* fill_pattern::vertexSource = source() + 24474;
const char* fill_pattern::fragmentSource = source() + 26459;
+// Uncompressed source of fill_pattern.vertex.glsl:
+/*
+uniform mat4 u_matrix;
+uniform vec2 u_pixel_coord_upper;
+uniform vec2 u_pixel_coord_lower;
+uniform vec4 u_scale;
+
+attribute vec2 a_pos;
+
+varying vec2 v_pos_a;
+varying vec2 v_pos_b;
+
+
+#ifndef HAS_UNIFORM_u_opacity
+uniform lowp float a_opacity_t;
+attribute lowp vec2 a_opacity;
+varying lowp float opacity;
+#else
+uniform lowp float u_opacity;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_from
+uniform lowp float a_pattern_from_t;
+attribute lowp vec4 a_pattern_from;
+varying lowp vec4 pattern_from;
+#else
+uniform lowp vec4 u_pattern_from;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_to
+uniform lowp float a_pattern_to_t;
+attribute lowp vec4 a_pattern_to;
+varying lowp vec4 pattern_to;
+#else
+uniform lowp vec4 u_pattern_to;
+#endif
+
+
+void main() {
+
+#ifndef HAS_UNIFORM_u_opacity
+ opacity = unpack_mix_vec2(a_opacity, a_opacity_t);
+#else
+ lowp float opacity = u_opacity;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_from
+ pattern_from = a_pattern_from;
+#else
+ mediump vec4 pattern_from = u_pattern_from;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_to
+ pattern_to = a_pattern_to;
+#else
+ mediump vec4 pattern_to = u_pattern_to;
+#endif
+
+
+ vec2 pattern_tl_a = pattern_from.xy;
+ vec2 pattern_br_a = pattern_from.zw;
+ vec2 pattern_tl_b = pattern_to.xy;
+ vec2 pattern_br_b = pattern_to.zw;
+
+ float pixelRatio = u_scale.x;
+ float tileZoomRatio = u_scale.y;
+ float fromScale = u_scale.z;
+ float toScale = u_scale.w;
+
+ vec2 display_size_a = vec2((pattern_br_a.x - pattern_tl_a.x) / pixelRatio, (pattern_br_a.y - pattern_tl_a.y) / pixelRatio);
+ vec2 display_size_b = vec2((pattern_br_b.x - pattern_tl_b.x) / pixelRatio, (pattern_br_b.y - pattern_tl_b.y) / pixelRatio);
+ gl_Position = u_matrix * vec4(a_pos, 0, 1);
+
+ v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, fromScale * display_size_a, tileZoomRatio, a_pos);
+ v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, toScale * display_size_b, tileZoomRatio, a_pos);
+}
+
+*/
+
+// Uncompressed source of fill_pattern.fragment.glsl:
+/*
+uniform vec2 u_texsize;
+uniform float u_fade;
+
+uniform sampler2D u_image;
+
+varying vec2 v_pos_a;
+varying vec2 v_pos_b;
+
+
+#ifndef HAS_UNIFORM_u_opacity
+varying lowp float opacity;
+#else
+uniform lowp float u_opacity;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_from
+varying lowp vec4 pattern_from;
+#else
+uniform lowp vec4 u_pattern_from;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_to
+varying lowp vec4 pattern_to;
+#else
+uniform lowp vec4 u_pattern_to;
+#endif
+
+
+void main() {
+
+#ifdef HAS_UNIFORM_u_opacity
+ lowp float opacity = u_opacity;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_pattern_from
+ mediump vec4 pattern_from = u_pattern_from;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_pattern_to
+ mediump vec4 pattern_to = u_pattern_to;
+#endif
+
+
+ vec2 pattern_tl_a = pattern_from.xy;
+ vec2 pattern_br_a = pattern_from.zw;
+ vec2 pattern_tl_b = pattern_to.xy;
+ vec2 pattern_br_b = pattern_to.zw;
+
+ vec2 imagecoord = mod(v_pos_a, 1.0);
+ vec2 pos = mix(pattern_tl_a / u_texsize, pattern_br_a / u_texsize, imagecoord);
+ vec4 color1 = texture2D(u_image, pos);
+
+ vec2 imagecoord_b = mod(v_pos_b, 1.0);
+ vec2 pos2 = mix(pattern_tl_b / u_texsize, pattern_br_b / u_texsize, imagecoord_b);
+ vec4 color2 = texture2D(u_image, pos2);
+
+ gl_FragColor = mix(color1, color2, u_fade) * opacity;
+
+#ifdef OVERDRAW_INSPECTOR
+ gl_FragColor = vec4(1.0);
+#endif
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/heatmap.cpp b/src/mbgl/shaders/heatmap.cpp
index 32a45828d1..561d2fad5e 100644
--- a/src/mbgl/shaders/heatmap.cpp
+++ b/src/mbgl/shaders/heatmap.cpp
@@ -10,5 +10,126 @@ const char* heatmap::name = "heatmap";
const char* heatmap::vertexSource = source() + 10792;
const char* heatmap::fragmentSource = source() + 13248;
+// Uncompressed source of heatmap.vertex.glsl:
+/*
+
+#ifndef HAS_UNIFORM_u_weight
+uniform lowp float a_weight_t;
+attribute highp vec2 a_weight;
+varying highp float weight;
+#else
+uniform highp float u_weight;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_radius
+uniform lowp float a_radius_t;
+attribute mediump vec2 a_radius;
+#else
+uniform mediump float u_radius;
+#endif
+
+
+uniform mat4 u_matrix;
+uniform float u_extrude_scale;
+uniform float u_opacity;
+uniform float u_intensity;
+
+attribute vec2 a_pos;
+
+varying vec2 v_extrude;
+
+// Effective "0" in the kernel density texture to adjust the kernel size to;
+// this empirically chosen number minimizes artifacts on overlapping kernels
+// for typical heatmap cases (assuming clustered source)
+const highp float ZERO = 1.0 / 255.0 / 16.0;
+
+// Gaussian kernel coefficient: 1 / sqrt(2 * PI)
+#define GAUSS_COEF 0.3989422804014327
+
+void main(void) {
+
+#ifndef HAS_UNIFORM_u_weight
+ weight = unpack_mix_vec2(a_weight, a_weight_t);
+#else
+ highp float weight = u_weight;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_radius
+ mediump float radius = unpack_mix_vec2(a_radius, a_radius_t);
+#else
+ mediump float radius = u_radius;
+#endif
+
+
+ // unencode the extrusion vector that we snuck into the a_pos vector
+ vec2 unscaled_extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0);
+
+ // This 'extrude' comes in ranging from [-1, -1], to [1, 1]. We'll use
+ // it to produce the vertices of a square mesh framing the point feature
+ // we're adding to the kernel density texture. We'll also pass it as
+ // a varying, so that the fragment shader can determine the distance of
+ // each fragment from the point feature.
+ // Before we do so, we need to scale it up sufficiently so that the
+ // kernel falls effectively to zero at the edge of the mesh.
+ // That is, we want to know S such that
+ // weight * u_intensity * GAUSS_COEF * exp(-0.5 * 3.0^2 * S^2) == ZERO
+ // Which solves to:
+ // S = sqrt(-2.0 * log(ZERO / (weight * u_intensity * GAUSS_COEF))) / 3.0
+ float S = sqrt(-2.0 * log(ZERO / weight / u_intensity / GAUSS_COEF)) / 3.0;
+
+ // Pass the varying in units of radius
+ v_extrude = S * unscaled_extrude;
+
+ // Scale by radius and the zoom-based scale factor to produce actual
+ // mesh position
+ vec2 extrude = v_extrude * radius * u_extrude_scale;
+
+ // multiply a_pos by 0.5, since we had it * 2 in order to sneak
+ // in extrusion data
+ vec4 pos = vec4(floor(a_pos * 0.5) + extrude, 0, 1);
+
+ gl_Position = u_matrix * pos;
+}
+
+*/
+
+// Uncompressed source of heatmap.fragment.glsl:
+/*
+
+#ifndef HAS_UNIFORM_u_weight
+varying highp float weight;
+#else
+uniform highp float u_weight;
+#endif
+
+
+uniform highp float u_intensity;
+varying vec2 v_extrude;
+
+// Gaussian kernel coefficient: 1 / sqrt(2 * PI)
+#define GAUSS_COEF 0.3989422804014327
+
+void main() {
+
+#ifdef HAS_UNIFORM_u_weight
+ highp float weight = u_weight;
+#endif
+
+
+ // Kernel density estimation with a Gaussian kernel of size 5x5
+ float d = -0.5 * 3.0 * 3.0 * dot(v_extrude, v_extrude);
+ float val = weight * u_intensity * GAUSS_COEF * exp(d);
+
+ gl_FragColor = vec4(val, 1.0, 1.0, 1.0);
+
+#ifdef OVERDRAW_INSPECTOR
+ gl_FragColor = vec4(1.0);
+#endif
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/heatmap_texture.cpp b/src/mbgl/shaders/heatmap_texture.cpp
index 527caf4dca..c68cffa506 100644
--- a/src/mbgl/shaders/heatmap_texture.cpp
+++ b/src/mbgl/shaders/heatmap_texture.cpp
@@ -10,5 +10,40 @@ const char* heatmap_texture::name = "heatmap_texture";
const char* heatmap_texture::vertexSource = source() + 13889;
const char* heatmap_texture::fragmentSource = source() + 14105;
+// Uncompressed source of heatmap_texture.vertex.glsl:
+/*
+uniform mat4 u_matrix;
+uniform vec2 u_world;
+attribute vec2 a_pos;
+varying vec2 v_pos;
+
+void main() {
+ gl_Position = u_matrix * vec4(a_pos * u_world, 0, 1);
+
+ v_pos.x = a_pos.x;
+ v_pos.y = 1.0 - a_pos.y;
+}
+
+*/
+
+// Uncompressed source of heatmap_texture.fragment.glsl:
+/*
+uniform sampler2D u_image;
+uniform sampler2D u_color_ramp;
+uniform float u_opacity;
+varying vec2 v_pos;
+
+void main() {
+ float t = texture2D(u_image, v_pos).r;
+ vec4 color = texture2D(u_color_ramp, vec2(t, 0.5));
+ gl_FragColor = color * u_opacity;
+
+#ifdef OVERDRAW_INSPECTOR
+ gl_FragColor = vec4(0.0);
+#endif
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/hillshade.cpp b/src/mbgl/shaders/hillshade.cpp
index 4ff8416d5e..4a2babe278 100644
--- a/src/mbgl/shaders/hillshade.cpp
+++ b/src/mbgl/shaders/hillshade.cpp
@@ -10,5 +10,78 @@ const char* hillshade::name = "hillshade";
const char* hillshade::vertexSource = source() + 38765;
const char* hillshade::fragmentSource = source() + 38964;
+// Uncompressed source of hillshade.vertex.glsl:
+/*
+uniform mat4 u_matrix;
+
+attribute vec2 a_pos;
+attribute vec2 a_texture_pos;
+
+varying vec2 v_pos;
+
+void main() {
+ gl_Position = u_matrix * vec4(a_pos, 0, 1);
+ v_pos = a_texture_pos / 8192.0;
+}
+
+*/
+
+// Uncompressed source of hillshade.fragment.glsl:
+/*
+uniform sampler2D u_image;
+varying vec2 v_pos;
+
+uniform vec2 u_latrange;
+uniform vec2 u_light;
+uniform vec4 u_shadow;
+uniform vec4 u_highlight;
+uniform vec4 u_accent;
+
+#define PI 3.141592653589793
+
+void main() {
+ vec4 pixel = texture2D(u_image, v_pos);
+
+ vec2 deriv = ((pixel.rg * 2.0) - 1.0);
+
+ // We divide the slope by a scale factor based on the cosin of the pixel's approximate latitude
+ // to account for mercator projection distortion. see #4807 for details
+ float scaleFactor = cos(radians((u_latrange[0] - u_latrange[1]) * (1.0 - v_pos.y) + u_latrange[1]));
+ // We also multiply the slope by an arbitrary z-factor of 1.25
+ float slope = atan(1.25 * length(deriv) / scaleFactor);
+ float aspect = deriv.x != 0.0 ? atan(deriv.y, -deriv.x) : PI / 2.0 * (deriv.y > 0.0 ? 1.0 : -1.0);
+
+ float intensity = u_light.x;
+ // We add PI to make this property match the global light object, which adds PI/2 to the light's azimuthal
+ // position property to account for 0deg corresponding to north/the top of the viewport in the style spec
+ // and the original shader was written to accept (-illuminationDirection - 90) as the azimuthal.
+ float azimuth = u_light.y + PI;
+
+ // We scale the slope exponentially based on intensity, using a calculation similar to
+ // the exponential interpolation function in the style spec:
+ // https://github.com/mapbox/mapbox-gl-js/blob/master/src/style-spec/expression/definitions/interpolate.js#L217-L228
+ // so that higher intensity values create more opaque hillshading.
+ float base = 1.875 - intensity * 1.75;
+ float maxValue = 0.5 * PI;
+ float scaledSlope = intensity != 0.5 ? ((pow(base, slope) - 1.0) / (pow(base, maxValue) - 1.0)) * maxValue : slope;
+
+ // The accent color is calculated with the cosine of the slope while the shade color is calculated with the sine
+ // so that the accent color's rate of change eases in while the shade color's eases out.
+ float accent = cos(scaledSlope);
+ // We multiply both the accent and shade color by a clamped intensity value
+ // so that intensities >= 0.5 do not additionally affect the color values
+ // while intensity values < 0.5 make the overall color more transparent.
+ vec4 accent_color = (1.0 - accent) * u_accent * clamp(intensity * 2.0, 0.0, 1.0);
+ float shade = abs(mod((aspect + azimuth) / PI + 0.5, 2.0) - 1.0);
+ vec4 shade_color = mix(u_shadow, u_highlight, shade) * sin(scaledSlope) * clamp(intensity * 2.0, 0.0, 1.0);
+ gl_FragColor = accent_color * (1.0 - shade_color.a) + shade_color;
+
+#ifdef OVERDRAW_INSPECTOR
+ gl_FragColor = vec4(1.0);
+#endif
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/hillshade_prepare.cpp b/src/mbgl/shaders/hillshade_prepare.cpp
index 37bcef6780..b92c374d69 100644
--- a/src/mbgl/shaders/hillshade_prepare.cpp
+++ b/src/mbgl/shaders/hillshade_prepare.cpp
@@ -10,5 +10,98 @@ const char* hillshade_prepare::name = "hillshade_prepare";
const char* hillshade_prepare::vertexSource = source() + 36031;
const char* hillshade_prepare::fragmentSource = source() + 36245;
+// Uncompressed source of hillshade_prepare.vertex.glsl:
+/*
+uniform mat4 u_matrix;
+
+attribute vec2 a_pos;
+attribute vec2 a_texture_pos;
+
+varying vec2 v_pos;
+
+void main() {
+ gl_Position = u_matrix * vec4(a_pos, 0, 1);
+ v_pos = (a_texture_pos / 8192.0) / 2.0 + 0.25;
+}
+
+*/
+
+// Uncompressed source of hillshade_prepare.fragment.glsl:
+/*
+#ifdef GL_ES
+precision highp float;
+#endif
+
+uniform sampler2D u_image;
+varying vec2 v_pos;
+uniform vec2 u_dimension;
+uniform float u_zoom;
+uniform float u_maxzoom;
+
+float getElevation(vec2 coord, float bias) {
+ // Convert encoded elevation value to meters
+ vec4 data = texture2D(u_image, coord) * 255.0;
+ return (data.r + data.g * 256.0 + data.b * 256.0 * 256.0) / 4.0;
+}
+
+void main() {
+ vec2 epsilon = 1.0 / u_dimension;
+
+ // queried pixels:
+ // +-----------+
+ // | | | |
+ // | a | b | c |
+ // | | | |
+ // +-----------+
+ // | | | |
+ // | d | e | f |
+ // | | | |
+ // +-----------+
+ // | | | |
+ // | g | h | i |
+ // | | | |
+ // +-----------+
+
+ float a = getElevation(v_pos + vec2(-epsilon.x, -epsilon.y), 0.0);
+ float b = getElevation(v_pos + vec2(0, -epsilon.y), 0.0);
+ float c = getElevation(v_pos + vec2(epsilon.x, -epsilon.y), 0.0);
+ float d = getElevation(v_pos + vec2(-epsilon.x, 0), 0.0);
+ float e = getElevation(v_pos, 0.0);
+ float f = getElevation(v_pos + vec2(epsilon.x, 0), 0.0);
+ float g = getElevation(v_pos + vec2(-epsilon.x, epsilon.y), 0.0);
+ float h = getElevation(v_pos + vec2(0, epsilon.y), 0.0);
+ float i = getElevation(v_pos + vec2(epsilon.x, epsilon.y), 0.0);
+
+ // here we divide the x and y slopes by 8 * pixel size
+ // where pixel size (aka meters/pixel) is:
+ // circumference of the world / (pixels per tile * number of tiles)
+ // which is equivalent to: 8 * 40075016.6855785 / (512 * pow(2, u_zoom))
+ // which can be reduced to: pow(2, 19.25619978527 - u_zoom)
+ // we want to vertically exaggerate the hillshading though, because otherwise
+ // it is barely noticeable at low zooms. to do this, we multiply this by some
+ // scale factor pow(2, (u_zoom - u_maxzoom) * a) where a is an arbitrary value
+ // Here we use a=0.3 which works out to the expression below. see
+ // nickidlugash's awesome breakdown for more info
+ // https://github.com/mapbox/mapbox-gl-js/pull/5286#discussion_r148419556
+ float exaggeration = u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;
+
+ vec2 deriv = vec2(
+ (c + f + f + i) - (a + d + d + g),
+ (g + h + h + i) - (a + b + b + c)
+ ) / pow(2.0, (u_zoom - u_maxzoom) * exaggeration + 19.2562 - u_zoom);
+
+ gl_FragColor = clamp(vec4(
+ deriv.x / 2.0 + 0.5,
+ deriv.y / 2.0 + 0.5,
+ 1.0,
+ 1.0), 0.0, 1.0);
+
+#ifdef OVERDRAW_INSPECTOR
+ gl_FragColor = vec4(1.0);
+#endif
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/line.cpp b/src/mbgl/shaders/line.cpp
index 100b50d6f6..4b76d21483 100644
--- a/src/mbgl/shaders/line.cpp
+++ b/src/mbgl/shaders/line.cpp
@@ -10,5 +10,238 @@ const char* line::name = "line";
const char* line::vertexSource = source() + 41600;
const char* line::fragmentSource = source() + 46063;
+// Uncompressed source of line.vertex.glsl:
+/*
+
+
+// the distance over which the line edge fades out.
+// Retina devices need a smaller distance to avoid aliasing.
+#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0
+
+// floor(127 / 2) == 63.0
+// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is
+// stored in a byte (-128..127). we scale regular normals up to length 63, but
+// there are also "special" normals that have a bigger length (of up to 126 in
+// this case).
+// #define scale 63.0
+#define scale 0.015873016
+
+attribute vec4 a_pos_normal;
+attribute vec4 a_data;
+
+uniform mat4 u_matrix;
+uniform mediump float u_ratio;
+uniform vec2 u_gl_units_to_pixels;
+
+varying vec2 v_normal;
+varying vec2 v_width2;
+varying float v_gamma_scale;
+varying highp float v_linesofar;
+
+
+#ifndef HAS_UNIFORM_u_color
+uniform lowp float a_color_t;
+attribute highp vec4 a_color;
+varying highp vec4 color;
+#else
+uniform highp vec4 u_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_blur
+uniform lowp float a_blur_t;
+attribute lowp vec2 a_blur;
+varying lowp float blur;
+#else
+uniform lowp float u_blur;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+uniform lowp float a_opacity_t;
+attribute lowp vec2 a_opacity;
+varying lowp float opacity;
+#else
+uniform lowp float u_opacity;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_gapwidth
+uniform lowp float a_gapwidth_t;
+attribute mediump vec2 a_gapwidth;
+#else
+uniform mediump float u_gapwidth;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_offset
+uniform lowp float a_offset_t;
+attribute lowp vec2 a_offset;
+#else
+uniform lowp float u_offset;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_width
+uniform lowp float a_width_t;
+attribute mediump vec2 a_width;
+#else
+uniform mediump float u_width;
+#endif
+
+
+void main() {
+
+#ifndef HAS_UNIFORM_u_color
+ color = unpack_mix_color(a_color, a_color_t);
+#else
+ highp vec4 color = u_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_blur
+ blur = unpack_mix_vec2(a_blur, a_blur_t);
+#else
+ lowp float blur = u_blur;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+ opacity = unpack_mix_vec2(a_opacity, a_opacity_t);
+#else
+ lowp float opacity = u_opacity;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_gapwidth
+ mediump float gapwidth = unpack_mix_vec2(a_gapwidth, a_gapwidth_t);
+#else
+ mediump float gapwidth = u_gapwidth;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_offset
+ lowp float offset = unpack_mix_vec2(a_offset, a_offset_t);
+#else
+ lowp float offset = u_offset;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_width
+ mediump float width = unpack_mix_vec2(a_width, a_width_t);
+#else
+ mediump float width = u_width;
+#endif
+
+
+ vec2 a_extrude = a_data.xy - 128.0;
+ float a_direction = mod(a_data.z, 4.0) - 1.0;
+
+ v_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * 2.0;
+
+ vec2 pos = a_pos_normal.xy;
+
+ // x is 1 if it's a round cap, 0 otherwise
+ // y is 1 if the normal points up, and -1 if it points down
+ mediump vec2 normal = a_pos_normal.zw;
+ v_normal = normal;
+
+ // these transformations used to be applied in the JS and native code bases.
+ // moved them into the shader for clarity and simplicity.
+ gapwidth = gapwidth / 2.0;
+ float halfwidth = width / 2.0;
+ offset = -1.0 * offset;
+
+ float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);
+ float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING);
+
+ // Scale the extrusion vector down to a normal and then up by the line width
+ // of this vertex.
+ mediump vec2 dist = outset * a_extrude * scale;
+
+ // Calculate the offset when drawing a line that is to the side of the actual line.
+ // We do this by creating a vector that points towards the extrude, but rotate
+ // it when we're drawing round end points (a_direction = -1 or 1) since their
+ // extrude vector points in another direction.
+ mediump float u = 0.5 * a_direction;
+ mediump float t = 1.0 - abs(u);
+ mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);
+
+ vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);
+ gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;
+
+ // calculate how much the perspective view squishes or stretches the extrude
+ float extrude_length_without_perspective = length(dist);
+ float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);
+ v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;
+
+ v_width2 = vec2(outset, inset);
+}
+
+*/
+
+// Uncompressed source of line.fragment.glsl:
+/*
+
+#ifndef HAS_UNIFORM_u_color
+varying highp vec4 color;
+#else
+uniform highp vec4 u_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_blur
+varying lowp float blur;
+#else
+uniform lowp float u_blur;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+varying lowp float opacity;
+#else
+uniform lowp float u_opacity;
+#endif
+
+
+varying vec2 v_width2;
+varying vec2 v_normal;
+varying float v_gamma_scale;
+
+void main() {
+
+#ifdef HAS_UNIFORM_u_color
+ highp vec4 color = u_color;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_blur
+ lowp float blur = u_blur;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_opacity
+ lowp float opacity = u_opacity;
+#endif
+
+
+ // Calculate the distance of the pixel from the line in pixels.
+ float dist = length(v_normal) * v_width2.s;
+
+ // Calculate the antialiasing fade factor. This is either when fading in
+ // the line in case of an offset line (v_width2.t) or when fading out
+ // (v_width2.s)
+ float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;
+ float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);
+
+ gl_FragColor = color * (alpha * opacity);
+
+#ifdef OVERDRAW_INSPECTOR
+ gl_FragColor = vec4(1.0);
+#endif
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/line_gradient.cpp b/src/mbgl/shaders/line_gradient.cpp
index 1f3706bfd8..6724f802a3 100644
--- a/src/mbgl/shaders/line_gradient.cpp
+++ b/src/mbgl/shaders/line_gradient.cpp
@@ -10,5 +10,220 @@ const char* line_gradient::name = "line_gradient";
const char* line_gradient::vertexSource = source() + 47235;
const char* line_gradient::fragmentSource = source() + 51544;
+// Uncompressed source of line_gradient.vertex.glsl:
+/*
+
+// the attribute conveying progress along a line is scaled to [0, 2^15)
+#define MAX_LINE_DISTANCE 32767.0
+
+// the distance over which the line edge fades out.
+// Retina devices need a smaller distance to avoid aliasing.
+#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0
+
+// floor(127 / 2) == 63.0
+// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is
+// stored in a byte (-128..127). we scale regular normals up to length 63, but
+// there are also "special" normals that have a bigger length (of up to 126 in
+// this case).
+// #define scale 63.0
+#define scale 0.015873016
+
+attribute vec4 a_pos_normal;
+attribute vec4 a_data;
+
+uniform mat4 u_matrix;
+uniform mediump float u_ratio;
+uniform vec2 u_gl_units_to_pixels;
+
+varying vec2 v_normal;
+varying vec2 v_width2;
+varying float v_gamma_scale;
+varying highp float v_lineprogress;
+
+
+#ifndef HAS_UNIFORM_u_blur
+uniform lowp float a_blur_t;
+attribute lowp vec2 a_blur;
+varying lowp float blur;
+#else
+uniform lowp float u_blur;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+uniform lowp float a_opacity_t;
+attribute lowp vec2 a_opacity;
+varying lowp float opacity;
+#else
+uniform lowp float u_opacity;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_gapwidth
+uniform lowp float a_gapwidth_t;
+attribute mediump vec2 a_gapwidth;
+#else
+uniform mediump float u_gapwidth;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_offset
+uniform lowp float a_offset_t;
+attribute lowp vec2 a_offset;
+#else
+uniform lowp float u_offset;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_width
+uniform lowp float a_width_t;
+attribute mediump vec2 a_width;
+#else
+uniform mediump float u_width;
+#endif
+
+
+void main() {
+
+#ifndef HAS_UNIFORM_u_blur
+ blur = unpack_mix_vec2(a_blur, a_blur_t);
+#else
+ lowp float blur = u_blur;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+ opacity = unpack_mix_vec2(a_opacity, a_opacity_t);
+#else
+ lowp float opacity = u_opacity;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_gapwidth
+ mediump float gapwidth = unpack_mix_vec2(a_gapwidth, a_gapwidth_t);
+#else
+ mediump float gapwidth = u_gapwidth;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_offset
+ lowp float offset = unpack_mix_vec2(a_offset, a_offset_t);
+#else
+ lowp float offset = u_offset;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_width
+ mediump float width = unpack_mix_vec2(a_width, a_width_t);
+#else
+ mediump float width = u_width;
+#endif
+
+
+ vec2 a_extrude = a_data.xy - 128.0;
+ float a_direction = mod(a_data.z, 4.0) - 1.0;
+
+ v_lineprogress = (floor(a_data.z / 4.0) + a_data.w * 64.0) * 2.0 / MAX_LINE_DISTANCE;
+
+ vec2 pos = a_pos_normal.xy;
+
+ // x is 1 if it's a round cap, 0 otherwise
+ // y is 1 if the normal points up, and -1 if it points down
+ mediump vec2 normal = a_pos_normal.zw;
+ v_normal = normal;
+
+ // these transformations used to be applied in the JS and native code bases.
+ // moved them into the shader for clarity and simplicity.
+ gapwidth = gapwidth / 2.0;
+ float halfwidth = width / 2.0;
+ offset = -1.0 * offset;
+
+ float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);
+ float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING);
+
+ // Scale the extrusion vector down to a normal and then up by the line width
+ // of this vertex.
+ mediump vec2 dist = outset * a_extrude * scale;
+
+ // Calculate the offset when drawing a line that is to the side of the actual line.
+ // We do this by creating a vector that points towards the extrude, but rotate
+ // it when we're drawing round end points (a_direction = -1 or 1) since their
+ // extrude vector points in another direction.
+ mediump float u = 0.5 * a_direction;
+ mediump float t = 1.0 - abs(u);
+ mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);
+
+ vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);
+ gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;
+
+ // calculate how much the perspective view squishes or stretches the extrude
+ float extrude_length_without_perspective = length(dist);
+ float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);
+ v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;
+
+ v_width2 = vec2(outset, inset);
+}
+
+*/
+
+// Uncompressed source of line_gradient.fragment.glsl:
+/*
+
+
+#ifndef HAS_UNIFORM_u_blur
+varying lowp float blur;
+#else
+uniform lowp float u_blur;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+varying lowp float opacity;
+#else
+uniform lowp float u_opacity;
+#endif
+
+
+uniform sampler2D u_image;
+
+varying vec2 v_width2;
+varying vec2 v_normal;
+varying float v_gamma_scale;
+varying highp float v_lineprogress;
+
+void main() {
+
+#ifdef HAS_UNIFORM_u_blur
+ lowp float blur = u_blur;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_opacity
+ lowp float opacity = u_opacity;
+#endif
+
+
+ // Calculate the distance of the pixel from the line in pixels.
+ float dist = length(v_normal) * v_width2.s;
+
+ // Calculate the antialiasing fade factor. This is either when fading in
+ // the line in case of an offset line (v_width2.t) or when fading out
+ // (v_width2.s)
+ float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;
+ float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);
+
+ // For gradient lines, v_lineprogress is the ratio along the entire line,
+ // scaled to [0, 2^15), and the gradient ramp is stored in a texture.
+ vec4 color = texture2D(u_image, vec2(v_lineprogress, 0.5));
+
+ gl_FragColor = color * (alpha * opacity);
+
+#ifdef OVERDRAW_INSPECTOR
+ gl_FragColor = vec4(1.0);
+#endif
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/line_pattern.cpp b/src/mbgl/shaders/line_pattern.cpp
index 726fb8f604..ad1ea153c3 100644
--- a/src/mbgl/shaders/line_pattern.cpp
+++ b/src/mbgl/shaders/line_pattern.cpp
@@ -10,5 +10,307 @@ const char* line_pattern::name = "line_pattern";
const char* line_pattern::vertexSource = source() + 52829;
const char* line_pattern::fragmentSource = source() + 57905;
+// Uncompressed source of line_pattern.vertex.glsl:
+/*
+// floor(127 / 2) == 63.0
+// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is
+// stored in a byte (-128..127). we scale regular normals up to length 63, but
+// there are also "special" normals that have a bigger length (of up to 126 in
+// this case).
+// #define scale 63.0
+#define scale 0.015873016
+
+// We scale the distance before adding it to the buffers so that we can store
+// long distances for long segments. Use this value to unscale the distance.
+#define LINE_DISTANCE_SCALE 2.0
+
+// the distance over which the line edge fades out.
+// Retina devices need a smaller distance to avoid aliasing.
+#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0
+
+attribute vec4 a_pos_normal;
+attribute vec4 a_data;
+
+uniform mat4 u_matrix;
+uniform vec2 u_gl_units_to_pixels;
+uniform mediump float u_ratio;
+
+varying vec2 v_normal;
+varying vec2 v_width2;
+varying float v_linesofar;
+varying float v_gamma_scale;
+
+
+#ifndef HAS_UNIFORM_u_blur
+uniform lowp float a_blur_t;
+attribute lowp vec2 a_blur;
+varying lowp float blur;
+#else
+uniform lowp float u_blur;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+uniform lowp float a_opacity_t;
+attribute lowp vec2 a_opacity;
+varying lowp float opacity;
+#else
+uniform lowp float u_opacity;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_offset
+uniform lowp float a_offset_t;
+attribute lowp vec2 a_offset;
+#else
+uniform lowp float u_offset;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_gapwidth
+uniform lowp float a_gapwidth_t;
+attribute mediump vec2 a_gapwidth;
+#else
+uniform mediump float u_gapwidth;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_width
+uniform lowp float a_width_t;
+attribute mediump vec2 a_width;
+#else
+uniform mediump float u_width;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_from
+uniform lowp float a_pattern_from_t;
+attribute lowp vec4 a_pattern_from;
+varying lowp vec4 pattern_from;
+#else
+uniform lowp vec4 u_pattern_from;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_to
+uniform lowp float a_pattern_to_t;
+attribute lowp vec4 a_pattern_to;
+varying lowp vec4 pattern_to;
+#else
+uniform lowp vec4 u_pattern_to;
+#endif
+
+
+void main() {
+
+#ifndef HAS_UNIFORM_u_blur
+ blur = unpack_mix_vec2(a_blur, a_blur_t);
+#else
+ lowp float blur = u_blur;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+ opacity = unpack_mix_vec2(a_opacity, a_opacity_t);
+#else
+ lowp float opacity = u_opacity;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_offset
+ lowp float offset = unpack_mix_vec2(a_offset, a_offset_t);
+#else
+ lowp float offset = u_offset;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_gapwidth
+ mediump float gapwidth = unpack_mix_vec2(a_gapwidth, a_gapwidth_t);
+#else
+ mediump float gapwidth = u_gapwidth;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_width
+ mediump float width = unpack_mix_vec2(a_width, a_width_t);
+#else
+ mediump float width = u_width;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_from
+ pattern_from = a_pattern_from;
+#else
+ mediump vec4 pattern_from = u_pattern_from;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_to
+ pattern_to = a_pattern_to;
+#else
+ mediump vec4 pattern_to = u_pattern_to;
+#endif
+
+
+ vec2 a_extrude = a_data.xy - 128.0;
+ float a_direction = mod(a_data.z, 4.0) - 1.0;
+ float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;
+ // float tileRatio = u_scale.y;
+ vec2 pos = a_pos_normal.xy;
+
+ // x is 1 if it's a round cap, 0 otherwise
+ // y is 1 if the normal points up, and -1 if it points down
+ mediump vec2 normal = a_pos_normal.zw;
+ v_normal = normal;
+
+ // these transformations used to be applied in the JS and native code bases.
+ // moved them into the shader for clarity and simplicity.
+ gapwidth = gapwidth / 2.0;
+ float halfwidth = width / 2.0;
+ offset = -1.0 * offset;
+
+ float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);
+ float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING);
+
+ // Scale the extrusion vector down to a normal and then up by the line width
+ // of this vertex.
+ mediump vec2 dist = outset * a_extrude * scale;
+
+ // Calculate the offset when drawing a line that is to the side of the actual line.
+ // We do this by creating a vector that points towards the extrude, but rotate
+ // it when we're drawing round end points (a_direction = -1 or 1) since their
+ // extrude vector points in another direction.
+ mediump float u = 0.5 * a_direction;
+ mediump float t = 1.0 - abs(u);
+ mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);
+
+ vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);
+ gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;
+
+ // calculate how much the perspective view squishes or stretches the extrude
+ float extrude_length_without_perspective = length(dist);
+ float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);
+ v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;
+
+ v_linesofar = a_linesofar;
+ v_width2 = vec2(outset, inset);
+}
+
+*/
+
+// Uncompressed source of line_pattern.fragment.glsl:
+/*
+uniform vec2 u_texsize;
+uniform float u_fade;
+uniform mediump vec4 u_scale;
+
+uniform sampler2D u_image;
+
+varying vec2 v_normal;
+varying vec2 v_width2;
+varying float v_linesofar;
+varying float v_gamma_scale;
+
+
+#ifndef HAS_UNIFORM_u_pattern_from
+varying lowp vec4 pattern_from;
+#else
+uniform lowp vec4 u_pattern_from;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_pattern_to
+varying lowp vec4 pattern_to;
+#else
+uniform lowp vec4 u_pattern_to;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_blur
+varying lowp float blur;
+#else
+uniform lowp float u_blur;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+varying lowp float opacity;
+#else
+uniform lowp float u_opacity;
+#endif
+
+
+void main() {
+
+#ifdef HAS_UNIFORM_u_pattern_from
+ mediump vec4 pattern_from = u_pattern_from;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_pattern_to
+ mediump vec4 pattern_to = u_pattern_to;
+#endif
+
+
+
+#ifdef HAS_UNIFORM_u_blur
+ lowp float blur = u_blur;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_opacity
+ lowp float opacity = u_opacity;
+#endif
+
+
+ vec2 pattern_tl_a = pattern_from.xy;
+ vec2 pattern_br_a = pattern_from.zw;
+ vec2 pattern_tl_b = pattern_to.xy;
+ vec2 pattern_br_b = pattern_to.zw;
+
+ float pixelRatio = u_scale.x;
+ float tileZoomRatio = u_scale.y;
+ float fromScale = u_scale.z;
+ float toScale = u_scale.w;
+
+ vec2 display_size_a = vec2((pattern_br_a.x - pattern_tl_a.x) / pixelRatio, (pattern_br_a.y - pattern_tl_a.y) / pixelRatio);
+ vec2 display_size_b = vec2((pattern_br_b.x - pattern_tl_b.x) / pixelRatio, (pattern_br_b.y - pattern_tl_b.y) / pixelRatio);
+
+ vec2 pattern_size_a = vec2(display_size_a.x * fromScale / tileZoomRatio, display_size_a.y);
+ vec2 pattern_size_b = vec2(display_size_b.x * toScale / tileZoomRatio, display_size_b.y);
+
+ // Calculate the distance of the pixel from the line in pixels.
+ float dist = length(v_normal) * v_width2.s;
+
+ // Calculate the antialiasing fade factor. This is either when fading in
+ // the line in case of an offset line (v_width2.t) or when fading out
+ // (v_width2.s)
+ float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;
+ float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);
+
+ float x_a = mod(v_linesofar / pattern_size_a.x, 1.0);
+ float x_b = mod(v_linesofar / pattern_size_b.x, 1.0);
+
+ // v_normal.y is 0 at the midpoint of the line, -1 at the lower edge, 1 at the upper edge
+ // we clamp the line width outset to be between 0 and half the pattern height plus padding (2.0)
+ // to ensure we don't sample outside the designated symbol on the sprite sheet.
+ // 0.5 is added to shift the component to be bounded between 0 and 1 for interpolation of
+ // the texture coordinate
+ float y_a = 0.5 + (v_normal.y * clamp(v_width2.s, 0.0, (pattern_size_a.y + 2.0) / 2.0) / pattern_size_a.y);
+ float y_b = 0.5 + (v_normal.y * clamp(v_width2.s, 0.0, (pattern_size_b.y + 2.0) / 2.0) / pattern_size_b.y);
+ vec2 pos_a = mix(pattern_tl_a / u_texsize, pattern_br_a / u_texsize, vec2(x_a, y_a));
+ vec2 pos_b = mix(pattern_tl_b / u_texsize, pattern_br_b / u_texsize, vec2(x_b, y_b));
+
+ vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);
+
+ gl_FragColor = color * alpha * opacity;
+
+#ifdef OVERDRAW_INSPECTOR
+ gl_FragColor = vec4(1.0);
+#endif
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/line_sdf.cpp b/src/mbgl/shaders/line_sdf.cpp
index ad8644a7d5..2573d9fd3f 100644
--- a/src/mbgl/shaders/line_sdf.cpp
+++ b/src/mbgl/shaders/line_sdf.cpp
@@ -10,5 +10,300 @@ const char* line_sdf::name = "line_sdf";
const char* line_sdf::vertexSource = source() + 61204;
const char* line_sdf::fragmentSource = source() + 66571;
+// Uncompressed source of line_sdf.vertex.glsl:
+/*
+// floor(127 / 2) == 63.0
+// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is
+// stored in a byte (-128..127). we scale regular normals up to length 63, but
+// there are also "special" normals that have a bigger length (of up to 126 in
+// this case).
+// #define scale 63.0
+#define scale 0.015873016
+
+// We scale the distance before adding it to the buffers so that we can store
+// long distances for long segments. Use this value to unscale the distance.
+#define LINE_DISTANCE_SCALE 2.0
+
+// the distance over which the line edge fades out.
+// Retina devices need a smaller distance to avoid aliasing.
+#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0
+
+attribute vec4 a_pos_normal;
+attribute vec4 a_data;
+
+uniform mat4 u_matrix;
+uniform mediump float u_ratio;
+uniform vec2 u_patternscale_a;
+uniform float u_tex_y_a;
+uniform vec2 u_patternscale_b;
+uniform float u_tex_y_b;
+uniform vec2 u_gl_units_to_pixels;
+
+varying vec2 v_normal;
+varying vec2 v_width2;
+varying vec2 v_tex_a;
+varying vec2 v_tex_b;
+varying float v_gamma_scale;
+
+
+#ifndef HAS_UNIFORM_u_color
+uniform lowp float a_color_t;
+attribute highp vec4 a_color;
+varying highp vec4 color;
+#else
+uniform highp vec4 u_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_blur
+uniform lowp float a_blur_t;
+attribute lowp vec2 a_blur;
+varying lowp float blur;
+#else
+uniform lowp float u_blur;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+uniform lowp float a_opacity_t;
+attribute lowp vec2 a_opacity;
+varying lowp float opacity;
+#else
+uniform lowp float u_opacity;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_gapwidth
+uniform lowp float a_gapwidth_t;
+attribute mediump vec2 a_gapwidth;
+#else
+uniform mediump float u_gapwidth;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_offset
+uniform lowp float a_offset_t;
+attribute lowp vec2 a_offset;
+#else
+uniform lowp float u_offset;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_width
+uniform lowp float a_width_t;
+attribute mediump vec2 a_width;
+varying mediump float width;
+#else
+uniform mediump float u_width;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_floorwidth
+uniform lowp float a_floorwidth_t;
+attribute lowp vec2 a_floorwidth;
+varying lowp float floorwidth;
+#else
+uniform lowp float u_floorwidth;
+#endif
+
+
+void main() {
+
+#ifndef HAS_UNIFORM_u_color
+ color = unpack_mix_color(a_color, a_color_t);
+#else
+ highp vec4 color = u_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_blur
+ blur = unpack_mix_vec2(a_blur, a_blur_t);
+#else
+ lowp float blur = u_blur;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+ opacity = unpack_mix_vec2(a_opacity, a_opacity_t);
+#else
+ lowp float opacity = u_opacity;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_gapwidth
+ mediump float gapwidth = unpack_mix_vec2(a_gapwidth, a_gapwidth_t);
+#else
+ mediump float gapwidth = u_gapwidth;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_offset
+ lowp float offset = unpack_mix_vec2(a_offset, a_offset_t);
+#else
+ lowp float offset = u_offset;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_width
+ width = unpack_mix_vec2(a_width, a_width_t);
+#else
+ mediump float width = u_width;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_floorwidth
+ floorwidth = unpack_mix_vec2(a_floorwidth, a_floorwidth_t);
+#else
+ lowp float floorwidth = u_floorwidth;
+#endif
+
+
+ vec2 a_extrude = a_data.xy - 128.0;
+ float a_direction = mod(a_data.z, 4.0) - 1.0;
+ float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;
+
+ vec2 pos = a_pos_normal.xy;
+
+ // x is 1 if it's a round cap, 0 otherwise
+ // y is 1 if the normal points up, and -1 if it points down
+ mediump vec2 normal = a_pos_normal.zw;
+ v_normal = normal;
+
+ // these transformations used to be applied in the JS and native code bases.
+ // moved them into the shader for clarity and simplicity.
+ gapwidth = gapwidth / 2.0;
+ float halfwidth = width / 2.0;
+ offset = -1.0 * offset;
+
+ float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);
+ float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING);
+
+ // Scale the extrusion vector down to a normal and then up by the line width
+ // of this vertex.
+ mediump vec2 dist =outset * a_extrude * scale;
+
+ // Calculate the offset when drawing a line that is to the side of the actual line.
+ // We do this by creating a vector that points towards the extrude, but rotate
+ // it when we're drawing round end points (a_direction = -1 or 1) since their
+ // extrude vector points in another direction.
+ mediump float u = 0.5 * a_direction;
+ mediump float t = 1.0 - abs(u);
+ mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);
+
+ vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);
+ gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;
+
+ // calculate how much the perspective view squishes or stretches the extrude
+ float extrude_length_without_perspective = length(dist);
+ float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);
+ v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;
+
+ v_tex_a = vec2(a_linesofar * u_patternscale_a.x / floorwidth, normal.y * u_patternscale_a.y + u_tex_y_a);
+ v_tex_b = vec2(a_linesofar * u_patternscale_b.x / floorwidth, normal.y * u_patternscale_b.y + u_tex_y_b);
+
+ v_width2 = vec2(outset, inset);
+}
+
+*/
+
+// Uncompressed source of line_sdf.fragment.glsl:
+/*
+
+uniform sampler2D u_image;
+uniform float u_sdfgamma;
+uniform float u_mix;
+
+varying vec2 v_normal;
+varying vec2 v_width2;
+varying vec2 v_tex_a;
+varying vec2 v_tex_b;
+varying float v_gamma_scale;
+
+
+#ifndef HAS_UNIFORM_u_color
+varying highp vec4 color;
+#else
+uniform highp vec4 u_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_blur
+varying lowp float blur;
+#else
+uniform lowp float u_blur;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+varying lowp float opacity;
+#else
+uniform lowp float u_opacity;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_width
+varying mediump float width;
+#else
+uniform mediump float u_width;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_floorwidth
+varying lowp float floorwidth;
+#else
+uniform lowp float u_floorwidth;
+#endif
+
+
+void main() {
+
+#ifdef HAS_UNIFORM_u_color
+ highp vec4 color = u_color;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_blur
+ lowp float blur = u_blur;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_opacity
+ lowp float opacity = u_opacity;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_width
+ mediump float width = u_width;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_floorwidth
+ lowp float floorwidth = u_floorwidth;
+#endif
+
+
+ // Calculate the distance of the pixel from the line in pixels.
+ float dist = length(v_normal) * v_width2.s;
+
+ // Calculate the antialiasing fade factor. This is either when fading in
+ // the line in case of an offset line (v_width2.t) or when fading out
+ // (v_width2.s)
+ float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;
+ float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);
+
+ float sdfdist_a = texture2D(u_image, v_tex_a).a;
+ float sdfdist_b = texture2D(u_image, v_tex_b).a;
+ float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);
+ alpha *= smoothstep(0.5 - u_sdfgamma / floorwidth, 0.5 + u_sdfgamma / floorwidth, sdfdist);
+
+ gl_FragColor = color * (alpha * opacity);
+
+#ifdef OVERDRAW_INSPECTOR
+ gl_FragColor = vec4(1.0);
+#endif
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/raster.cpp b/src/mbgl/shaders/raster.cpp
index b17d013546..67d7542516 100644
--- a/src/mbgl/shaders/raster.cpp
+++ b/src/mbgl/shaders/raster.cpp
@@ -10,5 +10,88 @@ const char* raster::name = "raster";
const char* raster::vertexSource = source() + 68497;
const char* raster::fragmentSource = source() + 69310;
+// Uncompressed source of raster.vertex.glsl:
+/*
+uniform mat4 u_matrix;
+uniform vec2 u_tl_parent;
+uniform float u_scale_parent;
+uniform float u_buffer_scale;
+
+attribute vec2 a_pos;
+attribute vec2 a_texture_pos;
+
+varying vec2 v_pos0;
+varying vec2 v_pos1;
+
+void main() {
+ gl_Position = u_matrix * vec4(a_pos, 0, 1);
+ // We are using Int16 for texture position coordinates to give us enough precision for
+ // fractional coordinates. We use 8192 to scale the texture coordinates in the buffer
+ // as an arbitrarily high number to preserve adequate precision when rendering.
+ // This is also the same value as the EXTENT we are using for our tile buffer pos coordinates,
+ // so math for modifying either is consistent.
+ v_pos0 = (((a_texture_pos / 8192.0) - 0.5) / u_buffer_scale ) + 0.5;
+ v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;
+}
+
+*/
+
+// Uncompressed source of raster.fragment.glsl:
+/*
+uniform float u_fade_t;
+uniform float u_opacity;
+uniform sampler2D u_image0;
+uniform sampler2D u_image1;
+varying vec2 v_pos0;
+varying vec2 v_pos1;
+
+uniform float u_brightness_low;
+uniform float u_brightness_high;
+
+uniform float u_saturation_factor;
+uniform float u_contrast_factor;
+uniform vec3 u_spin_weights;
+
+void main() {
+
+ // read and cross-fade colors from the main and parent tiles
+ vec4 color0 = texture2D(u_image0, v_pos0);
+ vec4 color1 = texture2D(u_image1, v_pos1);
+ if (color0.a > 0.0) {
+ color0.rgb = color0.rgb / color0.a;
+ }
+ if (color1.a > 0.0) {
+ color1.rgb = color1.rgb / color1.a;
+ }
+ vec4 color = mix(color0, color1, u_fade_t);
+ color.a *= u_opacity;
+ vec3 rgb = color.rgb;
+
+ // spin
+ rgb = vec3(
+ dot(rgb, u_spin_weights.xyz),
+ dot(rgb, u_spin_weights.zxy),
+ dot(rgb, u_spin_weights.yzx));
+
+ // saturation
+ float average = (color.r + color.g + color.b) / 3.0;
+ rgb += (average - rgb) * u_saturation_factor;
+
+ // contrast
+ rgb = (rgb - 0.5) * u_contrast_factor + 0.5;
+
+ // brightness
+ vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);
+ vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);
+
+ gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb) * color.a, color.a);
+
+#ifdef OVERDRAW_INSPECTOR
+ gl_FragColor = vec4(1.0);
+#endif
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/symbol_icon.cpp b/src/mbgl/shaders/symbol_icon.cpp
index 47b9c9b331..5b34d490bb 100644
--- a/src/mbgl/shaders/symbol_icon.cpp
+++ b/src/mbgl/shaders/symbol_icon.cpp
@@ -10,5 +10,147 @@ const char* symbol_icon::name = "symbol_icon";
const char* symbol_icon::vertexSource = source() + 70714;
const char* symbol_icon::fragmentSource = source() + 74120;
+// Uncompressed source of symbol_icon.vertex.glsl:
+/*
+const float PI = 3.141592653589793;
+
+attribute vec4 a_pos_offset;
+attribute vec4 a_data;
+attribute vec3 a_projected_pos;
+attribute float a_fade_opacity;
+
+uniform bool u_is_size_zoom_constant;
+uniform bool u_is_size_feature_constant;
+uniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function
+uniform highp float u_size; // used when size is both zoom and feature constant
+uniform highp float u_camera_to_center_distance;
+uniform highp float u_pitch;
+uniform bool u_rotate_symbol;
+uniform highp float u_aspect_ratio;
+uniform float u_fade_change;
+
+
+#ifndef HAS_UNIFORM_u_opacity
+uniform lowp float a_opacity_t;
+attribute lowp vec2 a_opacity;
+varying lowp float opacity;
+#else
+uniform lowp float u_opacity;
+#endif
+
+
+uniform mat4 u_matrix;
+uniform mat4 u_label_plane_matrix;
+uniform mat4 u_gl_coord_matrix;
+
+uniform bool u_is_text;
+uniform bool u_pitch_with_map;
+
+uniform vec2 u_texsize;
+
+varying vec2 v_tex;
+varying float v_fade_opacity;
+
+void main() {
+
+#ifndef HAS_UNIFORM_u_opacity
+ opacity = unpack_mix_vec2(a_opacity, a_opacity_t);
+#else
+ lowp float opacity = u_opacity;
+#endif
+
+
+ vec2 a_pos = a_pos_offset.xy;
+ vec2 a_offset = a_pos_offset.zw;
+
+ vec2 a_tex = a_data.xy;
+ vec2 a_size = a_data.zw;
+
+ highp float segment_angle = -a_projected_pos[2];
+
+ float size;
+ if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {
+ size = mix(a_size[0], a_size[1], u_size_t) / 256.0;
+ } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {
+ size = a_size[0] / 256.0;
+ } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) {
+ size = u_size;
+ } else {
+ size = u_size;
+ }
+
+ vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1);
+ highp float camera_to_anchor_distance = projectedPoint.w;
+ // See comments in symbol_sdf.vertex
+ highp float distance_ratio = u_pitch_with_map ?
+ camera_to_anchor_distance / u_camera_to_center_distance :
+ u_camera_to_center_distance / camera_to_anchor_distance;
+ highp float perspective_ratio = clamp(
+ 0.5 + 0.5 * distance_ratio,
+ 0.0, // Prevents oversized near-field symbols in pitched/overzoomed tiles
+ 4.0);
+
+ size *= perspective_ratio;
+
+ float fontScale = u_is_text ? size / 24.0 : size;
+
+ highp float symbol_rotation = 0.0;
+ if (u_rotate_symbol) {
+ // See comments in symbol_sdf.vertex
+ vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1);
+
+ vec2 a = projectedPoint.xy / projectedPoint.w;
+ vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w;
+
+ symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x);
+ }
+
+ highp float angle_sin = sin(segment_angle + symbol_rotation);
+ highp float angle_cos = cos(segment_angle + symbol_rotation);
+ mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);
+
+ vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);
+ gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * fontScale), 0.0, 1.0);
+
+ v_tex = a_tex / u_texsize;
+ vec2 fade_opacity = unpack_opacity(a_fade_opacity);
+ float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change;
+ v_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change));
+}
+
+*/
+
+// Uncompressed source of symbol_icon.fragment.glsl:
+/*
+uniform sampler2D u_texture;
+
+
+#ifndef HAS_UNIFORM_u_opacity
+varying lowp float opacity;
+#else
+uniform lowp float u_opacity;
+#endif
+
+
+varying vec2 v_tex;
+varying float v_fade_opacity;
+
+void main() {
+
+#ifdef HAS_UNIFORM_u_opacity
+ lowp float opacity = u_opacity;
+#endif
+
+
+ lowp float alpha = opacity * v_fade_opacity;
+ gl_FragColor = texture2D(u_texture, v_tex) * alpha;
+
+#ifdef OVERDRAW_INSPECTOR
+ gl_FragColor = vec4(1.0);
+#endif
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl
diff --git a/src/mbgl/shaders/symbol_sdf.cpp b/src/mbgl/shaders/symbol_sdf.cpp
index c46dbf44a2..4323aa9be5 100644
--- a/src/mbgl/shaders/symbol_sdf.cpp
+++ b/src/mbgl/shaders/symbol_sdf.cpp
@@ -10,5 +10,302 @@ const char* symbol_sdf::name = "symbol_sdf";
const char* symbol_sdf::vertexSource = source() + 74570;
const char* symbol_sdf::fragmentSource = source() + 80495;
+// Uncompressed source of symbol_sdf.vertex.glsl:
+/*
+const float PI = 3.141592653589793;
+
+attribute vec4 a_pos_offset;
+attribute vec4 a_data;
+attribute vec3 a_projected_pos;
+attribute float a_fade_opacity;
+
+// contents of a_size vary based on the type of property value
+// used for {text,icon}-size.
+// For constants, a_size is disabled.
+// For source functions, we bind only one value per vertex: the value of {text,icon}-size evaluated for the current feature.
+// For composite functions:
+// [ text-size(lowerZoomStop, feature),
+// text-size(upperZoomStop, feature) ]
+uniform bool u_is_size_zoom_constant;
+uniform bool u_is_size_feature_constant;
+uniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function
+uniform highp float u_size; // used when size is both zoom and feature constant
+
+
+#ifndef HAS_UNIFORM_u_fill_color
+uniform lowp float a_fill_color_t;
+attribute highp vec4 a_fill_color;
+varying highp vec4 fill_color;
+#else
+uniform highp vec4 u_fill_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_halo_color
+uniform lowp float a_halo_color_t;
+attribute highp vec4 a_halo_color;
+varying highp vec4 halo_color;
+#else
+uniform highp vec4 u_halo_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+uniform lowp float a_opacity_t;
+attribute lowp vec2 a_opacity;
+varying lowp float opacity;
+#else
+uniform lowp float u_opacity;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_halo_width
+uniform lowp float a_halo_width_t;
+attribute lowp vec2 a_halo_width;
+varying lowp float halo_width;
+#else
+uniform lowp float u_halo_width;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_halo_blur
+uniform lowp float a_halo_blur_t;
+attribute lowp vec2 a_halo_blur;
+varying lowp float halo_blur;
+#else
+uniform lowp float u_halo_blur;
+#endif
+
+
+uniform mat4 u_matrix;
+uniform mat4 u_label_plane_matrix;
+uniform mat4 u_gl_coord_matrix;
+
+uniform bool u_is_text;
+uniform bool u_pitch_with_map;
+uniform highp float u_pitch;
+uniform bool u_rotate_symbol;
+uniform highp float u_aspect_ratio;
+uniform highp float u_camera_to_center_distance;
+uniform float u_fade_change;
+
+uniform vec2 u_texsize;
+
+varying vec2 v_data0;
+varying vec3 v_data1;
+
+void main() {
+
+#ifndef HAS_UNIFORM_u_fill_color
+ fill_color = unpack_mix_color(a_fill_color, a_fill_color_t);
+#else
+ highp vec4 fill_color = u_fill_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_halo_color
+ halo_color = unpack_mix_color(a_halo_color, a_halo_color_t);
+#else
+ highp vec4 halo_color = u_halo_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+ opacity = unpack_mix_vec2(a_opacity, a_opacity_t);
+#else
+ lowp float opacity = u_opacity;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_halo_width
+ halo_width = unpack_mix_vec2(a_halo_width, a_halo_width_t);
+#else
+ lowp float halo_width = u_halo_width;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_halo_blur
+ halo_blur = unpack_mix_vec2(a_halo_blur, a_halo_blur_t);
+#else
+ lowp float halo_blur = u_halo_blur;
+#endif
+
+
+ vec2 a_pos = a_pos_offset.xy;
+ vec2 a_offset = a_pos_offset.zw;
+
+ vec2 a_tex = a_data.xy;
+ vec2 a_size = a_data.zw;
+
+ highp float segment_angle = -a_projected_pos[2];
+ float size;
+
+ if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {
+ size = mix(a_size[0], a_size[1], u_size_t) / 256.0;
+ } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {
+ size = a_size[0] / 256.0;
+ } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) {
+ size = u_size;
+ } else {
+ size = u_size;
+ }
+
+ vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1);
+ highp float camera_to_anchor_distance = projectedPoint.w;
+ // If the label is pitched with the map, layout is done in pitched space,
+ // which makes labels in the distance smaller relative to viewport space.
+ // We counteract part of that effect by multiplying by the perspective ratio.
+ // If the label isn't pitched with the map, we do layout in viewport space,
+ // which makes labels in the distance larger relative to the features around
+ // them. We counteract part of that effect by dividing by the perspective ratio.
+ highp float distance_ratio = u_pitch_with_map ?
+ camera_to_anchor_distance / u_camera_to_center_distance :
+ u_camera_to_center_distance / camera_to_anchor_distance;
+ highp float perspective_ratio = clamp(
+ 0.5 + 0.5 * distance_ratio,
+ 0.0, // Prevents oversized near-field symbols in pitched/overzoomed tiles
+ 4.0);
+
+ size *= perspective_ratio;
+
+ float fontScale = u_is_text ? size / 24.0 : size;
+
+ highp float symbol_rotation = 0.0;
+ if (u_rotate_symbol) {
+ // Point labels with 'rotation-alignment: map' are horizontal with respect to tile units
+ // To figure out that angle in projected space, we draw a short horizontal line in tile
+ // space, project it, and measure its angle in projected space.
+ vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1);
+
+ vec2 a = projectedPoint.xy / projectedPoint.w;
+ vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w;
+
+ symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x);
+ }
+
+ highp float angle_sin = sin(segment_angle + symbol_rotation);
+ highp float angle_cos = cos(segment_angle + symbol_rotation);
+ mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);
+
+ vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);
+ gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * fontScale), 0.0, 1.0);
+ float gamma_scale = gl_Position.w;
+
+ vec2 tex = a_tex / u_texsize;
+ vec2 fade_opacity = unpack_opacity(a_fade_opacity);
+ float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change;
+ float interpolated_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change));
+
+ v_data0 = vec2(tex.x, tex.y);
+ v_data1 = vec3(gamma_scale, size, interpolated_fade_opacity);
+}
+
+*/
+
+// Uncompressed source of symbol_sdf.fragment.glsl:
+/*
+#define SDF_PX 8.0
+#define EDGE_GAMMA 0.105/DEVICE_PIXEL_RATIO
+
+uniform bool u_is_halo;
+
+#ifndef HAS_UNIFORM_u_fill_color
+varying highp vec4 fill_color;
+#else
+uniform highp vec4 u_fill_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_halo_color
+varying highp vec4 halo_color;
+#else
+uniform highp vec4 u_halo_color;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_opacity
+varying lowp float opacity;
+#else
+uniform lowp float u_opacity;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_halo_width
+varying lowp float halo_width;
+#else
+uniform lowp float u_halo_width;
+#endif
+
+
+#ifndef HAS_UNIFORM_u_halo_blur
+varying lowp float halo_blur;
+#else
+uniform lowp float u_halo_blur;
+#endif
+
+
+uniform sampler2D u_texture;
+uniform highp float u_gamma_scale;
+uniform bool u_is_text;
+
+varying vec2 v_data0;
+varying vec3 v_data1;
+
+void main() {
+
+#ifdef HAS_UNIFORM_u_fill_color
+ highp vec4 fill_color = u_fill_color;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_halo_color
+ highp vec4 halo_color = u_halo_color;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_opacity
+ lowp float opacity = u_opacity;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_halo_width
+ lowp float halo_width = u_halo_width;
+#endif
+
+
+#ifdef HAS_UNIFORM_u_halo_blur
+ lowp float halo_blur = u_halo_blur;
+#endif
+
+
+ vec2 tex = v_data0.xy;
+ float gamma_scale = v_data1.x;
+ float size = v_data1.y;
+ float fade_opacity = v_data1[2];
+
+ float fontScale = u_is_text ? size / 24.0 : size;
+
+ lowp vec4 color = fill_color;
+ highp float gamma = EDGE_GAMMA / (fontScale * u_gamma_scale);
+ lowp float buff = (256.0 - 64.0) / 256.0;
+ if (u_is_halo) {
+ color = halo_color;
+ gamma = (halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * u_gamma_scale);
+ buff = (6.0 - halo_width / fontScale) / SDF_PX;
+ }
+
+ lowp float dist = texture2D(u_texture, tex).a;
+ highp float gamma_scaled = gamma * gamma_scale;
+ highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);
+
+ gl_FragColor = color * (alpha * opacity * fade_opacity);
+
+#ifdef OVERDRAW_INSPECTOR
+ gl_FragColor = vec4(1.0);
+#endif
+}
+
+*/
+
} // namespace shaders
} // namespace mbgl