Upgrade OpenGL backend to ES 3.0 (#995)

Co-authored-by: Tadej Novak <tadej@tano.si>
This commit is contained in:
mwilsnd
2023-04-13 16:24:45 -05:00
committed by GitHub
parent 569791b310
commit 4828cc7a8b
115 changed files with 760 additions and 1159 deletions

View File

@@ -313,21 +313,6 @@ extern void (* const glVertexAttribPointer)(GLuint, GLint, GLenum, GLboolean, GL
/// Pointer to glViewport OpenGL function.
extern void (* const glViewport)(GLint, GLint, GLsizei, GLsizei);
#ifndef MBGL_USE_GLES2
/// Pointer to glDrawPixels OpenGL function.
extern void (* const glDrawPixels)(GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
/// Pointer to glGetDoublev OpenGL function.
extern void (* const glGetDoublev)(GLenum, GLdouble *);
/// Pointer to glPixelTransferf OpenGL function.
extern void (* const glPixelTransferf)(GLenum, GLfloat);
/// Pointer to glPixelZoom OpenGL function.
extern void (* const glPixelZoom)(GLfloat, GLfloat);
/// Pointer to glPointSize OpenGL function.
extern void (* const glPointSize)(GLfloat);
/// Pointer to glRasterPos4d OpenGL function.
extern void (* const glRasterPos4d)(GLdouble, GLdouble, GLdouble, GLdouble);
#endif
#ifndef NDEBUG
/// Check for GL errors and print on the console.
void glCheckError(const char *cmd, const char *file, int line);

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -8,8 +8,7 @@ namespace mbgl {
namespace shaders {
template <> struct ShaderSource<BuiltIn::BackgroundProgram, gfx::Backend::Type::OpenGL> {
static constexpr const char* vertex = R"(attribute vec2 a_pos;
static constexpr const char* vertex = R"(layout (location = 0) in vec2 a_pos;
uniform mat4 u_matrix;
void main() {
@@ -20,10 +19,10 @@ void main() {
uniform float u_opacity;
void main() {
gl_FragColor = u_color * u_opacity;
fragColor = u_color * u_opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
}
)";

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -17,10 +17,9 @@ uniform float u_scale_a;
uniform float u_scale_b;
uniform float u_tile_units_to_pixels;
attribute vec2 a_pos;
varying vec2 v_pos_a;
varying vec2 v_pos_b;
layout (location = 0) in vec2 a_pos;
out vec2 v_pos_a;
out vec2 v_pos_b;
void main() {
gl_Position = u_matrix * vec4(a_pos, 0, 1);
@@ -39,22 +38,22 @@ uniform float u_opacity;
uniform sampler2D u_image;
varying vec2 v_pos_a;
varying vec2 v_pos_b;
in vec2 v_pos_a;
in vec2 v_pos_b;
void main() {
vec2 imagecoord = mod(v_pos_a, 1.0);
vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord);
vec4 color1 = texture2D(u_image, pos);
vec4 color1 = texture(u_image, pos);
vec2 imagecoord_b = mod(v_pos_b, 1.0);
vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b);
vec4 color2 = texture2D(u_image, pos2);
vec4 color2 = texture(u_image, pos2);
gl_FragColor = mix(color1, color2, u_mix) * u_opacity;
fragColor = mix(color1, color2, u_mix) * u_opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
}
)";

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -15,56 +15,55 @@ uniform vec2 u_extrude_scale;
uniform lowp float u_device_pixel_ratio;
uniform highp float u_camera_to_center_distance;
attribute vec2 a_pos;
varying vec3 v_data;
layout (location = 0) in vec2 a_pos;
out vec3 v_data;
#ifndef HAS_UNIFORM_u_color
uniform lowp float u_color_t;
attribute highp vec4 a_color;
varying highp vec4 color;
layout (location = 1) in highp vec4 a_color;
out highp vec4 color;
#else
uniform highp vec4 u_color;
#endif
#ifndef HAS_UNIFORM_u_radius
uniform lowp float u_radius_t;
attribute mediump vec2 a_radius;
varying mediump float radius;
layout (location = 2) in mediump vec2 a_radius;
out mediump float radius;
#else
uniform mediump float u_radius;
#endif
#ifndef HAS_UNIFORM_u_blur
uniform lowp float u_blur_t;
attribute lowp vec2 a_blur;
varying lowp float blur;
layout (location = 3) in lowp vec2 a_blur;
out lowp float blur;
#else
uniform lowp float u_blur;
#endif
#ifndef HAS_UNIFORM_u_opacity
uniform lowp float u_opacity_t;
attribute lowp vec2 a_opacity;
varying lowp float opacity;
layout (location = 4) in lowp vec2 a_opacity;
out lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
#ifndef HAS_UNIFORM_u_stroke_color
uniform lowp float u_stroke_color_t;
attribute highp vec4 a_stroke_color;
varying highp vec4 stroke_color;
layout (location = 5) in highp vec4 a_stroke_color;
out highp vec4 stroke_color;
#else
uniform highp vec4 u_stroke_color;
#endif
#ifndef HAS_UNIFORM_u_stroke_width
uniform lowp float u_stroke_width_t;
attribute mediump vec2 a_stroke_width;
varying mediump float stroke_width;
layout (location = 6) in mediump vec2 a_stroke_width;
out mediump float stroke_width;
#else
uniform mediump float u_stroke_width;
#endif
#ifndef HAS_UNIFORM_u_stroke_opacity
uniform lowp float u_stroke_opacity_t;
attribute lowp vec2 a_stroke_opacity;
varying lowp float stroke_opacity;
layout (location = 7) in lowp vec2 a_stroke_opacity;
out lowp float stroke_opacity;
#else
uniform lowp float u_stroke_opacity;
#endif
@@ -143,40 +142,40 @@ lowp float stroke_opacity = u_stroke_opacity;
v_data = vec3(extrude.x, extrude.y, antialiasblur);
}
)";
static constexpr const char* fragment = R"(varying vec3 v_data;
static constexpr const char* fragment = R"(in vec3 v_data;
#ifndef HAS_UNIFORM_u_color
varying highp vec4 color;
in highp vec4 color;
#else
uniform highp vec4 u_color;
#endif
#ifndef HAS_UNIFORM_u_radius
varying mediump float radius;
in mediump float radius;
#else
uniform mediump float u_radius;
#endif
#ifndef HAS_UNIFORM_u_blur
varying lowp float blur;
in lowp float blur;
#else
uniform lowp float u_blur;
#endif
#ifndef HAS_UNIFORM_u_opacity
varying lowp float opacity;
in lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
#ifndef HAS_UNIFORM_u_stroke_color
varying highp vec4 stroke_color;
in highp vec4 stroke_color;
#else
uniform highp vec4 u_stroke_color;
#endif
#ifndef HAS_UNIFORM_u_stroke_width
varying mediump float stroke_width;
in mediump float stroke_width;
#else
uniform mediump float u_stroke_width;
#endif
#ifndef HAS_UNIFORM_u_stroke_opacity
varying lowp float stroke_opacity;
in lowp float stroke_opacity;
#else
uniform lowp float u_stroke_opacity;
#endif
@@ -218,10 +217,10 @@ lowp float stroke_opacity = u_stroke_opacity;
extrude_length - radius / (radius + stroke_width)
);
gl_FragColor = opacity_t * mix(color * opacity, stroke_color * stroke_opacity, color_t);
fragColor = opacity_t * mix(color * opacity, stroke_color * stroke_opacity, color_t);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
}
)";

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -8,7 +8,7 @@ namespace mbgl {
namespace shaders {
template <> struct ShaderSource<BuiltIn::ClippingMaskProgram, gfx::Backend::Type::OpenGL> {
static constexpr const char* vertex = R"(attribute vec2 a_pos;
static constexpr const char* vertex = R"(layout (location = 0) in vec2 a_pos;
uniform mat4 u_matrix;
@@ -17,7 +17,7 @@ void main() {
}
)";
static constexpr const char* fragment = R"(void main() {
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
}
)";
};

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -8,18 +8,18 @@ namespace mbgl {
namespace shaders {
template <> struct ShaderSource<BuiltIn::CollisionBoxProgram, gfx::Backend::Type::OpenGL> {
static constexpr const char* vertex = R"(attribute vec2 a_pos;
attribute vec2 a_anchor_pos;
attribute vec2 a_extrude;
attribute vec2 a_placed;
attribute vec2 a_shift;
static constexpr const char* vertex = R"(layout (location = 0) in vec2 a_pos;
layout (location = 1) in vec2 a_anchor_pos;
layout (location = 2) in vec2 a_extrude;
layout (location = 3) in vec2 a_placed;
layout (location = 4) in vec2 a_shift;
uniform mat4 u_matrix;
uniform vec2 u_extrude_scale;
uniform float u_camera_to_center_distance;
varying float v_placed;
varying float v_notUsed;
out float v_placed;
out float v_notUsed;
void main() {
vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1);
@@ -37,24 +37,24 @@ void main() {
}
)";
static constexpr const char* fragment = R"(
varying float v_placed;
varying float v_notUsed;
in float v_placed;
in float v_notUsed;
void main() {
float alpha = 0.5;
// Red = collision, hide label
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;
fragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;
// Blue = no collision, label is showing
if (v_placed > 0.5) {
gl_FragColor = vec4(0.0, 0.0, 1.0, 0.5) * alpha;
fragColor = vec4(0.0, 0.0, 1.0, 0.5) * alpha;
}
if (v_notUsed > 0.5) {
// This box not used, fade it out
gl_FragColor *= .1;
fragColor *= .1;
}
})";
};

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -8,21 +8,20 @@ namespace mbgl {
namespace shaders {
template <> struct ShaderSource<BuiltIn::CollisionCircleProgram, gfx::Backend::Type::OpenGL> {
static constexpr const char* vertex = R"(attribute vec2 a_pos;
attribute vec2 a_anchor_pos;
attribute vec2 a_extrude;
attribute vec2 a_placed;
static constexpr const char* vertex = R"(layout (location = 0) in vec2 a_pos;
layout (location = 1) in vec2 a_anchor_pos;
layout (location = 2) in vec2 a_extrude;
layout (location = 3) in vec2 a_placed;
uniform mat4 u_matrix;
uniform vec2 u_extrude_scale;
uniform float u_camera_to_center_distance;
varying float v_placed;
varying float v_notUsed;
varying float v_radius;
varying vec2 v_extrude;
varying vec2 v_extrude_scale;
out float v_placed;
out float v_notUsed;
out float v_radius;
out vec2 v_extrude;
out vec2 v_extrude_scale;
void main() {
vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1);
@@ -47,11 +46,11 @@ void main() {
)";
static constexpr const char* fragment = R"(uniform float u_overscale_factor;
varying float v_placed;
varying float v_notUsed;
varying float v_radius;
varying vec2 v_extrude;
varying vec2 v_extrude_scale;
in float v_placed;
in float v_notUsed;
in float v_radius;
in vec2 v_extrude;
in vec2 v_extrude_scale;
void main() {
float alpha = 0.5;
@@ -77,7 +76,7 @@ void main() {
float distance_to_edge = abs(extrude_length - radius);
float opacity_t = smoothstep(-stroke_width, 0.0, -distance_to_edge);
gl_FragColor = opacity_t * color;
fragColor = opacity_t * color;
}
)";
};

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -8,8 +8,8 @@ namespace mbgl {
namespace shaders {
template <> struct ShaderSource<BuiltIn::DebugProgram, gfx::Backend::Type::OpenGL> {
static constexpr const char* vertex = R"(attribute vec2 a_pos;
varying vec2 v_uv;
static constexpr const char* vertex = R"(layout (location = 0) in vec2 a_pos;
out vec2 v_uv;
uniform mat4 u_matrix;
uniform float u_overlay_scale;
@@ -24,11 +24,11 @@ void main() {
static constexpr const char* fragment = R"(uniform highp vec4 u_color;
uniform sampler2D u_overlay;
varying vec2 v_uv;
in vec2 v_uv;
void main() {
vec4 overlay_color = texture2D(u_overlay, v_uv);
gl_FragColor = mix(u_color, overlay_color, overlay_color.a);
vec4 overlay_color = texture(u_overlay, v_uv);
fragColor = mix(u_color, overlay_color, overlay_color.a);
}
)";
};

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -8,21 +8,21 @@ namespace mbgl {
namespace shaders {
template <> struct ShaderSource<BuiltIn::FillProgram, gfx::Backend::Type::OpenGL> {
static constexpr const char* vertex = R"(attribute vec2 a_pos;
static constexpr const char* vertex = R"(layout (location = 0) in vec2 a_pos;
uniform mat4 u_matrix;
#ifndef HAS_UNIFORM_u_color
uniform lowp float u_color_t;
attribute highp vec4 a_color;
varying highp vec4 color;
layout (location = 1) in highp vec4 a_color;
out highp vec4 color;
#else
uniform highp vec4 u_color;
#endif
#ifndef HAS_UNIFORM_u_opacity
uniform lowp float u_opacity_t;
attribute lowp vec2 a_opacity;
varying lowp float opacity;
layout (location = 2) in lowp vec2 a_opacity;
out lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
@@ -43,12 +43,12 @@ lowp float opacity = u_opacity;
}
)";
static constexpr const char* fragment = R"(#ifndef HAS_UNIFORM_u_color
varying highp vec4 color;
in highp vec4 color;
#else
uniform highp vec4 u_color;
#endif
#ifndef HAS_UNIFORM_u_opacity
varying lowp float opacity;
in lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
@@ -61,10 +61,10 @@ highp vec4 color = u_color;
lowp float opacity = u_opacity;
#endif
gl_FragColor = color * opacity;
fragColor = color * opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
}
)";

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -15,27 +15,26 @@ uniform lowp float u_lightintensity;
uniform float u_vertical_gradient;
uniform lowp float u_opacity;
attribute vec2 a_pos;
attribute vec4 a_normal_ed;
varying vec4 v_color;
layout (location = 0) in vec2 a_pos;
layout (location = 1) in vec4 a_normal_ed;
out vec4 v_color;
#ifndef HAS_UNIFORM_u_base
uniform lowp float u_base_t;
attribute highp vec2 a_base;
layout (location = 2) in highp vec2 a_base;
#else
uniform highp float u_base;
#endif
#ifndef HAS_UNIFORM_u_height
uniform lowp float u_height_t;
attribute highp vec2 a_height;
layout (location = 3) in highp vec2 a_height;
#else
uniform highp float u_height;
#endif
#ifndef HAS_UNIFORM_u_color
uniform lowp float u_color_t;
attribute highp vec4 a_color;
layout (location = 4) in highp vec4 a_color;
#else
uniform highp vec4 u_color;
#endif
@@ -102,13 +101,13 @@ highp vec4 color = u_color;
v_color *= u_opacity;
}
)";
static constexpr const char* fragment = R"(varying vec4 v_color;
static constexpr const char* fragment = R"(in vec4 v_color;
void main() {
gl_FragColor = v_color;
fragColor = v_color;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
}
)";

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -20,38 +20,38 @@ uniform vec3 u_lightcolor;
uniform lowp vec3 u_lightpos;
uniform lowp float u_lightintensity;
attribute vec2 a_pos;
attribute vec4 a_normal_ed;
layout (location = 0) in vec2 a_pos;
layout (location = 1) in vec4 a_normal_ed;
varying vec2 v_pos_a;
varying vec2 v_pos_b;
varying vec4 v_lighting;
out vec2 v_pos_a;
out vec2 v_pos_b;
out vec4 v_lighting;
#ifndef HAS_UNIFORM_u_base
uniform lowp float u_base_t;
attribute lowp vec2 a_base;
varying lowp float base;
layout (location = 2) in lowp vec2 a_base;
out lowp float base;
#else
uniform lowp float u_base;
#endif
#ifndef HAS_UNIFORM_u_height
uniform lowp float u_height_t;
attribute lowp vec2 a_height;
varying lowp float height;
layout (location = 3) in lowp vec2 a_height;
out lowp float height;
#else
uniform lowp float u_height;
#endif
#ifndef HAS_UNIFORM_u_pattern_from
uniform lowp float u_pattern_from_t;
attribute lowp vec4 a_pattern_from;
varying lowp vec4 pattern_from;
layout (location = 4) in lowp vec4 a_pattern_from;
out lowp vec4 pattern_from;
#else
uniform lowp vec4 u_pattern_from;
#endif
#ifndef HAS_UNIFORM_u_pattern_to
uniform lowp float u_pattern_to_t;
attribute lowp vec4 a_pattern_to;
varying lowp vec4 pattern_to;
layout (location = 5) in lowp vec4 a_pattern_to;
out lowp vec4 pattern_to;
#else
uniform lowp vec4 u_pattern_to;
#endif
@@ -130,27 +130,27 @@ uniform float u_fade;
uniform sampler2D u_image;
varying vec2 v_pos_a;
varying vec2 v_pos_b;
varying vec4 v_lighting;
in vec2 v_pos_a;
in vec2 v_pos_b;
in vec4 v_lighting;
#ifndef HAS_UNIFORM_u_base
varying lowp float base;
in lowp float base;
#else
uniform lowp float u_base;
#endif
#ifndef HAS_UNIFORM_u_height
varying lowp float height;
in lowp float height;
#else
uniform lowp float u_height;
#endif
#ifndef HAS_UNIFORM_u_pattern_from
varying lowp vec4 pattern_from;
in lowp vec4 pattern_from;
#else
uniform lowp vec4 u_pattern_from;
#endif
#ifndef HAS_UNIFORM_u_pattern_to
varying lowp vec4 pattern_to;
in lowp vec4 pattern_to;
#else
uniform lowp vec4 u_pattern_to;
#endif
@@ -176,18 +176,18 @@ mediump vec4 pattern_to = u_pattern_to;
vec2 imagecoord = mod(v_pos_a, 1.0);
vec2 pos = mix(pattern_tl_a / u_texsize, pattern_br_a / u_texsize, imagecoord);
vec4 color1 = texture2D(u_image, pos);
vec4 color1 = texture(u_image, pos);
vec2 imagecoord_b = mod(v_pos_b, 1.0);
vec2 pos2 = mix(pattern_tl_b / u_texsize, pattern_br_b / u_texsize, imagecoord_b);
vec4 color2 = texture2D(u_image, pos2);
vec4 color2 = texture(u_image, pos2);
vec4 mixedColor = mix(color1, color2, u_fade);
gl_FragColor = mixedColor * v_lighting;
fragColor = mixedColor * v_lighting;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
}
)";

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -8,24 +8,24 @@ namespace mbgl {
namespace shaders {
template <> struct ShaderSource<BuiltIn::FillOutlineProgram, gfx::Backend::Type::OpenGL> {
static constexpr const char* vertex = R"(attribute vec2 a_pos;
static constexpr const char* vertex = R"(layout (location = 0) in vec2 a_pos;
uniform mat4 u_matrix;
uniform vec2 u_world;
varying vec2 v_pos;
out vec2 v_pos;
#ifndef HAS_UNIFORM_u_outline_color
uniform lowp float u_outline_color_t;
attribute highp vec4 a_outline_color;
varying highp vec4 outline_color;
layout (location = 1) in highp vec4 a_outline_color;
out highp vec4 outline_color;
#else
uniform highp vec4 u_outline_color;
#endif
#ifndef HAS_UNIFORM_u_opacity
uniform lowp float u_opacity_t;
attribute lowp vec2 a_opacity;
varying lowp float opacity;
layout (location = 2) in lowp vec2 a_opacity;
out lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
@@ -46,15 +46,15 @@ lowp float opacity = u_opacity;
v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;
}
)";
static constexpr const char* fragment = R"(varying vec2 v_pos;
static constexpr const char* fragment = R"(in vec2 v_pos;
#ifndef HAS_UNIFORM_u_outline_color
varying highp vec4 outline_color;
in highp vec4 outline_color;
#else
uniform highp vec4 u_outline_color;
#endif
#ifndef HAS_UNIFORM_u_opacity
varying lowp float opacity;
in lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
@@ -69,10 +69,10 @@ lowp float opacity = u_opacity;
float dist = length(v_pos - gl_FragCoord.xy);
float alpha = 1.0 - smoothstep(0.0, 1.0, dist);
gl_FragColor = outline_color * (alpha * opacity);
fragColor = outline_color * (alpha * opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
}
)";

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -14,30 +14,30 @@ uniform vec2 u_pixel_coord_upper;
uniform vec2 u_pixel_coord_lower;
uniform vec4 u_scale;
attribute vec2 a_pos;
layout (location = 0) in vec2 a_pos;
varying vec2 v_pos_a;
varying vec2 v_pos_b;
varying vec2 v_pos;
out vec2 v_pos_a;
out vec2 v_pos_b;
out vec2 v_pos;
#ifndef HAS_UNIFORM_u_opacity
uniform lowp float u_opacity_t;
attribute lowp vec2 a_opacity;
varying lowp float opacity;
layout (location = 1) in lowp vec2 a_opacity;
out lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
#ifndef HAS_UNIFORM_u_pattern_from
uniform lowp float u_pattern_from_t;
attribute lowp vec4 a_pattern_from;
varying lowp vec4 pattern_from;
layout (location = 2) in lowp vec4 a_pattern_from;
out lowp vec4 pattern_from;
#else
uniform lowp vec4 u_pattern_from;
#endif
#ifndef HAS_UNIFORM_u_pattern_to
uniform lowp float u_pattern_to_t;
attribute lowp vec4 a_pattern_to;
varying lowp vec4 pattern_to;
layout (location = 3) in lowp vec4 a_pattern_to;
out lowp vec4 pattern_to;
#else
uniform lowp vec4 u_pattern_to;
#endif
@@ -85,22 +85,22 @@ uniform vec2 u_texsize;
uniform sampler2D u_image;
uniform float u_fade;
varying vec2 v_pos_a;
varying vec2 v_pos_b;
varying vec2 v_pos;
in vec2 v_pos_a;
in vec2 v_pos_b;
in vec2 v_pos;
#ifndef HAS_UNIFORM_u_opacity
varying lowp float opacity;
in lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
#ifndef HAS_UNIFORM_u_pattern_from
varying lowp vec4 pattern_from;
in lowp vec4 pattern_from;
#else
uniform lowp vec4 u_pattern_from;
#endif
#ifndef HAS_UNIFORM_u_pattern_to
varying lowp vec4 pattern_to;
in lowp vec4 pattern_to;
#else
uniform lowp vec4 u_pattern_to;
#endif
@@ -123,11 +123,11 @@ mediump vec4 pattern_to = u_pattern_to;
vec2 imagecoord = mod(v_pos_a, 1.0);
vec2 pos = mix(pattern_tl_a / u_texsize, pattern_br_a / u_texsize, imagecoord);
vec4 color1 = texture2D(u_image, pos);
vec4 color1 = texture(u_image, pos);
vec2 imagecoord_b = mod(v_pos_b, 1.0);
vec2 pos2 = mix(pattern_tl_b / u_texsize, pattern_br_b / u_texsize, imagecoord_b);
vec4 color2 = texture2D(u_image, pos2);
vec4 color2 = texture(u_image, pos2);
// find distance to outline for alpha interpolation
@@ -135,10 +135,10 @@ mediump vec4 pattern_to = u_pattern_to;
float alpha = 1.0 - smoothstep(0.0, 1.0, dist);
gl_FragColor = mix(color1, color2, u_fade) * alpha * opacity;
fragColor = mix(color1, color2, u_fade) * alpha * opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
}
)";

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -13,29 +13,29 @@ uniform vec2 u_pixel_coord_upper;
uniform vec2 u_pixel_coord_lower;
uniform vec4 u_scale;
attribute vec2 a_pos;
layout (location = 0) in vec2 a_pos;
varying vec2 v_pos_a;
varying vec2 v_pos_b;
out vec2 v_pos_a;
out vec2 v_pos_b;
#ifndef HAS_UNIFORM_u_opacity
uniform lowp float u_opacity_t;
attribute lowp vec2 a_opacity;
varying lowp float opacity;
layout (location = 1) in lowp vec2 a_opacity;
out lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
#ifndef HAS_UNIFORM_u_pattern_from
uniform lowp float u_pattern_from_t;
attribute lowp vec4 a_pattern_from;
varying lowp vec4 pattern_from;
layout (location = 2) in lowp vec4 a_pattern_from;
out lowp vec4 pattern_from;
#else
uniform lowp vec4 u_pattern_from;
#endif
#ifndef HAS_UNIFORM_u_pattern_to
uniform lowp float u_pattern_to_t;
attribute lowp vec4 a_pattern_to;
varying lowp vec4 pattern_to;
layout (location = 3) in lowp vec4 a_pattern_to;
out lowp vec4 pattern_to;
#else
uniform lowp vec4 u_pattern_to;
#endif
@@ -80,21 +80,21 @@ uniform float u_fade;
uniform sampler2D u_image;
varying vec2 v_pos_a;
varying vec2 v_pos_b;
in vec2 v_pos_a;
in vec2 v_pos_b;
#ifndef HAS_UNIFORM_u_opacity
varying lowp float opacity;
in lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
#ifndef HAS_UNIFORM_u_pattern_from
varying lowp vec4 pattern_from;
in lowp vec4 pattern_from;
#else
uniform lowp vec4 u_pattern_from;
#endif
#ifndef HAS_UNIFORM_u_pattern_to
varying lowp vec4 pattern_to;
in lowp vec4 pattern_to;
#else
uniform lowp vec4 u_pattern_to;
#endif
@@ -117,16 +117,16 @@ mediump vec4 pattern_to = u_pattern_to;
vec2 imagecoord = mod(v_pos_a, 1.0);
vec2 pos = mix(pattern_tl_a / u_texsize, pattern_br_a / u_texsize, imagecoord);
vec4 color1 = texture2D(u_image, pos);
vec4 color1 = texture(u_image, pos);
vec2 imagecoord_b = mod(v_pos_b, 1.0);
vec2 pos2 = mix(pattern_tl_b / u_texsize, pattern_br_b / u_texsize, imagecoord_b);
vec4 color2 = texture2D(u_image, pos2);
vec4 color2 = texture(u_image, pos2);
gl_FragColor = mix(color1, color2, u_fade) * opacity;
fragColor = mix(color1, color2, u_fade) * opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
}
)";

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -8,26 +8,24 @@ namespace mbgl {
namespace shaders {
template <> struct ShaderSource<BuiltIn::HeatmapProgram, gfx::Backend::Type::OpenGL> {
static constexpr const char* vertex = R"(
uniform mat4 u_matrix;
static constexpr const char* vertex = R"(uniform mat4 u_matrix;
uniform float u_extrude_scale;
uniform float u_opacity;
uniform float u_intensity;
attribute vec2 a_pos;
varying vec2 v_extrude;
layout (location = 0) in vec2 a_pos;
out vec2 v_extrude;
#ifndef HAS_UNIFORM_u_weight
uniform lowp float u_weight_t;
attribute highp vec2 a_weight;
varying highp float weight;
layout (location = 1) in highp vec2 a_weight;
out highp float weight;
#else
uniform highp float u_weight;
#endif
#ifndef HAS_UNIFORM_u_radius
uniform lowp float u_radius_t;
attribute mediump vec2 a_radius;
layout (location = 2) in mediump vec2 a_radius;
#else
uniform mediump float u_radius;
#endif
@@ -84,10 +82,10 @@ mediump float radius = u_radius;
)";
static constexpr const char* fragment = R"(uniform highp float u_intensity;
varying vec2 v_extrude;
in vec2 v_extrude;
#ifndef HAS_UNIFORM_u_weight
varying highp float weight;
in highp float weight;
#else
uniform highp float u_weight;
#endif
@@ -104,10 +102,10 @@ highp float weight = u_weight;
float d = -0.5 * 3.0 * 3.0 * dot(v_extrude, v_extrude);
float val = weight * u_intensity * GAUSS_COEF * exp(d);
gl_FragColor = vec4(val, 1.0, 1.0, 1.0);
fragColor = vec4(val, 1.0, 1.0, 1.0);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
}
)";

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -10,8 +10,8 @@ namespace shaders {
template <> struct ShaderSource<BuiltIn::HeatmapTextureProgram, gfx::Backend::Type::OpenGL> {
static constexpr const char* vertex = R"(uniform mat4 u_matrix;
uniform vec2 u_world;
attribute vec2 a_pos;
varying vec2 v_pos;
layout (location = 0) in vec2 a_pos;
out vec2 v_pos;
void main() {
gl_Position = u_matrix * vec4(a_pos * u_world, 0, 1);
@@ -23,15 +23,15 @@ void main() {
static constexpr const char* fragment = R"(uniform sampler2D u_image;
uniform sampler2D u_color_ramp;
uniform float u_opacity;
varying vec2 v_pos;
in vec2 v_pos;
void main() {
float t = texture2D(u_image, v_pos).r;
vec4 color = texture2D(u_color_ramp, vec2(t, 0.5));
gl_FragColor = color * u_opacity;
float t = texture(u_image, v_pos).r;
vec4 color = texture(u_color_ramp, vec2(t, 0.5));
fragColor = color * u_opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(0.0);
fragColor = vec4(0.0);
#endif
}
)";

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -10,10 +10,10 @@ namespace shaders {
template <> struct ShaderSource<BuiltIn::HillshadeProgram, gfx::Backend::Type::OpenGL> {
static constexpr const char* vertex = R"(uniform mat4 u_matrix;
attribute vec2 a_pos;
attribute vec2 a_texture_pos;
layout (location = 0) in vec2 a_pos;
layout (location = 1) in vec2 a_texture_pos;
varying vec2 v_pos;
out vec2 v_pos;
void main() {
gl_Position = u_matrix * vec4(a_pos, 0, 1);
@@ -21,7 +21,7 @@ void main() {
}
)";
static constexpr const char* fragment = R"(uniform sampler2D u_image;
varying vec2 v_pos;
in vec2 v_pos;
uniform vec2 u_latrange;
uniform vec2 u_light;
@@ -32,7 +32,7 @@ uniform vec4 u_accent;
#define PI 3.141592653589793
void main() {
vec4 pixel = texture2D(u_image, v_pos);
vec4 pixel = texture(u_image, v_pos);
vec2 deriv = ((pixel.rg * 2.0) - 1.0);
@@ -66,10 +66,10 @@ void main() {
vec4 accent_color = (1.0 - accent) * u_accent * clamp(intensity * 2.0, 0.0, 1.0);
float shade = abs(mod((aspect + azimuth) / PI + 0.5, 2.0) - 1.0);
vec4 shade_color = mix(u_shadow, u_highlight, shade) * sin(scaledSlope) * clamp(intensity * 2.0, 0.0, 1.0);
gl_FragColor = accent_color * (1.0 - shade_color.a) + shade_color;
fragColor = accent_color * (1.0 - shade_color.a) + shade_color;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
}
)";

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -11,10 +11,10 @@ template <> struct ShaderSource<BuiltIn::HillshadePrepareProgram, gfx::Backend::
static constexpr const char* vertex = R"(uniform mat4 u_matrix;
uniform vec2 u_dimension;
attribute vec2 a_pos;
attribute vec2 a_texture_pos;
layout (location = 0) in vec2 a_pos;
layout (location = 1) in vec2 a_texture_pos;
varying vec2 v_pos;
out vec2 v_pos;
void main() {
gl_Position = u_matrix * vec4(a_pos, 0, 1);
@@ -29,7 +29,7 @@ precision highp float;
#endif
uniform sampler2D u_image;
varying vec2 v_pos;
in vec2 v_pos;
uniform vec2 u_dimension;
uniform float u_zoom;
uniform float u_maxzoom;
@@ -37,7 +37,7 @@ uniform vec4 u_unpack;
float getElevation(vec2 coord, float bias) {
// Convert encoded elevation value to meters
vec4 data = texture2D(u_image, coord) * 255.0;
vec4 data = texture(u_image, coord) * 255.0;
data.a = -1.0;
return dot(data, u_unpack) / 4.0;
}
@@ -88,14 +88,14 @@ void main() {
(g + h + h + i) - (a + b + b + c)
) / pow(2.0, (u_zoom - u_maxzoom) * exaggeration + 19.2562 - u_zoom);
gl_FragColor = clamp(vec4(
fragColor = clamp(vec4(
deriv.x / 2.0 + 0.5,
deriv.y / 2.0 + 0.5,
1.0,
1.0), 0.0, 1.0);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
}
)";

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -16,55 +16,55 @@ template <> struct ShaderSource<BuiltIn::LineProgram, gfx::Backend::Type::OpenGL
// #define scale 63.0
#define scale 0.015873016
attribute vec2 a_pos_normal;
attribute vec4 a_data;
layout (location = 0) in vec2 a_pos_normal;
layout (location = 1) in vec4 a_data;
uniform mat4 u_matrix;
uniform mediump float u_ratio;
uniform vec2 u_units_to_pixels;
uniform lowp float u_device_pixel_ratio;
varying vec2 v_normal;
varying vec2 v_width2;
varying float v_gamma_scale;
varying highp float v_linesofar;
out vec2 v_normal;
out vec2 v_width2;
out float v_gamma_scale;
out highp float v_linesofar;
#ifndef HAS_UNIFORM_u_color
uniform lowp float u_color_t;
attribute highp vec4 a_color;
varying highp vec4 color;
layout (location = 2) in highp vec4 a_color;
out highp vec4 color;
#else
uniform highp vec4 u_color;
#endif
#ifndef HAS_UNIFORM_u_blur
uniform lowp float u_blur_t;
attribute lowp vec2 a_blur;
varying lowp float blur;
layout (location = 3) in lowp vec2 a_blur;
out lowp float blur;
#else
uniform lowp float u_blur;
#endif
#ifndef HAS_UNIFORM_u_opacity
uniform lowp float u_opacity_t;
attribute lowp vec2 a_opacity;
varying lowp float opacity;
layout (location = 4) in lowp vec2 a_opacity;
out lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
#ifndef HAS_UNIFORM_u_gapwidth
uniform lowp float u_gapwidth_t;
attribute mediump vec2 a_gapwidth;
layout (location = 5) in mediump vec2 a_gapwidth;
#else
uniform mediump float u_gapwidth;
#endif
#ifndef HAS_UNIFORM_u_offset
uniform lowp float u_offset_t;
attribute lowp vec2 a_offset;
layout (location = 6) in lowp vec2 a_offset;
#else
uniform lowp float u_offset;
#endif
#ifndef HAS_UNIFORM_u_width
uniform lowp float u_width_t;
attribute mediump vec2 a_width;
layout (location = 7) in mediump vec2 a_width;
#else
uniform mediump float u_width;
#endif
@@ -153,22 +153,22 @@ mediump float width = u_width;
)";
static constexpr const char* fragment = R"(uniform lowp float u_device_pixel_ratio;
varying vec2 v_width2;
varying vec2 v_normal;
varying float v_gamma_scale;
in vec2 v_width2;
in vec2 v_normal;
in float v_gamma_scale;
#ifndef HAS_UNIFORM_u_color
varying highp vec4 color;
in highp vec4 color;
#else
uniform highp vec4 u_color;
#endif
#ifndef HAS_UNIFORM_u_blur
varying lowp float blur;
in lowp float blur;
#else
uniform lowp float u_blur;
#endif
#ifndef HAS_UNIFORM_u_opacity
varying lowp float opacity;
in lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
@@ -193,10 +193,10 @@ lowp float opacity = u_opacity;
float blur2 = (blur + 1.0 / u_device_pixel_ratio) * v_gamma_scale;
float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);
gl_FragColor = color * (alpha * opacity);
fragColor = color * (alpha * opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
}
)";

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -20,48 +20,48 @@ template <> struct ShaderSource<BuiltIn::LineGradientProgram, gfx::Backend::Type
// #define scale 63.0
#define scale 0.015873016
attribute vec2 a_pos_normal;
attribute vec4 a_data;
layout (location = 0) in vec2 a_pos_normal;
layout (location = 1) in vec4 a_data;
uniform mat4 u_matrix;
uniform mediump float u_ratio;
uniform lowp float u_device_pixel_ratio;
uniform vec2 u_units_to_pixels;
varying vec2 v_normal;
varying vec2 v_width2;
varying float v_gamma_scale;
varying highp float v_lineprogress;
out vec2 v_normal;
out vec2 v_width2;
out float v_gamma_scale;
out highp float v_lineprogress;
#ifndef HAS_UNIFORM_u_blur
uniform lowp float u_blur_t;
attribute lowp vec2 a_blur;
varying lowp float blur;
layout (location = 2) in lowp vec2 a_blur;
out lowp float blur;
#else
uniform lowp float u_blur;
#endif
#ifndef HAS_UNIFORM_u_opacity
uniform lowp float u_opacity_t;
attribute lowp vec2 a_opacity;
varying lowp float opacity;
layout (location = 3) in lowp vec2 a_opacity;
out lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
#ifndef HAS_UNIFORM_u_gapwidth
uniform lowp float u_gapwidth_t;
attribute mediump vec2 a_gapwidth;
layout (location = 4) in mediump vec2 a_gapwidth;
#else
uniform mediump float u_gapwidth;
#endif
#ifndef HAS_UNIFORM_u_offset
uniform lowp float u_offset_t;
attribute lowp vec2 a_offset;
layout (location = 5) in lowp vec2 a_offset;
#else
uniform lowp float u_offset;
#endif
#ifndef HAS_UNIFORM_u_width
uniform lowp float u_width_t;
attribute mediump vec2 a_width;
layout (location = 6) in mediump vec2 a_width;
#else
uniform mediump float u_width;
#endif
@@ -146,18 +146,18 @@ mediump float width = u_width;
static constexpr const char* fragment = R"(uniform lowp float u_device_pixel_ratio;
uniform sampler2D u_image;
varying vec2 v_width2;
varying vec2 v_normal;
varying float v_gamma_scale;
varying highp float v_lineprogress;
in vec2 v_width2;
in vec2 v_normal;
in float v_gamma_scale;
in highp float v_lineprogress;
#ifndef HAS_UNIFORM_u_blur
varying lowp float blur;
in lowp float blur;
#else
uniform lowp float u_blur;
#endif
#ifndef HAS_UNIFORM_u_opacity
varying lowp float opacity;
in lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
@@ -181,12 +181,12 @@ lowp float opacity = u_opacity;
// For gradient lines, v_lineprogress is the ratio along the entire line,
// scaled to [0, 2^15), and the gradient ramp is stored in a texture.
vec4 color = texture2D(u_image, vec2(v_lineprogress, 0.5));
vec4 color = texture(u_image, vec2(v_lineprogress, 0.5));
gl_FragColor = color * (alpha * opacity);
fragColor = color * (alpha * opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
}
)";

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -20,62 +20,62 @@ template <> struct ShaderSource<BuiltIn::LinePatternProgram, gfx::Backend::Type:
// long distances for long segments. Use this value to unscale the distance.
#define LINE_DISTANCE_SCALE 2.0
attribute vec2 a_pos_normal;
attribute vec4 a_data;
layout (location = 0) in vec2 a_pos_normal;
layout (location = 1) in vec4 a_data;
uniform mat4 u_matrix;
uniform vec2 u_units_to_pixels;
uniform mediump float u_ratio;
uniform lowp float u_device_pixel_ratio;
varying vec2 v_normal;
varying vec2 v_width2;
varying float v_linesofar;
varying float v_gamma_scale;
out vec2 v_normal;
out vec2 v_width2;
out float v_linesofar;
out float v_gamma_scale;
#ifndef HAS_UNIFORM_u_blur
uniform lowp float u_blur_t;
attribute lowp vec2 a_blur;
varying lowp float blur;
layout (location = 2) in lowp vec2 a_blur;
out lowp float blur;
#else
uniform lowp float u_blur;
#endif
#ifndef HAS_UNIFORM_u_opacity
uniform lowp float u_opacity_t;
attribute lowp vec2 a_opacity;
varying lowp float opacity;
layout (location = 3) in lowp vec2 a_opacity;
out lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
#ifndef HAS_UNIFORM_u_offset
uniform lowp float u_offset_t;
attribute lowp vec2 a_offset;
layout (location = 4) in lowp vec2 a_offset;
#else
uniform lowp float u_offset;
#endif
#ifndef HAS_UNIFORM_u_gapwidth
uniform lowp float u_gapwidth_t;
attribute mediump vec2 a_gapwidth;
layout (location = 5) in mediump vec2 a_gapwidth;
#else
uniform mediump float u_gapwidth;
#endif
#ifndef HAS_UNIFORM_u_width
uniform lowp float u_width_t;
attribute mediump vec2 a_width;
layout (location = 6) in mediump vec2 a_width;
#else
uniform mediump float u_width;
#endif
#ifndef HAS_UNIFORM_u_pattern_from
uniform lowp float u_pattern_from_t;
attribute lowp vec4 a_pattern_from;
varying lowp vec4 pattern_from;
layout (location = 7) in lowp vec4 a_pattern_from;
out lowp vec4 pattern_from;
#else
uniform lowp vec4 u_pattern_from;
#endif
#ifndef HAS_UNIFORM_u_pattern_to
uniform lowp float u_pattern_to_t;
attribute lowp vec4 a_pattern_to;
varying lowp vec4 pattern_to;
layout (location = 8) in lowp vec4 a_pattern_to;
out lowp vec4 pattern_to;
#else
uniform lowp vec4 u_pattern_to;
#endif
@@ -174,28 +174,28 @@ uniform mediump vec4 u_scale;
uniform sampler2D u_image;
varying vec2 v_normal;
varying vec2 v_width2;
varying float v_linesofar;
varying float v_gamma_scale;
in vec2 v_normal;
in vec2 v_width2;
in float v_linesofar;
in float v_gamma_scale;
#ifndef HAS_UNIFORM_u_pattern_from
varying lowp vec4 pattern_from;
in lowp vec4 pattern_from;
#else
uniform lowp vec4 u_pattern_from;
#endif
#ifndef HAS_UNIFORM_u_pattern_to
varying lowp vec4 pattern_to;
in lowp vec4 pattern_to;
#else
uniform lowp vec4 u_pattern_to;
#endif
#ifndef HAS_UNIFORM_u_blur
varying lowp float blur;
in lowp float blur;
#else
uniform lowp float u_blur;
#endif
#ifndef HAS_UNIFORM_u_opacity
varying lowp float opacity;
in lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
@@ -253,12 +253,12 @@ lowp float opacity = u_opacity;
vec2 pos_a = mix(pattern_tl_a / u_texsize, pattern_br_a / u_texsize, vec2(x_a, y_a));
vec2 pos_b = mix(pattern_tl_b / u_texsize, pattern_br_b / u_texsize, vec2(x_b, y_b));
vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);
vec4 color = mix(texture(u_image, pos_a), texture(u_image, pos_b), u_fade);
gl_FragColor = color * alpha * opacity;
fragColor = color * alpha * opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
}
)";

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -20,8 +20,8 @@ template <> struct ShaderSource<BuiltIn::LineSDFProgram, gfx::Backend::Type::Ope
// long distances for long segments. Use this value to unscale the distance.
#define LINE_DISTANCE_SCALE 2.0
attribute vec2 a_pos_normal;
attribute vec4 a_data;
layout (location = 0) in vec2 a_pos_normal;
layout (location = 1) in vec4 a_data;
uniform mat4 u_matrix;
uniform mediump float u_ratio;
@@ -32,56 +32,56 @@ uniform vec2 u_patternscale_b;
uniform float u_tex_y_b;
uniform vec2 u_units_to_pixels;
varying vec2 v_normal;
varying vec2 v_width2;
varying vec2 v_tex_a;
varying vec2 v_tex_b;
varying float v_gamma_scale;
out vec2 v_normal;
out vec2 v_width2;
out vec2 v_tex_a;
out vec2 v_tex_b;
out float v_gamma_scale;
#ifndef HAS_UNIFORM_u_color
uniform lowp float u_color_t;
attribute highp vec4 a_color;
varying highp vec4 color;
layout (location = 2) in highp vec4 a_color;
out highp vec4 color;
#else
uniform highp vec4 u_color;
#endif
#ifndef HAS_UNIFORM_u_blur
uniform lowp float u_blur_t;
attribute lowp vec2 a_blur;
varying lowp float blur;
layout (location = 3) in lowp vec2 a_blur;
out lowp float blur;
#else
uniform lowp float u_blur;
#endif
#ifndef HAS_UNIFORM_u_opacity
uniform lowp float u_opacity_t;
attribute lowp vec2 a_opacity;
varying lowp float opacity;
layout (location = 4) in lowp vec2 a_opacity;
out lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
#ifndef HAS_UNIFORM_u_gapwidth
uniform lowp float u_gapwidth_t;
attribute mediump vec2 a_gapwidth;
layout (location = 5) in mediump vec2 a_gapwidth;
#else
uniform mediump float u_gapwidth;
#endif
#ifndef HAS_UNIFORM_u_offset
uniform lowp float u_offset_t;
attribute lowp vec2 a_offset;
layout (location = 6) in lowp vec2 a_offset;
#else
uniform lowp float u_offset;
#endif
#ifndef HAS_UNIFORM_u_width
uniform lowp float u_width_t;
attribute mediump vec2 a_width;
varying mediump float width;
layout (location = 7) in mediump vec2 a_width;
out mediump float width;
#else
uniform mediump float u_width;
#endif
#ifndef HAS_UNIFORM_u_floorwidth
uniform lowp float u_floorwidth_t;
attribute lowp vec2 a_floorwidth;
varying lowp float floorwidth;
layout (location = 8) in lowp vec2 a_floorwidth;
out lowp float floorwidth;
#else
uniform lowp float u_floorwidth;
#endif
@@ -181,34 +181,34 @@ uniform sampler2D u_image;
uniform float u_sdfgamma;
uniform float u_mix;
varying vec2 v_normal;
varying vec2 v_width2;
varying vec2 v_tex_a;
varying vec2 v_tex_b;
varying float v_gamma_scale;
in vec2 v_normal;
in vec2 v_width2;
in vec2 v_tex_a;
in vec2 v_tex_b;
in float v_gamma_scale;
#ifndef HAS_UNIFORM_u_color
varying highp vec4 color;
in highp vec4 color;
#else
uniform highp vec4 u_color;
#endif
#ifndef HAS_UNIFORM_u_blur
varying lowp float blur;
in lowp float blur;
#else
uniform lowp float u_blur;
#endif
#ifndef HAS_UNIFORM_u_opacity
varying lowp float opacity;
in lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
#ifndef HAS_UNIFORM_u_width
varying mediump float width;
in mediump float width;
#else
uniform mediump float u_width;
#endif
#ifndef HAS_UNIFORM_u_floorwidth
varying lowp float floorwidth;
in lowp float floorwidth;
#else
uniform lowp float u_floorwidth;
#endif
@@ -239,15 +239,15 @@ lowp float floorwidth = u_floorwidth;
float blur2 = (blur + 1.0 / u_device_pixel_ratio) * v_gamma_scale;
float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 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_a = texture(u_image, v_tex_a).a;
float sdfdist_b = texture(u_image, v_tex_b).a;
float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);
alpha *= smoothstep(0.5 - u_sdfgamma / floorwidth, 0.5 + u_sdfgamma / floorwidth, sdfdist);
gl_FragColor = color * (alpha * opacity);
fragColor = color * (alpha * opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
}
)";

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -99,6 +99,8 @@ precision mediump float;
#endif
#endif
out highp vec4 fragColor;
)";
};

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -13,11 +13,11 @@ uniform vec2 u_tl_parent;
uniform float u_scale_parent;
uniform float u_buffer_scale;
attribute vec2 a_pos;
attribute vec2 a_texture_pos;
layout (location = 0) in vec2 a_pos;
layout (location = 1) in vec2 a_texture_pos;
varying vec2 v_pos0;
varying vec2 v_pos1;
out vec2 v_pos0;
out vec2 v_pos1;
void main() {
gl_Position = u_matrix * vec4(a_pos, 0, 1);
@@ -34,8 +34,8 @@ void main() {
uniform float u_opacity;
uniform sampler2D u_image0;
uniform sampler2D u_image1;
varying vec2 v_pos0;
varying vec2 v_pos1;
in vec2 v_pos0;
in vec2 v_pos1;
uniform float u_brightness_low;
uniform float u_brightness_high;
@@ -47,8 +47,8 @@ uniform vec3 u_spin_weights;
void main() {
// read and cross-fade colors from the main and parent tiles
vec4 color0 = texture2D(u_image0, v_pos0);
vec4 color1 = texture2D(u_image1, v_pos1);
vec4 color0 = texture(u_image0, v_pos0);
vec4 color1 = texture(u_image1, v_pos1);
if (color0.a > 0.0) {
color0.rgb = color0.rgb / color0.a;
}
@@ -76,10 +76,10 @@ void main() {
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, color.a);
fragColor = vec4(mix(u_high_vec, u_low_vec, rgb) * color.a, color.a);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
}
)";

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -10,11 +10,11 @@ namespace shaders {
template <> struct ShaderSource<BuiltIn::SymbolIconProgram, gfx::Backend::Type::OpenGL> {
static constexpr const char* vertex = R"(const float PI = 3.141592653589793;
attribute vec4 a_pos_offset;
attribute vec4 a_data;
attribute vec4 a_pixeloffset;
attribute vec3 a_projected_pos;
attribute float a_fade_opacity;
layout (location = 0) in vec4 a_pos_offset;
layout (location = 1) in vec4 a_data;
layout (location = 2) in vec4 a_pixeloffset;
layout (location = 3) in vec3 a_projected_pos;
layout (location = 4) in float a_fade_opacity;
uniform bool u_is_size_zoom_constant;
uniform bool u_is_size_feature_constant;
@@ -35,13 +35,13 @@ uniform bool u_pitch_with_map;
uniform vec2 u_texsize;
varying vec2 v_tex;
varying float v_fade_opacity;
out vec2 v_tex;
out float v_fade_opacity;
#ifndef HAS_UNIFORM_u_opacity
uniform lowp float u_opacity_t;
attribute lowp vec2 a_opacity;
varying lowp float opacity;
layout (location = 5) in lowp vec2 a_opacity;
out lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
@@ -115,11 +115,11 @@ lowp float opacity = u_opacity;
)";
static constexpr const char* fragment = R"(uniform sampler2D u_texture;
varying vec2 v_tex;
varying float v_fade_opacity;
in vec2 v_tex;
in float v_fade_opacity;
#ifndef HAS_UNIFORM_u_opacity
varying lowp float opacity;
in lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
@@ -130,10 +130,10 @@ lowp float opacity = u_opacity;
#endif
lowp float alpha = opacity * v_fade_opacity;
gl_FragColor = texture2D(u_texture, v_tex) * alpha;
fragColor = texture(u_texture, v_tex) * alpha;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
}
)";

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -10,11 +10,11 @@ namespace shaders {
template <> struct ShaderSource<BuiltIn::SymbolSDFIconProgram, gfx::Backend::Type::OpenGL> {
static constexpr const char* vertex = R"(const float PI = 3.141592653589793;
attribute vec4 a_pos_offset;
attribute vec4 a_data;
attribute vec4 a_pixeloffset;
attribute vec3 a_projected_pos;
attribute float a_fade_opacity;
layout (location = 0) in vec4 a_pos_offset;
layout (location = 1) in vec4 a_data;
layout (location = 2) in vec4 a_pixeloffset;
layout (location = 3) in vec3 a_projected_pos;
layout (location = 4) in float a_fade_opacity;
// contents of a_size vary based on the type of property value
// used for {text,icon}-size.
@@ -39,41 +39,41 @@ uniform highp float u_camera_to_center_distance;
uniform float u_fade_change;
uniform vec2 u_texsize;
varying vec2 v_data0;
varying vec3 v_data1;
out vec2 v_data0;
out vec3 v_data1;
#ifndef HAS_UNIFORM_u_fill_color
uniform lowp float u_fill_color_t;
attribute highp vec4 a_fill_color;
varying highp vec4 fill_color;
layout (location = 5) in highp vec4 a_fill_color;
out highp vec4 fill_color;
#else
uniform highp vec4 u_fill_color;
#endif
#ifndef HAS_UNIFORM_u_halo_color
uniform lowp float u_halo_color_t;
attribute highp vec4 a_halo_color;
varying highp vec4 halo_color;
layout (location = 6) in highp vec4 a_halo_color;
out highp vec4 halo_color;
#else
uniform highp vec4 u_halo_color;
#endif
#ifndef HAS_UNIFORM_u_opacity
uniform lowp float u_opacity_t;
attribute lowp vec2 a_opacity;
varying lowp float opacity;
layout (location = 7) in lowp vec2 a_opacity;
out lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
#ifndef HAS_UNIFORM_u_halo_width
uniform lowp float u_halo_width_t;
attribute lowp vec2 a_halo_width;
varying lowp float halo_width;
layout (location = 8) in lowp vec2 a_halo_width;
out lowp float halo_width;
#else
uniform lowp float u_halo_width;
#endif
#ifndef HAS_UNIFORM_u_halo_blur
uniform lowp float u_halo_blur_t;
attribute lowp vec2 a_halo_blur;
varying lowp float halo_blur;
layout (location = 9) in lowp vec2 a_halo_blur;
out lowp float halo_blur;
#else
uniform lowp float u_halo_blur;
#endif
@@ -182,31 +182,31 @@ uniform highp float u_gamma_scale;
uniform lowp float u_device_pixel_ratio;
uniform bool u_is_text;
varying vec2 v_data0;
varying vec3 v_data1;
in vec2 v_data0;
in vec3 v_data1;
#ifndef HAS_UNIFORM_u_fill_color
varying highp vec4 fill_color;
in highp vec4 fill_color;
#else
uniform highp vec4 u_fill_color;
#endif
#ifndef HAS_UNIFORM_u_halo_color
varying highp vec4 halo_color;
in highp vec4 halo_color;
#else
uniform highp vec4 u_halo_color;
#endif
#ifndef HAS_UNIFORM_u_opacity
varying lowp float opacity;
in lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
#ifndef HAS_UNIFORM_u_halo_width
varying lowp float halo_width;
in lowp float halo_width;
#else
uniform lowp float u_halo_width;
#endif
#ifndef HAS_UNIFORM_u_halo_blur
varying lowp float halo_blur;
in lowp float halo_blur;
#else
uniform lowp float u_halo_blur;
#endif
@@ -246,14 +246,14 @@ lowp float halo_blur = u_halo_blur;
buff = (6.0 - halo_width / fontScale) / SDF_PX;
}
lowp float dist = texture2D(u_texture, tex).a;
lowp float dist = texture(u_texture, tex).a;
highp float gamma_scaled = gamma * gamma_scale;
highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);
gl_FragColor = color * (alpha * opacity * fade_opacity);
fragColor = color * (alpha * opacity * fade_opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
}
)";

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -10,11 +10,11 @@ namespace shaders {
template <> struct ShaderSource<BuiltIn::SymbolSDFTextProgram, gfx::Backend::Type::OpenGL> {
static constexpr const char* vertex = R"(const float PI = 3.141592653589793;
attribute vec4 a_pos_offset;
attribute vec4 a_data;
attribute vec4 a_pixeloffset;
attribute vec3 a_projected_pos;
attribute float a_fade_opacity;
layout (location = 0) in vec4 a_pos_offset;
layout (location = 1) in vec4 a_data;
layout (location = 2) in vec4 a_pixeloffset;
layout (location = 3) in vec3 a_projected_pos;
layout (location = 4) in float a_fade_opacity;
// contents of a_size vary based on the type of property value
// used for {text,icon}-size.
@@ -39,41 +39,41 @@ uniform highp float u_camera_to_center_distance;
uniform float u_fade_change;
uniform vec2 u_texsize;
varying vec2 v_data0;
varying vec3 v_data1;
out vec2 v_data0;
out vec3 v_data1;
#ifndef HAS_UNIFORM_u_fill_color
uniform lowp float u_fill_color_t;
attribute highp vec4 a_fill_color;
varying highp vec4 fill_color;
layout (location = 5) in highp vec4 a_fill_color;
out highp vec4 fill_color;
#else
uniform highp vec4 u_fill_color;
#endif
#ifndef HAS_UNIFORM_u_halo_color
uniform lowp float u_halo_color_t;
attribute highp vec4 a_halo_color;
varying highp vec4 halo_color;
layout (location = 6) in highp vec4 a_halo_color;
out highp vec4 halo_color;
#else
uniform highp vec4 u_halo_color;
#endif
#ifndef HAS_UNIFORM_u_opacity
uniform lowp float u_opacity_t;
attribute lowp vec2 a_opacity;
varying lowp float opacity;
layout (location = 7) in lowp vec2 a_opacity;
out lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
#ifndef HAS_UNIFORM_u_halo_width
uniform lowp float u_halo_width_t;
attribute lowp vec2 a_halo_width;
varying lowp float halo_width;
layout (location = 8) in lowp vec2 a_halo_width;
out lowp float halo_width;
#else
uniform lowp float u_halo_width;
#endif
#ifndef HAS_UNIFORM_u_halo_blur
uniform lowp float u_halo_blur_t;
attribute lowp vec2 a_halo_blur;
varying lowp float halo_blur;
layout (location = 9) in lowp vec2 a_halo_blur;
out lowp float halo_blur;
#else
uniform lowp float u_halo_blur;
#endif
@@ -182,31 +182,31 @@ uniform highp float u_gamma_scale;
uniform lowp float u_device_pixel_ratio;
uniform bool u_is_text;
varying vec2 v_data0;
varying vec3 v_data1;
in vec2 v_data0;
in vec3 v_data1;
#ifndef HAS_UNIFORM_u_fill_color
varying highp vec4 fill_color;
in highp vec4 fill_color;
#else
uniform highp vec4 u_fill_color;
#endif
#ifndef HAS_UNIFORM_u_halo_color
varying highp vec4 halo_color;
in highp vec4 halo_color;
#else
uniform highp vec4 u_halo_color;
#endif
#ifndef HAS_UNIFORM_u_opacity
varying lowp float opacity;
in lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
#ifndef HAS_UNIFORM_u_halo_width
varying lowp float halo_width;
in lowp float halo_width;
#else
uniform lowp float u_halo_width;
#endif
#ifndef HAS_UNIFORM_u_halo_blur
varying lowp float halo_blur;
in lowp float halo_blur;
#else
uniform lowp float u_halo_blur;
#endif
@@ -246,14 +246,14 @@ lowp float halo_blur = u_halo_blur;
buff = (6.0 - halo_width / fontScale) / SDF_PX;
}
lowp float dist = texture2D(u_texture, tex).a;
lowp float dist = texture(u_texture, tex).a;
highp float gamma_scaled = gamma * gamma_scale;
highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);
gl_FragColor = color * (alpha * opacity * fade_opacity);
fragColor = color * (alpha * opacity * fade_opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
}
)";

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>
@@ -10,10 +10,10 @@ namespace shaders {
template <> struct ShaderSource<BuiltIn::SymbolTextAndIconProgram, gfx::Backend::Type::OpenGL> {
static constexpr const char* vertex = R"(const float PI = 3.141592653589793;
attribute vec4 a_pos_offset;
attribute vec4 a_data;
attribute vec3 a_projected_pos;
attribute float a_fade_opacity;
layout (location = 0) in vec4 a_pos_offset;
layout (location = 1) in vec4 a_data;
layout (location = 2) in vec3 a_projected_pos;
layout (location = 3) in float a_fade_opacity;
// contents of a_size vary based on the type of property value
// used for {text,icon}-size.
@@ -39,41 +39,41 @@ uniform float u_fade_change;
uniform vec2 u_texsize;
uniform vec2 u_texsize_icon;
varying vec4 v_data0;
varying vec4 v_data1;
out vec4 v_data0;
out vec4 v_data1;
#ifndef HAS_UNIFORM_u_fill_color
uniform lowp float u_fill_color_t;
attribute highp vec4 a_fill_color;
varying highp vec4 fill_color;
layout (location = 4) in highp vec4 a_fill_color;
out highp vec4 fill_color;
#else
uniform highp vec4 u_fill_color;
#endif
#ifndef HAS_UNIFORM_u_halo_color
uniform lowp float u_halo_color_t;
attribute highp vec4 a_halo_color;
varying highp vec4 halo_color;
layout (location = 5) in highp vec4 a_halo_color;
out highp vec4 halo_color;
#else
uniform highp vec4 u_halo_color;
#endif
#ifndef HAS_UNIFORM_u_opacity
uniform lowp float u_opacity_t;
attribute lowp vec2 a_opacity;
varying lowp float opacity;
layout (location = 6) in lowp vec2 a_opacity;
out lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
#ifndef HAS_UNIFORM_u_halo_width
uniform lowp float u_halo_width_t;
attribute lowp vec2 a_halo_width;
varying lowp float halo_width;
layout (location = 7) in lowp vec2 a_halo_width;
out lowp float halo_width;
#else
uniform lowp float u_halo_width;
#endif
#ifndef HAS_UNIFORM_u_halo_blur
uniform lowp float u_halo_blur_t;
attribute lowp vec2 a_halo_blur;
varying lowp float halo_blur;
layout (location = 8) in lowp vec2 a_halo_blur;
out lowp float halo_blur;
#else
uniform lowp float u_halo_blur;
#endif
@@ -186,31 +186,31 @@ uniform sampler2D u_texture_icon;
uniform highp float u_gamma_scale;
uniform lowp float u_device_pixel_ratio;
varying vec4 v_data0;
varying vec4 v_data1;
in vec4 v_data0;
in vec4 v_data1;
#ifndef HAS_UNIFORM_u_fill_color
varying highp vec4 fill_color;
in highp vec4 fill_color;
#else
uniform highp vec4 u_fill_color;
#endif
#ifndef HAS_UNIFORM_u_halo_color
varying highp vec4 halo_color;
in highp vec4 halo_color;
#else
uniform highp vec4 u_halo_color;
#endif
#ifndef HAS_UNIFORM_u_opacity
varying lowp float opacity;
in lowp float opacity;
#else
uniform lowp float u_opacity;
#endif
#ifndef HAS_UNIFORM_u_halo_width
varying lowp float halo_width;
in lowp float halo_width;
#else
uniform lowp float u_halo_width;
#endif
#ifndef HAS_UNIFORM_u_halo_blur
varying lowp float halo_blur;
in lowp float halo_blur;
#else
uniform lowp float u_halo_blur;
#endif
@@ -237,10 +237,10 @@ lowp float halo_blur = u_halo_blur;
if (v_data1.w == ICON) {
vec2 tex_icon = v_data0.zw;
lowp float alpha = opacity * fade_opacity;
gl_FragColor = texture2D(u_texture_icon, tex_icon) * alpha;
fragColor = texture(u_texture_icon, tex_icon) * alpha;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
return;
}
@@ -263,14 +263,14 @@ lowp float halo_blur = u_halo_blur;
buff = (6.0 - halo_width / fontScale) / SDF_PX;
}
lowp float dist = texture2D(u_texture, tex).a;
lowp float dist = texture(u_texture, tex).a;
highp float gamma_scaled = gamma * gamma_scale;
highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);
gl_FragColor = color * (alpha * opacity * fade_opacity);
fragColor = color * (alpha * opacity * fade_opacity);
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
}
)";

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/shaders/shader_source.hpp>

View File

@@ -1,5 +1,5 @@
// Generated code, do not modify this file!
// Generated on 2023-04-04T01:24:40.539Z by mwilsnd using shaders/generate_shader_code.js
// Generated on 2023-04-05T16:25:15.886Z by mwilsnd using shaders/generate_shader_code.js
#pragma once
#include <mbgl/gfx/backend.hpp>