summaryrefslogtreecommitdiff
path: root/src/mbgl/programs/gl/symbol_icon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/programs/gl/symbol_icon.cpp')
-rw-r--r--src/mbgl/programs/gl/symbol_icon.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mbgl/programs/gl/symbol_icon.cpp b/src/mbgl/programs/gl/symbol_icon.cpp
index dfdcd910bc..eb940c17bc 100644
--- a/src/mbgl/programs/gl/symbol_icon.cpp
+++ b/src/mbgl/programs/gl/symbol_icon.cpp
@@ -15,9 +15,9 @@ struct ShaderSource;
template <>
struct ShaderSource<SymbolIconProgram> {
static constexpr const char* name = "symbol_icon";
- static constexpr const uint8_t hash[8] = {0xa9, 0xd8, 0x73, 0xdf, 0xd9, 0xd8, 0x82, 0xf2};
+ static constexpr const uint8_t hash[8] = {0x17, 0x8a, 0xb9, 0xa4, 0x9d, 0xd2, 0xe1, 0x90};
static constexpr const auto vertexOffset = 50247;
- static constexpr const auto fragmentOffset = 52996;
+ static constexpr const auto fragmentOffset = 53077;
};
constexpr const char* ShaderSource<SymbolIconProgram>::name;
@@ -142,6 +142,10 @@ void main() {
vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);
gl_Position = u_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * max(a_minFontScale, fontScale) + a_pxoffset / 16.0), 0.0, 1.0);
+ // Symbols might end up being behind the camera. Modify z-value to be out of visible bounds
+ // if this is the case, otherwise ignore depth. -1.1 is safely out of the visible depth range [-1, 1]
+ gl_Position.z = mix(-1.1 * gl_Position.w, gl_Position.z, float(projected_pos.w > 0.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;