summaryrefslogtreecommitdiff
path: root/src/mbgl/shaders/fill.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-13 12:21:50 -0700
commit2cbc3d3332e32054e9fdc5323fef8e98f5f99a79 (patch)
tree05f2564ff02eeccc6b27e567df20daca5ca425bb /src/mbgl/shaders/fill.cpp
parent978363a47f3c15aa4f3ac42bd63d5f65a4f827b0 (diff)
downloadqtlocation-mapboxgl-2cbc3d3332e32054e9fdc5323fef8e98f5f99a79.tar.gz
[core] add shader defines for enabling/disabling attributes/uniforms for DDS
Diffstat (limited to 'src/mbgl/shaders/fill.cpp')
-rw-r--r--src/mbgl/shaders/fill.cpp40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/mbgl/shaders/fill.cpp b/src/mbgl/shaders/fill.cpp
index 0b775273d2..8f5f304014 100644
--- a/src/mbgl/shaders/fill.cpp
+++ b/src/mbgl/shaders/fill.cpp
@@ -11,28 +11,64 @@ 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_vec4(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);
}
)MBGL_SHADER";
const char* fill::fragmentSource = R"MBGL_SHADER(
+
+#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;