summaryrefslogtreecommitdiff
path: root/src/mbgl/shaders/fill_extrusion_pattern.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-06-04 15:43:27 +0200
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-06-14 11:13:43 -0700
commitb141707b8d17fb72276010075fdc75297de8675e (patch)
treec74ed01e395b0f97e70d004f402d12268f77451a /src/mbgl/shaders/fill_extrusion_pattern.cpp
parenteaa8f236729814b5edd47a03d5b7e4a25092f044 (diff)
downloadqtlocation-mapboxgl-b141707b8d17fb72276010075fdc75297de8675e.tar.gz
[core] add shader defines for enabling/disabling attributes/uniforms for DDS
Diffstat (limited to 'src/mbgl/shaders/fill_extrusion_pattern.cpp')
-rw-r--r--src/mbgl/shaders/fill_extrusion_pattern.cpp40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/mbgl/shaders/fill_extrusion_pattern.cpp b/src/mbgl/shaders/fill_extrusion_pattern.cpp
index e2de5c20b2..66c24b1bb0 100644
--- a/src/mbgl/shaders/fill_extrusion_pattern.cpp
+++ b/src/mbgl/shaders/fill_extrusion_pattern.cpp
@@ -30,16 +30,36 @@ varying vec2 v_pos_b;
varying vec4 v_lighting;
varying float v_directional;
+
+#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
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
base = max(0.0, base);
height = max(0.0, height);
@@ -81,12 +101,28 @@ 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
void main() {
-
-
+
+#ifdef HAS_UNIFORM_u_base
+ lowp float base = u_base;
+#endif
+
+#ifdef HAS_UNIFORM_u_height
+ lowp float height = u_height;
+#endif
vec2 imagecoord = mod(v_pos_a, 1.0);
vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);