summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-05-23 15:26:26 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-05-25 21:37:58 -0700
commit45c5b2a66c8dbadf8671458d183e76a981ff4843 (patch)
treef042e705b0d1f19329bf899b97dbf37242bdfb89
parent4e2c743ebabbbd78e49b1f645def99aaa328324e (diff)
downloadqtlocation-mapboxgl-45c5b2a66c8dbadf8671458d183e76a981ff4843.tar.gz
[core] Share shaders with gl-js
-rw-r--r--Makefile10
-rw-r--r--mbgl.gypi2
-rw-r--r--package.json1
-rw-r--r--platform/android/bitrise.yml3
-rw-r--r--src/mbgl/shader/box.fragment.glsl24
-rw-r--r--src/mbgl/shader/box.vertex.glsl16
-rw-r--r--src/mbgl/shader/circle.fragment.glsl10
-rw-r--r--src/mbgl/shader/circle.vertex.glsl23
-rw-r--r--src/mbgl/shader/collision_box_shader.cpp6
-rw-r--r--src/mbgl/shader/icon.fragment.glsl11
-rw-r--r--src/mbgl/shader/icon.vertex.glsl42
-rw-r--r--src/mbgl/shader/line.fragment.glsl19
-rw-r--r--src/mbgl/shader/line.vertex.glsl65
-rw-r--r--src/mbgl/shader/linepattern.fragment.glsl41
-rw-r--r--src/mbgl/shader/linepattern.vertex.glsl76
-rw-r--r--src/mbgl/shader/linesdf.fragment.glsl29
-rw-r--r--src/mbgl/shader/linesdf.vertex.glsl82
-rw-r--r--src/mbgl/shader/linesdf_shader.cpp6
-rw-r--r--src/mbgl/shader/outline.fragment.glsl9
-rw-r--r--src/mbgl/shader/outline.vertex.glsl10
-rw-r--r--src/mbgl/shader/outlinepattern.fragment.glsl30
-rw-r--r--src/mbgl/shader/outlinepattern.vertex.glsl21
-rw-r--r--src/mbgl/shader/pattern.fragment.glsl24
-rw-r--r--src/mbgl/shader/pattern.vertex.glsl17
-rw-r--r--src/mbgl/shader/plain.fragment.glsl5
-rw-r--r--src/mbgl/shader/plain.vertex.glsl7
-rw-r--r--src/mbgl/shader/plain_shader.cpp6
-rw-r--r--src/mbgl/shader/raster.fragment.glsl36
-rw-r--r--src/mbgl/shader/raster.vertex.glsl13
-rw-r--r--src/mbgl/shader/sdf.fragment.glsl17
-rw-r--r--src/mbgl/shader/sdf.vertex.glsl43
31 files changed, 18 insertions, 686 deletions
diff --git a/Makefile b/Makefile
index 5cf0efa4ee..26e9b58ec5 100644
--- a/Makefile
+++ b/Makefile
@@ -16,6 +16,8 @@ else
export XCPRETTY ?= | xcpretty
endif
+default: test-$(HOST_PLATFORM)
+
ifneq (,$(wildcard .git/.))
.mason:
git submodule update --init
@@ -23,7 +25,8 @@ else
.mason: ;
endif
-default: test-$(HOST_PLATFORM)
+node_modules: package.json
+ npm update # Install dependencies but don't run our own install script.
GYP = deps/run_gyp --depth=. -Goutput_dir=.
@@ -31,7 +34,7 @@ CONFIG_DEPENDENCIES = .mason configure
# Depend on gyp includes plus directories, so that projects are regenerated when
# files are added or removed.
-GYP_DEPENDENCIES = mbgl.gypi test/test.gypi bin/*.gypi $(shell find src include -type d)
+GYP_DEPENDENCIES = mbgl.gypi test/test.gypi bin/*.gypi $(shell find src include -type d) node_modules
#### OS X targets ##############################################################
@@ -179,9 +182,6 @@ apackage:
NODE_PRE_GYP = $(shell npm bin)/node-pre-gyp
NODE_OUTPUT_PATH = build/node-$(HOST_PLATFORM)-$(shell uname -m)
-node_modules: package.json
- npm update # Install dependencies but don't run our own install script.
-
$(NODE_OUTPUT_PATH)/config.gypi: platform/$(HOST_PLATFORM)/scripts/configure.sh $(CONFIG_DEPENDENCIES)
./configure $< $@ $(HOST_PLATFORM) $(shell uname -m)
diff --git a/mbgl.gypi b/mbgl.gypi
index e4d2474dfd..c25e53ed78 100644
--- a/mbgl.gypi
+++ b/mbgl.gypi
@@ -138,7 +138,7 @@
'<!@(find <(DEPTH)/src -name "*.h")',
'<!@(find <(DEPTH)/include -name "*.hpp")',
'<!@(find <(DEPTH)/include -name "*.h")',
- '<!@(find <(DEPTH)/src -name "*.glsl")',
+ '<!@(find -H <(DEPTH)/node_modules/mapbox-gl-shaders -name "*.glsl")',
'<(SHARED_INTERMEDIATE_DIR)/include/mbgl/util/version.hpp',
],
diff --git a/package.json b/package.json
index 515a58c790..a20946570d 100644
--- a/package.json
+++ b/package.json
@@ -19,6 +19,7 @@
"devDependencies": {
"aws-sdk": "^2.3.5",
"express": "^4.11.1",
+ "mapbox-gl-shaders": "mapbox/mapbox-gl-shaders#10941bb6f0b2b11c8bba83c3faaa094a62ad56d7",
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#b3441d9a285ffbe9b876677acb13d7df07e5b975",
"node-gyp": "^3.3.1",
"request": "^2.72.0",
diff --git a/platform/android/bitrise.yml b/platform/android/bitrise.yml
index bf4ba178e2..3c06a04675 100644
--- a/platform/android/bitrise.yml
+++ b/platform/android/bitrise.yml
@@ -62,7 +62,8 @@ workflows:
#!/bin/bash
set -eu -o pipefail
- apt-get install -y pkg-config python-pip python-dev build-essential
+ curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
+ apt-get install -y pkg-config python-pip python-dev build-essential nodejs
pip install awscli
aws s3 cp s3://mapbox/android/signing-credentials/secring.gpg platform/android/MapboxGLAndroidSDK/secring.gpg
diff --git a/src/mbgl/shader/box.fragment.glsl b/src/mbgl/shader/box.fragment.glsl
deleted file mode 100644
index 030f1219f8..0000000000
--- a/src/mbgl/shader/box.fragment.glsl
+++ /dev/null
@@ -1,24 +0,0 @@
-uniform float u_zoom;
-uniform float u_maxzoom;
-
-varying float v_max_zoom;
-varying float v_placement_zoom;
-
-void main() {
-
- float alpha = 0.5;
-
- gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0) * alpha;
-
- if (v_placement_zoom > u_zoom) {
- gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;
- }
-
- if (u_zoom >= v_max_zoom) {
- gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;
- }
-
- if (v_placement_zoom >= u_maxzoom) {
- gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0) * alpha * 0.2;
- }
-}
diff --git a/src/mbgl/shader/box.vertex.glsl b/src/mbgl/shader/box.vertex.glsl
deleted file mode 100644
index d141b13873..0000000000
--- a/src/mbgl/shader/box.vertex.glsl
+++ /dev/null
@@ -1,16 +0,0 @@
-attribute vec2 a_pos;
-attribute vec2 a_extrude;
-attribute vec2 a_data;
-
-uniform mat4 u_matrix;
-uniform float u_scale;
-
-varying float v_max_zoom;
-varying float v_placement_zoom;
-
-void main() {
- gl_Position = u_matrix * vec4(a_pos + a_extrude / u_scale, 0.0, 1.0);
-
- v_max_zoom = a_data.x;
- v_placement_zoom = a_data.y;
-}
diff --git a/src/mbgl/shader/circle.fragment.glsl b/src/mbgl/shader/circle.fragment.glsl
deleted file mode 100644
index 7267bf81e3..0000000000
--- a/src/mbgl/shader/circle.fragment.glsl
+++ /dev/null
@@ -1,10 +0,0 @@
-uniform vec4 u_color;
-uniform float u_blur;
-uniform float u_size;
-
-varying vec2 v_extrude;
-
-void main() {
- float t = smoothstep(1.0 - u_blur, 1.0, length(v_extrude));
- gl_FragColor = u_color * (1.0 - t);
-}
diff --git a/src/mbgl/shader/circle.vertex.glsl b/src/mbgl/shader/circle.vertex.glsl
deleted file mode 100644
index 387c377a60..0000000000
--- a/src/mbgl/shader/circle.vertex.glsl
+++ /dev/null
@@ -1,23 +0,0 @@
-// set by gl_util
-uniform float u_size;
-
-attribute vec2 a_pos;
-
-uniform mat4 u_matrix;
-uniform mat4 u_exmatrix;
-
-varying vec2 v_extrude;
-
-void main(void) {
- // unencode the extrusion vector that we snuck into the a_pos vector
- v_extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0);
-
- vec4 extrude = u_exmatrix * vec4(v_extrude * u_size, 0, 0);
- // multiply a_pos by 0.5, since we had it * 2 in order to sneak
- // in extrusion data
- gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0, 1);
-
- // gl_Position is divided by gl_Position.w after this shader runs.
- // Multiply the extrude by it so that it isn't affected by it.
- gl_Position += extrude * gl_Position.w;
-}
diff --git a/src/mbgl/shader/collision_box_shader.cpp b/src/mbgl/shader/collision_box_shader.cpp
index 7a4723dbb0..9d4d37c4cd 100644
--- a/src/mbgl/shader/collision_box_shader.cpp
+++ b/src/mbgl/shader/collision_box_shader.cpp
@@ -1,6 +1,6 @@
#include <mbgl/shader/collision_box_shader.hpp>
-#include <mbgl/shader/box.vertex.hpp>
-#include <mbgl/shader/box.fragment.hpp>
+#include <mbgl/shader/collisionbox.vertex.hpp>
+#include <mbgl/shader/collisionbox.fragment.hpp>
#include <mbgl/gl/gl.hpp>
#include <cstdio>
@@ -8,7 +8,7 @@
using namespace mbgl;
CollisionBoxShader::CollisionBoxShader(gl::GLObjectStore& glObjectStore)
- : Shader("collisionbox", shaders::box::vertex, shaders::box::fragment, glObjectStore) {
+ : Shader("collisionbox", shaders::collisionbox::vertex, shaders::collisionbox::fragment, glObjectStore) {
a_extrude = MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_extrude"));
a_data = MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_data"));
}
diff --git a/src/mbgl/shader/icon.fragment.glsl b/src/mbgl/shader/icon.fragment.glsl
deleted file mode 100644
index f9ed6e75ed..0000000000
--- a/src/mbgl/shader/icon.fragment.glsl
+++ /dev/null
@@ -1,11 +0,0 @@
-uniform sampler2D u_texture;
-uniform sampler2D u_fadetexture;
-uniform float u_opacity;
-
-varying vec2 v_tex;
-varying vec2 v_fade_tex;
-
-void main() {
- float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_opacity;
- gl_FragColor = texture2D(u_texture, v_tex) * alpha;
-}
diff --git a/src/mbgl/shader/icon.vertex.glsl b/src/mbgl/shader/icon.vertex.glsl
deleted file mode 100644
index a6a423127a..0000000000
--- a/src/mbgl/shader/icon.vertex.glsl
+++ /dev/null
@@ -1,42 +0,0 @@
-attribute vec2 a_pos;
-attribute vec2 a_offset;
-attribute vec4 a_data1;
-attribute vec4 a_data2;
-
-
-// matrix is for the vertex position, exmatrix is for rotating and projecting
-// the extrusion vector.
-uniform mat4 u_matrix;
-uniform mat4 u_exmatrix;
-uniform float u_zoom;
-uniform bool u_skewed;
-uniform float u_extra;
-
-uniform vec2 u_texsize;
-
-varying vec2 v_tex;
-varying vec2 v_fade_tex;
-
-void main() {
- vec2 a_tex = a_data1.xy;
- float a_labelminzoom = a_data1[2];
- float a_angle = a_data1[3];
- vec2 a_zoom = a_data2.st;
- float a_minzoom = a_zoom[0];
- float a_maxzoom = a_zoom[1];
-
- // u_zoom is the current zoom level adjusted for the change in font size
- float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));
-
- if (u_skewed) {
- vec4 extrude = u_exmatrix * vec4(a_offset / 64.0, 0, 0);
- gl_Position = u_matrix * vec4(a_pos + extrude.xy, 0, 1);
- gl_Position.z += z * gl_Position.w;
- } else {
- vec4 extrude = u_exmatrix * vec4(a_offset / 64.0, z, 0);
- gl_Position = u_matrix * vec4(a_pos, 0, 1) + extrude;
- }
-
- v_tex = a_tex / u_texsize;
- v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);
-}
diff --git a/src/mbgl/shader/line.fragment.glsl b/src/mbgl/shader/line.fragment.glsl
deleted file mode 100644
index e0ef649965..0000000000
--- a/src/mbgl/shader/line.fragment.glsl
+++ /dev/null
@@ -1,19 +0,0 @@
-uniform vec2 u_linewidth;
-uniform vec4 u_color;
-uniform float u_blur;
-
-varying vec2 v_normal;
-varying float v_gamma_scale;
-
-void main() {
- // Calculate the distance of the pixel from the line in pixels.
- float dist = length(v_normal) * u_linewidth.s;
-
- // Calculate the antialiasing fade factor. This is either when fading in
- // the line in case of an offset line (v_linewidth.t) or when fading out
- // (v_linewidth.s)
- float blur = u_blur * v_gamma_scale;
- float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);
-
- gl_FragColor = u_color * alpha;
-}
diff --git a/src/mbgl/shader/line.vertex.glsl b/src/mbgl/shader/line.vertex.glsl
deleted file mode 100644
index 973e92a17d..0000000000
--- a/src/mbgl/shader/line.vertex.glsl
+++ /dev/null
@@ -1,65 +0,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 vec2 a_pos;
-attribute vec4 a_data;
-
-uniform mat4 u_matrix;
-
-// shared
-uniform float u_ratio;
-uniform vec2 u_linewidth;
-uniform float u_offset;
-
-uniform float u_extra;
-uniform mat2 u_antialiasingmatrix;
-
-varying vec2 v_normal;
-varying float v_gamma_scale;
-
-void main() {
- vec2 a_extrude = a_data.xy - 128.0;
- float a_direction = mod(a_data.z, 4.0) - 1.0;
-
- // We store the texture normals in the most insignificant bit
- // transform y so that 0 => -1 and 1 => 1
- // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap
- // y is 1 if the normal points up, and -1 if it points down
- vec2 normal = mod(a_pos, 2.0);
- normal.y = sign(normal.y - 0.5);
- v_normal = normal;
-
- // Scale the extrusion vector down to a normal and then up by the line width
- // of this vertex.
- vec2 dist = u_linewidth.s * 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.
- float u = 0.5 * a_direction;
- float t = 1.0 - abs(u);
- vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);
-
- // Remove the texture normal bit of the position before scaling it with the
- // model/view matrix. Add the extrusion vector *after* the model/view matrix
- // because we're extruding the line in pixel space, regardless of the current
- // tile's zoom level.
- gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);
-
- // position of y on the screen
- float y = gl_Position.y / gl_Position.w;
-
- // how much features are squished in the y direction by the tilt
- float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);
-
- // how much features are squished in all directions by the perspectiveness
- float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.90));
-
- v_gamma_scale = perspective_scale * squish_scale;
-}
diff --git a/src/mbgl/shader/linepattern.fragment.glsl b/src/mbgl/shader/linepattern.fragment.glsl
deleted file mode 100644
index 4110a99ead..0000000000
--- a/src/mbgl/shader/linepattern.fragment.glsl
+++ /dev/null
@@ -1,41 +0,0 @@
-uniform vec2 u_linewidth;
-uniform float u_blur;
-
-uniform vec2 u_pattern_size_a;
-uniform vec2 u_pattern_tl_a;
-uniform vec2 u_pattern_br_a;
-uniform vec2 u_pattern_size_b;
-uniform vec2 u_pattern_tl_b;
-uniform vec2 u_pattern_br_b;
-uniform float u_fade;
-uniform float u_opacity;
-
-uniform sampler2D u_image;
-
-varying vec2 v_normal;
-varying float v_linesofar;
-varying float v_gamma_scale;
-
-void main() {
- // Calculate the distance of the pixel from the line in pixels.
- float dist = length(v_normal) * u_linewidth.s;
-
- // Calculate the antialiasing fade factor. This is either when fading in
- // the line in case of an offset line (v_linewidth.t) or when fading out
- // (v_linewidth.s)
- float blur = u_blur * v_gamma_scale;
- float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 0.0, 1.0);
-
- float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);
- float y_a = 0.5 + (v_normal.y * u_linewidth.s / u_pattern_size_a.y);
- vec2 pos_a = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));
- float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);
- float y_b = 0.5 + (v_normal.y * u_linewidth.s / u_pattern_size_b.y);
- vec2 pos_b = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));
-
- vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);
-
- alpha *= u_opacity;
-
- gl_FragColor = color * alpha;
-}
diff --git a/src/mbgl/shader/linepattern.vertex.glsl b/src/mbgl/shader/linepattern.vertex.glsl
deleted file mode 100644
index 5cceb64038..0000000000
--- a/src/mbgl/shader/linepattern.vertex.glsl
+++ /dev/null
@@ -1,76 +0,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
-
-// 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
-
-attribute vec2 a_pos;
-attribute vec4 a_data;
-
-// matrix is for the vertex position, exmatrix is for rotating and projecting
-// the extrusion vector.
-uniform mat4 u_matrix;
-uniform mat4 u_exmatrix;
-
-// shared
-uniform float u_ratio;
-uniform vec2 u_linewidth;
-uniform float u_offset;
-uniform vec4 u_color;
-
-uniform float u_extra;
-uniform mat2 u_antialiasingmatrix;
-
-varying vec2 v_normal;
-varying float v_linesofar;
-varying float v_gamma_scale;
-
-void main() {
- 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;
-
- // We store the texture normals in the most insignificant bit
- // transform y so that 0 => -1 and 1 => 1
- // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap
- // y is 1 if the normal points up, and -1 if it points down
- vec2 normal = mod(a_pos, 2.0);
- normal.y = sign(normal.y - 0.5);
- v_normal = normal;
-
- // Scale the extrusion vector down to a normal and then up by the line width
- // of this vertex.
- vec2 dist = u_linewidth.s * 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.
- float u = 0.5 * a_direction;
- float t = 1.0 - abs(u);
- vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);
-
- // Remove the texture normal bit of the position before scaling it with the
- // model/view matrix. Add the extrusion vector *after* the model/view matrix
- // because we're extruding the line in pixel space, regardless of the current
- // tile's zoom level.
- gl_Position = u_matrix * vec4(floor(a_pos / 2.0) + (offset + dist) / u_ratio, 0.0, 1.0);
- v_linesofar = a_linesofar;
-
- // position of y on the screen
- float y = gl_Position.y / gl_Position.w;
-
- // how much features are squished in the y direction by the tilt
- float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);
-
- // how much features are squished in all directions by the perspectiveness
- float perspective_scale = 1.0 / (1.0 - y * u_extra);
-
- v_gamma_scale = perspective_scale * squish_scale;
-}
diff --git a/src/mbgl/shader/linesdf.fragment.glsl b/src/mbgl/shader/linesdf.fragment.glsl
deleted file mode 100644
index f8962fa570..0000000000
--- a/src/mbgl/shader/linesdf.fragment.glsl
+++ /dev/null
@@ -1,29 +0,0 @@
-uniform vec2 u_linewidth;
-uniform vec4 u_color;
-uniform float u_blur;
-uniform sampler2D u_image;
-uniform float u_sdfgamma;
-uniform float u_mix;
-
-varying vec2 v_normal;
-varying vec2 v_tex_a;
-varying vec2 v_tex_b;
-varying float v_gamma_scale;
-
-void main() {
- // Calculate the distance of the pixel from the line in pixels.
- float dist = length(v_normal) * u_linewidth.s;
-
- // Calculate the antialiasing fade factor. This is either when fading in
- // the line in case of an offset line (v_linewidth.t) or when fading out
- // (v_linewidth.s)
- float blur = u_blur * v_gamma_scale;
- float alpha = clamp(min(dist - (u_linewidth.t - blur), u_linewidth.s - dist) / blur, 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, 0.5 + u_sdfgamma, sdfdist);
-
- gl_FragColor = u_color * alpha;
-}
diff --git a/src/mbgl/shader/linesdf.vertex.glsl b/src/mbgl/shader/linesdf.vertex.glsl
deleted file mode 100644
index 9174e4d987..0000000000
--- a/src/mbgl/shader/linesdf.vertex.glsl
+++ /dev/null
@@ -1,82 +0,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
-
-// 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
-
-attribute vec2 a_pos;
-attribute vec4 a_data;
-
-// matrix is for the vertex position, exmatrix is for rotating and projecting
-// the extrusion vector.
-uniform mat4 u_matrix;
-uniform mat4 u_exmatrix;
-
-// shared
-uniform float u_ratio;
-uniform vec2 u_linewidth;
-uniform float u_offset;
-uniform vec2 u_patternscale_a;
-uniform float u_tex_y_a;
-uniform vec2 u_patternscale_b;
-uniform float u_tex_y_b;
-
-uniform float u_extra;
-uniform mat2 u_antialiasingmatrix;
-
-varying vec2 v_normal;
-varying vec2 v_tex_a;
-varying vec2 v_tex_b;
-varying float v_gamma_scale;
-
-void main() {
- 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;
-
- // We store the texture normals in the most insignificant bit
- // transform y so that 0 => -1 and 1 => 1
- // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap
- // y is 1 if the normal points up, and -1 if it points down
- vec2 normal = mod(a_pos, 2.0);
- normal.y = sign(normal.y - 0.5);
- v_normal = normal;
-
- // Scale the extrusion vector down to a normal and then up by the line width
- // of this vertex.
- vec2 dist = u_linewidth.s * 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.
- float u = 0.5 * a_direction;
- float t = 1.0 - abs(u);
- vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);
-
- // Remove the texture normal bit of the position before scaling it with the
- // model/view matrix. Add the extrusion vector *after* the model/view matrix
- // because we're extruding the line in pixel space, regardless of the current
- // tile's zoom level.
- gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);
-
- v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);
- v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);
-
- // position of y on the screen
- float y = gl_Position.y / gl_Position.w;
-
- // how much features are squished in the y direction by the tilt
- float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);
-
- // how much features are squished in all directions by the perspectiveness
- float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));
-
- v_gamma_scale = perspective_scale * squish_scale;
-}
diff --git a/src/mbgl/shader/linesdf_shader.cpp b/src/mbgl/shader/linesdf_shader.cpp
index 1358127925..019634546a 100644
--- a/src/mbgl/shader/linesdf_shader.cpp
+++ b/src/mbgl/shader/linesdf_shader.cpp
@@ -1,6 +1,6 @@
#include <mbgl/shader/linesdf_shader.hpp>
-#include <mbgl/shader/linesdf.vertex.hpp>
-#include <mbgl/shader/linesdf.fragment.hpp>
+#include <mbgl/shader/linesdfpattern.vertex.hpp>
+#include <mbgl/shader/linesdfpattern.fragment.hpp>
#include <mbgl/gl/gl.hpp>
#include <cstdio>
@@ -8,7 +8,7 @@
using namespace mbgl;
LineSDFShader::LineSDFShader(gl::GLObjectStore& glObjectStore)
- : Shader("line", shaders::linesdf::vertex, shaders::linesdf::fragment, glObjectStore) {
+ : Shader("linesdfpattern", shaders::linesdfpattern::vertex, shaders::linesdfpattern::fragment, glObjectStore) {
a_data = MBGL_CHECK_ERROR(glGetAttribLocation(getID(), "a_data"));
}
diff --git a/src/mbgl/shader/outline.fragment.glsl b/src/mbgl/shader/outline.fragment.glsl
deleted file mode 100644
index eccda714e5..0000000000
--- a/src/mbgl/shader/outline.fragment.glsl
+++ /dev/null
@@ -1,9 +0,0 @@
-uniform vec4 u_color;
-
-varying vec2 v_pos;
-
-void main() {
- float dist = length(v_pos - gl_FragCoord.xy);
- float alpha = smoothstep(1.0, 0.0, dist);
- gl_FragColor = u_color * alpha;
-}
diff --git a/src/mbgl/shader/outline.vertex.glsl b/src/mbgl/shader/outline.vertex.glsl
deleted file mode 100644
index f720b8d629..0000000000
--- a/src/mbgl/shader/outline.vertex.glsl
+++ /dev/null
@@ -1,10 +0,0 @@
-attribute vec2 a_pos;
-uniform mat4 u_matrix;
-uniform vec2 u_world;
-
-varying vec2 v_pos;
-
-void main() {
- gl_Position = u_matrix * vec4(a_pos, 0, 1);
- v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;
-}
diff --git a/src/mbgl/shader/outlinepattern.fragment.glsl b/src/mbgl/shader/outlinepattern.fragment.glsl
deleted file mode 100644
index dd1efd63e6..0000000000
--- a/src/mbgl/shader/outlinepattern.fragment.glsl
+++ /dev/null
@@ -1,30 +0,0 @@
-uniform float u_opacity;
-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 float u_mix;
-
-uniform sampler2D u_image;
-
-varying vec2 v_pos_a;
-varying vec2 v_pos_b;
-varying vec2 v_pos;
-
-void main() {
- vec2 imagecoord = mod(v_pos_a, 1.0);
- vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);
- vec4 color1 = texture2D(u_image, pos);
-
- vec2 imagecoord_b = mod(v_pos_b, 1.0);
- vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, 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 = smoothstep(1.0, 0.0, dist);
-
-
- gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;
-} \ No newline at end of file
diff --git a/src/mbgl/shader/outlinepattern.vertex.glsl b/src/mbgl/shader/outlinepattern.vertex.glsl
deleted file mode 100644
index e31b77b560..0000000000
--- a/src/mbgl/shader/outlinepattern.vertex.glsl
+++ /dev/null
@@ -1,21 +0,0 @@
-uniform vec2 u_patternscale_a;
-uniform vec2 u_patternscale_b;
-uniform vec2 u_offset_a;
-uniform vec2 u_offset_b;
-
-attribute vec2 a_pos;
-
-uniform mat4 u_matrix;
-uniform vec2 u_world;
-
-varying vec2 v_pos_a;
-varying vec2 v_pos_b;
-varying vec2 v_pos;
-
-
-void main() {
- gl_Position = u_matrix * vec4(a_pos, 0, 1);
- v_pos_a = u_patternscale_a * a_pos + u_offset_a;
- v_pos_b = u_patternscale_b * a_pos + u_offset_b;
- v_pos = (gl_Position.xy/gl_Position.w + 1.0) / 2.0 * u_world;
-}
diff --git a/src/mbgl/shader/pattern.fragment.glsl b/src/mbgl/shader/pattern.fragment.glsl
deleted file mode 100644
index a28a52ce36..0000000000
--- a/src/mbgl/shader/pattern.fragment.glsl
+++ /dev/null
@@ -1,24 +0,0 @@
-uniform float u_opacity;
-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 float u_mix;
-
-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_pattern_br_a, imagecoord);
- vec4 color1 = texture2D(u_image, pos);
-
- vec2 imagecoord_b = mod(v_pos_b, 1.0);
- vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);
- vec4 color2 = texture2D(u_image, pos2);
-
- gl_FragColor = mix(color1, color2, u_mix) * u_opacity;
-}
diff --git a/src/mbgl/shader/pattern.vertex.glsl b/src/mbgl/shader/pattern.vertex.glsl
deleted file mode 100644
index 1363f17300..0000000000
--- a/src/mbgl/shader/pattern.vertex.glsl
+++ /dev/null
@@ -1,17 +0,0 @@
-uniform mat4 u_matrix;
-uniform vec2 u_patternscale_a;
-uniform vec2 u_patternscale_b;
-
-uniform vec2 u_offset_a;
-uniform vec2 u_offset_b;
-
-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 = u_patternscale_a * a_pos + u_offset_a;
- v_pos_b = u_patternscale_b * a_pos + u_offset_b;
-}
diff --git a/src/mbgl/shader/plain.fragment.glsl b/src/mbgl/shader/plain.fragment.glsl
deleted file mode 100644
index 8df552c171..0000000000
--- a/src/mbgl/shader/plain.fragment.glsl
+++ /dev/null
@@ -1,5 +0,0 @@
-uniform vec4 u_color;
-
-void main() {
- gl_FragColor = u_color;
-}
diff --git a/src/mbgl/shader/plain.vertex.glsl b/src/mbgl/shader/plain.vertex.glsl
deleted file mode 100644
index 866c3cd2f3..0000000000
--- a/src/mbgl/shader/plain.vertex.glsl
+++ /dev/null
@@ -1,7 +0,0 @@
-attribute vec2 a_pos;
-
-uniform mat4 u_matrix;
-
-void main() {
- gl_Position = u_matrix * vec4(a_pos, 0, 1);
-}
diff --git a/src/mbgl/shader/plain_shader.cpp b/src/mbgl/shader/plain_shader.cpp
index 1b5a7819b3..49d26ffa3c 100644
--- a/src/mbgl/shader/plain_shader.cpp
+++ b/src/mbgl/shader/plain_shader.cpp
@@ -1,6 +1,6 @@
#include <mbgl/shader/plain_shader.hpp>
-#include <mbgl/shader/plain.vertex.hpp>
-#include <mbgl/shader/plain.fragment.hpp>
+#include <mbgl/shader/fill.vertex.hpp>
+#include <mbgl/shader/fill.fragment.hpp>
#include <mbgl/gl/gl.hpp>
#include <cstdio>
@@ -8,7 +8,7 @@
using namespace mbgl;
PlainShader::PlainShader(gl::GLObjectStore& glObjectStore)
- : Shader("plain", shaders::plain::vertex, shaders::plain::fragment, glObjectStore) {
+ : Shader("fill", shaders::fill::vertex, shaders::fill::fragment, glObjectStore) {
}
void PlainShader::bind(GLbyte* offset) {
diff --git a/src/mbgl/shader/raster.fragment.glsl b/src/mbgl/shader/raster.fragment.glsl
deleted file mode 100644
index 333de76dc1..0000000000
--- a/src/mbgl/shader/raster.fragment.glsl
+++ /dev/null
@@ -1,36 +0,0 @@
-uniform sampler2D u_image;
-uniform float u_opacity;
-
-varying vec2 v_pos;
-
-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() {
-
- vec4 color = texture2D(u_image, v_pos) * 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);
-}
diff --git a/src/mbgl/shader/raster.vertex.glsl b/src/mbgl/shader/raster.vertex.glsl
deleted file mode 100644
index 107b82a0ef..0000000000
--- a/src/mbgl/shader/raster.vertex.glsl
+++ /dev/null
@@ -1,13 +0,0 @@
-uniform mat4 u_matrix;
-uniform float u_buffer;
-
-attribute vec2 a_pos;
-
-varying vec2 v_pos;
-
-
-void main() {
- gl_Position = u_matrix * vec4(a_pos, 0, 1);
- float dimension = (8192.0 + 2.0 * u_buffer);
- v_pos = (a_pos / dimension) + (u_buffer / dimension);
-}
diff --git a/src/mbgl/shader/sdf.fragment.glsl b/src/mbgl/shader/sdf.fragment.glsl
deleted file mode 100644
index 3a6a4a8c37..0000000000
--- a/src/mbgl/shader/sdf.fragment.glsl
+++ /dev/null
@@ -1,17 +0,0 @@
-uniform sampler2D u_texture;
-uniform sampler2D u_fadetexture;
-uniform vec4 u_color;
-uniform float u_buffer;
-uniform float u_gamma;
-
-varying vec2 v_tex;
-varying vec2 v_fade_tex;
-varying float v_gamma_scale;
-
-void main() {
- float dist = texture2D(u_texture, v_tex).a;
- float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;
- float gamma = u_gamma * v_gamma_scale;
- float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha;
- gl_FragColor = u_color * alpha;
-}
diff --git a/src/mbgl/shader/sdf.vertex.glsl b/src/mbgl/shader/sdf.vertex.glsl
deleted file mode 100644
index 818378475e..0000000000
--- a/src/mbgl/shader/sdf.vertex.glsl
+++ /dev/null
@@ -1,43 +0,0 @@
-attribute vec2 a_pos;
-attribute vec2 a_offset;
-attribute vec4 a_data1;
-attribute vec4 a_data2;
-
-
-// matrix is for the vertex position, exmatrix is for rotating and projecting
-// the extrusion vector.
-uniform mat4 u_matrix;
-uniform mat4 u_exmatrix;
-uniform float u_zoom;
-uniform bool u_skewed;
-
-uniform vec2 u_texsize;
-
-varying vec2 v_tex;
-varying vec2 v_fade_tex;
-varying float v_gamma_scale;
-
-void main() {
- vec2 a_tex = a_data1.xy;
- float a_labelminzoom = a_data1[2];
- float a_angle = a_data1[3];
- vec2 a_zoom = a_data2.st;
- float a_minzoom = a_zoom[0];
- float a_maxzoom = a_zoom[1];
-
- // u_zoom is the current zoom level adjusted for the change in font size
- float show = step(a_minzoom, u_zoom) * (1.0 - step(a_maxzoom, u_zoom));
-
- if (u_skewed) {
- vec4 extrude = u_exmatrix * vec4(a_offset * show / 64.0, 0, 0);
- gl_Position = u_matrix * vec4(a_pos + extrude.xy, 0, 1);
- } else {
- vec4 extrude = u_exmatrix * vec4(a_offset * show / 64.0, 0, 0);
- gl_Position = u_matrix * vec4(a_pos, 0, 1) + extrude;
- }
-
- v_gamma_scale = (gl_Position.w - 0.5);
-
- v_tex = a_tex / u_texsize;
- v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);
-}