summaryrefslogtreecommitdiff
path: root/src/mbgl/shaders/line_sdf.cpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-09-07 15:21:05 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-09-08 09:35:47 -0700
commitaa4dff1095e8f5e8ad584f5f7dcab3e61d8cf8ee (patch)
tree796efd2b8d33c1e6b6c7b4e401a761aa5cca8f86 /src/mbgl/shaders/line_sdf.cpp
parentb05e5ddd347a9362535ca33cefceae92c51c998f (diff)
downloadqtlocation-mapboxgl-aa4dff1095e8f5e8ad584f5f7dcab3e61d8cf8ee.tar.gz
[core] Align line vertex to 4-byte boundary
10 byte vertices are heavily penalized by common GL implementations.
Diffstat (limited to 'src/mbgl/shaders/line_sdf.cpp')
-rw-r--r--src/mbgl/shaders/line_sdf.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/mbgl/shaders/line_sdf.cpp b/src/mbgl/shaders/line_sdf.cpp
index dd81433543..c5d50566e8 100644
--- a/src/mbgl/shaders/line_sdf.cpp
+++ b/src/mbgl/shaders/line_sdf.cpp
@@ -23,7 +23,7 @@ const char* line_sdf::vertexSource = R"MBGL_SHADER(
// Retina devices need a smaller distance to avoid aliasing.
#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0
-attribute vec3 a_pos_normal;
+attribute vec4 a_pos_normal;
attribute vec4 a_data;
uniform mat4 u_matrix;
@@ -159,12 +159,9 @@ void main() {
vec2 pos = a_pos_normal.xy;
- // transform y normal 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
+ // 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 = unpack_float(a_pos_normal.z);
- normal.y = sign(normal.y - 0.5);
-
+ mediump vec2 normal = a_pos_normal.zw;
v_normal = normal;
// these transformations used to be applied in the JS and native code bases.