Setting up UBO for fill drawables (#1175)
This commit is contained in:
committed by
Bart Louwers
parent
ad4a598975
commit
b823f036fe
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-23T00:45:10.632Z by timsylvester using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-24T21:16:59.579Z by timsylvester using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
@@ -12,7 +12,7 @@ struct ShaderSource<BuiltIn::BackgroundShader, gfx::Backend::Type::OpenGL> {
|
||||
static constexpr const char* name = "BackgroundShader";
|
||||
static constexpr const char* vertex = R"(layout (location = 0) in vec2 a_pos;
|
||||
layout (std140) uniform BackgroundDrawableUBO {
|
||||
mat4 u_matrix;
|
||||
highp mat4 u_matrix;
|
||||
};
|
||||
|
||||
void main() {
|
||||
@@ -20,8 +20,8 @@ void main() {
|
||||
}
|
||||
)";
|
||||
static constexpr const char* fragment = R"(layout (std140) uniform BackgroundLayerUBO {
|
||||
vec4 u_color;
|
||||
vec4 u_opacity_pad3;
|
||||
highp vec4 u_color;
|
||||
highp vec4 u_opacity_pad3;
|
||||
};
|
||||
|
||||
void main() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-23T00:45:10.632Z by timsylvester using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-25T15:19:24.210Z by timsylvester using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
@@ -10,27 +10,38 @@ namespace shaders {
|
||||
template <>
|
||||
struct ShaderSource<BuiltIn::FillShader, gfx::Backend::Type::OpenGL> {
|
||||
static constexpr const char* name = "FillShader";
|
||||
static constexpr const char* vertex = R"(layout (location = 0) in vec2 a_pos;
|
||||
static constexpr const char* vertex = R"(layout (std140) uniform FillDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec4 u_scale;
|
||||
highp vec2 u_world;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp vec2 u_texsize;
|
||||
highp float u_fade;
|
||||
|
||||
layout (std140) uniform FillDrawableUBO {
|
||||
mat4 u_matrix;
|
||||
vec2 u_world;
|
||||
vec2 pad;
|
||||
highp float u_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_outline_color_t;
|
||||
highp float u_pattern_from_t;
|
||||
highp float u_pattern_to_t;
|
||||
|
||||
highp vec2 u_color;
|
||||
highp vec2 u_opacity;
|
||||
highp vec2 u_outline_color_pad;
|
||||
highp vec4 u_outline_color;
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
};
|
||||
|
||||
layout (location = 0) in vec2 a_pos;
|
||||
|
||||
#ifndef HAS_UNIFORM_u_color
|
||||
uniform lowp float u_color_t;
|
||||
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;
|
||||
layout (location = 2) in lowp vec2 a_opacity;
|
||||
out lowp float opacity;
|
||||
#else
|
||||
uniform lowp float u_opacity;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
@@ -48,15 +59,34 @@ lowp float opacity = u_opacity;
|
||||
gl_Position = u_matrix * vec4(a_pos, 0, 1);
|
||||
}
|
||||
)";
|
||||
static constexpr const char* fragment = R"(#ifndef HAS_UNIFORM_u_color
|
||||
static constexpr const char* fragment = R"(layout (std140) uniform FillDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec4 u_scale;
|
||||
highp vec2 u_world;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp vec2 u_texsize;
|
||||
highp float u_fade;
|
||||
|
||||
highp float u_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_outline_color_t;
|
||||
highp float u_pattern_from_t;
|
||||
highp float u_pattern_to_t;
|
||||
|
||||
highp vec2 u_color;
|
||||
highp vec2 u_opacity;
|
||||
highp vec2 u_outline_color_pad;
|
||||
highp vec4 u_outline_color;
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
};
|
||||
|
||||
#ifndef HAS_UNIFORM_u_color
|
||||
in highp vec4 color;
|
||||
#else
|
||||
uniform highp vec4 u_color;
|
||||
#endif
|
||||
#ifndef HAS_UNIFORM_u_opacity
|
||||
in lowp float opacity;
|
||||
#else
|
||||
uniform lowp float u_opacity;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-23T00:45:10.632Z by timsylvester using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-25T15:19:24.210Z by timsylvester using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
@@ -10,29 +10,40 @@ namespace shaders {
|
||||
template <>
|
||||
struct ShaderSource<BuiltIn::FillOutlineShader, gfx::Backend::Type::OpenGL> {
|
||||
static constexpr const char* name = "FillOutlineShader";
|
||||
static constexpr const char* vertex = R"(layout (location = 0) in vec2 a_pos;
|
||||
static constexpr const char* vertex = R"(layout (std140) uniform FillDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec4 u_scale;
|
||||
highp vec2 u_world;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp vec2 u_texsize;
|
||||
highp float u_fade;
|
||||
|
||||
layout (std140) uniform FillDrawableUBO {
|
||||
mat4 u_matrix;
|
||||
vec2 u_world;
|
||||
vec2 pad;
|
||||
highp float u_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_outline_color_t;
|
||||
highp float u_pattern_from_t;
|
||||
highp float u_pattern_to_t;
|
||||
|
||||
highp vec2 u_color;
|
||||
highp vec2 u_opacity;
|
||||
highp vec2 u_outline_color_pad;
|
||||
highp vec4 u_outline_color;
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
};
|
||||
|
||||
layout (location = 0) in vec2 a_pos;
|
||||
|
||||
out vec2 v_pos;
|
||||
|
||||
#ifndef HAS_UNIFORM_u_outline_color
|
||||
uniform lowp float u_outline_color_t;
|
||||
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;
|
||||
layout (location = 2) in lowp vec2 a_opacity;
|
||||
out lowp float opacity;
|
||||
#else
|
||||
uniform lowp float u_opacity;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
@@ -51,17 +62,36 @@ 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"(in vec2 v_pos;
|
||||
static constexpr const char* fragment = R"(layout (std140) uniform FillDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec4 u_scale;
|
||||
highp vec2 u_world;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp vec2 u_texsize;
|
||||
highp float u_fade;
|
||||
|
||||
highp float u_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_outline_color_t;
|
||||
highp float u_pattern_from_t;
|
||||
highp float u_pattern_to_t;
|
||||
|
||||
highp vec2 u_color;
|
||||
highp vec2 u_opacity;
|
||||
highp vec2 u_outline_color_pad;
|
||||
highp vec4 u_outline_color;
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
};
|
||||
|
||||
in vec2 v_pos;
|
||||
|
||||
#ifndef HAS_UNIFORM_u_outline_color
|
||||
in highp vec4 outline_color;
|
||||
#else
|
||||
uniform highp vec4 u_outline_color;
|
||||
#endif
|
||||
#ifndef HAS_UNIFORM_u_opacity
|
||||
in lowp float opacity;
|
||||
#else
|
||||
uniform lowp float u_opacity;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-23T18:10:10.798Z by timsylvester using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-25T14:44:39.644Z by timsylvester using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
@@ -10,11 +10,28 @@ namespace shaders {
|
||||
template <>
|
||||
struct ShaderSource<BuiltIn::FillOutlinePatternShader, gfx::Backend::Type::OpenGL> {
|
||||
static constexpr const char* name = "FillOutlinePatternShader";
|
||||
static constexpr const char* vertex = R"(uniform mat4 u_matrix;
|
||||
uniform vec2 u_world;
|
||||
uniform vec2 u_pixel_coord_upper;
|
||||
uniform vec2 u_pixel_coord_lower;
|
||||
uniform vec4 u_scale;
|
||||
static constexpr const char* vertex = R"(layout (std140) uniform FillDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec4 u_scale;
|
||||
highp vec2 u_world;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp vec2 u_texsize;
|
||||
highp float u_fade;
|
||||
|
||||
highp float u_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_outline_color_t;
|
||||
highp float u_pattern_from_t;
|
||||
highp float u_pattern_to_t;
|
||||
|
||||
highp vec2 u_color;
|
||||
highp vec2 u_opacity;
|
||||
highp vec2 u_outline_color_pad;
|
||||
highp vec4 u_outline_color;
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
};
|
||||
|
||||
layout (location = 0) in vec2 a_pos;
|
||||
|
||||
@@ -23,25 +40,16 @@ out vec2 v_pos_b;
|
||||
out vec2 v_pos;
|
||||
|
||||
#ifndef HAS_UNIFORM_u_opacity
|
||||
uniform lowp float u_opacity_t;
|
||||
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;
|
||||
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;
|
||||
layout (location = 3) in lowp vec4 a_pattern_to;
|
||||
out lowp vec4 pattern_to;
|
||||
#else
|
||||
uniform lowp vec4 u_pattern_to;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
@@ -82,10 +90,30 @@ mediump vec4 pattern_to = u_pattern_to;
|
||||
v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;
|
||||
}
|
||||
)";
|
||||
static constexpr const char* fragment = R"(
|
||||
uniform vec2 u_texsize;
|
||||
static constexpr const char* fragment = R"(layout (std140) uniform FillDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec4 u_scale;
|
||||
highp vec2 u_world;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp vec2 u_texsize;
|
||||
highp float u_fade;
|
||||
|
||||
highp float u_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_outline_color_t;
|
||||
highp float u_pattern_from_t;
|
||||
highp float u_pattern_to_t;
|
||||
|
||||
highp vec2 u_color;
|
||||
highp vec2 u_opacity;
|
||||
highp vec2 u_outline_color_pad;
|
||||
highp vec4 u_outline_color;
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
};
|
||||
|
||||
uniform sampler2D u_image;
|
||||
uniform float u_fade;
|
||||
|
||||
in vec2 v_pos_a;
|
||||
in vec2 v_pos_b;
|
||||
@@ -93,18 +121,12 @@ in vec2 v_pos;
|
||||
|
||||
#ifndef HAS_UNIFORM_u_opacity
|
||||
in lowp float opacity;
|
||||
#else
|
||||
uniform lowp float u_opacity;
|
||||
#endif
|
||||
#ifndef HAS_UNIFORM_u_pattern_from
|
||||
in lowp vec4 pattern_from;
|
||||
#else
|
||||
uniform lowp vec4 u_pattern_from;
|
||||
#endif
|
||||
#ifndef HAS_UNIFORM_u_pattern_to
|
||||
in lowp vec4 pattern_to;
|
||||
#else
|
||||
uniform lowp vec4 u_pattern_to;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated code, do not modify this file!
|
||||
// Generated on 2023-05-23T18:10:10.798Z by timsylvester using shaders/generate_shader_code.js
|
||||
// Generated on 2023-05-25T14:44:39.644Z by timsylvester using shaders/generate_shader_code.js
|
||||
|
||||
#pragma once
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
@@ -10,10 +10,28 @@ namespace shaders {
|
||||
template <>
|
||||
struct ShaderSource<BuiltIn::FillPatternShader, gfx::Backend::Type::OpenGL> {
|
||||
static constexpr const char* name = "FillPatternShader";
|
||||
static constexpr const char* vertex = R"(uniform mat4 u_matrix;
|
||||
uniform vec2 u_pixel_coord_upper;
|
||||
uniform vec2 u_pixel_coord_lower;
|
||||
uniform vec4 u_scale;
|
||||
static constexpr const char* vertex = R"(layout (std140) uniform FillDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec4 u_scale;
|
||||
highp vec2 u_world;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp vec2 u_texsize;
|
||||
highp float u_fade;
|
||||
|
||||
highp float u_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_outline_color_t;
|
||||
highp float u_pattern_from_t;
|
||||
highp float u_pattern_to_t;
|
||||
|
||||
highp vec2 u_color;
|
||||
highp vec2 u_opacity;
|
||||
highp vec2 u_outline_color_pad;
|
||||
highp vec4 u_outline_color;
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
};
|
||||
|
||||
layout (location = 0) in vec2 a_pos;
|
||||
|
||||
@@ -21,25 +39,16 @@ out vec2 v_pos_a;
|
||||
out vec2 v_pos_b;
|
||||
|
||||
#ifndef HAS_UNIFORM_u_opacity
|
||||
uniform lowp float u_opacity_t;
|
||||
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;
|
||||
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;
|
||||
layout (location = 3) in lowp vec4 a_pattern_to;
|
||||
out lowp vec4 pattern_to;
|
||||
#else
|
||||
uniform lowp vec4 u_pattern_to;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
@@ -77,8 +86,28 @@ mediump vec4 pattern_to = u_pattern_to;
|
||||
v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, toScale * display_size_b, tileZoomRatio, a_pos);
|
||||
}
|
||||
)";
|
||||
static constexpr const char* fragment = R"(uniform vec2 u_texsize;
|
||||
uniform float u_fade;
|
||||
static constexpr const char* fragment = R"(layout (std140) uniform FillDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec4 u_scale;
|
||||
highp vec2 u_world;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp vec2 u_texsize;
|
||||
highp float u_fade;
|
||||
|
||||
highp float u_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_outline_color_t;
|
||||
highp float u_pattern_from_t;
|
||||
highp float u_pattern_to_t;
|
||||
|
||||
highp vec2 u_color;
|
||||
highp vec2 u_opacity;
|
||||
highp vec2 u_outline_color_pad;
|
||||
highp vec4 u_outline_color;
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
};
|
||||
|
||||
uniform sampler2D u_image;
|
||||
|
||||
@@ -87,18 +116,12 @@ in vec2 v_pos_b;
|
||||
|
||||
#ifndef HAS_UNIFORM_u_opacity
|
||||
in lowp float opacity;
|
||||
#else
|
||||
uniform lowp float u_opacity;
|
||||
#endif
|
||||
#ifndef HAS_UNIFORM_u_pattern_from
|
||||
in lowp vec4 pattern_from;
|
||||
#else
|
||||
uniform lowp vec4 u_pattern_from;
|
||||
#endif
|
||||
#ifndef HAS_UNIFORM_u_pattern_to
|
||||
in lowp vec4 pattern_to;
|
||||
#else
|
||||
uniform lowp vec4 u_pattern_to;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
|
||||
Reference in New Issue
Block a user