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

@@ -4,7 +4,6 @@ on:
workflow_dispatch:
push:
branches:
- main
- opengl-2
tags:
- 'macos-*'
@@ -27,7 +26,6 @@ on:
pull_request:
branches:
- main
- opengl-2
paths:
- 'platform/ios/**'
@@ -133,7 +131,6 @@ jobs:
ctest -VV --test-dir $BUILD_DIR -R mbgl-test-runner
env:
BUILD_DIR: ../../../maplibre-gl-native-macostestbuild
if: ${{ github.ref != 'refs/heads/main' }}
- name: Check public symbols
run: make darwin-check-public-symbols

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>

View File

@@ -43,20 +43,12 @@ public class EGLConfigChooser implements GLSurfaceView.EGLConfigChooser {
private static final String TAG = "Mbgl-EGLConfigChooser";
/**
* Requires API level 17
* Requires API level 18
*
* @see android.opengl.EGL14.EGL_CONFORMANT;
* @see android.opengl.EGL15.EGL_OPENGL_ES3_BIT;
*/
@SuppressWarnings("JavadocReference")
private static final int EGL_CONFORMANT = 0x3042;
/**
* Requires API level 17
*
* @see android.opengl.EGL14.EGL_OPENGL_ES2_BIT;
*/
@SuppressWarnings("JavadocReference")
private static final int EGL_OPENGL_ES2_BIT = 0x0004;
private static final int EGL_OPENGL_ES3_BIT = 0x0040;
private boolean translucentSurface;
@@ -144,16 +136,14 @@ public class EGLConfigChooser implements GLSurfaceView.EGLConfigChooser {
class Config implements Comparable<Config> {
private final BufferFormat bufferFormat;
private final DepthStencilFormat depthStencilFormat;
private final boolean isNotConformant;
private final boolean isCaveat;
private final int index;
private final EGLConfig config;
public Config(BufferFormat bufferFormat, DepthStencilFormat depthStencilFormat,
boolean isNotConformant, boolean isCaveat, int index, EGLConfig config) {
boolean isCaveat, int index, EGLConfig config) {
this.bufferFormat = bufferFormat;
this.depthStencilFormat = depthStencilFormat;
this.isNotConformant = isNotConformant;
this.isCaveat = isCaveat;
this.index = index;
this.config = config;
@@ -172,11 +162,6 @@ public class EGLConfigChooser implements GLSurfaceView.EGLConfigChooser {
return i;
}
i = compare(isNotConformant, other.isNotConformant);
if (i != 0) {
return i;
}
i = compare(isCaveat, other.isCaveat);
if (i != 0) {
return i;
@@ -202,7 +187,6 @@ public class EGLConfigChooser implements GLSurfaceView.EGLConfigChooser {
i++;
int caveat = getConfigAttr(egl, display, config, EGL_CONFIG_CAVEAT);
int conformant = getConfigAttr(egl, display, config, EGL_CONFORMANT);
int bits = getConfigAttr(egl, display, config, EGL_BUFFER_SIZE);
int red = getConfigAttr(egl, display, config, EGL_RED_SIZE);
int green = getConfigAttr(egl, display, config, EGL_GREEN_SIZE);
@@ -243,12 +227,11 @@ public class EGLConfigChooser implements GLSurfaceView.EGLConfigChooser {
depthStencilFormat = DepthStencilFormat.Format24Depth8Stencil;
}
boolean isNotConformant = (conformant & EGL_OPENGL_ES2_BIT) != EGL_OPENGL_ES2_BIT;
boolean isCaveat = caveat != EGL_NONE;
// Ignore formats we don't recognise
if (bufferFormat != BufferFormat.Unknown) {
matches.add(new Config(bufferFormat, depthStencilFormat, isNotConformant, isCaveat, i, config));
matches.add(new Config(bufferFormat, depthStencilFormat, isCaveat, i, config));
}
}
@@ -268,10 +251,6 @@ public class EGLConfigChooser implements GLSurfaceView.EGLConfigChooser {
Logger.w(TAG, "Chosen config has a caveat.");
}
if (bestMatch.isNotConformant) {
Logger.w(TAG, "Chosen config is not conformant.");
}
return bestMatch.config;
}
@@ -300,9 +279,8 @@ public class EGLConfigChooser implements GLSurfaceView.EGLConfigChooser {
EGL_ALPHA_SIZE, translucentSurface ? 8 : 0,
EGL_DEPTH_SIZE, 16,
EGL_STENCIL_SIZE, 8,
(emulator ? EGL_NONE : EGL_CONFORMANT), EGL_OPENGL_ES2_BIT,
(emulator ? EGL_NONE : EGL_COLOR_BUFFER_TYPE), EGL_RGB_BUFFER,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT,
EGL_NONE
};
}

View File

@@ -4,7 +4,7 @@ endif()
target_compile_definitions(
mbgl-core
PUBLIC MBGL_USE_GLES2
PUBLIC
)
include(${PROJECT_SOURCE_DIR}/vendor/icu.cmake)
@@ -83,7 +83,7 @@ target_link_libraries(
mbgl-core
PRIVATE
EGL
GLESv2
GLESv3
Mapbox::Base::jni.hpp
android
atomic
@@ -107,7 +107,7 @@ target_include_directories(
target_link_libraries(
example-custom-layer
PRIVATE
GLESv2
GLESv3
Mapbox::Base
Mapbox::Base::optional
log

View File

@@ -1,4 +1,4 @@
#include <GLES2/gl2.h>
#include <GLES3/gl3.h>
#include <android/log.h>
#include <jni.h>
#include <mbgl/gl/custom_layer.hpp>
@@ -109,8 +109,8 @@ void checkCompileStatus(GLuint shader) {
// /DEBUGGING
static const GLchar * vertexShaderSource = "attribute vec2 a_pos; void main() { gl_Position = vec4(a_pos, 0, 1); }";
static const GLchar * fragmentShaderSource = "uniform highp vec4 fill_color; void main() { gl_FragColor = fill_color; }";
static const GLchar * vertexShaderSource = "#version 300 es\nlayout (location = 0) in vec2 a_pos; void main() { gl_Position = vec4(a_pos, 0, 1); }";
static const GLchar * fragmentShaderSource = "#version 300 es\nuniform highp vec4 fill_color; out highp vec4 fragColor; void main() { fragColor = fill_color; }";
class ExampleCustomLayer: mbgl::style::CustomLayerHost {
public:

View File

@@ -1,8 +1,6 @@
#include <mbgl/platform/gl_functions.hpp>
#define GL_GLEXT_PROTOTYPES
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <GLES3/gl3.h>
namespace mbgl {
namespace platform {

View File

@@ -3,11 +3,11 @@
#include "TargetConditionals.h"
#if TARGET_OS_IPHONE
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#include <OpenGLES/ES3/gl.h>
#include <OpenGLES/ES3/glext.h>
#elif TARGET_OS_SIMULATOR
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#include <OpenGLES/ES3/gl.h>
#include <OpenGLES/ES3/glext.h>
#elif TARGET_OS_MAC
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
@@ -167,14 +167,5 @@ void (* const glVertexAttrib4fv)(GLuint, const GLfloat *) = ::glVertexAttrib4fv;
void (* const glVertexAttribPointer)(GLuint, GLint, GLenum, GLboolean, GLsizei, const void *) = ::glVertexAttribPointer;
void (* const glViewport)(GLint, GLint, GLsizei, GLsizei) = ::glViewport;
#ifndef MBGL_USE_GLES2
void (* const glDrawPixels)(GLsizei, GLsizei, GLenum, GLenum, const GLvoid *) = ::glDrawPixels;
void (* const glGetDoublev)(GLenum, GLdouble *) = ::glGetDoublev;
void (* const glPixelTransferf)(GLenum, GLfloat) = ::glPixelTransferf;
void (* const glPixelZoom)(GLfloat, GLfloat) = ::glPixelZoom;
void (* const glPointSize)(GLfloat) = ::glPointSize;
void (* const glRasterPos4d)(GLdouble, GLdouble, GLdouble, GLdouble) = ::glRasterPos4d;
#endif
} // namespace platform
} // namespace mbgl

View File

@@ -10,7 +10,7 @@ namespace gl {
class EAGLBackendImpl : public HeadlessBackend::Impl {
public:
EAGLBackendImpl() {
glContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
glContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3];
if (glContext == nil) {
throw std::runtime_error("Error creating GL context object");
}

View File

@@ -40,9 +40,7 @@
#pragma warning(pop)
#endif
#if MBGL_USE_GLES2
#define GLFW_INCLUDE_ES2
#endif // MBGL_USE_GLES2
#define GLFW_INCLUDE_ES3
#define GL_GLEXT_PROTOTYPES
#include <GLFW/glfw3.h>
@@ -158,11 +156,9 @@ GLFWView::GLFWView(bool fullscreen_, bool benchmark_, const mbgl::ResourceOption
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
#endif
#if MBGL_USE_GLES2
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
#endif
if (mbgl::gfx::Backend::GetType() != mbgl::gfx::Backend::Type::OpenGL) {
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
@@ -285,20 +281,6 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action,
case GLFW_KEY_S:
if (view->changeStyleCallback) view->changeStyleCallback();
break;
#if !MBGL_USE_GLES2
case GLFW_KEY_B: {
auto debug = view->map->getDebug();
if (debug & mbgl::MapDebugOptions::StencilClip) {
debug &= ~mbgl::MapDebugOptions::StencilClip;
debug |= mbgl::MapDebugOptions::DepthBuffer;
} else if (debug & mbgl::MapDebugOptions::DepthBuffer) {
debug &= ~mbgl::MapDebugOptions::DepthBuffer;
} else {
debug |= mbgl::MapDebugOptions::StencilClip;
}
view->map->setDebug(debug);
} break;
#endif // MBGL_USE_GLES2
case GLFW_KEY_N:
if (!mods)
view->map->easeTo(mbgl::CameraOptions().withBearing(0.0), mbgl::AnimationOptions {{mbgl::Milliseconds(500)}});
@@ -681,14 +663,9 @@ void GLFWView::updateAnimatedAnnotations() {
void GLFWView::cycleDebugOptions() {
auto debug = map->getDebug();
#if !MBGL_USE_GLES2
if (debug & mbgl::MapDebugOptions::StencilClip)
if (debug & mbgl::MapDebugOptions::Overdraw)
debug = mbgl::MapDebugOptions::NoDebug;
else if (debug & mbgl::MapDebugOptions::Overdraw)
debug = mbgl::MapDebugOptions::StencilClip;
#else
if (debug & mbgl::MapDebugOptions::Overdraw) debug = mbgl::MapDebugOptions::NoDebug;
#endif // MBGL_USE_GLES2
else if (debug & mbgl::MapDebugOptions::Collision)
debug = mbgl::MapDebugOptions::Overdraw;
else if (debug & mbgl::MapDebugOptions::Timestamps)

View File

@@ -25,7 +25,7 @@ set_target_properties(mbgl-core PROPERTIES XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC
if(MBGL_WITH_OPENGL)
target_compile_definitions(
mbgl-core
PUBLIC MBGL_USE_GLES2 GLES_SILENCE_DEPRECATION GLES_SILENCE_DEPRECATION
PUBLIC GLES_SILENCE_DEPRECATION GLES_SILENCE_DEPRECATION
)
list(APPEND
PLATFORM_FILES

View File

@@ -10,8 +10,8 @@
}
- (void)didMoveToMapView:(MLNMapView *)mapView {
static const GLchar *vertexShaderSource = "attribute vec2 a_pos; void main() { gl_Position = vec4(a_pos, 1, 1); }";
static const GLchar *fragmentShaderSource = "void main() { gl_FragColor = vec4(0, 0.5, 0, 0.5); }";
static const GLchar *vertexShaderSource = "#version 300 es\nlayout (location = 0) in vec2 a_pos; void main() { gl_Position = vec4(a_pos, 1, 1); }";
static const GLchar *fragmentShaderSource = "#version 300 es\nout highp vec4 fragColor; void main() { fragColor = vec4(0, 0.5, 0, 0.5); }";
_program = glCreateProgram();
_vertexShader = glCreateShader(GL_VERTEX_SHADER);

View File

@@ -1,5 +1,3 @@
set(USE_GLES2 ON)
macro(initialize_ios_target target)
set_xcode_property(${target} IPHONEOS_DEPLOYMENT_TARGET "9.0")
set_xcode_property(${target} ENABLE_BITCODE "YES")

View File

@@ -114,7 +114,7 @@ void MLNMapViewOpenGLImpl::createView() {
}
if (!resource.context) {
resource.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
resource.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3];
assert(resource.context);
}

View File

@@ -2,13 +2,8 @@
#define GL_GLEXT_PROTOTYPES
#ifndef MBGL_USE_GLES2
#include <GL/gl.h>
#include <GL/glext.h>
#else
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#endif
#include <GLES3/gl3.h>
#include <GLES3/gl3ext.h>
namespace mbgl {
namespace platform {
@@ -153,14 +148,5 @@ void (* const glVertexAttrib4fv)(GLuint, const GLfloat *) = ::glVertexAttrib4fv;
void (* const glVertexAttribPointer)(GLuint, GLint, GLenum, GLboolean, GLsizei, const void *) = ::glVertexAttribPointer;
void (* const glViewport)(GLint, GLint, GLsizei, GLsizei) = ::glViewport;
#ifndef MBGL_USE_GLES2
void (* const glDrawPixels)(GLsizei, GLsizei, GLenum, GLenum, const GLvoid *) = ::glDrawPixels;
void (* const glGetDoublev)(GLenum, GLdouble *) = ::glGetDoublev;
void (* const glPixelTransferf)(GLenum, GLfloat) = ::glPixelTransferf;
void (* const glPixelZoom)(GLfloat, GLfloat) = ::glPixelZoom;
void (* const glPointSize)(GLfloat) = ::glPointSize;
void (* const glRasterPos4d)(GLdouble, GLdouble, GLdouble, GLdouble) = ::glRasterPos4d;
#endif
} // namespace platform
} // namespace mbgl

View File

@@ -37,9 +37,7 @@ public:
}
const EGLint attribs[] = {
#if MBGL_USE_GLES2
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
#endif
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT,
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
EGL_NONE
};
@@ -77,7 +75,7 @@ public:
// objects and also to write vertex and fragment shaders in the OpenGL ES
// Shading Language.
const EGLint attribs[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_CONTEXT_CLIENT_VERSION, 3,
EGL_NONE
};

View File

@@ -218,7 +218,7 @@ function(add_node_module NAME)
TARGET ${_TARGET}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/platform/windows/vendor/mesa3d/${_ARCH}/libglapi.dll" "${_OUTPUT_PATH}"
COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/platform/windows/vendor/mesa3d/${_ARCH}/libGLESv2.dll" "${_OUTPUT_PATH}"
COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/platform/windows/vendor/mesa3d/${_ARCH}/libGLESv3.dll" "${_OUTPUT_PATH}"
COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/platform/windows/vendor/mesa3d/${_ARCH}/osmesa.dll" "${_OUTPUT_PATH}"
)
endif()

View File

@@ -122,7 +122,7 @@ target_sources(
target_compile_definitions(
mbgl-core
PRIVATE QT_IMAGE_DECODERS
PUBLIC __QT__ MBGL_USE_GLES2
PUBLIC __QT__
)
target_include_directories(

View File

@@ -16,10 +16,10 @@ else()
endif()
find_library(OSMesa_osmesa_LIBRARY NAMES osmesa PATHS ${OSMesa_DIR}/lib PATH_SUFFIXES ${_ARCH} NO_DEFAULT_PATH)
find_library(OSMesa_libGLESv2_LIBRARY NAMES libGLESv2 PATHS ${OSMesa_DIR}/lib PATH_SUFFIXES ${_ARCH} NO_DEFAULT_PATH)
find_library(OSMesa_libGLESv3_LIBRARY NAMES libGLESv3 PATHS ${OSMesa_DIR}/lib PATH_SUFFIXES ${_ARCH} NO_DEFAULT_PATH)
find_file(OSMesa_osmesa_LIBRARY_DLL NAMES osmesa.dll PATHS ${OSMesa_DIR} PATH_SUFFIXES ${_ARCH} NO_DEFAULT_PATH)
find_file(OSMesa_libGLESv2_LIBRARY_DLL NAMES libGLESv2.dll PATHS ${OSMesa_DIR} PATH_SUFFIXES ${_ARCH} NO_DEFAULT_PATH)
find_file(OSMesa_libGLESv3_LIBRARY_DLL NAMES libGLESv3.dll PATHS ${OSMesa_DIR} PATH_SUFFIXES ${_ARCH} NO_DEFAULT_PATH)
unset(_ARCH)
@@ -29,18 +29,18 @@ include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OSMesa
REQUIRED_VARS
OSMesa_osmesa_LIBRARY
OSMesa_libGLESv2_LIBRARY
OSMesa_libGLESv3_LIBRARY
OSMesa_INCLUDE_DIR)
# Hide internal variables
mark_as_advanced(OSMesa_INCLUDE_DIR OSMesa_osmesa_LIBRARY OSMesa_libGLESv2_LIBRARY)
mark_as_advanced(OSMesa_INCLUDE_DIR OSMesa_osmesa_LIBRARY OSMesa_libGLESv3_LIBRARY)
# Set standard variables
if(OSMesa_FOUND)
set(OSMesa_INCLUDE_DIRS "${OSMesa_INCLUDE_DIR}")
set(OSMesa_LIBRARIES
"${OSMesa_osmesa_LIBRARY}"
"${OSMesa_libGLESv2_LIBRARY}"
"${OSMesa_libGLESv3_LIBRARY}"
)
add_library(OSMesa::osmesa SHARED IMPORTED)
@@ -53,13 +53,13 @@ if(OSMesa_FOUND)
IMPORTED_LOCATION ${OSMesa_osmesa_LIBRARY_DLL}
)
add_library(OSMesa::libGLESv2 SHARED IMPORTED)
add_library(OSMesa::libGLESv3 SHARED IMPORTED)
set_target_properties(
OSMesa::libGLESv2
OSMesa::libGLESv3
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${OSMesa_INCLUDE_DIRS}
IMPORTED_IMPLIB ${OSMesa_libGLESv2_LIBRARY}
IMPORTED_LOCATION ${OSMesa_libGLESv2_LIBRARY_DLL}
IMPORTED_IMPLIB ${OSMesa_libGLESv3_LIBRARY}
IMPORTED_LOCATION ${OSMesa_libGLESv3_LIBRARY_DLL}
)
endif()

View File

@@ -43,7 +43,7 @@ To configure build with OSMesa (software rendering), use the following command:
cmake . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DMBGL_WITH_OSMESA=ON
```
**WARNING:** as OSMesa doesn't have static libraries, it's necessary to copy `libglapi.dll`, `libGLESv2.dll` and `osmesa.dll` from `platform\windows\vendor\mesa3d\<arch>` to executable/dll directory you want to use, otherwise it won't run.
**WARNING:** as OSMesa doesn't have static libraries, it's necessary to copy `libglapi.dll`, `libGLESv3.dll` and `osmesa.dll` from `platform\windows\vendor\mesa3d\<arch>` to executable/dll directory you want to use, otherwise it won't run.
## Building

View File

@@ -12,16 +12,7 @@
#endif
#endif
#define GL_GLEXT_PROTOTYPES
#ifdef MBGL_USE_GLES2
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#else
#include <GL/gl.h>
#include <GL/glext.h>
#endif
#include <GLES3/gl3.h>
#include <GL/wgl.h>
#ifdef __cplusplus
@@ -495,15 +486,6 @@ HGLRC(* const wglCreateContextAttribsARB)(HDC, HGLRC, const int*) = [](HDC hDC,
const char* (* const wglGetExtensionsStringARB)(HDC) = [](HDC hdc) { if (!opengl32) loadWGL(); return ::wgl_wglGetExtensionsStringARB(hdc); };
const char* (* const wglGetExtensionsStringEXT)() = [](void) { if (!opengl32) loadWGL(); return ::wgl_wglGetExtensionsStringEXT(); };
#ifndef MBGL_USE_GLES2
void (* const glDrawPixels)(GLsizei, GLsizei, GLenum, GLenum, const GLvoid *) = ::glDrawPixels;
void (* const glGetDoublev)(GLenum, GLdouble *) = ::glGetDoublev;
void (* const glPixelTransferf)(GLenum, GLfloat) = ::glPixelTransferf;
void (* const glPixelZoom)(GLfloat, GLfloat) = ::glPixelZoom;
void (* const glPointSize)(GLfloat) = ::glPointSize;
void (* const glRasterPos4d)(GLdouble, GLdouble, GLdouble, GLdouble) = ::glRasterPos4d;
#endif
} // namespace platform
} // namespace mbgl
#endif

View File

@@ -6,13 +6,8 @@
#define GL_GLEXT_PROTOTYPES
#endif
#ifndef MBGL_USE_GLES2
#include <GL/gl.h>
#include <GL/glext.h>
#else
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#endif
#include <GLES3/gl3.h>
#include <GLES3/gl3ext.h>
namespace mbgl {
namespace platform {
@@ -157,14 +152,5 @@ void (* const glVertexAttrib4fv)(GLuint, const GLfloat *) = ::glVertexAttrib4fv;
void (* const glVertexAttribPointer)(GLuint, GLint, GLenum, GLboolean, GLsizei, const void *) = ::glVertexAttribPointer;
void (* const glViewport)(GLint, GLint, GLsizei, GLsizei) = ::glViewport;
#ifndef MBGL_USE_GLES2
void (* const glDrawPixels)(GLsizei, GLsizei, GLenum, GLenum, const GLvoid *) = ::glDrawPixels;
void (* const glGetDoublev)(GLenum, GLdouble *) = ::glGetDoublev;
void (* const glPixelTransferf)(GLenum, GLfloat) = ::glPixelTransferf;
void (* const glPixelZoom)(GLfloat, GLfloat) = ::glPixelZoom;
void (* const glPointSize)(GLfloat) = ::glPointSize;
void (* const glRasterPos4d)(GLdouble, GLdouble, GLdouble, GLdouble) = ::glRasterPos4d;
#endif
} // namespace platform
} // namespace mbgl

View File

@@ -39,9 +39,7 @@ public:
}
const EGLint attribs[] = {
#if MBGL_USE_GLES2
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
#endif
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT,
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
EGL_NONE
};

View File

@@ -166,14 +166,13 @@ public:
ARB_multisample = extensionSupportedWGL("WGL_ARB_multisample");
ARB_create_context = extensionSupportedWGL("WGL_ARB_create_context");
ARB_create_context_profile = extensionSupportedWGL("WGL_ARB_create_context_profile");
EXT_create_context_es2_profile = extensionSupportedWGL("WGL_EXT_create_context_es2_profile");
EXT_colorspace = extensionSupportedWGL("WGL_EXT_colorspace");
ARB_pixel_format = extensionSupportedWGL("WGL_ARB_pixel_format");
ARB_ES2_compatibility = extensionSupportedWGL("GL_ARB_ES2_compatibility");
ARB_ES3_compatibility = extensionSupportedWGL("GL_ARB_ES3_compatibility");
if (!ARB_create_context || !ARB_create_context_profile || !(EXT_create_context_es2_profile || ARB_ES2_compatibility)) {
Log::Error(Event::OpenGL, "OpenGL ES 2.0 is unavailable");
throw std::runtime_error("OpenGL ES 2.0 is unavailable");
if (!ARB_create_context || !ARB_create_context_profile || !ARB_ES3_compatibility) {
Log::Error(Event::OpenGL, "OpenGL ES 3.0 is unavailable");
throw std::runtime_error("OpenGL ES 3.0 is unavailable");
}
DestroyHelperWindow();
@@ -207,10 +206,9 @@ public:
bool ARB_multisample = false;
bool ARB_create_context = false;
bool ARB_create_context_profile = false;
bool EXT_create_context_es2_profile = false;
bool EXT_colorspace = false;
bool ARB_pixel_format = false;
bool ARB_ES2_compatibility = false;
bool ARB_ES3_compatibility = false;
WNDCLASSEXA renderingWindowClass = { sizeof(WNDCLASSEXA) };
};
@@ -316,7 +314,7 @@ private:
if (wglDisplayConfig->ARB_create_context) {
renderingWindowRenderingContext = mbgl::platform::wglCreateContextAttribsARB(renderingWindowDeviceContext, NULL,
std::initializer_list<int>({
WGL_CONTEXT_MAJOR_VERSION_ARB, 2,
WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
WGL_CONTEXT_MINOR_VERSION_ARB, 0,
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
NULL

View File

@@ -72,8 +72,6 @@ target_compile_definitions(
mbgl-core
PRIVATE
CURL_STATICLIB
PUBLIC
MBGL_USE_GLES2
)
if(MBGL_WITH_EGL)
@@ -93,7 +91,7 @@ if(MBGL_WITH_EGL)
mbgl-core
PRIVATE
unofficial::angle::libEGL
unofficial::angle::libGLESv2
unofficial::angle::libGLESv3
)
elseif(MBGL_WITH_OSMESA)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
@@ -116,7 +114,7 @@ elseif(MBGL_WITH_OSMESA)
mbgl-core
PRIVATE
OSMesa::osmesa
OSMesa::libGLESv2
OSMesa::libGLESv3
)
else()
find_package(OpenGL REQUIRED)

View File

@@ -15,3 +15,5 @@ precision mediump float;
#endif
#endif
out highp vec4 fragColor;

View File

@@ -2,9 +2,9 @@ uniform vec4 u_color;
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,4 @@
attribute vec2 a_pos;
layout (location = 0) in vec2 a_pos;
uniform mat4 u_matrix;
void main() {

View File

@@ -8,21 +8,21 @@ 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

@@ -7,10 +7,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);

View File

@@ -1,4 +1,4 @@
varying vec3 v_data;
in vec3 v_data;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define mediump float radius
@@ -31,9 +31,9 @@ void main() {
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

@@ -5,9 +5,8 @@ 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;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define mediump float radius

View File

@@ -1,3 +1,3 @@
void main() {
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
}

View File

@@ -1,4 +1,4 @@
attribute vec2 a_pos;
layout (location = 0) in vec2 a_pos;
uniform mat4 u_matrix;

View File

@@ -1,21 +1,21 @@
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,15 +1,15 @@
attribute vec2 a_pos;
attribute vec2 a_anchor_pos;
attribute vec2 a_extrude;
attribute vec2 a_placed;
attribute vec2 a_shift;
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);

View File

@@ -1,10 +1,10 @@
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;
@@ -30,5 +30,5 @@ 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,18 +1,17 @@
attribute vec2 a_pos;
attribute vec2 a_anchor_pos;
attribute vec2 a_extrude;
attribute vec2 a_placed;
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);

View File

@@ -1,9 +1,9 @@
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 @@
attribute vec2 a_pos;
varying vec2 v_uv;
layout (location = 0) in vec2 a_pos;
out vec2 v_uv;
uniform mat4 u_matrix;
uniform float u_overlay_scale;

View File

@@ -5,9 +5,9 @@ void main() {
#pragma mapbox: initialize highp vec4 color
#pragma mapbox: initialize lowp float opacity
gl_FragColor = color * opacity;
fragColor = color * opacity;
#ifdef OVERDRAW_INSPECTOR
gl_FragColor = vec4(1.0);
fragColor = vec4(1.0);
#endif
}

View File

@@ -1,4 +1,4 @@
attribute vec2 a_pos;
layout (location = 0) in vec2 a_pos;
uniform mat4 u_matrix;

View File

@@ -1,9 +1,9 @@
varying vec4 v_color;
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

@@ -5,10 +5,9 @@ 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;
#pragma mapbox: define highp float base
#pragma mapbox: define highp float height

View File

@@ -3,9 +3,9 @@ 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;
#pragma mapbox: define lowp float base
#pragma mapbox: define lowp float height
@@ -25,17 +25,17 @@ void main() {
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

@@ -10,12 +10,12 @@ 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;
#pragma mapbox: define lowp float base
#pragma mapbox: define lowp float height

View File

@@ -1,4 +1,4 @@
varying vec2 v_pos;
in vec2 v_pos;
#pragma mapbox: define highp vec4 outline_color
#pragma mapbox: define lowp float opacity
@@ -9,9 +9,9 @@ void main() {
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,9 +1,9 @@
attribute vec2 a_pos;
layout (location = 0) in vec2 a_pos;
uniform mat4 u_matrix;
uniform vec2 u_world;
varying vec2 v_pos;
out vec2 v_pos;
#pragma mapbox: define highp vec4 outline_color
#pragma mapbox: define lowp float opacity

View File

@@ -3,9 +3,9 @@ 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;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
@@ -23,11 +23,11 @@ void main() {
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
@@ -35,9 +35,9 @@ void main() {
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

@@ -4,11 +4,11 @@ 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;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from

View File

@@ -3,8 +3,8 @@ 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;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from
@@ -22,15 +22,15 @@ void main() {
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

@@ -3,10 +3,10 @@ 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;
#pragma mapbox: define lowp float opacity
#pragma mapbox: define lowp vec4 pattern_from

View File

@@ -10,7 +10,34 @@ const generatedHeader = `// Generated code, do not modify this file!
// Generated on ${new Date().toISOString()} by ${os.userInfo().username} using shaders/generate_shader_code.js
`;
const pragmaMapConvert = (source, pragmaMap, pipelineStage) => {
const newAttribLocationMapping = (source) => {
return {
__alloc: findHighestAttribLocation(source)
};
}
const locationForAttrib = (attribLocations, locationName) => {
if (attribLocations[locationName]) {
return attribLocations[attribLocations];
}
attribLocations[locationName] = ++attribLocations.__alloc;
return attribLocations[locationName];
};
const findHighestAttribLocation = (source) => {
const re = /layout\s*\(\s*location\s*=\s*(\d+)\s*\)\s*in\s+/g;
let match;
let topIndex = -1;
while (match = re.exec(source)) {
topIndex = Number(match[1]) > topIndex ? Number(match[1]) : topIndex;
}
return topIndex;
}
const pragmaMapConvert = (source, pragmaMap, attribLocations, pipelineStage) => {
const re = /#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g;
if (pipelineStage == "fragment") {
@@ -18,7 +45,7 @@ const pragmaMapConvert = (source, pragmaMap, pipelineStage) => {
pragmaMap[name] = true;
if (operation === 'define') {
return `#ifndef HAS_UNIFORM_u_${name}
varying ${precision} ${type} ${name};
in ${precision} ${type} ${name};
#else
uniform ${precision} ${type} u_${name};
#endif`;
@@ -40,8 +67,8 @@ ${precision} ${type} ${name} = u_${name};
if (operation === 'define') {
return `#ifndef HAS_UNIFORM_u_${name}
uniform lowp float u_${name}_t;
attribute ${precision} ${attrType} a_${name};
varying ${precision} ${type} ${name};
layout (location = ${locationForAttrib(attribLocations, name)}) in ${precision} ${attrType} a_${name};
out ${precision} ${type} ${name};
#else
uniform ${precision} ${type} u_${name};
#endif`;
@@ -65,7 +92,7 @@ ${precision} ${type} ${name} = u_${name};
if (operation === 'define') {
return `#ifndef HAS_UNIFORM_u_${name}
uniform lowp float u_${name}_t;
attribute ${precision} ${attrType} a_${name};
layout (location = ${locationForAttrib(attribLocations, name)}) in ${precision} ${attrType} a_${name};
#else
uniform ${precision} ${type} u_${name};
#endif`;
@@ -131,11 +158,14 @@ let shaderNames = [];
JSON.parse(fs.readFileSync(path.join(args.input, "manifest.json")))
.filter(it => typeof it == "object")
.forEach((elem) => {
let pragmaMap = [];
const fragmentSource = fs.readFileSync(path.join(args.input, elem.glsl_frag), {encoding: "utf8"});
const vertexSource = fs.readFileSync(path.join(args.input, elem.glsl_vert), {encoding: "utf8"});
const frag = pragmaMapConvert(fragmentSource, pragmaMap, "fragment");
const vert = pragmaMapConvert(vertexSource, pragmaMap, "vertex");
let pragmaMap = [];
let attribMap = newAttribLocationMapping(vertexSource);
const frag = pragmaMapConvert(fragmentSource, pragmaMap, attribMap, "fragment");
const vert = pragmaMapConvert(vertexSource, pragmaMap, attribMap, "vertex");
fs.writeFileSync(
path.join(args.output, elem.header + ".hpp"),

View File

@@ -1,6 +1,6 @@
uniform highp float u_intensity;
varying vec2 v_extrude;
in vec2 v_extrude;
#pragma mapbox: define highp float weight
@@ -14,9 +14,9 @@ void main() {
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,12 +1,10 @@
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;
#pragma mapbox: define highp float weight
#pragma mapbox: define mediump float radius

View File

@@ -1,14 +1,14 @@
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,7 +1,7 @@
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);

View File

@@ -1,5 +1,5 @@
uniform sampler2D u_image;
varying vec2 v_pos;
in vec2 v_pos;
uniform vec2 u_latrange;
uniform vec2 u_light;
@@ -10,7 +10,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);
@@ -44,9 +44,9 @@ 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,9 +1,9 @@
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);

View File

@@ -3,7 +3,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;
@@ -11,7 +11,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;
}
@@ -62,13 +62,13 @@ 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,10 +1,10 @@
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);

View File

@@ -1,8 +1,8 @@
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;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
@@ -22,9 +22,9 @@ void main() {
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

@@ -6,18 +6,18 @@
// #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;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur

View File

@@ -1,10 +1,10 @@
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;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity
@@ -24,11 +24,11 @@ void main() {
// 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

@@ -10,18 +10,18 @@
// #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;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity

View File

@@ -5,10 +5,10 @@ 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;
#pragma mapbox: define lowp vec4 pattern_from
#pragma mapbox: define lowp vec4 pattern_to
@@ -60,11 +60,11 @@ void main() {
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

@@ -10,18 +10,18 @@
// 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;
#pragma mapbox: define lowp float blur
#pragma mapbox: define lowp float opacity

View File

@@ -4,11 +4,11 @@ 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;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur
@@ -32,14 +32,14 @@ void main() {
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

@@ -10,8 +10,8 @@
// 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;
@@ -22,11 +22,11 @@ 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;
#pragma mapbox: define highp vec4 color
#pragma mapbox: define lowp float blur

View File

@@ -2,8 +2,8 @@ uniform float u_fade_t;
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;
@@ -15,8 +15,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;
}
@@ -44,9 +44,9 @@ 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

@@ -3,11 +3,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);

View File

@@ -1,7 +1,7 @@
uniform sampler2D u_texture;
varying vec2 v_tex;
varying float v_fade_opacity;
in vec2 v_tex;
in float v_fade_opacity;
#pragma mapbox: define lowp float opacity
@@ -9,9 +9,9 @@ void main() {
#pragma mapbox: initialize lowp float opacity
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
}

Some files were not shown because too many files have changed in this diff Show More