Layer group uniforms (#2247)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1228,7 +1228,6 @@ if(MBGL_WITH_METAL)
|
||||
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/mtl/hillshade.hpp
|
||||
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/mtl/hillshade_prepare.hpp
|
||||
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/mtl/line.hpp
|
||||
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/mtl/line_gradient.hpp
|
||||
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/mtl/raster.hpp
|
||||
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/mtl/shader_group.hpp
|
||||
${PROJECT_SOURCE_DIR}/include/mbgl/shaders/mtl/shader_program.hpp
|
||||
@@ -1274,7 +1273,6 @@ if(MBGL_WITH_METAL)
|
||||
${PROJECT_SOURCE_DIR}src/mbgl/shaders/mtl/hillshade.cpp
|
||||
${PROJECT_SOURCE_DIR}src/mbgl/shaders/mtl/hillshade_prepare.cpp
|
||||
${PROJECT_SOURCE_DIR}src/mbgl/shaders/mtl/line.cpp
|
||||
${PROJECT_SOURCE_DIR}src/mbgl/shaders/mtl/line_gradient.cpp
|
||||
${PROJECT_SOURCE_DIR}src/mbgl/shaders/mtl/raster.cpp
|
||||
${PROJECT_SOURCE_DIR}src/mbgl/shaders/mtl/symbol_icon.cpp
|
||||
${PROJECT_SOURCE_DIR}src/mbgl/shaders/mtl/symbol_sdf.cpp
|
||||
|
||||
@@ -1072,7 +1072,6 @@ MLN_DRAWABLES_MTL_SOURCE = [
|
||||
"src/mbgl/shaders/mtl/hillshade.cpp",
|
||||
"src/mbgl/shaders/mtl/hillshade_prepare.cpp",
|
||||
"src/mbgl/shaders/mtl/line.cpp",
|
||||
"src/mbgl/shaders/mtl/line_gradient.cpp",
|
||||
"src/mbgl/shaders/mtl/raster.cpp",
|
||||
"src/mbgl/shaders/mtl/symbol_icon.cpp",
|
||||
"src/mbgl/shaders/mtl/symbol_sdf.cpp",
|
||||
@@ -1117,7 +1116,6 @@ MLN_DRAWABLES_MTL_HEADERS = [
|
||||
"include/mbgl/shaders/mtl/hillshade.hpp",
|
||||
"include/mbgl/shaders/mtl/hillshade_prepare.hpp",
|
||||
"include/mbgl/shaders/mtl/line.hpp",
|
||||
"include/mbgl/shaders/mtl/line_gradient.hpp",
|
||||
"include/mbgl/shaders/mtl/raster.hpp",
|
||||
"include/mbgl/shaders/mtl/shader_group.hpp",
|
||||
"include/mbgl/shaders/mtl/shader_program.hpp",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/renderer/layer_group.hpp>
|
||||
#include <mbgl/gl/uniform_buffer_gl.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
@@ -19,7 +20,15 @@ public:
|
||||
void upload(gfx::UploadPass&) override;
|
||||
void render(RenderOrchestrator&, PaintParameters&) override;
|
||||
|
||||
const gfx::UniformBufferArray& getUniformBuffers() const override { return uniformBuffers; };
|
||||
|
||||
gfx::UniformBufferArray& mutableUniformBuffers() override { return uniformBuffers; };
|
||||
|
||||
void bindUniformBuffers() const;
|
||||
void unbindUniformBuffers() const;
|
||||
|
||||
protected:
|
||||
UniformBufferArrayGL uniformBuffers;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -33,7 +42,15 @@ public:
|
||||
void upload(gfx::UploadPass&) override;
|
||||
void render(RenderOrchestrator&, PaintParameters&) override;
|
||||
|
||||
const gfx::UniformBufferArray& getUniformBuffers() const override { return uniformBuffers; };
|
||||
|
||||
gfx::UniformBufferArray& mutableUniformBuffers() override { return uniformBuffers; };
|
||||
|
||||
void bindUniformBuffers() const;
|
||||
void unbindUniformBuffers() const;
|
||||
|
||||
protected:
|
||||
UniformBufferArrayGL uniformBuffers;
|
||||
};
|
||||
|
||||
} // namespace gl
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/renderer/layer_group.hpp>
|
||||
#include <mbgl/mtl/uniform_buffer.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
@@ -8,6 +9,8 @@ class PaintParameters;
|
||||
|
||||
namespace mtl {
|
||||
|
||||
class RenderPass;
|
||||
|
||||
/**
|
||||
A layer group for non-tile-based drawables
|
||||
*/
|
||||
@@ -19,7 +22,15 @@ public:
|
||||
void upload(gfx::UploadPass&) override;
|
||||
void render(RenderOrchestrator&, PaintParameters&) override;
|
||||
|
||||
const gfx::UniformBufferArray& getUniformBuffers() const override { return uniformBuffers; };
|
||||
|
||||
gfx::UniformBufferArray& mutableUniformBuffers() override { return uniformBuffers; };
|
||||
|
||||
void bindUniformBuffers(RenderPass&) const noexcept;
|
||||
void unbindUniformBuffers(RenderPass&) const noexcept {}
|
||||
|
||||
protected:
|
||||
UniformBufferArray uniformBuffers;
|
||||
};
|
||||
|
||||
} // namespace mtl
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/mtl/mtl_fwd.hpp>
|
||||
#include <mbgl/mtl/uniform_buffer.hpp>
|
||||
#include <mbgl/renderer/layer_group.hpp>
|
||||
|
||||
#include <Foundation/NSSharedPtr.hpp>
|
||||
@@ -13,6 +14,8 @@ class PaintParameters;
|
||||
|
||||
namespace mtl {
|
||||
|
||||
class RenderPass;
|
||||
|
||||
/**
|
||||
A layer group for tile-based drawables
|
||||
*/
|
||||
@@ -24,9 +27,17 @@ public:
|
||||
void upload(gfx::UploadPass&) override;
|
||||
void render(RenderOrchestrator&, PaintParameters&) override;
|
||||
|
||||
const gfx::UniformBufferArray& getUniformBuffers() const override { return uniformBuffers; };
|
||||
|
||||
gfx::UniformBufferArray& mutableUniformBuffers() override { return uniformBuffers; };
|
||||
|
||||
void bindUniformBuffers(RenderPass&) const noexcept;
|
||||
void unbindUniformBuffers(RenderPass&) const noexcept {}
|
||||
|
||||
protected:
|
||||
std::optional<MTLDepthStencilStatePtr> stateNone;
|
||||
std::optional<MTLDepthStencilStatePtr> stateDepth;
|
||||
UniformBufferArray uniformBuffers;
|
||||
};
|
||||
|
||||
} // namespace mtl
|
||||
|
||||
@@ -101,6 +101,12 @@ public:
|
||||
|
||||
void runTweakers(const RenderTree&, PaintParameters&);
|
||||
|
||||
/// Get the uniform buffers attached to this layer group
|
||||
virtual const gfx::UniformBufferArray& getUniformBuffers() const = 0;
|
||||
|
||||
/// Get the mutable uniform buffer array attached to this layer group
|
||||
virtual gfx::UniformBufferArray& mutableUniformBuffers() = 0;
|
||||
|
||||
protected:
|
||||
const Type type;
|
||||
bool enabled = true;
|
||||
|
||||
@@ -7,10 +7,13 @@
|
||||
namespace mbgl {
|
||||
namespace shaders {
|
||||
|
||||
//
|
||||
// Background
|
||||
|
||||
struct alignas(16) BackgroundDrawableUBO {
|
||||
std::array<float, 4 * 4> matrix;
|
||||
};
|
||||
static_assert(sizeof(BackgroundDrawableUBO) % 16 == 0);
|
||||
static_assert(sizeof(BackgroundDrawableUBO) == 64);
|
||||
|
||||
struct alignas(16) BackgroundLayerUBO {
|
||||
/* 0 */ Color color;
|
||||
@@ -20,6 +23,18 @@ struct alignas(16) BackgroundLayerUBO {
|
||||
};
|
||||
static_assert(sizeof(BackgroundLayerUBO) == 32);
|
||||
|
||||
//
|
||||
// Background pattern
|
||||
|
||||
struct alignas(16) BackgroundPatternDrawableUBO {
|
||||
std::array<float, 4 * 4> matrix;
|
||||
std::array<float, 2> pixel_coord_upper;
|
||||
std::array<float, 2> pixel_coord_lower;
|
||||
float tile_units_to_pixels;
|
||||
float pad1, pad2, pad3;
|
||||
};
|
||||
static_assert(sizeof(BackgroundPatternDrawableUBO) == 96);
|
||||
|
||||
struct alignas(16) BackgroundPatternLayerUBO {
|
||||
/* 0 */ std::array<float, 2> pattern_tl_a;
|
||||
/* 8 */ std::array<float, 2> pattern_br_a;
|
||||
@@ -28,17 +43,14 @@ struct alignas(16) BackgroundPatternLayerUBO {
|
||||
/* 32 */ std::array<float, 2> texsize;
|
||||
/* 40 */ std::array<float, 2> pattern_size_a;
|
||||
/* 48 */ std::array<float, 2> pattern_size_b;
|
||||
/* 56 */ std::array<float, 2> pixel_coord_upper;
|
||||
/* 64 */ std::array<float, 2> pixel_coord_lower;
|
||||
/* 72 */ float tile_units_to_pixels;
|
||||
/* 76 */ float scale_a;
|
||||
/* 80 */ float scale_b;
|
||||
/* 84 */ float mix;
|
||||
/* 88 */ float opacity;
|
||||
/* 92 */ float pad1;
|
||||
/* 96 */
|
||||
/* 56 */ float scale_a;
|
||||
/* 60 */ float scale_b;
|
||||
/* 64 */ float mix;
|
||||
/* 68 */ float opacity;
|
||||
/* 72 */ float pad1, pad2;
|
||||
/* 80 */
|
||||
};
|
||||
static_assert(sizeof(BackgroundPatternLayerUBO) == 96);
|
||||
static_assert(sizeof(BackgroundPatternLayerUBO) == 80);
|
||||
|
||||
enum {
|
||||
idBackgroundDrawableUBO,
|
||||
|
||||
@@ -20,7 +20,7 @@ struct alignas(16) FillExtrusionDrawableUBO {
|
||||
static_assert(sizeof(FillExtrusionDrawableUBO) == 7 * 16);
|
||||
|
||||
/// Evaluated properties that do not depend on the tile
|
||||
struct alignas(16) FillExtrusionDrawablePropsUBO {
|
||||
struct alignas(16) FillExtrusionPropsUBO {
|
||||
/* 0 */ Color color;
|
||||
/* 16 */ std::array<float, 3> light_color;
|
||||
/* 28 */ float pad1;
|
||||
@@ -34,15 +34,15 @@ struct alignas(16) FillExtrusionDrawablePropsUBO {
|
||||
/* 68 */ float pad2, pad3, pad4;
|
||||
/* 80 */
|
||||
};
|
||||
static_assert(sizeof(FillExtrusionDrawablePropsUBO) == 5 * 16);
|
||||
static_assert(sizeof(FillExtrusionPropsUBO) == 5 * 16);
|
||||
|
||||
/// Evaluated properties that depend on the tile
|
||||
struct alignas(16) FillExtrusionDrawableTilePropsUBO {
|
||||
struct alignas(16) FillExtrusionTilePropsUBO {
|
||||
/* 0 */ std::array<float, 4> pattern_from;
|
||||
/* 16 */ std::array<float, 4> pattern_to;
|
||||
/* 32 */
|
||||
};
|
||||
static_assert(sizeof(FillExtrusionDrawableTilePropsUBO) == 2 * 16);
|
||||
static_assert(sizeof(FillExtrusionTilePropsUBO) == 2 * 16);
|
||||
|
||||
/// Attribute interpolations
|
||||
struct alignas(16) FillExtrusionInterpolateUBO {
|
||||
@@ -58,8 +58,8 @@ static_assert(sizeof(FillExtrusionInterpolateUBO) == 2 * 16);
|
||||
|
||||
enum {
|
||||
idFillExtrusionDrawableUBO,
|
||||
idFillExtrusionDrawablePropsUBO,
|
||||
idFillExtrusionDrawableTilePropsUBO,
|
||||
idFillExtrusionPropsUBO,
|
||||
idFillExtrusionTilePropsUBO,
|
||||
idFillExtrusionInterpolateUBO,
|
||||
fillExtrusionUBOCount
|
||||
};
|
||||
|
||||
@@ -13,13 +13,6 @@ struct alignas(16) FillDrawableUBO {
|
||||
};
|
||||
static_assert(sizeof(FillDrawableUBO) == 4 * 16);
|
||||
|
||||
struct alignas(16) FillEvaluatedPropsUBO {
|
||||
Color color;
|
||||
float opacity;
|
||||
float pad1, pad2, pad3;
|
||||
};
|
||||
static_assert(sizeof(FillEvaluatedPropsUBO) == 2 * 16);
|
||||
|
||||
struct alignas(16) FillInterpolateUBO {
|
||||
float color_t;
|
||||
float opacity_t;
|
||||
@@ -27,13 +20,6 @@ struct alignas(16) FillInterpolateUBO {
|
||||
};
|
||||
static_assert(sizeof(FillInterpolateUBO) % 16 == 0);
|
||||
|
||||
enum {
|
||||
idFillDrawableUBO,
|
||||
idFillEvaluatedPropsUBO,
|
||||
idFillInterpolateUBO,
|
||||
fillUBOCount
|
||||
};
|
||||
|
||||
//
|
||||
// Fill outline
|
||||
|
||||
@@ -45,13 +31,6 @@ struct alignas(16) FillOutlineDrawableUBO {
|
||||
};
|
||||
static_assert(sizeof(FillOutlineDrawableUBO) == 5 * 16);
|
||||
|
||||
struct alignas(16) FillOutlineEvaluatedPropsUBO {
|
||||
Color outline_color;
|
||||
float opacity;
|
||||
float pad1, pad2, pad3;
|
||||
};
|
||||
static_assert(sizeof(FillOutlineEvaluatedPropsUBO) == 2 * 16);
|
||||
|
||||
struct alignas(16) FillOutlineInterpolateUBO {
|
||||
float outline_color_t;
|
||||
float opacity_t;
|
||||
@@ -59,13 +38,6 @@ struct alignas(16) FillOutlineInterpolateUBO {
|
||||
};
|
||||
static_assert(sizeof(FillOutlineInterpolateUBO) == 1 * 16);
|
||||
|
||||
enum {
|
||||
idFillOutlineDrawableUBO,
|
||||
idFillOutlineEvaluatedPropsUBO,
|
||||
idFillOutlineInterpolateUBO,
|
||||
fillOutlineUBOCount
|
||||
};
|
||||
|
||||
//
|
||||
// Fill Pattern
|
||||
|
||||
@@ -80,13 +52,6 @@ struct alignas(16) FillPatternDrawableUBO {
|
||||
};
|
||||
static_assert(sizeof(FillPatternDrawableUBO) == 7 * 16);
|
||||
|
||||
struct alignas(16) FillPatternEvaluatedPropsUBO {
|
||||
float opacity;
|
||||
float fade;
|
||||
float pad1, pad2;
|
||||
};
|
||||
static_assert(sizeof(FillPatternEvaluatedPropsUBO) == 1 * 16);
|
||||
|
||||
struct alignas(16) FillPatternTilePropsUBO {
|
||||
std::array<float, 4> pattern_from;
|
||||
std::array<float, 4> pattern_to;
|
||||
@@ -101,14 +66,6 @@ struct alignas(16) FillPatternInterpolateUBO {
|
||||
};
|
||||
static_assert(sizeof(FillPatternInterpolateUBO) == 1 * 16);
|
||||
|
||||
enum {
|
||||
idFillPatternDrawableUBO,
|
||||
idFillPatternTilePropsUBO,
|
||||
idFillPatternEvaluatedPropsUBO,
|
||||
idFillPatternInterpolateUBO,
|
||||
fillPatternUBOCount
|
||||
};
|
||||
|
||||
//
|
||||
// Fill pattern outline
|
||||
|
||||
@@ -122,13 +79,6 @@ struct alignas(16) FillOutlinePatternDrawableUBO {
|
||||
};
|
||||
static_assert(sizeof(FillOutlinePatternDrawableUBO) == 7 * 16);
|
||||
|
||||
struct alignas(16) FillOutlinePatternEvaluatedPropsUBO {
|
||||
float opacity;
|
||||
float fade;
|
||||
float pad1, pad2;
|
||||
};
|
||||
static_assert(sizeof(FillOutlinePatternEvaluatedPropsUBO) == 16);
|
||||
|
||||
struct alignas(16) FillOutlinePatternTilePropsUBO {
|
||||
std::array<float, 4> pattern_from;
|
||||
std::array<float, 4> pattern_to;
|
||||
@@ -143,14 +93,6 @@ struct alignas(16) FillOutlinePatternInterpolateUBO {
|
||||
};
|
||||
static_assert(sizeof(FillOutlinePatternInterpolateUBO) == 1 * 16);
|
||||
|
||||
enum {
|
||||
idFillOutlinePatternDrawableUBO,
|
||||
idFillOutlinePatternTilePropsUBO,
|
||||
idFillOutlinePatternEvaluatedPropsUBO,
|
||||
idFillOutlinePatternInterpolateUBO,
|
||||
fillOutlinePatternUBOCount
|
||||
};
|
||||
|
||||
//
|
||||
// Fill outline triangulated
|
||||
|
||||
@@ -162,18 +104,25 @@ struct alignas(16) FillOutlineTriangulatedDrawableUBO {
|
||||
};
|
||||
static_assert(sizeof(FillOutlineTriangulatedDrawableUBO) % 16 == 0);
|
||||
|
||||
struct alignas(16) FillOutlineTriangulatedPropertiesUBO {
|
||||
//
|
||||
// Fill evaluated properties
|
||||
|
||||
struct alignas(16) FillEvaluatedPropsUBO {
|
||||
Color color;
|
||||
Color outline_color;
|
||||
float opacity;
|
||||
float fade;
|
||||
float width;
|
||||
float pad1, pad2;
|
||||
float pad1;
|
||||
};
|
||||
static_assert(sizeof(FillOutlineTriangulatedPropertiesUBO) % 16 == 0);
|
||||
static_assert(sizeof(FillEvaluatedPropsUBO) == 3 * 16);
|
||||
|
||||
enum {
|
||||
idFillOutlineTriangulatedDrawableUBO,
|
||||
idFillOutlineTriangulatedPropertiesUBO,
|
||||
fillOutlineTriangulatedUBOCount
|
||||
idFillDrawableUBO,
|
||||
idFillTilePropsUBO,
|
||||
idFillInterpolateUBO,
|
||||
idFillEvaluatedPropsUBO,
|
||||
fillUBOCount
|
||||
};
|
||||
|
||||
} // namespace shaders
|
||||
|
||||
@@ -19,11 +19,12 @@ void main() {
|
||||
)";
|
||||
static constexpr const char* fragment = R"(layout (std140) uniform BackgroundLayerUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec4 u_opacity_pad3;
|
||||
highp float u_opacity;
|
||||
highp float layer_pad1, layer_pad2, layer_pad3;
|
||||
};
|
||||
|
||||
void main() {
|
||||
fragColor = u_color * u_opacity_pad3.x;
|
||||
fragColor = u_color * u_opacity;
|
||||
#ifdef OVERDRAW_INSPECTOR
|
||||
fragColor = vec4(1.0);
|
||||
#endif
|
||||
|
||||
@@ -8,10 +8,14 @@ namespace shaders {
|
||||
template <>
|
||||
struct ShaderSource<BuiltIn::BackgroundPatternShader, gfx::Backend::Type::OpenGL> {
|
||||
static constexpr const char* name = "BackgroundPatternShader";
|
||||
static constexpr const char* vertex = R"(layout (std140) uniform BackgroundDrawableUBO {
|
||||
static constexpr const char* vertex = R"(layout (std140) uniform BackgroundPatternDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp float u_tile_units_to_pixels;
|
||||
highp float drawable_pad1, drawable_pad2, drawable_pad3;
|
||||
};
|
||||
layout (std140) uniform BackgroundLayerUBO {
|
||||
layout (std140) uniform BackgroundPatternLayerUBO {
|
||||
highp vec2 u_pattern_tl_a;
|
||||
highp vec2 u_pattern_br_a;
|
||||
highp vec2 u_pattern_tl_b;
|
||||
@@ -19,14 +23,11 @@ layout (std140) uniform BackgroundLayerUBO {
|
||||
highp vec2 u_texsize;
|
||||
highp vec2 u_pattern_size_a;
|
||||
highp vec2 u_pattern_size_b;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp float u_tile_units_to_pixels;
|
||||
highp float u_scale_a;
|
||||
highp float u_scale_b;
|
||||
highp float u_mix;
|
||||
highp float u_opacity;
|
||||
highp float pad;
|
||||
highp float layer_pad1, layer_pad2;
|
||||
};
|
||||
|
||||
layout (location = 0) in vec2 a_pos;
|
||||
@@ -40,7 +41,7 @@ void main() {
|
||||
v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, a_pos);
|
||||
}
|
||||
)";
|
||||
static constexpr const char* fragment = R"(layout (std140) uniform BackgroundLayerUBO {
|
||||
static constexpr const char* fragment = R"(layout (std140) uniform BackgroundPatternLayerUBO {
|
||||
highp vec2 u_pattern_tl_a;
|
||||
highp vec2 u_pattern_br_a;
|
||||
highp vec2 u_pattern_tl_b;
|
||||
@@ -48,14 +49,11 @@ void main() {
|
||||
highp vec2 u_texsize;
|
||||
highp vec2 u_pattern_size_a;
|
||||
highp vec2 u_pattern_size_b;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp float u_tile_units_to_pixels;
|
||||
highp float u_scale_a;
|
||||
highp float u_scale_b;
|
||||
highp float u_mix;
|
||||
highp float u_opacity;
|
||||
highp float pad;
|
||||
highp float layer_pad1, layer_pad2;
|
||||
};
|
||||
|
||||
uniform sampler2D u_image;
|
||||
|
||||
@@ -14,13 +14,13 @@ out vec3 v_data;
|
||||
layout (std140) uniform CircleDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec2 u_extrude_scale;
|
||||
lowp vec2 pad2_;
|
||||
lowp vec2 drawable_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform CirclePaintParamsUBO {
|
||||
highp float u_camera_to_center_distance;
|
||||
lowp float pad3_;
|
||||
lowp vec2 pad4_;
|
||||
lowp float params_pad1;
|
||||
lowp vec2 params_pad2;
|
||||
};
|
||||
|
||||
layout (std140) uniform CircleEvaluatedPropsUBO {
|
||||
@@ -33,7 +33,7 @@ layout (std140) uniform CircleEvaluatedPropsUBO {
|
||||
lowp float u_stroke_opacity;
|
||||
bool u_scale_with_map;
|
||||
bool u_pitch_with_map;
|
||||
lowp float pad0_;
|
||||
lowp float props_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform CircleInterpolateUBO {
|
||||
@@ -44,7 +44,7 @@ layout (std140) uniform CircleInterpolateUBO {
|
||||
lowp float u_stroke_color_t;
|
||||
lowp float u_stroke_width_t;
|
||||
lowp float u_stroke_opacity_t;
|
||||
lowp float pad1_;
|
||||
lowp float interp_pad1;
|
||||
};
|
||||
|
||||
#ifndef HAS_UNIFORM_u_color
|
||||
@@ -162,7 +162,7 @@ layout (std140) uniform CircleEvaluatedPropsUBO {
|
||||
lowp float u_stroke_opacity;
|
||||
bool u_scale_with_map;
|
||||
bool u_pitch_with_map;
|
||||
lowp float pad0_;
|
||||
lowp float props_pad1;
|
||||
};
|
||||
|
||||
#ifndef HAS_UNIFORM_u_color
|
||||
|
||||
@@ -23,7 +23,7 @@ layout(std140) uniform CustomSymbolIconParametersUBO {
|
||||
bool u_pitch_with_map;
|
||||
highp float u_camera_to_center_distance;
|
||||
highp float u_aspect_ratio;
|
||||
highp float pad0, pad1, pad3;
|
||||
highp float params_pad1, params_pad2, params_pad3;
|
||||
};
|
||||
|
||||
out vec2 v_tex;
|
||||
|
||||
@@ -11,17 +11,18 @@ struct ShaderSource<BuiltIn::FillShader, gfx::Backend::Type::OpenGL> {
|
||||
static constexpr const char* vertex = R"(layout (std140) uniform FillDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
};
|
||||
layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp float u_opacity;
|
||||
highp float padding_props1;
|
||||
highp float padding_props2;
|
||||
highp float padding_props3;
|
||||
};
|
||||
layout (std140) uniform FillInterpolateUBO {
|
||||
highp float u_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float pad_interp_1, pad_interp_2;
|
||||
highp float interp_pad1, interp_pad2;
|
||||
};
|
||||
layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_width;
|
||||
highp float props_pad1;
|
||||
};
|
||||
|
||||
layout (location = 0) in vec2 a_pos;
|
||||
@@ -50,17 +51,18 @@ lowp float opacity = u_opacity;
|
||||
gl_Position = u_matrix * vec4(a_pos, 0, 1);
|
||||
}
|
||||
)";
|
||||
static constexpr const char* fragment = R"(layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp float u_opacity;
|
||||
highp float padding_props1;
|
||||
highp float padding_props2;
|
||||
highp float padding_props3;
|
||||
};
|
||||
layout (std140) uniform FillInterpolateUBO {
|
||||
static constexpr const char* fragment = R"(layout (std140) uniform FillInterpolateUBO {
|
||||
highp float u_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float pad_interp_1, pad_interp_2;
|
||||
highp float interp_pad1, interp_pad2;
|
||||
};
|
||||
layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_width;
|
||||
highp float props_pad1;
|
||||
};
|
||||
|
||||
#ifndef HAS_UNIFORM_u_color
|
||||
|
||||
@@ -12,7 +12,29 @@ struct ShaderSource<BuiltIn::FillExtrusionShader, gfx::Backend::Type::OpenGL> {
|
||||
layout (location = 1) in vec4 a_normal_ed;
|
||||
out vec4 v_color;
|
||||
|
||||
layout (std140) uniform FillExtrusionDrawableTilePropsUBO {
|
||||
layout (std140) uniform FillExtrusionDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec4 u_scale;
|
||||
highp vec2 u_texsize;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp float u_height_factor;
|
||||
highp float drawable_pad1;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec3 u_lightcolor;
|
||||
highp float props_pad1;
|
||||
highp vec3 u_lightpos;
|
||||
highp float u_base;
|
||||
highp float u_height;
|
||||
highp float u_lightintensity;
|
||||
highp float u_vertical_gradient;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float props_pad2, props_pad3, props_pad4;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionTilePropsUBO {
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
};
|
||||
@@ -22,31 +44,8 @@ layout (std140) uniform FillExtrusionInterpolateUBO {
|
||||
highp float u_color_t;
|
||||
highp float u_pattern_from_t;
|
||||
highp float u_pattern_to_t;
|
||||
highp float u_pad_interp1, u_pad_interp2, u_pad_interp3;
|
||||
highp float interp_pad1, interp_pad2, interp_pad3;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec4 u_scale;
|
||||
highp vec2 u_texsize;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp float u_height_factor;
|
||||
highp float u_pad_drawable;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionDrawablePropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec3 u_lightcolor;
|
||||
highp float u_pad1;
|
||||
highp vec3 u_lightpos;
|
||||
highp float u_base;
|
||||
highp float u_height;
|
||||
highp float u_lightintensity;
|
||||
highp float u_vertical_gradient;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_pad_props2, u_pad_props3, u_pad_props4;
|
||||
};
|
||||
|
||||
#ifndef HAS_UNIFORM_u_base
|
||||
layout (location = 2) in highp vec2 a_base;
|
||||
#endif
|
||||
|
||||
@@ -15,7 +15,29 @@ out vec2 v_pos_a;
|
||||
out vec2 v_pos_b;
|
||||
out vec4 v_lighting;
|
||||
|
||||
layout (std140) uniform FillExtrusionDrawableTilePropsUBO {
|
||||
layout (std140) uniform FillExtrusionDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec4 u_scale;
|
||||
highp vec2 u_texsize;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp float u_height_factor;
|
||||
highp float drawable_pad1;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec3 u_lightcolor;
|
||||
highp float props_pad1;
|
||||
highp vec3 u_lightpos;
|
||||
highp float u_base;
|
||||
highp float u_height;
|
||||
highp float u_lightintensity;
|
||||
highp float u_vertical_gradient;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float props_pad2, props_pad3, props_pad4;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionTilePropsUBO {
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
};
|
||||
@@ -25,29 +47,7 @@ layout (std140) uniform FillExtrusionInterpolateUBO {
|
||||
highp float u_color_t;
|
||||
highp float u_pattern_from_t;
|
||||
highp float u_pattern_to_t;
|
||||
highp float u_pad_interp1, u_pad_interp2, u_pad_interp3;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec4 u_scale;
|
||||
highp vec2 u_texsize;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp float u_height_factor;
|
||||
highp float u_pad_drawable;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionDrawablePropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec3 u_lightcolor;
|
||||
highp float u_pad1;
|
||||
highp vec3 u_lightpos;
|
||||
highp float u_base;
|
||||
highp float u_height;
|
||||
highp float u_lightintensity;
|
||||
highp float u_vertical_gradient;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_pad_props2, u_pad_props3, u_pad_props4;
|
||||
highp float interp_pad1, interp_pad2, interp_pad3;
|
||||
};
|
||||
|
||||
#ifndef HAS_UNIFORM_u_base
|
||||
@@ -140,7 +140,29 @@ mediump vec4 pattern_to = u_pattern_to;
|
||||
in vec2 v_pos_b;
|
||||
in vec4 v_lighting;
|
||||
|
||||
layout (std140) uniform FillExtrusionDrawableTilePropsUBO {
|
||||
layout (std140) uniform FillExtrusionDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec4 u_scale;
|
||||
highp vec2 u_texsize;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp float u_height_factor;
|
||||
highp float drawable_pad1;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec3 u_lightcolor;
|
||||
highp float props_pad1;
|
||||
highp vec3 u_lightpos;
|
||||
highp float u_base;
|
||||
highp float u_height;
|
||||
highp float u_lightintensity;
|
||||
highp float u_vertical_gradient;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float props_pad2, props_pad3, props_pad4;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionTilePropsUBO {
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
};
|
||||
@@ -150,29 +172,7 @@ layout (std140) uniform FillExtrusionInterpolateUBO {
|
||||
highp float u_color_t;
|
||||
highp float u_pattern_from_t;
|
||||
highp float u_pattern_to_t;
|
||||
highp float u_pad_interp1, u_pad_interp2, u_pad_interp3;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec4 u_scale;
|
||||
highp vec2 u_texsize;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp float u_height_factor;
|
||||
highp float u_pad_drawable;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionDrawablePropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec3 u_lightcolor;
|
||||
highp float u_pad1;
|
||||
highp vec3 u_lightpos;
|
||||
highp float u_base;
|
||||
highp float u_height;
|
||||
highp float u_lightintensity;
|
||||
highp float u_vertical_gradient;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_pad_props2, u_pad_props3, u_pad_props4;
|
||||
highp float interp_pad1, interp_pad2, interp_pad3;
|
||||
};
|
||||
|
||||
uniform sampler2D u_image;
|
||||
|
||||
@@ -11,20 +11,21 @@ struct ShaderSource<BuiltIn::FillOutlineShader, gfx::Backend::Type::OpenGL> {
|
||||
static constexpr const char* vertex = R"(layout (std140) uniform FillOutlineDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec2 u_world;
|
||||
highp vec2 pad;
|
||||
};
|
||||
layout (std140) uniform FillOutlineEvaluatedPropsUBO {
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float padding_props1;
|
||||
highp float padding_props2;
|
||||
highp float padding_props3;
|
||||
highp vec2 drawable_pad1;
|
||||
};
|
||||
layout (std140) uniform FillOutlineInterpolateUBO {
|
||||
highp float u_outline_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_padding_interp1;
|
||||
highp float u_padding_interp2;
|
||||
highp float interp_pad1;
|
||||
highp float interp_pad2;
|
||||
};
|
||||
layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_width;
|
||||
highp float props_pad1;
|
||||
};
|
||||
|
||||
layout (location = 0) in vec2 a_pos;
|
||||
@@ -56,18 +57,19 @@ 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"(layout (std140) uniform FillOutlineEvaluatedPropsUBO {
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float padding_props1;
|
||||
highp float padding_props2;
|
||||
highp float padding_props3;
|
||||
};
|
||||
layout (std140) uniform FillOutlineInterpolateUBO {
|
||||
static constexpr const char* fragment = R"(layout (std140) uniform FillOutlineInterpolateUBO {
|
||||
highp float u_outline_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_padding_interp1;
|
||||
highp float u_padding_interp2;
|
||||
highp float interp_pad1;
|
||||
highp float interp_pad2;
|
||||
};
|
||||
layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_width;
|
||||
highp float props_pad1;
|
||||
};
|
||||
|
||||
in vec2 v_pos;
|
||||
|
||||
@@ -16,21 +16,23 @@ struct ShaderSource<BuiltIn::FillOutlinePatternShader, gfx::Backend::Type::OpenG
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp vec2 u_texsize;
|
||||
};
|
||||
layout (std140) uniform FillOutlinePatternEvaluatedPropsUBO {
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float padding_props1;
|
||||
highp float padding_props2;
|
||||
layout (std140) uniform FillOutlinePatternTilePropsUBO {
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
};
|
||||
layout (std140) uniform FillOutlinePatternInterpolateUBO {
|
||||
highp float u_pattern_from_t;
|
||||
highp float u_pattern_to_t;
|
||||
highp float u_opacity_t;
|
||||
highp float pad1;
|
||||
highp float interp_pad1;
|
||||
};
|
||||
layout (std140) uniform FillOutlinePatternTilePropsUBO {
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_width;
|
||||
highp float props_pad1;
|
||||
};
|
||||
|
||||
layout (location = 0) in vec2 a_pos;
|
||||
@@ -98,21 +100,23 @@ mediump vec4 pattern_to = u_pattern_to;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp vec2 u_texsize;
|
||||
};
|
||||
layout (std140) uniform FillOutlinePatternEvaluatedPropsUBO {
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float padding_props1;
|
||||
highp float padding_props2;
|
||||
layout (std140) uniform FillOutlinePatternTilePropsUBO {
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
};
|
||||
layout (std140) uniform FillOutlinePatternInterpolateUBO {
|
||||
highp float u_pattern_from_t;
|
||||
highp float u_pattern_to_t;
|
||||
highp float u_opacity_t;
|
||||
highp float pad1;
|
||||
highp float interp_pad1;
|
||||
};
|
||||
layout (std140) uniform FillOutlinePatternTilePropsUBO {
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_width;
|
||||
highp float props_pad1;
|
||||
};
|
||||
|
||||
uniform sampler2D u_image;
|
||||
|
||||
@@ -23,14 +23,15 @@ layout (std140) uniform FillOutlineTriangulatedDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec2 u_units_to_pixels;
|
||||
mediump float u_ratio;
|
||||
lowp float pad0;
|
||||
lowp float drawable_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform FillOutlineTriangulatedPropertiesUBO {
|
||||
layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_opacity;
|
||||
mediump float u_width;
|
||||
highp vec2 pad1;
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_width;
|
||||
highp float props_pad1;
|
||||
};
|
||||
|
||||
out vec2 v_normal;
|
||||
@@ -76,11 +77,13 @@ void main() {
|
||||
v_width = outset;
|
||||
}
|
||||
)";
|
||||
static constexpr const char* fragment = R"(layout (std140) uniform FillOutlineTriangulatedPropertiesUBO {
|
||||
static constexpr const char* fragment = R"(layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_opacity;
|
||||
mediump float u_width;
|
||||
highp vec2 pad1;
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_width;
|
||||
highp float props_pad1;
|
||||
};
|
||||
|
||||
in float v_width;
|
||||
@@ -97,7 +100,7 @@ void main() {
|
||||
float blur2 = (1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;
|
||||
float alpha = clamp(min(dist + blur2, v_width - dist) / blur2, 0.0, 1.0);
|
||||
|
||||
fragColor = u_color * (alpha * u_opacity);
|
||||
fragColor = u_outline_color * (alpha * u_opacity);
|
||||
|
||||
#ifdef OVERDRAW_INSPECTOR
|
||||
fragColor = vec4(1.0);
|
||||
|
||||
@@ -14,24 +14,26 @@ struct ShaderSource<BuiltIn::FillPatternShader, gfx::Backend::Type::OpenGL> {
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp vec2 u_texsize;
|
||||
highp float pad1;
|
||||
highp float pad2;
|
||||
highp float drawable_pad1;
|
||||
highp float drawable_pad2;
|
||||
};
|
||||
layout (std140) uniform FillPatternEvaluatedPropsUBO {
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float padding_props1;
|
||||
highp float padding_props2;
|
||||
layout (std140) uniform FillPatternTilePropsUBO {
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
};
|
||||
layout (std140) uniform FillPatternInterpolateUBO {
|
||||
highp float u_pattern_from_t;
|
||||
highp float u_pattern_to_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_padding_interp1;
|
||||
highp float interp_pad1;
|
||||
};
|
||||
layout (std140) uniform FillPatternTilePropsUBO {
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_width;
|
||||
highp float props_pad1;
|
||||
};
|
||||
|
||||
layout (location = 0) in vec2 a_pos;
|
||||
@@ -93,24 +95,26 @@ mediump vec4 pattern_to = u_pattern_to;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp vec2 u_texsize;
|
||||
highp float pad1;
|
||||
highp float pad2;
|
||||
highp float drawable_pad1;
|
||||
highp float drawable_pad2;
|
||||
};
|
||||
layout (std140) uniform FillPatternEvaluatedPropsUBO {
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float padding_props1;
|
||||
highp float padding_props2;
|
||||
layout (std140) uniform FillPatternTilePropsUBO {
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
};
|
||||
layout (std140) uniform FillPatternInterpolateUBO {
|
||||
highp float u_pattern_from_t;
|
||||
highp float u_pattern_to_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_padding_interp1;
|
||||
highp float interp_pad1;
|
||||
};
|
||||
layout (std140) uniform FillPatternTilePropsUBO {
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_width;
|
||||
highp float props_pad1;
|
||||
};
|
||||
|
||||
uniform sampler2D u_image;
|
||||
|
||||
@@ -14,21 +14,21 @@ out vec2 v_extrude;
|
||||
layout (std140) uniform HeatmapDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp float u_extrude_scale;
|
||||
lowp float pad1_;
|
||||
lowp vec2 pad2_;
|
||||
lowp float drawable_pad1;
|
||||
lowp vec2 drawable_pad2;
|
||||
};
|
||||
|
||||
layout (std140) uniform HeatmapEvaluatedPropsUBO {
|
||||
highp float u_weight;
|
||||
highp float u_radius;
|
||||
highp float u_intensity;
|
||||
lowp float pad0_;
|
||||
lowp float props_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform HeatmapInterpolateUBO {
|
||||
lowp float u_weight_t;
|
||||
lowp float u_radius_t;
|
||||
lowp vec2 pad3_;
|
||||
lowp vec2 interp_pad1;
|
||||
};
|
||||
|
||||
#ifndef HAS_UNIFORM_u_weight
|
||||
@@ -95,7 +95,7 @@ layout (std140) uniform HeatmapEvaluatedPropsUBO {
|
||||
highp float u_weight;
|
||||
highp float u_radius;
|
||||
highp float u_intensity;
|
||||
lowp float pad0_;
|
||||
lowp float props_pad1;
|
||||
};
|
||||
|
||||
#ifndef HAS_UNIFORM_u_weight
|
||||
|
||||
@@ -11,11 +11,11 @@ struct ShaderSource<BuiltIn::HeatmapTextureShader, gfx::Backend::Type::OpenGL> {
|
||||
static constexpr const char* vertex = R"(layout (location = 0) in vec2 a_pos;
|
||||
out vec2 v_pos;
|
||||
|
||||
layout (std140) uniform HeatmapTextureDrawableUBO {
|
||||
layout (std140) uniform HeatmapTexturePropsUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec2 u_world;
|
||||
highp float u_opacity;
|
||||
lowp float pad0_;
|
||||
lowp float props_pad1;
|
||||
};
|
||||
|
||||
void main() {
|
||||
@@ -29,11 +29,11 @@ void main() {
|
||||
uniform sampler2D u_image;
|
||||
uniform sampler2D u_color_ramp;
|
||||
|
||||
layout (std140) uniform HeatmapTextureDrawableUBO {
|
||||
layout (std140) uniform HeatmapTexturePropsUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec2 u_world;
|
||||
highp float u_opacity;
|
||||
lowp float pad0_;
|
||||
lowp float props_pad1;
|
||||
};
|
||||
|
||||
void main() {
|
||||
|
||||
@@ -21,25 +21,13 @@ layout (location = 1) in vec4 a_data;
|
||||
|
||||
layout (std140) uniform LineDynamicUBO {
|
||||
highp vec2 u_units_to_pixels;
|
||||
lowp float pad0, pad1;
|
||||
lowp float dynamic_pad1, dynamic_pad2;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineUBO {
|
||||
layout (std140) uniform LineDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
mediump float u_ratio;
|
||||
lowp float pad2, pad3, pad4;
|
||||
};
|
||||
|
||||
layout (std140) uniform LinePropertiesUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
|
||||
highp float pad5;
|
||||
highp vec2 pad6;
|
||||
lowp float drawable_pad1, drawable_pad2, drawable_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineInterpolationUBO {
|
||||
@@ -49,8 +37,19 @@ layout (std140) uniform LineInterpolationUBO {
|
||||
lowp float u_gapwidth_t;
|
||||
lowp float u_offset_t;
|
||||
lowp float u_width_t;
|
||||
highp vec2 interp_pad1;
|
||||
};
|
||||
|
||||
highp vec2 pad7;
|
||||
layout (std140) uniform LineEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
lowp float u_floorwidth;
|
||||
highp float props_pad1;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
out vec2 v_normal;
|
||||
@@ -162,22 +161,10 @@ mediump float width = u_width;
|
||||
v_width2 = vec2(outset, inset);
|
||||
}
|
||||
)";
|
||||
static constexpr const char* fragment = R"(layout (std140) uniform LineUBO {
|
||||
static constexpr const char* fragment = R"(layout (std140) uniform LineDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
mediump float u_ratio;
|
||||
lowp float pad2, pad3, pad4;
|
||||
};
|
||||
|
||||
layout (std140) uniform LinePropertiesUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
|
||||
highp float pad5;
|
||||
highp vec2 pad6;
|
||||
lowp float drawable_pad1, drawable_pad2, drawable_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineInterpolationUBO {
|
||||
@@ -187,8 +174,19 @@ layout (std140) uniform LineInterpolationUBO {
|
||||
lowp float u_gapwidth_t;
|
||||
lowp float u_offset_t;
|
||||
lowp float u_width_t;
|
||||
highp vec2 interp_pad1;
|
||||
};
|
||||
|
||||
highp vec2 pad7;
|
||||
layout (std140) uniform LineEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
lowp float u_floorwidth;
|
||||
highp float props_pad1;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
in vec2 v_width2;
|
||||
|
||||
@@ -25,24 +25,13 @@ layout (location = 1) in vec4 a_data;
|
||||
|
||||
layout (std140) uniform LineDynamicUBO {
|
||||
highp vec2 u_units_to_pixels;
|
||||
lowp float pad0, pad1;
|
||||
lowp float dynamic_pad1, dynamic_pad2;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineGradientUBO {
|
||||
layout (std140) uniform LineGradientDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
mediump float u_ratio;
|
||||
lowp float pad2, pad3, pad4;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineGradientPropertiesUBO {
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
|
||||
highp float pad5;
|
||||
highp vec2 pad6;
|
||||
lowp float drawable_pad1, drawable_pad2, drawable_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineGradientInterpolationUBO {
|
||||
@@ -51,9 +40,20 @@ layout (std140) uniform LineGradientInterpolationUBO {
|
||||
lowp float u_gapwidth_t;
|
||||
lowp float u_offset_t;
|
||||
lowp float u_width_t;
|
||||
highp float interp_pad1;
|
||||
highp vec2 interp_pad2;
|
||||
};
|
||||
|
||||
highp float pad7;
|
||||
highp vec2 pad8;
|
||||
layout (std140) uniform LineEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
lowp float u_floorwidth;
|
||||
highp float props_pad1;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
out vec2 v_normal;
|
||||
@@ -156,21 +156,10 @@ mediump float width = u_width;
|
||||
v_width2 = vec2(outset, inset);
|
||||
}
|
||||
)";
|
||||
static constexpr const char* fragment = R"(layout (std140) uniform LineGradientUBO {
|
||||
static constexpr const char* fragment = R"(layout (std140) uniform LineGradientDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
mediump float u_ratio;
|
||||
lowp float pad2, pad3, pad4;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineGradientPropertiesUBO {
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
|
||||
highp float pad5;
|
||||
highp vec2 pad6;
|
||||
lowp float drawable_pad1, drawable_pad2, drawable_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineGradientInterpolationUBO {
|
||||
@@ -179,9 +168,20 @@ layout (std140) uniform LineGradientInterpolationUBO {
|
||||
lowp float u_gapwidth_t;
|
||||
lowp float u_offset_t;
|
||||
lowp float u_width_t;
|
||||
highp float interp_pad1;
|
||||
highp vec2 interp_pad2;
|
||||
};
|
||||
|
||||
highp float pad7;
|
||||
highp vec2 pad8;
|
||||
layout (std140) uniform LineEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
lowp float u_floorwidth;
|
||||
highp float props_pad1;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
uniform sampler2D u_image;
|
||||
|
||||
@@ -25,10 +25,10 @@ layout (location = 1) in vec4 a_data;
|
||||
|
||||
layout (std140) uniform LineDynamicUBO {
|
||||
highp vec2 u_units_to_pixels;
|
||||
lowp float pad0, pad1;
|
||||
lowp float dynamic_pad1, dynamic_pad2;
|
||||
};
|
||||
|
||||
layout (std140) uniform LinePatternUBO {
|
||||
layout (std140) uniform LinePatternDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
mediump vec4 u_scale;
|
||||
highp vec2 u_texsize;
|
||||
@@ -36,22 +36,6 @@ layout (std140) uniform LinePatternUBO {
|
||||
highp float u_fade;
|
||||
};
|
||||
|
||||
layout (std140) uniform LinePatternPropertiesUBO {
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
lowp float u_offset;
|
||||
mediump float u_gapwidth;
|
||||
mediump float u_width;
|
||||
|
||||
highp float pad2;
|
||||
highp vec2 pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform LinePatternTilePropertiesUBO {
|
||||
lowp vec4 u_pattern_from;
|
||||
lowp vec4 u_pattern_to;
|
||||
};
|
||||
|
||||
layout (std140) uniform LinePatternInterpolationUBO {
|
||||
lowp float u_blur_t;
|
||||
lowp float u_opacity_t;
|
||||
@@ -60,8 +44,24 @@ layout (std140) uniform LinePatternInterpolationUBO {
|
||||
lowp float u_width_t;
|
||||
lowp float u_pattern_from_t;
|
||||
lowp float u_pattern_to_t;
|
||||
highp float interp_pad1;
|
||||
};
|
||||
|
||||
highp float pad4;
|
||||
layout (std140) uniform LinePatternTilePropertiesUBO {
|
||||
lowp vec4 u_pattern_from;
|
||||
lowp vec4 u_pattern_to;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
lowp float u_floorwidth;
|
||||
highp float props_pad1;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
out vec2 v_normal;
|
||||
@@ -182,7 +182,7 @@ mediump vec4 pattern_to = u_pattern_to;
|
||||
v_width2 = vec2(outset, inset);
|
||||
}
|
||||
)";
|
||||
static constexpr const char* fragment = R"(layout (std140) uniform LinePatternUBO {
|
||||
static constexpr const char* fragment = R"(layout (std140) uniform LinePatternDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
mediump vec4 u_scale;
|
||||
highp vec2 u_texsize;
|
||||
@@ -190,22 +190,6 @@ mediump vec4 pattern_to = u_pattern_to;
|
||||
highp float u_fade;
|
||||
};
|
||||
|
||||
layout (std140) uniform LinePatternPropertiesUBO {
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
lowp float u_offset;
|
||||
mediump float u_gapwidth;
|
||||
mediump float u_width;
|
||||
|
||||
highp float pad2;
|
||||
highp vec2 pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform LinePatternTilePropertiesUBO {
|
||||
lowp vec4 u_pattern_from;
|
||||
lowp vec4 u_pattern_to;
|
||||
};
|
||||
|
||||
layout (std140) uniform LinePatternInterpolationUBO {
|
||||
lowp float u_blur_t;
|
||||
lowp float u_opacity_t;
|
||||
@@ -214,8 +198,24 @@ layout (std140) uniform LinePatternInterpolationUBO {
|
||||
lowp float u_width_t;
|
||||
lowp float u_pattern_from_t;
|
||||
lowp float u_pattern_to_t;
|
||||
highp float interp_pad1;
|
||||
};
|
||||
|
||||
highp float pad4;
|
||||
layout (std140) uniform LinePatternTilePropertiesUBO {
|
||||
lowp vec4 u_pattern_from;
|
||||
lowp vec4 u_pattern_to;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
lowp float u_floorwidth;
|
||||
highp float props_pad1;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
uniform sampler2D u_image;
|
||||
|
||||
@@ -25,10 +25,10 @@ layout (location = 1) in vec4 a_data;
|
||||
|
||||
layout (std140) uniform LineDynamicUBO {
|
||||
highp vec2 u_units_to_pixels;
|
||||
lowp float pad0, pad1;
|
||||
lowp float dynamic_pad1, dynamic_pad2;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineSDFUBO {
|
||||
layout (std140) uniform LineSDFDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec2 u_patternscale_a;
|
||||
highp vec2 u_patternscale_b;
|
||||
@@ -37,19 +37,7 @@ layout (std140) uniform LineSDFUBO {
|
||||
highp float u_tex_y_b;
|
||||
highp float u_sdfgamma;
|
||||
highp float u_mix;
|
||||
lowp float pad2, pad3, pad4;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineSDFPropertiesUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
lowp float u_floorwidth;
|
||||
|
||||
highp vec2 pad5;
|
||||
lowp float drawable_pad1, drawable_pad2, drawable_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineSDFInterpolationUBO {
|
||||
@@ -60,8 +48,19 @@ layout (std140) uniform LineSDFInterpolationUBO {
|
||||
lowp float u_offset_t;
|
||||
lowp float u_width_t;
|
||||
lowp float u_floorwidth_t;
|
||||
highp float interp_pad1;
|
||||
};
|
||||
|
||||
highp float pad6;
|
||||
layout (std140) uniform LineEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
lowp float u_floorwidth;
|
||||
highp float props_pad1;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
out vec2 v_normal;
|
||||
@@ -187,7 +186,7 @@ lowp float floorwidth = u_floorwidth;
|
||||
}
|
||||
)";
|
||||
static constexpr const char* fragment = R"(
|
||||
layout (std140) uniform LineSDFUBO {
|
||||
layout (std140) uniform LineSDFDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec2 u_patternscale_a;
|
||||
highp vec2 u_patternscale_b;
|
||||
@@ -196,20 +195,7 @@ layout (std140) uniform LineSDFUBO {
|
||||
highp float u_tex_y_b;
|
||||
highp float u_sdfgamma;
|
||||
highp float u_mix;
|
||||
|
||||
lowp float pad2, pad3, pad4;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineSDFPropertiesUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
lowp float u_floorwidth;
|
||||
|
||||
highp vec2 pad5;
|
||||
lowp float drawable_pad1, drawable_pad2, drawable_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineSDFInterpolationUBO {
|
||||
@@ -220,8 +206,19 @@ layout (std140) uniform LineSDFInterpolationUBO {
|
||||
lowp float u_offset_t;
|
||||
lowp float u_width_t;
|
||||
lowp float u_floorwidth_t;
|
||||
highp float interp_pad1;
|
||||
};
|
||||
|
||||
highp float pad6;
|
||||
layout (std140) uniform LineEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
lowp float u_floorwidth;
|
||||
highp float props_pad1;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
uniform sampler2D u_image;
|
||||
|
||||
@@ -10,6 +10,8 @@ struct ShaderSource<BuiltIn::RasterShader, gfx::Backend::Type::OpenGL> {
|
||||
static constexpr const char* name = "RasterShader";
|
||||
static constexpr const char* vertex = R"(layout (std140) uniform RasterDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
};
|
||||
layout (std140) uniform RasterEvaluatedPropsUBO {
|
||||
highp vec3 u_spin_weights;
|
||||
highp vec2 u_tl_parent;
|
||||
highp float u_scale_parent;
|
||||
@@ -20,8 +22,8 @@ struct ShaderSource<BuiltIn::RasterShader, gfx::Backend::Type::OpenGL> {
|
||||
highp float u_brightness_high;
|
||||
highp float u_saturation_factor;
|
||||
highp float u_contrast_factor;
|
||||
highp float pad1;
|
||||
highp float pad2;
|
||||
highp float props_pad1;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
layout (location = 0) in vec2 a_pos;
|
||||
@@ -41,8 +43,7 @@ void main() {
|
||||
v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;
|
||||
}
|
||||
)";
|
||||
static constexpr const char* fragment = R"(layout (std140) uniform RasterDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
static constexpr const char* fragment = R"(layout (std140) uniform RasterEvaluatedPropsUBO {
|
||||
highp vec3 u_spin_weights;
|
||||
highp vec2 u_tl_parent;
|
||||
highp float u_scale_parent;
|
||||
@@ -53,8 +54,8 @@ void main() {
|
||||
highp float u_brightness_high;
|
||||
highp float u_saturation_factor;
|
||||
highp float u_contrast_factor;
|
||||
highp float pad1;
|
||||
highp float pad2;
|
||||
highp float props_pad1;
|
||||
highp float props_pad2;
|
||||
};
|
||||
uniform sampler2D u_image0;
|
||||
uniform sampler2D u_image1;
|
||||
|
||||
@@ -14,6 +14,13 @@ layout (location = 2) in vec4 a_pixeloffset;
|
||||
layout (location = 3) in vec3 a_projected_pos;
|
||||
layout (location = 4) in float a_fade_opacity;
|
||||
|
||||
layout (std140) uniform SymbolDynamicUBO {
|
||||
highp float u_fade_change;
|
||||
highp float u_camera_to_center_distance;
|
||||
highp float u_aspect_ratio;
|
||||
highp float dynamic_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp mat4 u_label_plane_matrix;
|
||||
@@ -24,26 +31,10 @@ layout (std140) uniform SymbolDrawableUBO {
|
||||
|
||||
highp float u_gamma_scale;
|
||||
bool u_rotate_symbol;
|
||||
highp vec2 u_pad1;
|
||||
highp vec2 drawable_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDynamicUBO {
|
||||
highp float u_fade_change;
|
||||
highp float u_camera_to_center_distance;
|
||||
highp float u_aspect_ratio;
|
||||
highp float pad0;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawablePaintUBO {
|
||||
highp vec4 u_fill_color;
|
||||
highp vec4 u_halo_color;
|
||||
highp float u_opacity;
|
||||
highp float u_halo_width;
|
||||
highp float u_halo_blur;
|
||||
highp float u_padding;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableTilePropsUBO {
|
||||
layout (std140) uniform SymbolTilePropsUBO {
|
||||
bool u_is_text;
|
||||
bool u_is_halo;
|
||||
bool u_pitch_with_map;
|
||||
@@ -51,16 +42,31 @@ layout (std140) uniform SymbolDrawableTilePropsUBO {
|
||||
bool u_is_size_feature_constant;
|
||||
highp float u_size_t; // used to interpolate between zoom stops when size is a composite function
|
||||
highp float u_size; // used when size is both zoom and feature constant
|
||||
bool u_pad3;
|
||||
bool tileprops_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableInterpolateUBO {
|
||||
layout (std140) uniform SymbolInterpolateUBO {
|
||||
highp float u_fill_color_t;
|
||||
highp float u_halo_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_halo_width_t;
|
||||
highp float u_halo_blur_t;
|
||||
highp float u_pad4,u_pad5,u_pad6;
|
||||
highp float interp_pad1, interp_pad2, interp_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolEvaluatedPropsUBO {
|
||||
highp vec4 u_text_fill_color;
|
||||
highp vec4 u_text_halo_color;
|
||||
highp float u_text_opacity;
|
||||
highp float u_text_halo_width;
|
||||
highp float u_text_halo_blur;
|
||||
highp float props_pad1;
|
||||
highp vec4 u_icon_fill_color;
|
||||
highp vec4 u_icon_halo_color;
|
||||
highp float u_icon_opacity;
|
||||
highp float u_icon_halo_width;
|
||||
highp float u_icon_halo_blur;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
out vec2 v_tex;
|
||||
@@ -72,6 +78,8 @@ out lowp float opacity;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
highp float u_opacity = u_is_text ? u_text_opacity : u_icon_opacity;
|
||||
|
||||
#ifndef HAS_UNIFORM_u_opacity
|
||||
opacity = unpack_mix_vec2(a_opacity, u_opacity_t);
|
||||
#else
|
||||
@@ -140,22 +148,39 @@ lowp float opacity = u_opacity;
|
||||
)";
|
||||
static constexpr const char* fragment = R"(uniform sampler2D u_texture;
|
||||
|
||||
layout (std140) uniform SymbolDrawablePaintUBO {
|
||||
highp vec4 u_fill_color;
|
||||
highp vec4 u_halo_color;
|
||||
highp float u_opacity;
|
||||
highp float u_halo_width;
|
||||
highp float u_halo_blur;
|
||||
highp float u_padding;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableInterpolateUBO {
|
||||
layout (std140) uniform SymbolInterpolateUBO {
|
||||
highp float u_fill_color_t;
|
||||
highp float u_halo_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_halo_width_t;
|
||||
highp float u_halo_blur_t;
|
||||
highp float u_pad4,u_pad5,u_pad6;
|
||||
highp float interp_pad1, interp_pad2,interp_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolTilePropsUBO {
|
||||
bool u_is_text;
|
||||
bool u_is_halo;
|
||||
bool u_pitch_with_map;
|
||||
bool u_is_size_zoom_constant;
|
||||
bool u_is_size_feature_constant;
|
||||
highp float u_size_t; // used to interpolate between zoom stops when size is a composite function
|
||||
highp float u_size; // used when size is both zoom and feature constant
|
||||
bool tileprops_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolEvaluatedPropsUBO {
|
||||
highp vec4 u_text_fill_color;
|
||||
highp vec4 u_text_halo_color;
|
||||
highp float u_text_opacity;
|
||||
highp float u_text_halo_width;
|
||||
highp float u_text_halo_blur;
|
||||
highp float props_pad1;
|
||||
highp vec4 u_icon_fill_color;
|
||||
highp vec4 u_icon_halo_color;
|
||||
highp float u_icon_opacity;
|
||||
highp float u_icon_halo_width;
|
||||
highp float u_icon_halo_blur;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
in vec2 v_tex;
|
||||
@@ -166,6 +191,8 @@ in lowp float opacity;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
highp float u_opacity = u_is_text ? u_text_opacity : u_icon_opacity;
|
||||
|
||||
#ifdef HAS_UNIFORM_u_opacity
|
||||
lowp float opacity = u_opacity;
|
||||
#endif
|
||||
|
||||
@@ -22,6 +22,13 @@ layout (location = 4) in float a_fade_opacity;
|
||||
// [ text-size(lowerZoomStop, feature),
|
||||
// text-size(upperZoomStop, feature) ]
|
||||
|
||||
layout (std140) uniform SymbolDynamicUBO {
|
||||
highp float u_fade_change;
|
||||
highp float u_camera_to_center_distance;
|
||||
highp float u_aspect_ratio;
|
||||
highp float dynamic_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp mat4 u_label_plane_matrix;
|
||||
@@ -32,26 +39,10 @@ layout (std140) uniform SymbolDrawableUBO {
|
||||
|
||||
highp float u_gamma_scale;
|
||||
bool u_rotate_symbol;
|
||||
highp vec2 u_pad1;
|
||||
highp vec2 drawable_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDynamicUBO {
|
||||
highp float u_fade_change;
|
||||
highp float u_camera_to_center_distance;
|
||||
highp float u_aspect_ratio;
|
||||
highp float pad0;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawablePaintUBO {
|
||||
highp vec4 u_fill_color;
|
||||
highp vec4 u_halo_color;
|
||||
highp float u_opacity;
|
||||
highp float u_halo_width;
|
||||
highp float u_halo_blur;
|
||||
highp float u_padding;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableTilePropsUBO {
|
||||
layout (std140) uniform SymbolTilePropsUBO {
|
||||
bool u_is_text;
|
||||
bool u_is_halo;
|
||||
bool u_pitch_with_map;
|
||||
@@ -59,16 +50,31 @@ layout (std140) uniform SymbolDrawableTilePropsUBO {
|
||||
bool u_is_size_feature_constant;
|
||||
highp float u_size_t; // used to interpolate between zoom stops when size is a composite function
|
||||
highp float u_size; // used when size is both zoom and feature constant
|
||||
bool u_pad3;
|
||||
bool tileprops_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableInterpolateUBO {
|
||||
layout (std140) uniform SymbolInterpolateUBO {
|
||||
highp float u_fill_color_t;
|
||||
highp float u_halo_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_halo_width_t;
|
||||
highp float u_halo_blur_t;
|
||||
highp float u_pad4,u_pad5,u_pad6;
|
||||
highp float interp_pad1, interp_pad2, interp_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolEvaluatedPropsUBO {
|
||||
highp vec4 u_text_fill_color;
|
||||
highp vec4 u_text_halo_color;
|
||||
highp float u_text_opacity;
|
||||
highp float u_text_halo_width;
|
||||
highp float u_text_halo_blur;
|
||||
highp float props_pad1;
|
||||
highp vec4 u_icon_fill_color;
|
||||
highp vec4 u_icon_halo_color;
|
||||
highp float u_icon_opacity;
|
||||
highp float u_icon_halo_width;
|
||||
highp float u_icon_halo_blur;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
out vec2 v_data0;
|
||||
@@ -96,6 +102,12 @@ out lowp float halo_blur;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
highp vec4 u_fill_color = u_is_text ? u_text_fill_color : u_icon_fill_color;
|
||||
highp vec4 u_halo_color = u_is_text ? u_text_halo_color : u_icon_halo_color;
|
||||
highp float u_opacity = u_is_text ? u_text_opacity : u_icon_opacity;
|
||||
highp float u_halo_width = u_is_text ? u_text_halo_width : u_icon_halo_width;
|
||||
highp float u_halo_blur = u_is_text ? u_text_halo_blur : u_icon_halo_blur;
|
||||
|
||||
#ifndef HAS_UNIFORM_u_fill_color
|
||||
fill_color = unpack_mix_color(a_fill_color, u_fill_color_t);
|
||||
#else
|
||||
@@ -193,6 +205,13 @@ lowp float halo_blur = u_halo_blur;
|
||||
)";
|
||||
static constexpr const char* fragment = R"(#define SDF_PX 8.0
|
||||
|
||||
layout (std140) uniform SymbolDynamicUBO {
|
||||
highp float u_fade_change;
|
||||
highp float u_camera_to_center_distance;
|
||||
highp float u_aspect_ratio;
|
||||
highp float dynamic_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp mat4 u_label_plane_matrix;
|
||||
@@ -203,26 +222,10 @@ layout (std140) uniform SymbolDrawableUBO {
|
||||
|
||||
highp float u_gamma_scale;
|
||||
bool u_rotate_symbol;
|
||||
highp vec2 u_pad1;
|
||||
highp vec2 drawable_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDynamicUBO {
|
||||
highp float u_fade_change;
|
||||
highp float u_camera_to_center_distance;
|
||||
highp float u_aspect_ratio;
|
||||
highp float pad0;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawablePaintUBO {
|
||||
highp vec4 u_fill_color;
|
||||
highp vec4 u_halo_color;
|
||||
highp float u_opacity;
|
||||
highp float u_halo_width;
|
||||
highp float u_halo_blur;
|
||||
highp float u_padding;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableTilePropsUBO {
|
||||
layout (std140) uniform SymbolTilePropsUBO {
|
||||
bool u_is_text;
|
||||
bool u_is_halo;
|
||||
bool u_pitch_with_map;
|
||||
@@ -230,16 +233,31 @@ layout (std140) uniform SymbolDrawableTilePropsUBO {
|
||||
bool u_is_size_feature_constant;
|
||||
highp float u_size_t; // used to interpolate between zoom stops when size is a composite function
|
||||
highp float u_size; // used when size is both zoom and feature constant
|
||||
bool u_pad3;
|
||||
bool tileprops_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableInterpolateUBO {
|
||||
layout (std140) uniform SymbolInterpolateUBO {
|
||||
highp float u_fill_color_t;
|
||||
highp float u_halo_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_halo_width_t;
|
||||
highp float u_halo_blur_t;
|
||||
highp float u_pad4,u_pad5,u_pad6;
|
||||
highp float interp_pad1, interp_pad2, interp_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolEvaluatedPropsUBO {
|
||||
highp vec4 u_text_fill_color;
|
||||
highp vec4 u_text_halo_color;
|
||||
highp float u_text_opacity;
|
||||
highp float u_text_halo_width;
|
||||
highp float u_text_halo_blur;
|
||||
highp float props_pad1;
|
||||
highp vec4 u_icon_fill_color;
|
||||
highp vec4 u_icon_halo_color;
|
||||
highp float u_icon_opacity;
|
||||
highp float u_icon_halo_width;
|
||||
highp float u_icon_halo_blur;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
@@ -264,6 +282,12 @@ in lowp float halo_blur;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
highp vec4 u_fill_color = u_is_text ? u_text_fill_color : u_icon_fill_color;
|
||||
highp vec4 u_halo_color = u_is_text ? u_text_halo_color : u_icon_halo_color;
|
||||
highp float u_opacity = u_is_text ? u_text_opacity : u_icon_opacity;
|
||||
highp float u_halo_width = u_is_text ? u_text_halo_width : u_icon_halo_width;
|
||||
highp float u_halo_blur = u_is_text ? u_text_halo_blur : u_icon_halo_blur;
|
||||
|
||||
#ifdef HAS_UNIFORM_u_fill_color
|
||||
highp vec4 fill_color = u_fill_color;
|
||||
#endif
|
||||
|
||||
@@ -21,6 +21,13 @@ layout (location = 3) in float a_fade_opacity;
|
||||
// [ text-size(lowerZoomStop, feature),
|
||||
// text-size(upperZoomStop, feature) ]
|
||||
|
||||
layout (std140) uniform SymbolDynamicUBO {
|
||||
highp float u_fade_change;
|
||||
highp float u_camera_to_center_distance;
|
||||
highp float u_aspect_ratio;
|
||||
highp float dynamic_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp mat4 u_label_plane_matrix;
|
||||
@@ -31,26 +38,10 @@ layout (std140) uniform SymbolDrawableUBO {
|
||||
|
||||
highp float u_gamma_scale;
|
||||
bool u_rotate_symbol;
|
||||
highp vec2 u_pad1;
|
||||
highp vec2 drawable_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDynamicUBO {
|
||||
highp float u_fade_change;
|
||||
highp float u_camera_to_center_distance;
|
||||
highp float u_aspect_ratio;
|
||||
highp float pad0;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawablePaintUBO {
|
||||
highp vec4 u_fill_color;
|
||||
highp vec4 u_halo_color;
|
||||
highp float u_opacity;
|
||||
highp float u_halo_width;
|
||||
highp float u_halo_blur;
|
||||
highp float u_padding;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableTilePropsUBO {
|
||||
layout (std140) uniform SymbolTilePropsUBO {
|
||||
bool u_is_text;
|
||||
bool u_is_halo;
|
||||
bool u_pitch_with_map;
|
||||
@@ -58,16 +49,31 @@ layout (std140) uniform SymbolDrawableTilePropsUBO {
|
||||
bool u_is_size_feature_constant;
|
||||
highp float u_size_t; // used to interpolate between zoom stops when size is a composite function
|
||||
highp float u_size; // used when size is both zoom and feature constant
|
||||
bool u_pad3;
|
||||
bool tileprops_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableInterpolateUBO {
|
||||
layout (std140) uniform SymbolInterpolateUBO {
|
||||
highp float u_fill_color_t;
|
||||
highp float u_halo_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_halo_width_t;
|
||||
highp float u_halo_blur_t;
|
||||
highp float u_pad4,u_pad5,u_pad6;
|
||||
highp float interp_pad1, interp_pad2, interp_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolEvaluatedPropsUBO {
|
||||
highp vec4 u_text_fill_color;
|
||||
highp vec4 u_text_halo_color;
|
||||
highp float u_text_opacity;
|
||||
highp float u_text_halo_width;
|
||||
highp float u_text_halo_blur;
|
||||
highp float props_pad1;
|
||||
highp vec4 u_icon_fill_color;
|
||||
highp vec4 u_icon_halo_color;
|
||||
highp float u_icon_opacity;
|
||||
highp float u_icon_halo_width;
|
||||
highp float u_icon_halo_blur;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
out vec4 v_data0;
|
||||
@@ -95,6 +101,12 @@ out lowp float halo_blur;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
highp vec4 u_fill_color = u_is_text ? u_text_fill_color : u_icon_fill_color;
|
||||
highp vec4 u_halo_color = u_is_text ? u_text_halo_color : u_icon_halo_color;
|
||||
highp float u_opacity = u_is_text ? u_text_opacity : u_icon_opacity;
|
||||
highp float u_halo_width = u_is_text ? u_text_halo_width : u_icon_halo_width;
|
||||
highp float u_halo_blur = u_is_text ? u_text_halo_blur : u_icon_halo_blur;
|
||||
|
||||
#ifndef HAS_UNIFORM_u_fill_color
|
||||
fill_color = unpack_mix_color(a_fill_color, u_fill_color_t);
|
||||
#else
|
||||
@@ -196,6 +208,13 @@ lowp float halo_blur = u_halo_blur;
|
||||
#define SDF 1.0
|
||||
#define ICON 0.0
|
||||
|
||||
layout (std140) uniform SymbolDynamicUBO {
|
||||
highp float u_fade_change;
|
||||
highp float u_camera_to_center_distance;
|
||||
highp float u_aspect_ratio;
|
||||
highp float dynamic_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp mat4 u_label_plane_matrix;
|
||||
@@ -206,26 +225,10 @@ layout (std140) uniform SymbolDrawableUBO {
|
||||
|
||||
highp float u_gamma_scale;
|
||||
bool u_rotate_symbol;
|
||||
highp vec2 u_pad1;
|
||||
highp vec2 drawable_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDynamicUBO {
|
||||
highp float u_fade_change;
|
||||
highp float u_camera_to_center_distance;
|
||||
highp float u_aspect_ratio;
|
||||
highp float pad0;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawablePaintUBO {
|
||||
highp vec4 u_fill_color;
|
||||
highp vec4 u_halo_color;
|
||||
highp float u_opacity;
|
||||
highp float u_halo_width;
|
||||
highp float u_halo_blur;
|
||||
highp float u_padding;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableTilePropsUBO {
|
||||
layout (std140) uniform SymbolTilePropsUBO {
|
||||
bool u_is_text;
|
||||
bool u_is_halo;
|
||||
bool u_pitch_with_map;
|
||||
@@ -233,16 +236,31 @@ layout (std140) uniform SymbolDrawableTilePropsUBO {
|
||||
bool u_is_size_feature_constant;
|
||||
highp float u_size_t; // used to interpolate between zoom stops when size is a composite function
|
||||
highp float u_size; // used when size is both zoom and feature constant
|
||||
bool u_pad3;
|
||||
bool tileprops_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableInterpolateUBO {
|
||||
layout (std140) uniform SymbolInterpolateUBO {
|
||||
highp float u_fill_color_t;
|
||||
highp float u_halo_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_halo_width_t;
|
||||
highp float u_halo_blur_t;
|
||||
highp float u_pad4,u_pad5,u_pad6;
|
||||
highp float interp_pad1, interp_pad2,interp_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolEvaluatedPropsUBO {
|
||||
highp vec4 u_text_fill_color;
|
||||
highp vec4 u_text_halo_color;
|
||||
highp float u_text_opacity;
|
||||
highp float u_text_halo_width;
|
||||
highp float u_text_halo_blur;
|
||||
highp float props_pad1;
|
||||
highp vec4 u_icon_fill_color;
|
||||
highp vec4 u_icon_halo_color;
|
||||
highp float u_icon_opacity;
|
||||
highp float u_icon_halo_width;
|
||||
highp float u_icon_halo_blur;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
@@ -268,6 +286,12 @@ in lowp float halo_blur;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
highp vec4 u_fill_color = u_is_text ? u_text_fill_color : u_icon_fill_color;
|
||||
highp vec4 u_halo_color = u_is_text ? u_text_halo_color : u_icon_halo_color;
|
||||
highp float u_opacity = u_is_text ? u_text_opacity : u_icon_opacity;
|
||||
highp float u_halo_width = u_is_text ? u_text_halo_width : u_icon_halo_width;
|
||||
highp float u_halo_blur = u_is_text ? u_text_halo_blur : u_icon_halo_blur;
|
||||
|
||||
#ifdef HAS_UNIFORM_u_fill_color
|
||||
highp vec4 fill_color = u_fill_color;
|
||||
#endif
|
||||
|
||||
@@ -8,12 +8,6 @@
|
||||
namespace mbgl {
|
||||
namespace shaders {
|
||||
|
||||
struct AttributeInfo {
|
||||
AttributeInfo(std::string_view name, std::size_t id);
|
||||
std::string_view name;
|
||||
std::size_t id;
|
||||
};
|
||||
|
||||
struct UniformBlockInfo {
|
||||
UniformBlockInfo(std::string_view name, std::size_t id);
|
||||
std::string_view name;
|
||||
@@ -21,6 +15,12 @@ struct UniformBlockInfo {
|
||||
std::size_t binding;
|
||||
};
|
||||
|
||||
struct AttributeInfo {
|
||||
AttributeInfo(std::string_view name, std::size_t id);
|
||||
std::string_view name;
|
||||
std::size_t id;
|
||||
};
|
||||
|
||||
struct TextureInfo {
|
||||
TextureInfo(std::string_view name, std::size_t id);
|
||||
std::string_view name;
|
||||
|
||||
@@ -5,16 +5,16 @@
|
||||
namespace mbgl {
|
||||
namespace shaders {
|
||||
|
||||
struct alignas(16) HeatmapTextureDrawableUBO {
|
||||
struct alignas(16) HeatmapTexturePropsUBO {
|
||||
std::array<float, 4 * 4> matrix;
|
||||
std::array<float, 2> world;
|
||||
float opacity;
|
||||
float pad1;
|
||||
};
|
||||
static_assert(sizeof(HeatmapTextureDrawableUBO) % 16 == 0);
|
||||
static_assert(sizeof(HeatmapTexturePropsUBO) % 16 == 0);
|
||||
|
||||
enum {
|
||||
idHeatmapTextureDrawableUBO,
|
||||
idHeatmapTexturePropsUBO,
|
||||
heatmapTextureUBOCount
|
||||
};
|
||||
|
||||
|
||||
@@ -15,23 +15,12 @@ struct alignas(16) LineDynamicUBO {
|
||||
};
|
||||
static_assert(sizeof(LineDynamicUBO) == 16);
|
||||
|
||||
struct alignas(16) LineUBO {
|
||||
struct alignas(16) LineDrawableUBO {
|
||||
std::array<float, 4 * 4> matrix;
|
||||
float ratio;
|
||||
float pad1, pad2, pad3;
|
||||
};
|
||||
static_assert(sizeof(LineUBO) % 16 == 0);
|
||||
|
||||
struct alignas(16) LinePropertiesUBO {
|
||||
Color color;
|
||||
float blur;
|
||||
float opacity;
|
||||
float gapwidth;
|
||||
float offset;
|
||||
float width;
|
||||
float pad1, pad2, pad3;
|
||||
};
|
||||
static_assert(sizeof(LinePropertiesUBO) % 16 == 0);
|
||||
static_assert(sizeof(LineDrawableUBO) % 16 == 0);
|
||||
|
||||
struct alignas(16) LineInterpolationUBO {
|
||||
float color_t;
|
||||
@@ -44,28 +33,10 @@ struct alignas(16) LineInterpolationUBO {
|
||||
};
|
||||
static_assert(sizeof(LineInterpolationUBO) % 16 == 0);
|
||||
|
||||
enum {
|
||||
idLineDynamicUBO,
|
||||
idLineUBO,
|
||||
idLinePropertiesUBO,
|
||||
idLineInterpolationUBO,
|
||||
lineUBOCount
|
||||
};
|
||||
|
||||
//
|
||||
// Line gradient
|
||||
|
||||
using LineGradientUBO = LineUBO;
|
||||
|
||||
struct alignas(16) LineGradientPropertiesUBO {
|
||||
float blur;
|
||||
float opacity;
|
||||
float gapwidth;
|
||||
float offset;
|
||||
float width;
|
||||
float pad1, pad2, pad3;
|
||||
};
|
||||
static_assert(sizeof(LineGradientPropertiesUBO) % 16 == 0);
|
||||
using LineGradientDrawableUBO = LineDrawableUBO;
|
||||
|
||||
struct alignas(16) LineGradientInterpolationUBO {
|
||||
float blur_t;
|
||||
@@ -77,35 +48,17 @@ struct alignas(16) LineGradientInterpolationUBO {
|
||||
};
|
||||
static_assert(sizeof(LineGradientInterpolationUBO) % 16 == 0);
|
||||
|
||||
enum {
|
||||
idLineGradientDynamicUBO,
|
||||
idLineGradientUBO,
|
||||
idLineGradientPropertiesUBO,
|
||||
idLineGradientInterpolationUBO,
|
||||
lineGradientUBOCount
|
||||
};
|
||||
|
||||
//
|
||||
// Line pattern
|
||||
|
||||
struct alignas(16) LinePatternUBO {
|
||||
struct alignas(16) LinePatternDrawableUBO {
|
||||
std::array<float, 4 * 4> matrix;
|
||||
std::array<float, 4> scale;
|
||||
std::array<float, 2> texsize;
|
||||
float ratio;
|
||||
float fade;
|
||||
};
|
||||
static_assert(sizeof(LinePatternUBO) % 16 == 0);
|
||||
|
||||
struct alignas(16) LinePatternPropertiesUBO {
|
||||
float blur;
|
||||
float opacity;
|
||||
float offset;
|
||||
float gapwidth;
|
||||
float width;
|
||||
float pad1, pad2, pad3;
|
||||
};
|
||||
static_assert(sizeof(LinePatternPropertiesUBO) % 16 == 0);
|
||||
static_assert(sizeof(LinePatternDrawableUBO) % 16 == 0);
|
||||
|
||||
struct alignas(16) LinePatternInterpolationUBO {
|
||||
float blur_t;
|
||||
@@ -125,19 +78,10 @@ struct alignas(16) LinePatternTilePropertiesUBO {
|
||||
};
|
||||
static_assert(sizeof(LinePatternTilePropertiesUBO) % 16 == 0);
|
||||
|
||||
enum {
|
||||
idLinePatternDynamicUBO,
|
||||
idLinePatternUBO,
|
||||
idLinePatternPropertiesUBO,
|
||||
idLinePatternInterpolationUBO,
|
||||
idLinePatternTilePropertiesUBO,
|
||||
linePatternUBOCount
|
||||
};
|
||||
|
||||
//
|
||||
// Line SDF
|
||||
|
||||
struct alignas(16) LineSDFUBO {
|
||||
struct alignas(16) LineSDFDrawableUBO {
|
||||
std::array<float, 4 * 4> matrix;
|
||||
std::array<float, 2> patternscale_a;
|
||||
std::array<float, 2> patternscale_b;
|
||||
@@ -148,19 +92,7 @@ struct alignas(16) LineSDFUBO {
|
||||
float mix;
|
||||
float pad1, pad2, pad3;
|
||||
};
|
||||
static_assert(sizeof(LineSDFUBO) % 16 == 0);
|
||||
|
||||
struct alignas(16) LineSDFPropertiesUBO {
|
||||
Color color;
|
||||
float blur;
|
||||
float opacity;
|
||||
float gapwidth;
|
||||
float offset;
|
||||
float width;
|
||||
float floorwidth;
|
||||
float pad1, pad2;
|
||||
};
|
||||
static_assert(sizeof(LineSDFPropertiesUBO) % 16 == 0);
|
||||
static_assert(sizeof(LineSDFDrawableUBO) % 16 == 0);
|
||||
|
||||
struct alignas(16) LineSDFInterpolationUBO {
|
||||
float color_t;
|
||||
@@ -174,12 +106,28 @@ struct alignas(16) LineSDFInterpolationUBO {
|
||||
};
|
||||
static_assert(sizeof(LineSDFInterpolationUBO) % 16 == 0);
|
||||
|
||||
//
|
||||
// Line evaluated properties
|
||||
|
||||
struct alignas(16) LineEvaluatedPropsUBO {
|
||||
Color color;
|
||||
float blur;
|
||||
float opacity;
|
||||
float gapwidth;
|
||||
float offset;
|
||||
float width;
|
||||
float floorwidth;
|
||||
float pad1, pad2;
|
||||
};
|
||||
static_assert(sizeof(LineEvaluatedPropsUBO) % 16 == 0);
|
||||
|
||||
enum {
|
||||
idLineSDFDynamicUBO,
|
||||
idLineSDFUBO,
|
||||
idLineSDFPropertiesUBO,
|
||||
idLineSDFInterpolationUBO,
|
||||
lineSDFUBOCount
|
||||
idLineDynamicUBO,
|
||||
idLineDrawableUBO,
|
||||
idLineInterpolationUBO,
|
||||
idLineTilePropertiesUBO,
|
||||
idLineEvaluatedPropsUBO,
|
||||
lineUBOCount
|
||||
};
|
||||
|
||||
} // namespace shaders
|
||||
|
||||
@@ -14,9 +14,9 @@ struct ShaderSource<BuiltIn::BackgroundShader, gfx::Backend::Type::Metal> {
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 2> uniforms;
|
||||
static const std::array<AttributeInfo, 1> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 2> uniforms;
|
||||
static const std::array<TextureInfo, 0> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
@@ -24,7 +24,7 @@ struct ShaderSource<BuiltIn::BackgroundShader, gfx::Backend::Type::Metal> {
|
||||
using namespace metal;
|
||||
|
||||
struct VertexStage {
|
||||
short2 position [[attribute(0)]];
|
||||
short2 position [[attribute(2)]];
|
||||
};
|
||||
|
||||
struct FragmentStage {
|
||||
@@ -37,20 +37,18 @@ struct alignas(16) BackgroundDrawableUBO {
|
||||
struct alignas(16) BackgroundLayerUBO {
|
||||
float4 color;
|
||||
float opacity;
|
||||
bool overdrawInspector;
|
||||
uint8_t pad1, pad2, pad3;
|
||||
float pad4, pad5;
|
||||
float pad1, pad2, pad3;
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(VertexStage in [[stage_in]],
|
||||
device const BackgroundDrawableUBO& drawableUBO [[buffer(1)]]) {
|
||||
device const BackgroundDrawableUBO& drawableUBO [[buffer(0)]]) {
|
||||
return {
|
||||
.position = drawableUBO.matrix * float4(float2(in.position.xy), 0, 1)
|
||||
};
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const BackgroundLayerUBO& layerUBO [[buffer(2)]]) {
|
||||
device const BackgroundLayerUBO& layerUBO [[buffer(1)]]) {
|
||||
#if defined(OVERDRAW_INSPECTOR)
|
||||
return half4(1.0);
|
||||
#endif
|
||||
|
||||
@@ -11,9 +11,9 @@ struct ShaderSource<BuiltIn::BackgroundPatternShader, gfx::Backend::Type::Metal>
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 2> uniforms;
|
||||
static const std::array<AttributeInfo, 1> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 2> uniforms;
|
||||
static const std::array<TextureInfo, 1> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
@@ -21,7 +21,7 @@ struct ShaderSource<BuiltIn::BackgroundPatternShader, gfx::Backend::Type::Metal>
|
||||
using namespace metal;
|
||||
|
||||
struct VertexStage {
|
||||
short2 position [[attribute(0)]];
|
||||
short2 position [[attribute(2)]];
|
||||
};
|
||||
|
||||
struct FragmentStage {
|
||||
@@ -30,10 +30,14 @@ struct FragmentStage {
|
||||
float2 pos_b;
|
||||
};
|
||||
|
||||
struct alignas(16) BackgroundDrawableUBO {
|
||||
struct alignas(16) BackgroundPatternDrawableUBO {
|
||||
float4x4 matrix;
|
||||
float2 pixel_coord_upper;
|
||||
float2 pixel_coord_lower;
|
||||
float tile_units_to_pixels;
|
||||
float pad1, pad2, pad3;
|
||||
};
|
||||
struct alignas(16) BackgroundLayerUBO {
|
||||
struct alignas(16) BackgroundPatternLayerUBO {
|
||||
float2 pattern_tl_a;
|
||||
float2 pattern_br_a;
|
||||
float2 pattern_tl_b;
|
||||
@@ -41,30 +45,26 @@ struct alignas(16) BackgroundLayerUBO {
|
||||
float2 texsize;
|
||||
float2 pattern_size_a;
|
||||
float2 pattern_size_b;
|
||||
float2 pixel_coord_upper;
|
||||
float2 pixel_coord_lower;
|
||||
float tile_units_to_pixels;
|
||||
float scale_a;
|
||||
float scale_b;
|
||||
float mix;
|
||||
float opacity;
|
||||
bool overdrawInspector;
|
||||
uint8_t pad1, pad2, pad3;
|
||||
float pad1, pad2;
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(VertexStage in [[stage_in]],
|
||||
device const BackgroundDrawableUBO& drawableUBO [[buffer(1)]],
|
||||
device const BackgroundLayerUBO& layerUBO [[buffer(2)]]) {
|
||||
device const BackgroundPatternDrawableUBO& drawableUBO [[buffer(0)]],
|
||||
device const BackgroundPatternLayerUBO& layerUBO [[buffer(1)]]) {
|
||||
const float2 pos = float2(in.position);
|
||||
const float2 pos_a = get_pattern_pos(layerUBO.pixel_coord_upper,
|
||||
layerUBO.pixel_coord_lower,
|
||||
const float2 pos_a = get_pattern_pos(drawableUBO.pixel_coord_upper,
|
||||
drawableUBO.pixel_coord_lower,
|
||||
layerUBO.scale_a * layerUBO.pattern_size_a,
|
||||
layerUBO.tile_units_to_pixels,
|
||||
drawableUBO.tile_units_to_pixels,
|
||||
pos);
|
||||
const float2 pos_b = get_pattern_pos(layerUBO.pixel_coord_upper,
|
||||
layerUBO.pixel_coord_lower,
|
||||
const float2 pos_b = get_pattern_pos(drawableUBO.pixel_coord_upper,
|
||||
drawableUBO.pixel_coord_lower,
|
||||
layerUBO.scale_b * layerUBO.pattern_size_b,
|
||||
layerUBO.tile_units_to_pixels,
|
||||
drawableUBO.tile_units_to_pixels,
|
||||
pos);
|
||||
return {
|
||||
.position = drawableUBO.matrix * float4(float2(in.position.xy), 0, 1),
|
||||
@@ -74,7 +74,7 @@ FragmentStage vertex vertexMain(VertexStage in [[stage_in]],
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const BackgroundLayerUBO& layerUBO [[buffer(2)]],
|
||||
device const BackgroundPatternLayerUBO& layerUBO [[buffer(1)]],
|
||||
texture2d<float, access::sample> image [[texture(0)]],
|
||||
sampler image_sampler [[sampler(0)]]) {
|
||||
#if defined(OVERDRAW_INSPECTOR)
|
||||
|
||||
@@ -14,35 +14,35 @@ struct ShaderSource<BuiltIn::CircleShader, gfx::Backend::Type::Metal> {
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 4> uniforms;
|
||||
static const std::array<AttributeInfo, 8> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 4> uniforms;
|
||||
static const std::array<TextureInfo, 0> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
struct VertexStage {
|
||||
short2 position [[attribute(0)]];
|
||||
short2 position [[attribute(4)]];
|
||||
|
||||
#if !defined(HAS_UNIFORM_u_color)
|
||||
float4 color [[attribute(1)]];
|
||||
float4 color [[attribute(5)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_radius)
|
||||
float2 radius [[attribute(2)]];
|
||||
float2 radius [[attribute(6)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_blur)
|
||||
float2 blur [[attribute(3)]];
|
||||
float2 blur [[attribute(7)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_opacity)
|
||||
float2 opacity [[attribute(4)]];
|
||||
float2 opacity [[attribute(8)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_stroke_color)
|
||||
float4 stroke_color [[attribute(5)]];
|
||||
float4 stroke_color [[attribute(9)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_stroke_width)
|
||||
float2 stroke_width [[attribute(6)]];
|
||||
float2 stroke_width [[attribute(10)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_stroke_opacity)
|
||||
float2 stroke_opacity [[attribute(7)]];
|
||||
float2 stroke_opacity [[attribute(11)]];
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -108,10 +108,10 @@ struct alignas(16) CircleInterpolateUBO {
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const CircleDrawableUBO& drawable [[buffer(8)]],
|
||||
device const CirclePaintParamsUBO& params [[buffer(9)]],
|
||||
device const CircleEvaluatedPropsUBO& props [[buffer(10)]],
|
||||
device const CircleInterpolateUBO& interp [[buffer(11)]]) {
|
||||
device const CircleDrawableUBO& drawable [[buffer(0)]],
|
||||
device const CirclePaintParamsUBO& params [[buffer(1)]],
|
||||
device const CircleEvaluatedPropsUBO& props [[buffer(2)]],
|
||||
device const CircleInterpolateUBO& interp [[buffer(3)]]) {
|
||||
|
||||
#if defined(HAS_UNIFORM_u_radius)
|
||||
const auto radius = props.radius;
|
||||
@@ -189,8 +189,8 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const CirclePaintParamsUBO& params [[buffer(9)]],
|
||||
device const CircleEvaluatedPropsUBO& props [[buffer(10)]]) {
|
||||
device const CirclePaintParamsUBO& params [[buffer(1)]],
|
||||
device const CircleEvaluatedPropsUBO& props [[buffer(2)]]) {
|
||||
#if defined(OVERDRAW_INSPECTOR)
|
||||
return half4(1.0);
|
||||
#endif
|
||||
|
||||
@@ -20,9 +20,9 @@ struct ShaderSource<BuiltIn::ClippingMaskProgram, gfx::Backend::Type::Metal> {
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 1> uniforms;
|
||||
static const std::array<AttributeInfo, 1> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 1> uniforms;
|
||||
static const std::array<TextureInfo, 0> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
@@ -38,7 +38,7 @@ struct alignas(16) ClipUBO {
|
||||
static_assert(sizeof(ClipUBO) == 5 * 16, "unexpected padding");
|
||||
|
||||
struct VertexStage {
|
||||
short2 position [[attribute(0)]];
|
||||
short2 position [[attribute(1)]];
|
||||
};
|
||||
|
||||
struct FragmentStage {
|
||||
@@ -51,7 +51,7 @@ struct FragmentResult {
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(VertexStage in [[stage_in]],
|
||||
device const ClipUBO& clipUBO [[buffer(1)]]) {
|
||||
device const ClipUBO& clipUBO [[buffer(0)]]) {
|
||||
return { clipUBO.matrix * float4(float2(in.position.xy), 0, 1) };
|
||||
}
|
||||
|
||||
|
||||
@@ -14,19 +14,19 @@ struct ShaderSource<BuiltIn::CollisionBoxShader, gfx::Backend::Type::Metal> {
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 1> uniforms;
|
||||
static const std::array<AttributeInfo, 5> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 1> uniforms;
|
||||
static const std::array<TextureInfo, 0> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
|
||||
struct VertexStage {
|
||||
short2 pos [[attribute(0)]];
|
||||
short2 anchor_pos [[attribute(1)]];
|
||||
short2 extrude [[attribute(2)]];
|
||||
ushort2 placed [[attribute(3)]];
|
||||
float2 shift [[attribute(4)]];
|
||||
short2 pos [[attribute(1)]];
|
||||
short2 anchor_pos [[attribute(2)]];
|
||||
short2 extrude [[attribute(3)]];
|
||||
ushort2 placed [[attribute(4)]];
|
||||
float2 shift [[attribute(5)]];
|
||||
};
|
||||
|
||||
struct FragmentStage {
|
||||
@@ -43,7 +43,7 @@ struct alignas(16) CollisionBoxUBO {
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const CollisionBoxUBO& drawable [[buffer(5)]]) {
|
||||
device const CollisionBoxUBO& drawable [[buffer(0)]]) {
|
||||
|
||||
float4 projectedPoint = drawable.matrix * float4(float2(vertx.anchor_pos), 0, 1);
|
||||
float camera_to_anchor_distance = projectedPoint.w;
|
||||
@@ -66,7 +66,7 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const CollisionBoxUBO& drawable [[buffer(5)]]) {
|
||||
device const CollisionBoxUBO& drawable [[buffer(0)]]) {
|
||||
|
||||
float alpha = 0.5;
|
||||
|
||||
|
||||
@@ -14,18 +14,18 @@ struct ShaderSource<BuiltIn::CollisionCircleShader, gfx::Backend::Type::Metal> {
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 1> uniforms;
|
||||
static const std::array<AttributeInfo, 4> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 1> uniforms;
|
||||
static const std::array<TextureInfo, 0> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
|
||||
struct VertexStage {
|
||||
short2 pos [[attribute(0)]];
|
||||
short2 anchor_pos [[attribute(1)]];
|
||||
short2 extrude [[attribute(2)]];
|
||||
ushort2 placed [[attribute(3)]];
|
||||
short2 pos [[attribute(1)]];
|
||||
short2 anchor_pos [[attribute(2)]];
|
||||
short2 extrude [[attribute(3)]];
|
||||
ushort2 placed [[attribute(4)]];
|
||||
};
|
||||
|
||||
struct FragmentStage {
|
||||
@@ -45,7 +45,7 @@ struct alignas(16) CollisionCircleUBO {
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const CollisionCircleUBO& drawable [[buffer(4)]]) {
|
||||
device const CollisionCircleUBO& drawable [[buffer(0)]]) {
|
||||
|
||||
float4 projectedPoint = drawable.matrix * float4(float2(vertx.anchor_pos), 0, 1);
|
||||
float camera_to_anchor_distance = projectedPoint.w;
|
||||
@@ -77,7 +77,7 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const CollisionCircleUBO& drawable [[buffer(4)]]) {
|
||||
device const CollisionCircleUBO& drawable [[buffer(0)]]) {
|
||||
|
||||
float alpha = 0.5;
|
||||
|
||||
|
||||
@@ -54,82 +54,82 @@ float4 unpack_mix_color(const float4 packedColors, const float t) {
|
||||
decode_color(float2(packedColors[2], packedColors[3])), t);
|
||||
}
|
||||
|
||||
struct alignas(16) FillEvaluatedPropsUBO {
|
||||
float4 color;
|
||||
float4 outline_color;
|
||||
float opacity;
|
||||
float fade;
|
||||
float width;
|
||||
float pad1;
|
||||
};
|
||||
|
||||
struct alignas(16) FillExtrusionDrawableUBO {
|
||||
/* 0 */ float4x4 matrix;
|
||||
/* 64 */ float4 scale;
|
||||
/* 80 */ float2 texsize;
|
||||
/* 88 */ float2 pixel_coord_upper;
|
||||
/* 96 */ float2 pixel_coord_lower;
|
||||
/* 104 */ float height_factor;
|
||||
/* 108 */ float pad;
|
||||
/* 112 */
|
||||
};
|
||||
static_assert(sizeof(FillExtrusionDrawableUBO) == 7 * 16, "unexpected padding");
|
||||
|
||||
struct alignas(16) FillExtrusionPropsUBO {
|
||||
/* 0 */ float4 color;
|
||||
/* 16 */ float4 light_color_pad;
|
||||
/* 32 */ float4 light_position_base;
|
||||
/* 48 */ float height;
|
||||
/* 52 */ float light_intensity;
|
||||
/* 56 */ float vertical_gradient;
|
||||
/* 60 */ float opacity;
|
||||
/* 64 */ float fade;
|
||||
/* 68 */ float pad2, pad3, pad4;
|
||||
/* 80 */
|
||||
};
|
||||
static_assert(sizeof(FillExtrusionPropsUBO) == 5 * 16, "unexpected padding");
|
||||
|
||||
struct alignas(16) FillExtrusionTilePropsUBO {
|
||||
/* 0 */ float4 pattern_from;
|
||||
/* 16 */ float4 pattern_to;
|
||||
/* 32 */
|
||||
};
|
||||
static_assert(sizeof(FillExtrusionTilePropsUBO) == 2 * 16, "unexpected padding");
|
||||
|
||||
struct alignas(16) FillExtrusionInterpolateUBO {
|
||||
/* 0 */ float base_t;
|
||||
/* 4 */ float height_t;
|
||||
/* 8 */ float color_t;
|
||||
/* 12 */ float pattern_from_t;
|
||||
/* 16 */ float pattern_to_t;
|
||||
/* 20 */ float pad1, pad2, pad3;
|
||||
/* 32 */
|
||||
};
|
||||
static_assert(sizeof(FillExtrusionInterpolateUBO) == 2 * 16, "unexpected padding");
|
||||
|
||||
struct alignas(16) LineDynamicUBO {
|
||||
float2 units_to_pixels;
|
||||
float pad1, pad2;
|
||||
};
|
||||
|
||||
struct alignas(16) LineUBO {
|
||||
float4x4 matrix;
|
||||
float ratio;
|
||||
float pad1, pad2, pad3;
|
||||
};
|
||||
|
||||
struct alignas(16) LineGradientUBO {
|
||||
float4x4 matrix;
|
||||
float ratio;
|
||||
float pad1, pad2, pad3;
|
||||
};
|
||||
|
||||
struct alignas(16) LinePropertiesUBO {
|
||||
struct alignas(16) LineEvaluatedPropsUBO {
|
||||
float4 color;
|
||||
float blur;
|
||||
float opacity;
|
||||
float gapwidth;
|
||||
float offset;
|
||||
float width;
|
||||
float pad1, pad2, pad3;
|
||||
};
|
||||
|
||||
struct alignas(16) LineGradientPropertiesUBO {
|
||||
float blur;
|
||||
float opacity;
|
||||
float gapwidth;
|
||||
float offset;
|
||||
float width;
|
||||
float pad1, pad2, pad3;
|
||||
};
|
||||
|
||||
struct alignas(16) LineInterpolationUBO {
|
||||
float color_t;
|
||||
float blur_t;
|
||||
float opacity_t;
|
||||
float gapwidth_t;
|
||||
float offset_t;
|
||||
float width_t;
|
||||
float floorwidth;
|
||||
float pad1, pad2;
|
||||
};
|
||||
|
||||
struct alignas(16) LineGradientInterpolationUBO {
|
||||
float blur_t;
|
||||
float opacity_t;
|
||||
float gapwidth_t;
|
||||
float offset_t;
|
||||
float width_t;
|
||||
float pad1, pad2, pad3;
|
||||
struct alignas(16) SymbolDynamicUBO {
|
||||
float fade_change;
|
||||
float camera_to_center_distance;
|
||||
float aspect_ratio;
|
||||
float pad;
|
||||
};
|
||||
|
||||
struct alignas(16) SymbolDrawableTilePropsUBO {
|
||||
/*bool*/ int is_text;
|
||||
/*bool*/ int is_halo;
|
||||
/*bool*/ int pitch_with_map;
|
||||
/*bool*/ int is_size_zoom_constant;
|
||||
/*bool*/ int is_size_feature_constant;
|
||||
float size_t;
|
||||
float size;
|
||||
float padding;
|
||||
};
|
||||
static_assert(sizeof(SymbolDrawableTilePropsUBO) == 2 * 16, "unexpected padding");
|
||||
|
||||
struct alignas(16) SymbolDrawableInterpolateUBO {
|
||||
float fill_color_t;
|
||||
float halo_color_t;
|
||||
float opacity_t;
|
||||
float halo_width_t;
|
||||
float halo_blur_t;
|
||||
float pad1, pad2, pad3;
|
||||
};
|
||||
static_assert(sizeof(SymbolDrawableInterpolateUBO) == 32, "unexpected padding");
|
||||
static_assert(sizeof(SymbolDynamicUBO) == 16, "unexpected padding");
|
||||
|
||||
struct alignas(16) SymbolDrawableUBO {
|
||||
float4x4 matrix;
|
||||
@@ -145,23 +145,43 @@ struct alignas(16) SymbolDrawableUBO {
|
||||
};
|
||||
static_assert(sizeof(SymbolDrawableUBO) == 14 * 16, "unexpected padding");
|
||||
|
||||
struct alignas(16) SymbolDynamicUBO {
|
||||
float fade_change;
|
||||
float camera_to_center_distance;
|
||||
float aspect_ratio;
|
||||
float pad;
|
||||
};
|
||||
static_assert(sizeof(SymbolDynamicUBO) == 16, "unexpected padding");
|
||||
|
||||
struct alignas(16) SymbolDrawablePaintUBO {
|
||||
float4 fill_color;
|
||||
float4 halo_color;
|
||||
float opacity;
|
||||
float halo_width;
|
||||
float halo_blur;
|
||||
struct alignas(16) SymbolTilePropsUBO {
|
||||
/*bool*/ int is_text;
|
||||
/*bool*/ int is_halo;
|
||||
/*bool*/ int pitch_with_map;
|
||||
/*bool*/ int is_size_zoom_constant;
|
||||
/*bool*/ int is_size_feature_constant;
|
||||
float size_t;
|
||||
float size;
|
||||
float padding;
|
||||
};
|
||||
static_assert(sizeof(SymbolDrawablePaintUBO) == 3 * 16, "unexpected padding");
|
||||
static_assert(sizeof(SymbolTilePropsUBO) == 2 * 16, "unexpected padding");
|
||||
|
||||
struct alignas(16) SymbolInterpolateUBO {
|
||||
float fill_color_t;
|
||||
float halo_color_t;
|
||||
float opacity_t;
|
||||
float halo_width_t;
|
||||
float halo_blur_t;
|
||||
float pad1, pad2, pad3;
|
||||
};
|
||||
static_assert(sizeof(SymbolInterpolateUBO) == 32, "unexpected padding");
|
||||
|
||||
struct alignas(16) SymbolEvaluatedPropsUBO {
|
||||
float4 text_fill_color;
|
||||
float4 text_halo_color;
|
||||
float text_opacity;
|
||||
float text_halo_width;
|
||||
float text_halo_blur;
|
||||
float pad1;
|
||||
float4 icon_fill_color;
|
||||
float4 icon_halo_color;
|
||||
float icon_opacity;
|
||||
float icon_halo_width;
|
||||
float icon_halo_blur;
|
||||
float pad2;
|
||||
};
|
||||
static_assert(sizeof(SymbolEvaluatedPropsUBO) == 6 * 16, "unexpected padding");
|
||||
|
||||
// unpack pattern position
|
||||
inline float2 get_pattern_pos(const float2 pixel_coord_upper, const float2 pixel_coord_lower,
|
||||
|
||||
@@ -14,9 +14,9 @@ struct ShaderSource<BuiltIn::CustomSymbolIconShader, gfx::Backend::Type::Metal>
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 2> uniforms;
|
||||
static const std::array<AttributeInfo, 2> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 2> uniforms;
|
||||
static const std::array<TextureInfo, 1> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
@@ -36,8 +36,8 @@ struct alignas(16) CustomSymbolIconParametersUBO {
|
||||
};
|
||||
|
||||
struct VertexStage {
|
||||
float2 a_pos [[attribute(0)]];
|
||||
float2 a_tex [[attribute(1)]];
|
||||
float2 a_pos [[attribute(2)]];
|
||||
float2 a_tex [[attribute(3)]];
|
||||
};
|
||||
|
||||
struct FragmentStage {
|
||||
@@ -59,8 +59,8 @@ float2 ellipseRotateVec2(float2 v, float angle, float radiusRatio /* A/B */) {
|
||||
}
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const CustomSymbolIconDrawableUBO& drawable [[buffer(2)]],
|
||||
device const CustomSymbolIconParametersUBO& parameters [[buffer(3)]]) {
|
||||
device const CustomSymbolIconDrawableUBO& drawable [[buffer(0)]],
|
||||
device const CustomSymbolIconParametersUBO& parameters [[buffer(1)]]) {
|
||||
|
||||
const float2 extrude = glMod(float2(vertx.a_pos), 2.0) * 2.0 - 1.0;
|
||||
const float2 anchor = (parameters.anchor - float2(0.5, 0.5)) * 2.0;
|
||||
|
||||
@@ -14,15 +14,15 @@ struct ShaderSource<BuiltIn::DebugShader, gfx::Backend::Type::Metal> {
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 1> uniforms;
|
||||
static const std::array<AttributeInfo, 1> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 1> uniforms;
|
||||
static const std::array<TextureInfo, 1> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
|
||||
struct VertexStage {
|
||||
short2 pos [[attribute(0)]];
|
||||
short2 pos [[attribute(1)]];
|
||||
};
|
||||
|
||||
struct FragmentStage {
|
||||
@@ -38,7 +38,7 @@ struct alignas(16) DebugUBO {
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const DebugUBO& debugUBO [[buffer(1)]]) {
|
||||
device const DebugUBO& debugUBO [[buffer(0)]]) {
|
||||
|
||||
const float4 position = debugUBO.matrix * float4(float2(vertx.pos) * debugUBO.overlay_scale, 0, 1);
|
||||
|
||||
@@ -53,7 +53,7 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const DebugUBO& debugUBO [[buffer(1)]],
|
||||
device const DebugUBO& debugUBO [[buffer(0)]],
|
||||
texture2d<float, access::sample> overlay [[texture(0)]],
|
||||
sampler overlay_sampler [[sampler(0)]]) {
|
||||
|
||||
|
||||
@@ -14,21 +14,21 @@ struct ShaderSource<BuiltIn::FillShader, gfx::Backend::Type::Metal> {
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 3> uniforms;
|
||||
static const std::array<AttributeInfo, 3> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 3> uniforms;
|
||||
static const std::array<TextureInfo, 0> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
|
||||
struct VertexStage {
|
||||
short2 position [[attribute(0)]];
|
||||
short2 position [[attribute(4)]];
|
||||
|
||||
#if !defined(HAS_UNIFORM_u_color)
|
||||
float4 color [[attribute(1)]];
|
||||
float4 color [[attribute(5)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_opacity)
|
||||
float2 opacity [[attribute(2)]];
|
||||
float2 opacity [[attribute(6)]];
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -47,20 +47,15 @@ struct alignas(16) FillDrawableUBO {
|
||||
float4x4 matrix;
|
||||
};
|
||||
|
||||
struct alignas(16) FillEvaluatedPropsUBO {
|
||||
float4 color;
|
||||
float opacity;
|
||||
};
|
||||
|
||||
struct alignas(16) FillInterpolateUBO {
|
||||
float color_t;
|
||||
float opacity_t;
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const FillDrawableUBO& drawable [[buffer(3)]],
|
||||
device const FillEvaluatedPropsUBO& props [[buffer(4)]],
|
||||
device const FillInterpolateUBO& interp [[buffer(5)]]) {
|
||||
device const FillDrawableUBO& drawable [[buffer(0)]],
|
||||
device const FillInterpolateUBO& interp [[buffer(2)]],
|
||||
device const FillEvaluatedPropsUBO& props [[buffer(3)]]) {
|
||||
return {
|
||||
.position = drawable.matrix * float4(float2(vertx.position), 0.0f, 1.0f),
|
||||
#if !defined(HAS_UNIFORM_u_color)
|
||||
@@ -73,7 +68,7 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const FillEvaluatedPropsUBO& props [[buffer(4)]]) {
|
||||
device const FillEvaluatedPropsUBO& props [[buffer(3)]]) {
|
||||
#if defined(OVERDRAW_INSPECTOR)
|
||||
return half4(1.0);
|
||||
#endif
|
||||
@@ -101,16 +96,16 @@ struct ShaderSource<BuiltIn::FillOutlineShader, gfx::Backend::Type::Metal> {
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 3> uniforms;
|
||||
static const std::array<AttributeInfo, 3> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 3> uniforms;
|
||||
static const std::array<TextureInfo, 0> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
struct VertexStage {
|
||||
short2 position [[attribute(0)]];
|
||||
float4 outline_color [[attribute(1)]];
|
||||
float2 opacity [[attribute(2)]];
|
||||
short2 position [[attribute(4)]];
|
||||
float4 outline_color [[attribute(5)]];
|
||||
float2 opacity [[attribute(6)]];
|
||||
};
|
||||
|
||||
struct FragmentStage {
|
||||
@@ -130,20 +125,15 @@ struct alignas(16) FillOutlineDrawableUBO {
|
||||
float2 pad1;
|
||||
};
|
||||
|
||||
struct alignas(16) FillOutlineEvaluatedPropsUBO {
|
||||
float4 outline_color;
|
||||
float opacity;
|
||||
};
|
||||
|
||||
struct alignas(16) FillOutlineInterpolateUBO {
|
||||
float outline_color_t;
|
||||
float opacity_t;
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const FillOutlineDrawableUBO& drawable [[buffer(3)]],
|
||||
device const FillOutlineEvaluatedPropsUBO& props [[buffer(4)]],
|
||||
device const FillOutlineInterpolateUBO& interp [[buffer(5)]]) {
|
||||
device const FillOutlineDrawableUBO& drawable [[buffer(0)]],
|
||||
device const FillOutlineInterpolateUBO& interp [[buffer(2)]],
|
||||
device const FillEvaluatedPropsUBO& props [[buffer(3)]]) {
|
||||
const float4 position = drawable.matrix * float4(float2(vertx.position), 0.0f, 1.0f);
|
||||
return {
|
||||
.position = position,
|
||||
@@ -158,7 +148,7 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const FillOutlineEvaluatedPropsUBO& props [[buffer(4)]]) {
|
||||
device const FillEvaluatedPropsUBO& props [[buffer(3)]]) {
|
||||
#if defined(OVERDRAW_INSPECTOR)
|
||||
return half4(1.0);
|
||||
#endif
|
||||
@@ -192,23 +182,23 @@ struct ShaderSource<BuiltIn::FillPatternShader, gfx::Backend::Type::Metal> {
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 4> uniforms;
|
||||
static const std::array<AttributeInfo, 4> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 4> uniforms;
|
||||
static const std::array<TextureInfo, 1> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
struct VertexStage {
|
||||
short2 position [[attribute(0)]];
|
||||
short2 position [[attribute(4)]];
|
||||
|
||||
#if !defined(HAS_UNIFORM_u_pattern_from)
|
||||
ushort4 pattern_from [[attribute(1)]];
|
||||
ushort4 pattern_from [[attribute(5)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_pattern_to)
|
||||
ushort4 pattern_to [[attribute(2)]];
|
||||
ushort4 pattern_to [[attribute(6)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_opacity)
|
||||
float2 opacity [[attribute(3)]];
|
||||
float2 opacity [[attribute(7)]];
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -236,11 +226,6 @@ struct alignas(16) FillPatternDrawableUBO {
|
||||
float2 texsize;
|
||||
};
|
||||
|
||||
struct alignas(16) FillPatternEvaluatedPropsUBO {
|
||||
float opacity;
|
||||
float fade;
|
||||
};
|
||||
|
||||
struct alignas(16) FillPatternTilePropsUBO {
|
||||
float4 pattern_from;
|
||||
float4 pattern_to;
|
||||
@@ -253,10 +238,10 @@ struct alignas(16) FillPatternInterpolateUBO {
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const FillPatternDrawableUBO& drawable [[buffer(4)]],
|
||||
device const FillPatternTilePropsUBO& tileProps [[buffer(5)]],
|
||||
device const FillPatternEvaluatedPropsUBO& props [[buffer(6)]],
|
||||
device const FillPatternInterpolateUBO& interp [[buffer(7)]]) {
|
||||
device const FillPatternDrawableUBO& drawable [[buffer(0)]],
|
||||
device const FillPatternTilePropsUBO& tileProps [[buffer(1)]],
|
||||
device const FillPatternInterpolateUBO& interp [[buffer(2)]],
|
||||
device const FillEvaluatedPropsUBO& props [[buffer(3)]]) {
|
||||
#if defined(HAS_UNIFORM_u_pattern_from)
|
||||
const auto pattern_from = float4(tileProps.pattern_from);
|
||||
#else
|
||||
@@ -300,9 +285,9 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const FillPatternDrawableUBO& drawable [[buffer(4)]],
|
||||
device const FillPatternTilePropsUBO& tileProps [[buffer(5)]],
|
||||
device const FillPatternEvaluatedPropsUBO& props [[buffer(6)]],
|
||||
device const FillPatternDrawableUBO& drawable [[buffer(0)]],
|
||||
device const FillPatternTilePropsUBO& tileProps [[buffer(1)]],
|
||||
device const FillEvaluatedPropsUBO& props [[buffer(3)]],
|
||||
texture2d<float, access::sample> image0 [[texture(0)]],
|
||||
sampler image0_sampler [[sampler(0)]]) {
|
||||
#if defined(OVERDRAW_INSPECTOR)
|
||||
@@ -351,24 +336,24 @@ struct ShaderSource<BuiltIn::FillOutlinePatternShader, gfx::Backend::Type::Metal
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 4> uniforms;
|
||||
static const std::array<AttributeInfo, 4> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 4> uniforms;
|
||||
static const std::array<TextureInfo, 1> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
|
||||
struct VertexStage {
|
||||
short2 position [[attribute(0)]];
|
||||
short2 position [[attribute(4)]];
|
||||
|
||||
#if !defined(HAS_UNIFORM_u_pattern_from)
|
||||
ushort4 pattern_from [[attribute(1)]];
|
||||
ushort4 pattern_from [[attribute(5)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_pattern_to)
|
||||
ushort4 pattern_to [[attribute(2)]];
|
||||
ushort4 pattern_to [[attribute(6)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_opacity)
|
||||
float2 opacity [[attribute(3)]];
|
||||
float2 opacity [[attribute(7)]];
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -398,11 +383,6 @@ struct alignas(16) FillOutlinePatternDrawableUBO {
|
||||
float2 texsize;
|
||||
};
|
||||
|
||||
struct alignas(16) FillOutlinePatternEvaluatedPropsUBO {
|
||||
float opacity;
|
||||
float fade;
|
||||
};
|
||||
|
||||
struct alignas(16) FillOutlinePatternTilePropsUBO {
|
||||
float4 pattern_from;
|
||||
float4 pattern_to;
|
||||
@@ -415,10 +395,10 @@ struct alignas(16) FillOutlinePatternInterpolateUBO {
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const FillOutlinePatternDrawableUBO& drawable [[buffer(4)]],
|
||||
device const FillOutlinePatternTilePropsUBO& tileProps [[buffer(5)]],
|
||||
device const FillOutlinePatternEvaluatedPropsUBO& props [[buffer(6)]],
|
||||
device const FillOutlinePatternInterpolateUBO& interp [[buffer(7)]]) {
|
||||
device const FillOutlinePatternDrawableUBO& drawable [[buffer(0)]],
|
||||
device const FillOutlinePatternTilePropsUBO& tileProps [[buffer(1)]],
|
||||
device const FillOutlinePatternInterpolateUBO& interp [[buffer(2)]],
|
||||
device const FillEvaluatedPropsUBO& props [[buffer(3)]]) {
|
||||
#if defined(HAS_UNIFORM_u_pattern_from)
|
||||
const auto pattern_from = tileProps.pattern_from;
|
||||
#else
|
||||
@@ -469,9 +449,9 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const FillOutlinePatternDrawableUBO& drawable [[buffer(4)]],
|
||||
device const FillOutlinePatternTilePropsUBO& tileProps [[buffer(5)]],
|
||||
device const FillOutlinePatternEvaluatedPropsUBO& props [[buffer(6)]],
|
||||
device const FillOutlinePatternDrawableUBO& drawable [[buffer(0)]],
|
||||
device const FillOutlinePatternTilePropsUBO& tileProps [[buffer(1)]],
|
||||
device const FillEvaluatedPropsUBO& props [[buffer(3)]],
|
||||
texture2d<float, access::sample> image0 [[texture(0)]],
|
||||
sampler image0_sampler [[sampler(0)]]) {
|
||||
#if defined(OVERDRAW_INSPECTOR)
|
||||
@@ -524,15 +504,15 @@ struct ShaderSource<BuiltIn::FillOutlineTriangulatedShader, gfx::Backend::Type::
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 2> uniforms;
|
||||
static const std::array<AttributeInfo, 2> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 2> uniforms;
|
||||
static const std::array<TextureInfo, 0> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
struct VertexStage {
|
||||
short2 pos_normal [[attribute(0)]];
|
||||
uchar4 data [[attribute(1)]];
|
||||
short2 pos_normal [[attribute(4)]];
|
||||
uchar4 data [[attribute(5)]];
|
||||
};
|
||||
|
||||
struct FragmentStage {
|
||||
@@ -549,16 +529,9 @@ struct alignas(16) FillOutlineTriangulatedDrawableUBO {
|
||||
float pad;
|
||||
};
|
||||
|
||||
struct alignas(16) FillOutlineTriangulatedPropertiesUBO {
|
||||
float4 color;
|
||||
float opacity;
|
||||
float width;
|
||||
float pad1, pad2;
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const FillOutlineTriangulatedDrawableUBO& drawable [[buffer(2)]],
|
||||
device const FillOutlineTriangulatedPropertiesUBO& props [[buffer(3)]]) {
|
||||
device const FillOutlineTriangulatedDrawableUBO& drawable [[buffer(0)]],
|
||||
device const FillEvaluatedPropsUBO& props [[buffer(3)]]) {
|
||||
|
||||
// the distance over which the line edge fades out.
|
||||
// Retina devices need a smaller distance to avoid aliasing.
|
||||
@@ -595,7 +568,7 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const FillOutlineTriangulatedPropertiesUBO& props [[buffer(3)]]) {
|
||||
device const FillEvaluatedPropsUBO& props [[buffer(3)]]) {
|
||||
|
||||
// Calculate the distance of the pixel from the line in pixels.
|
||||
const float dist = length(in.normal) * in.width2;
|
||||
@@ -605,7 +578,7 @@ half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
const float blur2 = (1.0 / DEVICE_PIXEL_RATIO) * in.gamma_scale;
|
||||
const float alpha = clamp(min(dist + blur2, in.width2 - dist) / blur2, 0.0, 1.0);
|
||||
|
||||
return half4(props.color * (alpha * props.opacity));
|
||||
return half4(props.outline_color * (alpha * props.opacity));
|
||||
}
|
||||
)";
|
||||
};
|
||||
|
||||
@@ -14,61 +14,24 @@ struct ShaderSource<BuiltIn::FillExtrusionShader, gfx::Backend::Type::Metal> {
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 3> uniforms;
|
||||
static const std::array<AttributeInfo, 5> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 3> uniforms;
|
||||
static const std::array<TextureInfo, 0> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
struct alignas(16) FillExtrusionInterpolateUBO {
|
||||
/* 0 */ float base_t;
|
||||
/* 4 */ float height_t;
|
||||
/* 8 */ float color_t;
|
||||
/* 12 */ float pattern_from_t;
|
||||
/* 16 */ float pattern_to_t;
|
||||
/* 20 */ float pad1, pad2, pad3;
|
||||
/* 32 */
|
||||
};
|
||||
static_assert(sizeof(FillExtrusionInterpolateUBO) == 2 * 16, "unexpected padding");
|
||||
|
||||
struct alignas(16) FillExtrusionDrawableUBO {
|
||||
/* 0 */ float4x4 matrix;
|
||||
/* 64 */ float4 scale;
|
||||
/* 80 */ float2 texsize;
|
||||
/* 88 */ float2 pixel_coord_upper;
|
||||
/* 96 */ float2 pixel_coord_lower;
|
||||
/* 104 */ float height_factor;
|
||||
/* 108 */ float pad;
|
||||
/* 112 */
|
||||
};
|
||||
static_assert(sizeof(FillExtrusionDrawableUBO) == 7 * 16, "unexpected padding");
|
||||
|
||||
struct alignas(16) FillExtrusionDrawablePropsUBO {
|
||||
/* 0 */ float4 color;
|
||||
/* 16 */ float4 light_color_pad;
|
||||
/* 32 */ float4 light_position_base;
|
||||
/* 48 */ float height;
|
||||
/* 52 */ float light_intensity;
|
||||
/* 56 */ float vertical_gradient;
|
||||
/* 60 */ float opacity;
|
||||
/* 64 */ float fade;
|
||||
/* 68 */ float pad2, pad3, pad4;
|
||||
/* 80 */
|
||||
};
|
||||
static_assert(sizeof(FillExtrusionDrawablePropsUBO) == 5 * 16, "unexpected padding");
|
||||
|
||||
struct VertexStage {
|
||||
short2 pos [[attribute(0)]];
|
||||
short4 normal_ed [[attribute(1)]];
|
||||
short2 pos [[attribute(4)]];
|
||||
short4 normal_ed [[attribute(5)]];
|
||||
|
||||
#if !defined(HAS_UNIFORM_u_color)
|
||||
float4 color [[attribute(2)]];
|
||||
float4 color [[attribute(6)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_base)
|
||||
float base [[attribute(3)]];
|
||||
float base [[attribute(7)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_height)
|
||||
float height [[attribute(4)]];
|
||||
float height [[attribute(8)]];
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -83,9 +46,9 @@ struct FragmentOutput {
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const FillExtrusionDrawableUBO& fill [[buffer(5)]],
|
||||
device const FillExtrusionDrawablePropsUBO& props [[buffer(6)]],
|
||||
device const FillExtrusionInterpolateUBO& interp [[buffer(7)]]) {
|
||||
device const FillExtrusionDrawableUBO& fill [[buffer(0)]],
|
||||
device const FillExtrusionPropsUBO& props [[buffer(1)]],
|
||||
device const FillExtrusionInterpolateUBO& interp [[buffer(3)]]) {
|
||||
|
||||
#if defined(HAS_UNIFORM_u_base)
|
||||
const auto base = props.light_position_base.w;
|
||||
|
||||
@@ -14,70 +14,27 @@ struct ShaderSource<BuiltIn::FillExtrusionPatternShader, gfx::Backend::Type::Met
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 4> uniforms;
|
||||
static const std::array<AttributeInfo, 6> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 4> uniforms;
|
||||
static const std::array<TextureInfo, 1> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
struct alignas(16) FillExtrusionDrawableTilePropsUBO {
|
||||
/* 0 */ float4 pattern_from;
|
||||
/* 16 */ float4 pattern_to;
|
||||
/* 32 */
|
||||
};
|
||||
|
||||
struct alignas(16) FillExtrusionInterpolateUBO {
|
||||
/* 0 */ float base_t;
|
||||
/* 4 */ float height_t;
|
||||
/* 8 */ float color_t;
|
||||
/* 12 */ float pattern_from_t;
|
||||
/* 16 */ float pattern_to_t;
|
||||
/* 20 */ float pad1, pad2, pad3;
|
||||
/* 32 */
|
||||
};
|
||||
static_assert(sizeof(FillExtrusionInterpolateUBO) == 2 * 16, "unexpected padding");
|
||||
|
||||
struct alignas(16) FillExtrusionDrawableUBO {
|
||||
/* 0 */ float4x4 matrix;
|
||||
/* 64 */ float4 scale;
|
||||
/* 80 */ float2 texsize;
|
||||
/* 88 */ float2 pixel_coord_upper;
|
||||
/* 96 */ float2 pixel_coord_lower;
|
||||
/* 104 */ float height_factor;
|
||||
/* 108 */ float pad;
|
||||
/* 112 */
|
||||
};
|
||||
static_assert(sizeof(FillExtrusionDrawableUBO) == 7 * 16, "unexpected padding");
|
||||
|
||||
struct alignas(16) FillExtrusionDrawablePropsUBO {
|
||||
/* 0 */ float4 color;
|
||||
/* 16 */ float4 light_color_pad;
|
||||
/* 32 */ float4 light_position_base;
|
||||
/* 48 */ float height;
|
||||
/* 52 */ float light_intensity;
|
||||
/* 56 */ float vertical_gradient;
|
||||
/* 60 */ float opacity;
|
||||
/* 64 */ float fade;
|
||||
/* 68 */ float pad2, pad3, pad4;
|
||||
/* 80 */
|
||||
};
|
||||
static_assert(sizeof(FillExtrusionDrawablePropsUBO) == 5 * 16, "unexpected padding");
|
||||
|
||||
struct VertexStage {
|
||||
short2 pos [[attribute(0)]];
|
||||
short4 normal_ed [[attribute(1)]];
|
||||
short2 pos [[attribute(4)]];
|
||||
short4 normal_ed [[attribute(5)]];
|
||||
|
||||
#if !defined(HAS_UNIFORM_u_base)
|
||||
float base [[attribute(2)]];
|
||||
float base [[attribute(6)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_height)
|
||||
float height [[attribute(3)]];
|
||||
float height [[attribute(7)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_pattern_from)
|
||||
ushort4 pattern_from [[attribute(4)]];
|
||||
ushort4 pattern_from [[attribute(8)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_pattern_to)
|
||||
ushort4 pattern_to [[attribute(5)]];
|
||||
ushort4 pattern_to [[attribute(9)]];
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -101,10 +58,10 @@ struct FragmentOutput {
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const FillExtrusionDrawableUBO& fill [[buffer(6)]],
|
||||
device const FillExtrusionDrawablePropsUBO& props [[buffer(7)]],
|
||||
device const FillExtrusionDrawableTilePropsUBO& tileProps [[buffer(8)]],
|
||||
device const FillExtrusionInterpolateUBO& interp [[buffer(9)]]) {
|
||||
device const FillExtrusionDrawableUBO& fill [[buffer(0)]],
|
||||
device const FillExtrusionPropsUBO& props [[buffer(1)]],
|
||||
device const FillExtrusionTilePropsUBO& tileProps [[buffer(2)]],
|
||||
device const FillExtrusionInterpolateUBO& interp [[buffer(3)]]) {
|
||||
|
||||
#if defined(HAS_UNIFORM_u_base)
|
||||
const auto base = props.light_position_base.w;
|
||||
@@ -192,9 +149,9 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
}
|
||||
|
||||
fragment FragmentOutput fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const FillExtrusionDrawableUBO& fill [[buffer(6)]],
|
||||
device const FillExtrusionDrawablePropsUBO& props [[buffer(7)]],
|
||||
device const FillExtrusionDrawableTilePropsUBO& tileProps [[buffer(8)]],
|
||||
device const FillExtrusionDrawableUBO& fill [[buffer(0)]],
|
||||
device const FillExtrusionPropsUBO& props [[buffer(1)]],
|
||||
device const FillExtrusionTilePropsUBO& tileProps [[buffer(2)]],
|
||||
texture2d<float, access::sample> image0 [[texture(0)]],
|
||||
sampler image0_sampler [[sampler(0)]]) {
|
||||
#if defined(OVERDRAW_INSPECTOR)
|
||||
|
||||
@@ -14,21 +14,21 @@ struct ShaderSource<BuiltIn::HeatmapShader, gfx::Backend::Type::Metal> {
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 3> uniforms;
|
||||
static const std::array<AttributeInfo, 3> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 3> uniforms;
|
||||
static const std::array<TextureInfo, 0> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
|
||||
struct VertexStage {
|
||||
short2 pos [[attribute(0)]];
|
||||
short2 pos [[attribute(3)]];
|
||||
|
||||
#if !defined(HAS_UNIFORM_u_weight)
|
||||
float2 weight [[attribute(1)]];
|
||||
float2 weight [[attribute(4)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_radius)
|
||||
float2 radius [[attribute(2)]];
|
||||
float2 radius [[attribute(5)]];
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -67,9 +67,9 @@ constant const float ZERO = 1.0 / 255.0 / 16.0;
|
||||
#define GAUSS_COEF 0.3989422804014327
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const HeatmapDrawableUBO& drawable [[buffer(3)]],
|
||||
device const HeatmapEvaluatedPropsUBO& props [[buffer(4)]],
|
||||
device const HeatmapInterpolateUBO& interp [[buffer(5)]]) {
|
||||
device const HeatmapDrawableUBO& drawable [[buffer(0)]],
|
||||
device const HeatmapEvaluatedPropsUBO& props [[buffer(1)]],
|
||||
device const HeatmapInterpolateUBO& interp [[buffer(2)]]) {
|
||||
|
||||
#if defined(HAS_UNIFORM_u_weight)
|
||||
const auto weight = props.weight;
|
||||
@@ -117,7 +117,7 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const HeatmapEvaluatedPropsUBO& props [[buffer(4)]]) {
|
||||
device const HeatmapEvaluatedPropsUBO& props [[buffer(1)]]) {
|
||||
#if defined(OVERDRAW_INSPECTOR)
|
||||
return half4(1.0);
|
||||
#endif
|
||||
|
||||
@@ -14,15 +14,15 @@ struct ShaderSource<BuiltIn::HeatmapTextureShader, gfx::Backend::Type::Metal> {
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 1> uniforms;
|
||||
static const std::array<AttributeInfo, 1> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 1> uniforms;
|
||||
static const std::array<TextureInfo, 2> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
|
||||
struct VertexStage {
|
||||
short2 pos [[attribute(0)]];
|
||||
short2 pos [[attribute(1)]];
|
||||
};
|
||||
|
||||
struct FragmentStage {
|
||||
@@ -30,7 +30,7 @@ struct FragmentStage {
|
||||
float2 pos;
|
||||
};
|
||||
|
||||
struct alignas(16) HeatmapTextureDrawableUBO {
|
||||
struct alignas(16) HeatmapTexturePropsUBO {
|
||||
float4x4 matrix;
|
||||
float2 world;
|
||||
float opacity;
|
||||
@@ -39,10 +39,10 @@ struct alignas(16) HeatmapTextureDrawableUBO {
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const HeatmapTextureDrawableUBO& drawable [[buffer(1)]]) {
|
||||
device const HeatmapTexturePropsUBO& props [[buffer(0)]]) {
|
||||
|
||||
const float2 pos = float2(vertx.pos);
|
||||
const float4 position = drawable.matrix * float4(pos * drawable.world, 0, 1);
|
||||
const float4 position = props.matrix * float4(pos * props.world, 0, 1);
|
||||
|
||||
return {
|
||||
.position = position,
|
||||
@@ -51,7 +51,7 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const HeatmapTextureDrawableUBO& drawable [[buffer(1)]],
|
||||
device const HeatmapTexturePropsUBO& props [[buffer(0)]],
|
||||
texture2d<float, access::sample> image [[texture(0)]],
|
||||
texture2d<float, access::sample> color_ramp [[texture(1)]],
|
||||
sampler image_sampler [[sampler(0)]],
|
||||
@@ -63,7 +63,7 @@ half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
|
||||
float t = image.sample(image_sampler, in.pos).r;
|
||||
float4 color = color_ramp.sample(color_ramp_sampler, float2(t, 0.5));
|
||||
return half4(color * drawable.opacity);
|
||||
return half4(color * props.opacity);
|
||||
}
|
||||
)";
|
||||
};
|
||||
|
||||
@@ -14,16 +14,16 @@ struct ShaderSource<BuiltIn::HillshadeShader, gfx::Backend::Type::Metal> {
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 2> uniforms;
|
||||
static const std::array<AttributeInfo, 2> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 2> uniforms;
|
||||
static const std::array<TextureInfo, 1> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
|
||||
struct VertexStage {
|
||||
short2 pos [[attribute(0)]];
|
||||
short2 texture_pos [[attribute(1)]];
|
||||
short2 pos [[attribute(2)]];
|
||||
short2 texture_pos [[attribute(3)]];
|
||||
};
|
||||
|
||||
struct FragmentStage {
|
||||
@@ -44,7 +44,7 @@ struct alignas(16) HillshadeEvaluatedPropsUBO {
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const HillshadeDrawableUBO& drawable [[buffer(2)]]) {
|
||||
device const HillshadeDrawableUBO& drawable [[buffer(0)]]) {
|
||||
|
||||
const float4 position = drawable.matrix * float4(float2(vertx.pos), 0, 1);
|
||||
float2 pos = float2(vertx.texture_pos) / 8192.0;
|
||||
@@ -57,8 +57,8 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const HillshadeDrawableUBO& drawable [[buffer(2)]],
|
||||
device const HillshadeEvaluatedPropsUBO& props [[buffer(3)]],
|
||||
device const HillshadeDrawableUBO& drawable [[buffer(0)]],
|
||||
device const HillshadeEvaluatedPropsUBO& props [[buffer(1)]],
|
||||
texture2d<float, access::sample> image [[texture(0)]],
|
||||
sampler image_sampler [[sampler(0)]]) {
|
||||
#if defined(OVERDRAW_INSPECTOR)
|
||||
|
||||
@@ -14,15 +14,15 @@ struct ShaderSource<BuiltIn::HillshadePrepareShader, gfx::Backend::Type::Metal>
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 1> uniforms;
|
||||
static const std::array<AttributeInfo, 2> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 1> uniforms;
|
||||
static const std::array<TextureInfo, 1> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
struct VertexStage {
|
||||
short2 pos [[attribute(0)]];
|
||||
short2 texture_pos [[attribute(1)]];
|
||||
short2 pos [[attribute(1)]];
|
||||
short2 texture_pos [[attribute(2)]];
|
||||
};
|
||||
|
||||
struct FragmentStage {
|
||||
@@ -39,7 +39,7 @@ struct alignas(16) HillshadePrepareDrawableUBO {
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const HillshadePrepareDrawableUBO& drawable [[buffer(2)]]) {
|
||||
device const HillshadePrepareDrawableUBO& drawable [[buffer(0)]]) {
|
||||
|
||||
const float4 position = drawable.matrix * float4(float2(vertx.pos), 0, 1);
|
||||
|
||||
@@ -61,7 +61,7 @@ float getElevation(float2 coord, float bias, texture2d<float, access::sample> im
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const HillshadePrepareDrawableUBO& drawable [[buffer(2)]],
|
||||
device const HillshadePrepareDrawableUBO& drawable [[buffer(0)]],
|
||||
texture2d<float, access::sample> image [[texture(0)]],
|
||||
sampler image_sampler [[sampler(0)]]) {
|
||||
#if defined(OVERDRAW_INSPECTOR)
|
||||
|
||||
@@ -14,33 +14,33 @@ struct ShaderSource<BuiltIn::LineShader, gfx::Backend::Type::Metal> {
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 4> uniforms;
|
||||
static const std::array<AttributeInfo, 8> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 4> uniforms;
|
||||
static const std::array<TextureInfo, 0> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
struct VertexStage {
|
||||
short2 pos_normal [[attribute(0)]];
|
||||
uchar4 data [[attribute(1)]];
|
||||
short2 pos_normal [[attribute(5)]];
|
||||
uchar4 data [[attribute(6)]];
|
||||
|
||||
#if !defined(HAS_UNIFORM_u_color)
|
||||
float4 color [[attribute(2)]];
|
||||
float4 color [[attribute(7)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_blur)
|
||||
float2 blur [[attribute(3)]];
|
||||
float2 blur [[attribute(8)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_opacity)
|
||||
float2 opacity [[attribute(4)]];
|
||||
float2 opacity [[attribute(9)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_gapwidth)
|
||||
float2 gapwidth [[attribute(5)]];
|
||||
float2 gapwidth [[attribute(10)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_offset)
|
||||
float2 offset [[attribute(6)]];
|
||||
float2 offset [[attribute(11)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_width)
|
||||
float2 width [[attribute(7)]];
|
||||
float2 width [[attribute(12)]];
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -61,11 +61,27 @@ struct FragmentStage {
|
||||
#endif
|
||||
};
|
||||
|
||||
struct alignas(16) LineDrawableUBO {
|
||||
float4x4 matrix;
|
||||
float ratio;
|
||||
float pad1, pad2, pad3;
|
||||
};
|
||||
|
||||
struct alignas(16) LineInterpolationUBO {
|
||||
float color_t;
|
||||
float blur_t;
|
||||
float opacity_t;
|
||||
float gapwidth_t;
|
||||
float offset_t;
|
||||
float width_t;
|
||||
float pad1, pad2;
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const LineDynamicUBO& dynamic [[buffer(8)]],
|
||||
device const LineUBO& line [[buffer(9)]],
|
||||
device const LinePropertiesUBO& props [[buffer(10)]],
|
||||
device const LineInterpolationUBO& interp [[buffer(11)]]) {
|
||||
device const LineDynamicUBO& dynamic [[buffer(0)]],
|
||||
device const LineDrawableUBO& drawable [[buffer(1)]],
|
||||
device const LineInterpolationUBO& interp [[buffer(2)]],
|
||||
device const LineEvaluatedPropsUBO& props [[buffer(4)]]) {
|
||||
|
||||
#if defined(HAS_UNIFORM_u_gapwidth)
|
||||
const auto gapwidth = props.gapwidth / 2;
|
||||
@@ -112,8 +128,8 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
const float t = 1.0 - abs(u);
|
||||
const float2 offset2 = offset * a_extrude * LINE_NORMAL_SCALE * v_normal.y * float2x2(t, -u, u, t);
|
||||
|
||||
const float4 projected_extrude = line.matrix * float4(dist / line.ratio, 0.0, 0.0);
|
||||
const float4 position = line.matrix * float4(pos + offset2 / line.ratio, 0.0, 1.0) + projected_extrude;
|
||||
const float4 projected_extrude = drawable.matrix * float4(dist / drawable.ratio, 0.0, 0.0);
|
||||
const float4 position = drawable.matrix * float4(pos + offset2 / drawable.ratio, 0.0, 1.0) + projected_extrude;
|
||||
|
||||
// calculate how much the perspective view squishes or stretches the extrude
|
||||
const float extrude_length_without_perspective = length(dist);
|
||||
@@ -138,8 +154,7 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const LineUBO& line [[buffer(9)]],
|
||||
device const LinePropertiesUBO& props [[buffer(10)]]) {
|
||||
device const LineEvaluatedPropsUBO& props [[buffer(4)]]) {
|
||||
#if defined(OVERDRAW_INSPECTOR)
|
||||
return half4(1.0);
|
||||
#endif
|
||||
@@ -173,42 +188,211 @@ half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
)";
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ShaderSource<BuiltIn::LineGradientShader, gfx::Backend::Type::Metal> {
|
||||
static constexpr auto name = "LineGradientShader";
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 4> uniforms;
|
||||
static const std::array<AttributeInfo, 7> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<TextureInfo, 1> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
struct VertexStage {
|
||||
short2 pos_normal [[attribute(5)]];
|
||||
uchar4 data [[attribute(6)]];
|
||||
float2 blur [[attribute(7)]];
|
||||
float2 opacity [[attribute(8)]];
|
||||
float2 gapwidth [[attribute(9)]];
|
||||
float2 offset [[attribute(10)]];
|
||||
float2 width [[attribute(11)]];
|
||||
};
|
||||
|
||||
struct FragmentStage {
|
||||
float4 position [[position, invariant]];
|
||||
float2 width2;
|
||||
half2 normal;
|
||||
half gamma_scale;
|
||||
float lineprogress;
|
||||
|
||||
#if !defined(HAS_UNIFORM_u_blur)
|
||||
half blur;
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_opacity)
|
||||
half opacity;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct alignas(16) LineGradientDrawableUBO {
|
||||
float4x4 matrix;
|
||||
float ratio;
|
||||
float pad1, pad2, pad3;
|
||||
};
|
||||
|
||||
struct alignas(16) LineGradientInterpolationUBO {
|
||||
float blur_t;
|
||||
float opacity_t;
|
||||
float gapwidth_t;
|
||||
float offset_t;
|
||||
float width_t;
|
||||
float pad1, pad2, pad3;
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const LineDynamicUBO& dynamic [[buffer(0)]],
|
||||
device const LineGradientDrawableUBO& drawable [[buffer(1)]],
|
||||
device const LineGradientInterpolationUBO& interp [[buffer(2)]],
|
||||
device const LineEvaluatedPropsUBO& props [[buffer(4)]]) {
|
||||
|
||||
#if !defined(HAS_UNIFORM_u_blur)
|
||||
const auto blur = unpack_mix_float(vertx.blur, interp.blur_t);
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_opacity)
|
||||
const auto opacity = unpack_mix_float(vertx.opacity, interp.opacity_t);
|
||||
#endif
|
||||
#if defined(HAS_UNIFORM_u_gapwidth)
|
||||
const auto gapwidth = props.gapwidth;
|
||||
#else
|
||||
const auto gapwidth = unpack_mix_float(vertx.gapwidth, interp.gapwidth_t) / 2;
|
||||
#endif
|
||||
#if defined(HAS_UNIFORM_u_offset)
|
||||
const auto offset = props.offset;
|
||||
#else
|
||||
const auto offset = unpack_mix_float(vertx.offset, interp.offset_t) * -1;
|
||||
#endif
|
||||
#if defined(HAS_UNIFORM_u_width)
|
||||
const auto width = props.width;
|
||||
#else
|
||||
const auto width = unpack_mix_float(vertx.width, interp.width_t);
|
||||
#endif
|
||||
|
||||
// the distance over which the line edge fades out.
|
||||
// Retina devices need a smaller distance to avoid aliasing.
|
||||
const float ANTIALIASING = 1.0 / DEVICE_PIXEL_RATIO / 2.0;
|
||||
|
||||
const float2 a_extrude = float2(vertx.data.xy) - 128.0;
|
||||
const float a_direction = fmod(float(vertx.data.z), 4.0) - 1.0;
|
||||
const float v_lineprogress = (floor(float(vertx.data.z) / 4.0) + vertx.data.w * 64.0) * 2.0 / MAX_LINE_DISTANCE;
|
||||
const float2 pos = floor(float2(vertx.pos_normal) * 0.5);
|
||||
|
||||
// x is 1 if it's a round cap, 0 otherwise
|
||||
// y is 1 if the normal points up, and -1 if it points down
|
||||
// We store these in the least significant bit of a_pos_normal
|
||||
const float2 normal = float2(vertx.pos_normal) - 2.0 * pos;
|
||||
const float2 v_normal = float2(normal.x, normal.y * 2.0 - 1.0);
|
||||
|
||||
const float halfwidth = width / 2.0;
|
||||
const float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);
|
||||
const float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING);
|
||||
|
||||
// Scale the extrusion vector down to a normal and then up by the line width of this vertex.
|
||||
const float2 dist = outset * a_extrude * LINE_NORMAL_SCALE;
|
||||
|
||||
// Calculate the offset when drawing a line that is to the side of the actual line.
|
||||
// We do this by creating a vector that points towards the extrude, but rotate
|
||||
// it when we're drawing round end points (a_direction = -1 or 1) since their
|
||||
// extrude vector points in another direction.
|
||||
const float u = 0.5 * a_direction;
|
||||
const float t = 1.0 - abs(u);
|
||||
const float2 offset2 = offset * a_extrude * LINE_NORMAL_SCALE * v_normal.y * float2x2(t, -u, u, t);
|
||||
|
||||
const float4 projected_extrude = drawable.matrix * float4(dist / drawable.ratio, 0.0, 0.0);
|
||||
const float4 position = drawable.matrix * float4(pos + offset2 / drawable.ratio, 0.0, 1.0) + projected_extrude;
|
||||
|
||||
// calculate how much the perspective view squishes or stretches the extrude
|
||||
const float extrude_length_without_perspective = length(dist);
|
||||
const float extrude_length_with_perspective = length(projected_extrude.xy / position.w * dynamic.units_to_pixels);
|
||||
|
||||
return {
|
||||
.position = position,
|
||||
.width2 = float2(outset, inset),
|
||||
.normal = half2(v_normal),
|
||||
.gamma_scale = half(extrude_length_without_perspective / extrude_length_with_perspective),
|
||||
.lineprogress = v_lineprogress,
|
||||
|
||||
#if !defined(HAS_UNIFORM_u_blur)
|
||||
.blur = half(blur),
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_opacity)
|
||||
.opacity = half(opacity),
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const LineEvaluatedPropsUBO& props [[buffer(4)]],
|
||||
texture2d<float, access::sample> gradientTexture [[texture(0)]]) {
|
||||
#if defined(OVERDRAW_INSPECTOR)
|
||||
return half4(1.0);
|
||||
#endif
|
||||
|
||||
#if defined(HAS_UNIFORM_u_blur)
|
||||
const float blur = props.blur;
|
||||
#else
|
||||
const float blur = float(in.blur);
|
||||
#endif
|
||||
#if defined(HAS_UNIFORM_u_opacity)
|
||||
const float opacity = props.opacity;
|
||||
#else
|
||||
const float opacity = float(in.opacity);
|
||||
#endif
|
||||
|
||||
// Calculate the distance of the pixel from the line in pixels.
|
||||
const float dist = length(in.normal) * in.width2.x;
|
||||
|
||||
// Calculate the antialiasing fade factor. This is either when fading in the
|
||||
// line in case of an offset line (v_width2.y) or when fading out (v_width2.x)
|
||||
const float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * in.gamma_scale;
|
||||
const float alpha = clamp(min(dist - (in.width2.y - blur2), in.width2.x - dist) / blur2, 0.0, 1.0);
|
||||
|
||||
// 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.
|
||||
constexpr sampler sampler2d(coord::normalized, filter::linear);
|
||||
const float4 color = gradientTexture.sample(sampler2d, float2(in.lineprogress, 0.5));
|
||||
|
||||
return half4(color * (alpha * opacity));
|
||||
}
|
||||
)";
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ShaderSource<BuiltIn::LinePatternShader, gfx::Backend::Type::Metal> {
|
||||
static constexpr auto name = "LinePatternShader";
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 5> uniforms;
|
||||
static const std::array<AttributeInfo, 9> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 5> uniforms;
|
||||
static const std::array<TextureInfo, 1> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
struct VertexStage {
|
||||
short2 pos_normal [[attribute(0)]];
|
||||
uchar4 data [[attribute(1)]];
|
||||
short2 pos_normal [[attribute(5)]];
|
||||
uchar4 data [[attribute(6)]];
|
||||
|
||||
#if !defined(HAS_UNIFORM_u_blur)
|
||||
float2 blur [[attribute(2)]];
|
||||
float2 blur [[attribute(7)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_opacity)
|
||||
float2 opacity [[attribute(3)]];
|
||||
float2 opacity [[attribute(8)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_gapwidth)
|
||||
float2 gapwidth [[attribute(4)]];
|
||||
float2 gapwidth [[attribute(9)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_offset)
|
||||
float2 offset [[attribute(5)]];
|
||||
float2 offset [[attribute(10)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_width)
|
||||
float2 width [[attribute(6)]];
|
||||
float2 width [[attribute(11)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_pattern_from)
|
||||
ushort4 pattern_from [[attribute(7)]];
|
||||
ushort4 pattern_from [[attribute(12)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_pattern_to)
|
||||
ushort4 pattern_to [[attribute(8)]];
|
||||
ushort4 pattern_to [[attribute(13)]];
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -233,7 +417,7 @@ struct FragmentStage {
|
||||
#endif
|
||||
};
|
||||
|
||||
struct alignas(16) LinePatternUBO {
|
||||
struct alignas(16) LinePatternDrawableUBO {
|
||||
float4x4 matrix;
|
||||
float4 scale;
|
||||
float2 texsize;
|
||||
@@ -241,15 +425,6 @@ struct alignas(16) LinePatternUBO {
|
||||
float fade;
|
||||
};
|
||||
|
||||
struct alignas(16) LinePatternPropertiesUBO {
|
||||
float blur;
|
||||
float opacity;
|
||||
float offset;
|
||||
float gapwidth;
|
||||
float width;
|
||||
float pad1, pad2, pad3;
|
||||
};
|
||||
|
||||
struct alignas(16) LinePatternInterpolationUBO {
|
||||
float blur_t;
|
||||
float opacity_t;
|
||||
@@ -267,11 +442,11 @@ struct alignas(16) LinePatternTilePropertiesUBO {
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const LineDynamicUBO& dynamic [[buffer(9)]],
|
||||
device const LinePatternUBO& line [[buffer(10)]],
|
||||
device const LinePatternPropertiesUBO& props [[buffer(11)]],
|
||||
device const LinePatternInterpolationUBO& interp [[buffer(12)]],
|
||||
device const LinePatternTilePropertiesUBO& tileProps [[buffer(13)]]) {
|
||||
device const LineDynamicUBO& dynamic [[buffer(0)]],
|
||||
device const LinePatternDrawableUBO& drawable [[buffer(1)]],
|
||||
device const LinePatternInterpolationUBO& interp [[buffer(2)]],
|
||||
device const LinePatternTilePropertiesUBO& tileProps [[buffer(3)]],
|
||||
device const LineEvaluatedPropsUBO& props [[buffer(4)]]) {
|
||||
|
||||
#if defined(HAS_UNIFORM_u_gapwidth)
|
||||
const auto gapwidth = props.gapwidth / 2;
|
||||
@@ -320,8 +495,8 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
const float t = 1.0 - abs(u);
|
||||
const float2 offset2 = offset * a_extrude * LINE_NORMAL_SCALE * v_normal.y * float2x2(t, -u, u, t);
|
||||
|
||||
const float4 projected_extrude = line.matrix * float4(dist / line.ratio, 0.0, 0.0);
|
||||
const float4 position = line.matrix * float4(pos + offset2 / line.ratio, 0.0, 1.0) + projected_extrude;
|
||||
const float4 projected_extrude = drawable.matrix * float4(dist / drawable.ratio, 0.0, 0.0);
|
||||
const float4 position = drawable.matrix * float4(pos + offset2 / drawable.ratio, 0.0, 1.0) + projected_extrude;
|
||||
|
||||
// calculate how much the perspective view squishes or stretches the extrude
|
||||
const float extrude_length_without_perspective = length(dist);
|
||||
@@ -350,9 +525,9 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const LinePatternUBO& line [[buffer(10)]],
|
||||
device const LinePatternPropertiesUBO& props [[buffer(11)]],
|
||||
device const LinePatternTilePropertiesUBO& tileProps [[buffer(13)]],
|
||||
device const LinePatternDrawableUBO& drawable [[buffer(1)]],
|
||||
device const LinePatternTilePropertiesUBO& tileProps [[buffer(3)]],
|
||||
device const LineEvaluatedPropsUBO& props [[buffer(4)]],
|
||||
texture2d<float, access::sample> image0 [[texture(0)]],
|
||||
sampler image0_sampler [[sampler(0)]]) {
|
||||
#if defined(OVERDRAW_INSPECTOR)
|
||||
@@ -385,10 +560,10 @@ half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
const float2 pattern_tl_b = pattern_to.xy;
|
||||
const float2 pattern_br_b = pattern_to.zw;
|
||||
|
||||
const float pixelRatio = line.scale.x;
|
||||
const float tileZoomRatio = line.scale.y;
|
||||
const float fromScale = line.scale.z;
|
||||
const float toScale = line.scale.w;
|
||||
const float pixelRatio = drawable.scale.x;
|
||||
const float tileZoomRatio = drawable.scale.y;
|
||||
const float fromScale = drawable.scale.z;
|
||||
const float toScale = drawable.scale.w;
|
||||
|
||||
const float2 display_size_a = float2((pattern_br_a.x - pattern_tl_a.x) / pixelRatio, (pattern_br_a.y - pattern_tl_a.y) / pixelRatio);
|
||||
const float2 display_size_b = float2((pattern_br_b.x - pattern_tl_b.x) / pixelRatio, (pattern_br_b.y - pattern_tl_b.y) / pixelRatio);
|
||||
@@ -415,10 +590,10 @@ half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
// the texture coordinate
|
||||
const float y_a = 0.5 + (in.normal.y * clamp(in.width2.x, 0.0, (pattern_size_a.y + 2.0) / 2.0) / pattern_size_a.y);
|
||||
const float y_b = 0.5 + (in.normal.y * clamp(in.width2.x, 0.0, (pattern_size_b.y + 2.0) / 2.0) / pattern_size_b.y);
|
||||
const float2 pos_a = mix(pattern_tl_a / line.texsize, pattern_br_a / line.texsize, float2(x_a, y_a));
|
||||
const float2 pos_b = mix(pattern_tl_b / line.texsize, pattern_br_b / line.texsize, float2(x_b, y_b));
|
||||
const float2 pos_a = mix(pattern_tl_a / drawable.texsize, pattern_br_a / drawable.texsize, float2(x_a, y_a));
|
||||
const float2 pos_b = mix(pattern_tl_b / drawable.texsize, pattern_br_b / drawable.texsize, float2(x_b, y_b));
|
||||
|
||||
const float4 color = mix(image0.sample(image0_sampler, pos_a), image0.sample(image0_sampler, pos_b), line.fade);
|
||||
const float4 color = mix(image0.sample(image0_sampler, pos_a), image0.sample(image0_sampler, pos_b), drawable.fade);
|
||||
|
||||
return half4(color * alpha * opacity);
|
||||
}
|
||||
@@ -431,36 +606,36 @@ struct ShaderSource<BuiltIn::LineSDFShader, gfx::Backend::Type::Metal> {
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 4> uniforms;
|
||||
static const std::array<AttributeInfo, 9> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 4> uniforms;
|
||||
static const std::array<TextureInfo, 1> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
struct VertexStage {
|
||||
short2 pos_normal [[attribute(0)]];
|
||||
uchar4 data [[attribute(1)]];
|
||||
short2 pos_normal [[attribute(5)]];
|
||||
uchar4 data [[attribute(6)]];
|
||||
|
||||
#if !defined(HAS_UNIFORM_u_color)
|
||||
float4 color [[attribute(2)]];
|
||||
float4 color [[attribute(7)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_blur)
|
||||
float2 blur [[attribute(3)]];
|
||||
float2 blur [[attribute(8)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_opacity)
|
||||
float2 opacity [[attribute(4)]];
|
||||
float2 opacity [[attribute(9)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_gapwidth)
|
||||
float2 gapwidth [[attribute(5)]];
|
||||
float2 gapwidth [[attribute(10)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_offset)
|
||||
float2 offset [[attribute(6)]];
|
||||
float2 offset [[attribute(11)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_width)
|
||||
float2 width [[attribute(7)]];
|
||||
float2 width [[attribute(12)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_floorwidth)
|
||||
float2 floorwidth [[attribute(8)]];
|
||||
float2 floorwidth [[attribute(13)]];
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -486,7 +661,7 @@ struct FragmentStage {
|
||||
#endif
|
||||
};
|
||||
|
||||
struct alignas(16) LineSDFUBO {
|
||||
struct alignas(16) LineSDFDrawableUBO {
|
||||
float4x4 matrix;
|
||||
float2 patternscale_a;
|
||||
float2 patternscale_b;
|
||||
@@ -498,17 +673,6 @@ struct alignas(16) LineSDFUBO {
|
||||
float pad1, pad2, pad3;
|
||||
};
|
||||
|
||||
struct alignas(16) LineSDFPropertiesUBO {
|
||||
float4 color;
|
||||
float blur;
|
||||
float opacity;
|
||||
float gapwidth;
|
||||
float offset;
|
||||
float width;
|
||||
float floorwidth;
|
||||
float pad1, pad2;
|
||||
};
|
||||
|
||||
struct alignas(16) LineSDFInterpolationUBO {
|
||||
float color_t;
|
||||
float blur_t;
|
||||
@@ -521,10 +685,10 @@ struct alignas(16) LineSDFInterpolationUBO {
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const LineDynamicUBO& dynamic [[buffer(9)]],
|
||||
device const LineSDFUBO& line [[buffer(10)]],
|
||||
device const LineSDFPropertiesUBO& props [[buffer(11)]],
|
||||
device const LineSDFInterpolationUBO& interp [[buffer(12)]]) {
|
||||
device const LineDynamicUBO& dynamic [[buffer(0)]],
|
||||
device const LineSDFDrawableUBO& drawable [[buffer(1)]],
|
||||
device const LineSDFInterpolationUBO& interp [[buffer(2)]],
|
||||
device const LineEvaluatedPropsUBO& props [[buffer(4)]]) {
|
||||
|
||||
#if defined(HAS_UNIFORM_u_gapwidth)
|
||||
const auto gapwidth = props.gapwidth / 2;
|
||||
@@ -578,8 +742,8 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
const float t = 1.0 - abs(u);
|
||||
const float2 offset2 = offset * a_extrude * LINE_NORMAL_SCALE * v_normal.y * float2x2(t, -u, u, t);
|
||||
|
||||
const float4 projected_extrude = line.matrix * float4(dist / line.ratio, 0.0, 0.0);
|
||||
const float4 position = line.matrix * float4(pos + offset2 / line.ratio, 0.0, 1.0) + projected_extrude;
|
||||
const float4 projected_extrude = drawable.matrix * float4(dist / drawable.ratio, 0.0, 0.0);
|
||||
const float4 position = drawable.matrix * float4(pos + offset2 / drawable.ratio, 0.0, 1.0) + projected_extrude;
|
||||
|
||||
// calculate how much the perspective view squishes or stretches the extrude
|
||||
const float extrude_length_without_perspective = length(dist);
|
||||
@@ -590,8 +754,8 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
.width2 = float2(outset, inset),
|
||||
.normal = v_normal,
|
||||
.gamma_scale = half(extrude_length_without_perspective / extrude_length_with_perspective),
|
||||
.tex_a = float2(linesofar * line.patternscale_a.x / floorwidth, (normal.y * line.patternscale_a.y + line.tex_y_a) * 2.0),
|
||||
.tex_b = float2(linesofar * line.patternscale_b.x / floorwidth, (normal.y * line.patternscale_b.y + line.tex_y_b) * 2.0),
|
||||
.tex_a = float2(linesofar * drawable.patternscale_a.x / floorwidth, (normal.y * drawable.patternscale_a.y + drawable.tex_y_a) * 2.0),
|
||||
.tex_b = float2(linesofar * drawable.patternscale_b.x / floorwidth, (normal.y * drawable.patternscale_b.y + drawable.tex_y_b) * 2.0),
|
||||
|
||||
#if !defined(HAS_UNIFORM_u_color)
|
||||
.color = unpack_mix_color(vertx.color, interp.color_t),
|
||||
@@ -609,8 +773,8 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const LineSDFUBO& line [[buffer(10)]],
|
||||
device const LineSDFPropertiesUBO& props [[buffer(11)]],
|
||||
device const LineSDFDrawableUBO& drawable [[buffer(1)]],
|
||||
device const LineEvaluatedPropsUBO& props [[buffer(4)]],
|
||||
texture2d<float, access::sample> image0 [[texture(0)]],
|
||||
sampler image0_sampler [[sampler(0)]]) {
|
||||
#if defined(OVERDRAW_INSPECTOR)
|
||||
@@ -644,10 +808,10 @@ half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
|
||||
const float sdfdist_a = image0.sample(image0_sampler, in.tex_a).a;
|
||||
const float sdfdist_b = image0.sample(image0_sampler, in.tex_b).a;
|
||||
const float sdfdist = mix(sdfdist_a, sdfdist_b, line.mix);
|
||||
const float sdfdist = mix(sdfdist_a, sdfdist_b, drawable.mix);
|
||||
const float dist = length(in.normal) * in.width2.x;
|
||||
const float alpha = clamp(min(dist - (in.width2.y - blur2), in.width2.x - dist) / blur2, 0.0, 1.0) *
|
||||
smoothstep(0.5 - line.sdfgamma / floorwidth, 0.5 + line.sdfgamma / floorwidth, sdfdist);
|
||||
smoothstep(0.5 - drawable.sdfgamma / floorwidth, 0.5 + drawable.sdfgamma / floorwidth, sdfdist);
|
||||
|
||||
return half4(color * (alpha * opacity));
|
||||
}
|
||||
|
||||
@@ -1,167 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/shaders/line_layer_ubo.hpp>
|
||||
#include <mbgl/shaders/shader_source.hpp>
|
||||
#include <mbgl/shaders/mtl/common.hpp>
|
||||
#include <mbgl/shaders/mtl/shader_program.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace shaders {
|
||||
|
||||
template <>
|
||||
struct ShaderSource<BuiltIn::LineGradientShader, gfx::Backend::Type::Metal> {
|
||||
static constexpr auto name = "LineGradientShader";
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<AttributeInfo, 7> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 4> uniforms;
|
||||
static const std::array<TextureInfo, 1> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
struct VertexStage {
|
||||
short2 pos_normal [[attribute(0)]];
|
||||
uchar4 data [[attribute(1)]];
|
||||
float2 blur [[attribute(2)]];
|
||||
float2 opacity [[attribute(3)]];
|
||||
float2 gapwidth [[attribute(4)]];
|
||||
float2 offset [[attribute(5)]];
|
||||
float2 width [[attribute(6)]];
|
||||
};
|
||||
|
||||
struct FragmentStage {
|
||||
float4 position [[position, invariant]];
|
||||
float2 width2;
|
||||
half2 normal;
|
||||
half gamma_scale;
|
||||
float lineprogress;
|
||||
|
||||
#if !defined(HAS_UNIFORM_u_blur)
|
||||
half blur;
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_opacity)
|
||||
half opacity;
|
||||
#endif
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const LineDynamicUBO& dynamic [[buffer(7)]],
|
||||
device const LineGradientUBO& line [[buffer(8)]],
|
||||
device const LineGradientPropertiesUBO& props [[buffer(9)]],
|
||||
device const LineGradientInterpolationUBO& interp [[buffer(10)]]) {
|
||||
|
||||
#if !defined(HAS_UNIFORM_u_blur)
|
||||
const auto blur = unpack_mix_float(vertx.blur, interp.blur_t);
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_opacity)
|
||||
const auto opacity = unpack_mix_float(vertx.opacity, interp.opacity_t);
|
||||
#endif
|
||||
#if defined(HAS_UNIFORM_u_gapwidth)
|
||||
const auto gapwidth = props.gapwidth;
|
||||
#else
|
||||
const auto gapwidth = unpack_mix_float(vertx.gapwidth, interp.gapwidth_t) / 2;
|
||||
#endif
|
||||
#if defined(HAS_UNIFORM_u_offset)
|
||||
const auto offset = props.offset;
|
||||
#else
|
||||
const auto offset = unpack_mix_float(vertx.offset, interp.offset_t) * -1;
|
||||
#endif
|
||||
#if defined(HAS_UNIFORM_u_width)
|
||||
const auto width = props.width;
|
||||
#else
|
||||
const auto width = unpack_mix_float(vertx.width, interp.width_t);
|
||||
#endif
|
||||
|
||||
// the distance over which the line edge fades out.
|
||||
// Retina devices need a smaller distance to avoid aliasing.
|
||||
const float ANTIALIASING = 1.0 / DEVICE_PIXEL_RATIO / 2.0;
|
||||
|
||||
const float2 a_extrude = float2(vertx.data.xy) - 128.0;
|
||||
const float a_direction = fmod(float(vertx.data.z), 4.0) - 1.0;
|
||||
const float v_lineprogress = (floor(float(vertx.data.z) / 4.0) + vertx.data.w * 64.0) * 2.0 / MAX_LINE_DISTANCE;
|
||||
const float2 pos = floor(float2(vertx.pos_normal) * 0.5);
|
||||
|
||||
// x is 1 if it's a round cap, 0 otherwise
|
||||
// y is 1 if the normal points up, and -1 if it points down
|
||||
// We store these in the least significant bit of a_pos_normal
|
||||
const float2 normal = float2(vertx.pos_normal) - 2.0 * pos;
|
||||
const float2 v_normal = float2(normal.x, normal.y * 2.0 - 1.0);
|
||||
|
||||
const float halfwidth = width / 2.0;
|
||||
const float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);
|
||||
const float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING);
|
||||
|
||||
// Scale the extrusion vector down to a normal and then up by the line width of this vertex.
|
||||
const float2 dist = outset * a_extrude * LINE_NORMAL_SCALE;
|
||||
|
||||
// Calculate the offset when drawing a line that is to the side of the actual line.
|
||||
// We do this by creating a vector that points towards the extrude, but rotate
|
||||
// it when we're drawing round end points (a_direction = -1 or 1) since their
|
||||
// extrude vector points in another direction.
|
||||
const float u = 0.5 * a_direction;
|
||||
const float t = 1.0 - abs(u);
|
||||
const float2 offset2 = offset * a_extrude * LINE_NORMAL_SCALE * v_normal.y * float2x2(t, -u, u, t);
|
||||
|
||||
const float4 projected_extrude = line.matrix * float4(dist / line.ratio, 0.0, 0.0);
|
||||
const float4 position = line.matrix * float4(pos + offset2 / line.ratio, 0.0, 1.0) + projected_extrude;
|
||||
|
||||
// calculate how much the perspective view squishes or stretches the extrude
|
||||
const float extrude_length_without_perspective = length(dist);
|
||||
const float extrude_length_with_perspective = length(projected_extrude.xy / position.w * dynamic.units_to_pixels);
|
||||
|
||||
return {
|
||||
.position = position,
|
||||
.width2 = float2(outset, inset),
|
||||
.normal = half2(v_normal),
|
||||
.gamma_scale = half(extrude_length_without_perspective / extrude_length_with_perspective),
|
||||
.lineprogress = v_lineprogress,
|
||||
|
||||
#if !defined(HAS_UNIFORM_u_blur)
|
||||
.blur = half(blur),
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_opacity)
|
||||
.opacity = half(opacity),
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const LineGradientUBO& line [[buffer(8)]],
|
||||
device const LineGradientPropertiesUBO& props [[buffer(9)]],
|
||||
texture2d<float, access::sample> gradientTexture [[texture(0)]]) {
|
||||
#if defined(OVERDRAW_INSPECTOR)
|
||||
return half4(1.0);
|
||||
#endif
|
||||
|
||||
#if defined(HAS_UNIFORM_u_blur)
|
||||
const float blur = props.blur;
|
||||
#else
|
||||
const float blur = float(in.blur);
|
||||
#endif
|
||||
#if defined(HAS_UNIFORM_u_opacity)
|
||||
const float opacity = props.opacity;
|
||||
#else
|
||||
const float opacity = float(in.opacity);
|
||||
#endif
|
||||
|
||||
// Calculate the distance of the pixel from the line in pixels.
|
||||
const float dist = length(in.normal) * in.width2.x;
|
||||
|
||||
// Calculate the antialiasing fade factor. This is either when fading in the
|
||||
// line in case of an offset line (v_width2.y) or when fading out (v_width2.x)
|
||||
const float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * in.gamma_scale;
|
||||
const float alpha = clamp(min(dist - (in.width2.y - blur2), in.width2.x - dist) / blur2, 0.0, 1.0);
|
||||
|
||||
// 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.
|
||||
constexpr sampler sampler2d(coord::normalized, filter::linear);
|
||||
const float4 color = gradientTexture.sample(sampler2d, float2(in.lineprogress, 0.5));
|
||||
|
||||
return half4(color * (alpha * opacity));
|
||||
}
|
||||
)";
|
||||
};
|
||||
|
||||
} // namespace shaders
|
||||
} // namespace mbgl
|
||||
@@ -14,16 +14,16 @@ struct ShaderSource<BuiltIn::RasterShader, gfx::Backend::Type::Metal> {
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 2> uniforms;
|
||||
static const std::array<AttributeInfo, 2> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 1> uniforms;
|
||||
static const std::array<TextureInfo, 2> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
|
||||
struct VertexStage {
|
||||
short2 pos [[attribute(0)]];
|
||||
short2 texture_pos [[attribute(1)]];
|
||||
short2 pos [[attribute(2)]];
|
||||
short2 texture_pos [[attribute(3)]];
|
||||
};
|
||||
|
||||
struct FragmentStage {
|
||||
@@ -34,6 +34,9 @@ struct FragmentStage {
|
||||
|
||||
struct alignas(16) RasterDrawableUBO {
|
||||
float4x4 matrix;
|
||||
};
|
||||
|
||||
struct alignas(16) RasterEvaluatedPropsUBO {
|
||||
float3 spin_weights;
|
||||
float2 tl_parent;
|
||||
float scale_parent;
|
||||
@@ -50,7 +53,8 @@ struct alignas(16) RasterDrawableUBO {
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const RasterDrawableUBO& drawable [[buffer(2)]]) {
|
||||
device const RasterDrawableUBO& drawable [[buffer(0)]],
|
||||
device const RasterEvaluatedPropsUBO& props [[buffer(1)]]) {
|
||||
|
||||
const float4 position = drawable.matrix * float4(float2(vertx.pos), 0, 1);
|
||||
|
||||
@@ -59,8 +63,8 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
// as an arbitrarily high number to preserve adequate precision when rendering.
|
||||
// This is also the same value as the EXTENT we are using for our tile buffer pos coordinates,
|
||||
// so math for modifying either is consistent.
|
||||
const float2 pos0 = (((float2(vertx.texture_pos) / 8192.0) - 0.5) / drawable.buffer_scale ) + 0.5;
|
||||
const float2 pos1 = (pos0 * drawable.scale_parent) + drawable.tl_parent;
|
||||
const float2 pos0 = (((float2(vertx.texture_pos) / 8192.0) - 0.5) / props.buffer_scale ) + 0.5;
|
||||
const float2 pos1 = (pos0 * props.scale_parent) + props.tl_parent;
|
||||
|
||||
return {
|
||||
.position = position,
|
||||
@@ -70,7 +74,7 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const RasterDrawableUBO& drawable [[buffer(2)]],
|
||||
device const RasterEvaluatedPropsUBO& props [[buffer(1)]],
|
||||
texture2d<float, access::sample> image0 [[texture(0)]],
|
||||
texture2d<float, access::sample> image1 [[texture(1)]],
|
||||
sampler image0_sampler [[sampler(0)]],
|
||||
@@ -88,26 +92,26 @@ half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
if (color1.a > 0.0) {
|
||||
color1.rgb = color1.rgb / color1.a;
|
||||
}
|
||||
float4 color = mix(color0, color1, drawable.fade_t);
|
||||
color.a *= drawable.opacity;
|
||||
float4 color = mix(color0, color1, props.fade_t);
|
||||
color.a *= props.opacity;
|
||||
float3 rgb = color.rgb;
|
||||
|
||||
// spin
|
||||
rgb = float3(
|
||||
dot(rgb, drawable.spin_weights.xyz),
|
||||
dot(rgb, drawable.spin_weights.zxy),
|
||||
dot(rgb, drawable.spin_weights.yzx));
|
||||
dot(rgb, props.spin_weights.xyz),
|
||||
dot(rgb, props.spin_weights.zxy),
|
||||
dot(rgb, props.spin_weights.yzx));
|
||||
|
||||
// saturation
|
||||
float average = (color.r + color.g + color.b) / 3.0;
|
||||
rgb += (average - rgb) * drawable.saturation_factor;
|
||||
rgb += (average - rgb) * props.saturation_factor;
|
||||
|
||||
// contrast
|
||||
rgb = (rgb - 0.5) * drawable.contrast_factor + 0.5;
|
||||
rgb = (rgb - 0.5) * props.contrast_factor + 0.5;
|
||||
|
||||
// brightness
|
||||
float3 high_vec = float3(drawable.brightness_low, drawable.brightness_low, drawable.brightness_low);
|
||||
float3 low_vec = float3(drawable.brightness_high, drawable.brightness_high, drawable.brightness_high);
|
||||
float3 high_vec = float3(props.brightness_low, props.brightness_low, props.brightness_low);
|
||||
float3 low_vec = float3(props.brightness_high, props.brightness_high, props.brightness_high);
|
||||
|
||||
return half4(half3(mix(high_vec, low_vec, rgb) * color.a), color.a);
|
||||
}
|
||||
|
||||
@@ -13,18 +13,9 @@
|
||||
|
||||
namespace mbgl {
|
||||
namespace shaders {
|
||||
struct AttributeInfo {
|
||||
constexpr AttributeInfo(std::size_t index_, gfx::AttributeDataType dataType_, std::size_t id_)
|
||||
: index(index_),
|
||||
dataType(dataType_),
|
||||
id(id_) {}
|
||||
std::size_t index;
|
||||
gfx::AttributeDataType dataType;
|
||||
std::size_t id;
|
||||
};
|
||||
struct UniformBlockInfo {
|
||||
constexpr UniformBlockInfo(std::size_t index_, bool vertex_, bool fragment_, std::size_t size_, std::size_t id_)
|
||||
: index(index_),
|
||||
constexpr UniformBlockInfo(bool vertex_, bool fragment_, std::size_t size_, std::size_t id_)
|
||||
: index(id_),
|
||||
vertex(vertex_),
|
||||
fragment(fragment_),
|
||||
size(size_),
|
||||
@@ -35,6 +26,15 @@ struct UniformBlockInfo {
|
||||
std::size_t size;
|
||||
std::size_t id;
|
||||
};
|
||||
struct AttributeInfo {
|
||||
constexpr AttributeInfo(std::size_t index_, gfx::AttributeDataType dataType_, std::size_t id_)
|
||||
: index(index_),
|
||||
dataType(dataType_),
|
||||
id(id_) {}
|
||||
std::size_t index;
|
||||
gfx::AttributeDataType dataType;
|
||||
std::size_t id;
|
||||
};
|
||||
struct TextureInfo {
|
||||
constexpr TextureInfo(std::size_t index_, std::size_t id_)
|
||||
: index(index_),
|
||||
|
||||
@@ -14,21 +14,21 @@ struct ShaderSource<BuiltIn::SymbolIconShader, gfx::Backend::Type::Metal> {
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 5> uniforms;
|
||||
static const std::array<AttributeInfo, 6> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 5> uniforms;
|
||||
static const std::array<TextureInfo, 1> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
struct VertexStage {
|
||||
float4 pos_offset [[attribute(0)]];
|
||||
float4 data [[attribute(1)]];
|
||||
float4 pixeloffset [[attribute(2)]];
|
||||
float3 projected_pos [[attribute(3)]];
|
||||
float fade_opacity [[attribute(4)]];
|
||||
float4 pos_offset [[attribute(5)]];
|
||||
float4 data [[attribute(6)]];
|
||||
float4 pixeloffset [[attribute(7)]];
|
||||
float3 projected_pos [[attribute(8)]];
|
||||
float fade_opacity [[attribute(9)]];
|
||||
|
||||
#if !defined(HAS_UNIFORM_u_opacity)
|
||||
float opacity [[attribute(5)]];
|
||||
float opacity [[attribute(10)]];
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -46,11 +46,11 @@ struct FragmentStage {
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const SymbolDrawableUBO& drawable [[buffer(6)]],
|
||||
device const SymbolDynamicUBO& dynamic [[buffer(7)]],
|
||||
device const SymbolDrawablePaintUBO& paint [[buffer(8)]],
|
||||
device const SymbolDrawableTilePropsUBO& props [[buffer(9)]],
|
||||
device const SymbolDrawableInterpolateUBO& interp [[buffer(10)]]) {
|
||||
device const SymbolDynamicUBO& dynamic [[buffer(0)]],
|
||||
device const SymbolDrawableUBO& drawable [[buffer(1)]],
|
||||
device const SymbolTilePropsUBO& tileprops [[buffer(2)]],
|
||||
device const SymbolInterpolateUBO& interp [[buffer(3)]],
|
||||
device const SymbolEvaluatedPropsUBO& paint [[buffer(4)]]) {
|
||||
|
||||
const float2 a_pos = vertx.pos_offset.xy;
|
||||
const float2 a_offset = vertx.pos_offset.zw;
|
||||
@@ -65,18 +65,18 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
const float segment_angle = -vertx.projected_pos[2];
|
||||
|
||||
float size;
|
||||
if (!props.is_size_zoom_constant && !props.is_size_feature_constant) {
|
||||
size = mix(a_size_min, a_size[1], props.size_t) / 128.0;
|
||||
} else if (props.is_size_zoom_constant && !props.is_size_feature_constant) {
|
||||
if (!tileprops.is_size_zoom_constant && !tileprops.is_size_feature_constant) {
|
||||
size = mix(a_size_min, a_size[1], tileprops.size_t) / 128.0;
|
||||
} else if (tileprops.is_size_zoom_constant && !tileprops.is_size_feature_constant) {
|
||||
size = a_size_min / 128.0;
|
||||
} else {
|
||||
size = props.size;
|
||||
size = tileprops.size;
|
||||
}
|
||||
|
||||
const float4 projectedPoint = drawable.matrix * float4(a_pos, 0, 1);
|
||||
const float camera_to_anchor_distance = projectedPoint.w;
|
||||
// See comments in symbol_sdf.vertex
|
||||
const float distance_ratio = props.pitch_with_map ?
|
||||
const float distance_ratio = tileprops.pitch_with_map ?
|
||||
camera_to_anchor_distance / dynamic.camera_to_center_distance :
|
||||
dynamic.camera_to_center_distance / camera_to_anchor_distance;
|
||||
const float perspective_ratio = clamp(
|
||||
@@ -86,7 +86,7 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
|
||||
size *= perspective_ratio;
|
||||
|
||||
const float fontScale = props.is_text ? size / 24.0 : size;
|
||||
const float fontScale = tileprops.is_text ? size / 24.0 : size;
|
||||
|
||||
float symbol_rotation = 0.0;
|
||||
if (drawable.rotate_symbol) {
|
||||
@@ -123,8 +123,10 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const SymbolDrawableUBO& drawable [[buffer(6)]],
|
||||
device const SymbolDrawablePaintUBO& paint [[buffer(8)]],
|
||||
device const SymbolDynamicUBO& dynamic [[buffer(0)]],
|
||||
device const SymbolDrawableUBO& drawable [[buffer(1)]],
|
||||
device const SymbolTilePropsUBO& tileprops [[buffer(2)]],
|
||||
device const SymbolEvaluatedPropsUBO& props [[buffer(4)]],
|
||||
texture2d<float, access::sample> image [[texture(0)]],
|
||||
sampler image_sampler [[sampler(0)]]) {
|
||||
#if defined(OVERDRAW_INSPECTOR)
|
||||
@@ -132,7 +134,7 @@ half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
#endif
|
||||
|
||||
#if defined(HAS_UNIFORM_u_opacity)
|
||||
const float opacity = paint.opacity * in.fade_opacity;
|
||||
const float opacity = (tileprops.is_text ? props.text_opacity : props.icon_opacity) * in.fade_opacity;
|
||||
#else
|
||||
const float opacity = in.opacity; // fade_opacity is baked in for this case
|
||||
#endif
|
||||
|
||||
@@ -14,33 +14,33 @@ struct ShaderSource<BuiltIn::SymbolSDFIconShader, gfx::Backend::Type::Metal> {
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 5> uniforms;
|
||||
static const std::array<AttributeInfo, 10> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 5> uniforms;
|
||||
static const std::array<TextureInfo, 1> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
struct VertexStage {
|
||||
float4 pos_offset [[attribute(0)]];
|
||||
float4 data [[attribute(1)]];
|
||||
float4 pixeloffset [[attribute(2)]];
|
||||
float3 projected_pos [[attribute(3)]];
|
||||
float fade_opacity [[attribute(4)]];
|
||||
float4 pos_offset [[attribute(5)]];
|
||||
float4 data [[attribute(6)]];
|
||||
float4 pixeloffset [[attribute(7)]];
|
||||
float3 projected_pos [[attribute(8)]];
|
||||
float fade_opacity [[attribute(9)]];
|
||||
|
||||
#if !defined(HAS_UNIFORM_u_fill_color)
|
||||
float4 fill_color [[attribute(5)]];
|
||||
float4 fill_color [[attribute(10)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_halo_color)
|
||||
float4 halo_color [[attribute(6)]];
|
||||
float4 halo_color [[attribute(11)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_opacity)
|
||||
float opacity [[attribute(7)]];
|
||||
float opacity [[attribute(12)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_halo_width)
|
||||
float halo_width [[attribute(8)]];
|
||||
float halo_width [[attribute(13)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_halo_blur)
|
||||
float halo_blur [[attribute(9)]];
|
||||
float halo_blur [[attribute(14)]];
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -71,11 +71,11 @@ struct FragmentStage {
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const SymbolDrawableUBO& drawable [[buffer(10)]],
|
||||
device const SymbolDynamicUBO& dynamic [[buffer(11)]],
|
||||
device const SymbolDrawablePaintUBO& paint [[buffer(12)]],
|
||||
device const SymbolDrawableTilePropsUBO& props [[buffer(13)]],
|
||||
device const SymbolDrawableInterpolateUBO& interp [[buffer(14)]]) {
|
||||
device const SymbolDynamicUBO& dynamic [[buffer(0)]],
|
||||
device const SymbolDrawableUBO& drawable [[buffer(1)]],
|
||||
device const SymbolTilePropsUBO& tileprops [[buffer(2)]],
|
||||
device const SymbolInterpolateUBO& interp [[buffer(3)]],
|
||||
device const SymbolEvaluatedPropsUBO& props [[buffer(4)]]) {
|
||||
|
||||
const float2 a_pos = vertx.pos_offset.xy;
|
||||
const float2 a_offset = vertx.pos_offset.zw;
|
||||
@@ -89,12 +89,12 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
const float segment_angle = -vertx.projected_pos[2];
|
||||
|
||||
float size;
|
||||
if (!props.is_size_zoom_constant && !props.is_size_feature_constant) {
|
||||
size = mix(a_size_min, a_size[1], props.size_t) / 128.0;
|
||||
} else if (props.is_size_zoom_constant && !props.is_size_feature_constant) {
|
||||
if (!tileprops.is_size_zoom_constant && !tileprops.is_size_feature_constant) {
|
||||
size = mix(a_size_min, a_size[1], tileprops.size_t) / 128.0;
|
||||
} else if (tileprops.is_size_zoom_constant && !tileprops.is_size_feature_constant) {
|
||||
size = a_size_min / 128.0;
|
||||
} else {
|
||||
size = props.size;
|
||||
size = tileprops.size;
|
||||
}
|
||||
|
||||
const float4 projectedPoint = drawable.matrix * float4(a_pos, 0, 1);
|
||||
@@ -105,7 +105,7 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
// If the label isn't pitched with the map, we do layout in viewport space,
|
||||
// which makes labels in the distance larger relative to the features around
|
||||
// them. We counteract part of that effect by dividing by the perspective ratio.
|
||||
const float distance_ratio = props.pitch_with_map ?
|
||||
const float distance_ratio = tileprops.pitch_with_map ?
|
||||
camera_to_anchor_distance / dynamic.camera_to_center_distance :
|
||||
dynamic.camera_to_center_distance / camera_to_anchor_distance;
|
||||
const float perspective_ratio = clamp(
|
||||
@@ -115,7 +115,7 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
|
||||
size *= perspective_ratio;
|
||||
|
||||
const float fontScale = props.is_text ? size / 24.0 : size;
|
||||
const float fontScale = tileprops.is_text ? size / 24.0 : size;
|
||||
|
||||
float symbol_rotation = 0.0;
|
||||
if (drawable.rotate_symbol) {
|
||||
@@ -165,10 +165,10 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const SymbolDrawableUBO& drawable [[buffer(10)]],
|
||||
device const SymbolDynamicUBO& dynamic [[buffer(11)]],
|
||||
device const SymbolDrawablePaintUBO& paint [[buffer(12)]],
|
||||
device const SymbolDrawableTilePropsUBO& props [[buffer(13)]],
|
||||
device const SymbolDynamicUBO& dynamic [[buffer(0)]],
|
||||
device const SymbolDrawableUBO& drawable [[buffer(1)]],
|
||||
device const SymbolTilePropsUBO& tileprops [[buffer(2)]],
|
||||
device const SymbolEvaluatedPropsUBO& props [[buffer(4)]],
|
||||
texture2d<float, access::sample> image [[texture(0)]],
|
||||
sampler image_sampler [[sampler(0)]]) {
|
||||
#if defined(OVERDRAW_INSPECTOR)
|
||||
@@ -176,36 +176,36 @@ half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
#endif
|
||||
|
||||
#if defined(HAS_UNIFORM_u_fill_color)
|
||||
const half4 fill_color = half4(paint.fill_color);
|
||||
const half4 fill_color = half4(tileprops.is_text ? props.text_fill_color : props.icon_fill_color);
|
||||
#else
|
||||
const half4 fill_color = in.fill_color;
|
||||
#endif
|
||||
#if defined(HAS_UNIFORM_u_halo_color)
|
||||
const half4 halo_color = half4(paint.halo_color);
|
||||
const half4 halo_color = half4(tileprops.is_text ? props.text_halo_color : props.icon_halo_color);
|
||||
#else
|
||||
const half4 halo_color = in.halo_color;
|
||||
#endif
|
||||
#if defined(HAS_UNIFORM_u_opacity)
|
||||
const float opacity = paint.opacity;
|
||||
const float opacity = tileprops.is_text ? props.text_opacity : props.icon_opacity;
|
||||
#else
|
||||
const float opacity = in.opacity;
|
||||
#endif
|
||||
#if defined(HAS_UNIFORM_u_halo_width)
|
||||
const float halo_width = paint.halo_width;
|
||||
const float halo_width = tileprops.is_text ? props.text_halo_width : props.icon_halo_width;
|
||||
#else
|
||||
const float halo_width = in.halo_width;
|
||||
#endif
|
||||
#if defined(HAS_UNIFORM_u_halo_blur)
|
||||
const float halo_blur = paint.halo_blur;
|
||||
const float halo_blur = tileprops.is_text ? props.text_halo_blur : props.icon_halo_blur;
|
||||
#else
|
||||
const float halo_blur = in.halo_blur;
|
||||
#endif
|
||||
|
||||
const float EDGE_GAMMA = 0.105 / DEVICE_PIXEL_RATIO;
|
||||
const float fontGamma = in.fontScale * drawable.gamma_scale;
|
||||
const half4 color = props.is_halo ? halo_color : fill_color;
|
||||
const float gamma = ((props.is_halo ? (halo_blur * 1.19 / SDF_PX) : 0) + EDGE_GAMMA) / fontGamma;
|
||||
const float buff = props.is_halo ? (6.0 - halo_width / in.fontScale) / SDF_PX : (256.0 - 64.0) / 256.0;
|
||||
const half4 color = tileprops.is_halo ? halo_color : fill_color;
|
||||
const float gamma = ((tileprops.is_halo ? (halo_blur * 1.19 / SDF_PX) : 0) + EDGE_GAMMA) / fontGamma;
|
||||
const float buff = tileprops.is_halo ? (6.0 - halo_width / in.fontScale) / SDF_PX : (256.0 - 64.0) / 256.0;
|
||||
const float dist = image.sample(image_sampler, float2(in.tex)).a;
|
||||
const float gamma_scaled = gamma * in.gamma_scale;
|
||||
const float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);
|
||||
|
||||
@@ -14,9 +14,9 @@ struct ShaderSource<BuiltIn::SymbolTextAndIconShader, gfx::Backend::Type::Metal>
|
||||
static constexpr auto vertexMainFunction = "vertexMain";
|
||||
static constexpr auto fragmentMainFunction = "fragmentMain";
|
||||
|
||||
static const std::array<UniformBlockInfo, 5> uniforms;
|
||||
static const std::array<AttributeInfo, 9> attributes;
|
||||
static constexpr std::array<AttributeInfo, 0> instanceAttributes{};
|
||||
static const std::array<UniformBlockInfo, 5> uniforms;
|
||||
static const std::array<TextureInfo, 2> textures;
|
||||
|
||||
static constexpr auto source = R"(
|
||||
@@ -24,25 +24,25 @@ struct ShaderSource<BuiltIn::SymbolTextAndIconShader, gfx::Backend::Type::Metal>
|
||||
#define ICON 0.0
|
||||
|
||||
struct VertexStage {
|
||||
float4 pos_offset [[attribute(0)]];
|
||||
float4 data [[attribute(1)]];
|
||||
float3 projected_pos [[attribute(2)]];
|
||||
float fade_opacity [[attribute(3)]];
|
||||
float4 pos_offset [[attribute(5)]];
|
||||
float4 data [[attribute(6)]];
|
||||
float3 projected_pos [[attribute(7)]];
|
||||
float fade_opacity [[attribute(8)]];
|
||||
|
||||
#if !defined(HAS_UNIFORM_u_fill_color)
|
||||
float4 fill_color [[attribute(4)]];
|
||||
float4 fill_color [[attribute(9)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_halo_color)
|
||||
float4 halo_color [[attribute(5)]];
|
||||
float4 halo_color [[attribute(10)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_opacity)
|
||||
float opacity [[attribute(6)]];
|
||||
float opacity [[attribute(11)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_halo_width)
|
||||
float halo_width [[attribute(7)]];
|
||||
float halo_width [[attribute(12)]];
|
||||
#endif
|
||||
#if !defined(HAS_UNIFORM_u_halo_blur)
|
||||
float halo_blur [[attribute(8)]];
|
||||
float halo_blur [[attribute(13)]];
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -75,11 +75,11 @@ struct FragmentStage {
|
||||
};
|
||||
|
||||
FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
device const SymbolDrawableUBO& drawable [[buffer(9)]],
|
||||
device const SymbolDynamicUBO& dynamic [[buffer(10)]],
|
||||
device const SymbolDrawablePaintUBO& paint [[buffer(11)]],
|
||||
device const SymbolDrawableTilePropsUBO& props [[buffer(12)]],
|
||||
device const SymbolDrawableInterpolateUBO& interp [[buffer(13)]]) {
|
||||
device const SymbolDynamicUBO& dynamic [[buffer(0)]],
|
||||
device const SymbolDrawableUBO& drawable [[buffer(1)]],
|
||||
device const SymbolTilePropsUBO& tileprops [[buffer(2)]],
|
||||
device const SymbolInterpolateUBO& interp [[buffer(3)]],
|
||||
device const SymbolEvaluatedPropsUBO& props [[buffer(4)]]) {
|
||||
|
||||
const float2 a_pos = vertx.pos_offset.xy;
|
||||
const float2 a_offset = vertx.pos_offset.zw;
|
||||
@@ -93,12 +93,12 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
const float segment_angle = -vertx.projected_pos[2];
|
||||
|
||||
float size;
|
||||
if (!props.is_size_zoom_constant && !props.is_size_feature_constant) {
|
||||
size = mix(a_size_min, a_size[1], props.size_t) / 128.0;
|
||||
} else if (props.is_size_zoom_constant && !props.is_size_feature_constant) {
|
||||
if (!tileprops.is_size_zoom_constant && !tileprops.is_size_feature_constant) {
|
||||
size = mix(a_size_min, a_size[1], tileprops.size_t) / 128.0;
|
||||
} else if (tileprops.is_size_zoom_constant && !tileprops.is_size_feature_constant) {
|
||||
size = a_size_min / 128.0;
|
||||
} else {
|
||||
size = props.size;
|
||||
size = tileprops.size;
|
||||
}
|
||||
|
||||
const float4 projectedPoint = drawable.matrix * float4(a_pos, 0, 1);
|
||||
@@ -109,7 +109,7 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
// If the label isn't pitched with the map, we do layout in viewport space,
|
||||
// which makes labels in the distance larger relative to the features around
|
||||
// them. We counteract part of that effect by dividing by the perspective ratio.
|
||||
const float distance_ratio = props.pitch_with_map ?
|
||||
const float distance_ratio = tileprops.pitch_with_map ?
|
||||
camera_to_anchor_distance / dynamic.camera_to_center_distance :
|
||||
dynamic.camera_to_center_distance / camera_to_anchor_distance;
|
||||
const float perspective_ratio = clamp(
|
||||
@@ -175,10 +175,10 @@ FragmentStage vertex vertexMain(thread const VertexStage vertx [[stage_in]],
|
||||
}
|
||||
|
||||
half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
device const SymbolDrawableUBO& drawable [[buffer(9)]],
|
||||
device const SymbolDynamicUBO& dynamic [[buffer(10)]],
|
||||
device const SymbolDrawablePaintUBO& paint [[buffer(11)]],
|
||||
device const SymbolDrawableTilePropsUBO& props [[buffer(12)]],
|
||||
device const SymbolDynamicUBO& dynamic [[buffer(0)]],
|
||||
device const SymbolDrawableUBO& drawable [[buffer(1)]],
|
||||
device const SymbolTilePropsUBO& tileprops [[buffer(2)]],
|
||||
device const SymbolEvaluatedPropsUBO& props [[buffer(4)]],
|
||||
texture2d<float, access::sample> glyph_image [[texture(0)]],
|
||||
texture2d<float, access::sample> icon_image [[texture(1)]],
|
||||
sampler glyph_sampler [[sampler(0)]],
|
||||
@@ -188,27 +188,27 @@ half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
#endif
|
||||
|
||||
#if defined(HAS_UNIFORM_u_fill_color)
|
||||
const half4 fill_color = half4(paint.fill_color);
|
||||
const half4 fill_color = half4(tileprops.is_text ? props.text_fill_color : props.icon_fill_color);
|
||||
#else
|
||||
const half4 fill_color = in.fill_color;
|
||||
#endif
|
||||
#if defined(HAS_UNIFORM_u_halo_color)
|
||||
const half4 halo_color = half4(paint.halo_color);
|
||||
const half4 halo_color = half4(tileprops.is_text ? props.text_halo_color : props.icon_halo_color);
|
||||
#else
|
||||
const half4 halo_color = in.halo_color;
|
||||
#endif
|
||||
#if defined(HAS_UNIFORM_u_opacity)
|
||||
const half opacity = half(paint.opacity);
|
||||
const half opacity = half(tileprops.is_text ? props.text_opacity : props.icon_opacity);
|
||||
#else
|
||||
const half opacity = in.opacity;
|
||||
#endif
|
||||
#if defined(HAS_UNIFORM_u_halo_width)
|
||||
const half halo_width = half(paint.halo_width);
|
||||
const half halo_width = half(tileprops.is_text ? props.text_halo_width : props.icon_halo_width);
|
||||
#else
|
||||
const half halo_width = in.halo_width;
|
||||
#endif
|
||||
#if defined(HAS_UNIFORM_u_halo_blur)
|
||||
const half halo_blur = half(paint.halo_blur);
|
||||
const half halo_blur = half(tileprops.is_text ? props.text_halo_blur : props.icon_halo_blur);
|
||||
#else
|
||||
const half halo_blur = in.halo_blur;
|
||||
#endif
|
||||
@@ -219,10 +219,10 @@ half4 fragment fragmentMain(FragmentStage in [[stage_in]],
|
||||
}
|
||||
|
||||
const float EDGE_GAMMA = 0.105 / DEVICE_PIXEL_RATIO;
|
||||
const half4 color = props.is_halo ? halo_color : fill_color;
|
||||
const half4 color = tileprops.is_halo ? halo_color : fill_color;
|
||||
const float fontGamma = in.fontScale * drawable.gamma_scale;
|
||||
const float gamma = ((props.is_halo ? (halo_blur * 1.19 / SDF_PX) : 0) + EDGE_GAMMA) / fontGamma;
|
||||
const float buff = props.is_halo ? (6.0 - halo_width / in.fontScale) / SDF_PX : (256.0 - 64.0) / 256.0;
|
||||
const float gamma = ((tileprops.is_halo ? (halo_blur * 1.19 / SDF_PX) : 0) + EDGE_GAMMA) / fontGamma;
|
||||
const float buff = tileprops.is_halo ? (6.0 - halo_width / in.fontScale) / SDF_PX : (256.0 - 64.0) / 256.0;
|
||||
const float dist = glyph_image.sample(glyph_sampler, float2(in.tex)).a;
|
||||
const float gamma_scaled = gamma * in.gamma_scale;
|
||||
const float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);
|
||||
|
||||
@@ -14,14 +14,14 @@ struct ShaderSource<BuiltIn::WideVectorShader, gfx::Backend::Type::Metal> {
|
||||
static constexpr auto vertexMainFunction = "vertexTri_wideVecPerf";
|
||||
static constexpr auto fragmentMainFunction = "fragmentTri_wideVecPerf";
|
||||
|
||||
static constexpr std::array<AttributeInfo, 3> attributes{
|
||||
AttributeInfo{0, gfx::AttributeDataType::Float3, idWideVectorScreenPos},
|
||||
AttributeInfo{1, gfx::AttributeDataType::Float4, idWideVectorColor},
|
||||
AttributeInfo{2, gfx::AttributeDataType::Int, idWideVectorIndex}};
|
||||
static constexpr std::array<UniformBlockInfo, 2> uniforms{
|
||||
UniformBlockInfo{3, true, false, sizeof(WideVectorUniformsUBO), idWideVectorUniformsUBO},
|
||||
UniformBlockInfo{4, true, false, sizeof(WideVectorUniformWideVecUBO), idWideVectorUniformWideVecUBO},
|
||||
UniformBlockInfo{true, false, sizeof(WideVectorUniformsUBO), idWideVectorUniformsUBO},
|
||||
UniformBlockInfo{true, false, sizeof(WideVectorUniformWideVecUBO), idWideVectorUniformWideVecUBO},
|
||||
};
|
||||
static constexpr std::array<AttributeInfo, 3> attributes{
|
||||
AttributeInfo{wideVectorUBOCount + 0, gfx::AttributeDataType::Float3, idWideVectorScreenPos},
|
||||
AttributeInfo{wideVectorUBOCount + 1, gfx::AttributeDataType::Float4, idWideVectorColor},
|
||||
AttributeInfo{wideVectorUBOCount + 2, gfx::AttributeDataType::Int, idWideVectorIndex}};
|
||||
static constexpr std::array<AttributeInfo, 4> instanceAttributes{
|
||||
AttributeInfo{5, gfx::AttributeDataType::Float3, idWideVectorInstanceCenter},
|
||||
AttributeInfo{5, gfx::AttributeDataType::Float4, idWideVectorInstanceColor},
|
||||
@@ -112,9 +112,9 @@ typedef struct
|
||||
struct VertexTriWideVecB
|
||||
{
|
||||
// x, y offset around the center
|
||||
float3 screenPos [[attribute(0)]];
|
||||
float4 color [[attribute(1)]];
|
||||
int index [[attribute(2)]];
|
||||
float3 screenPos [[attribute(2)]];
|
||||
float4 color [[attribute(3)]];
|
||||
int index [[attribute(4)]];
|
||||
};
|
||||
|
||||
// Wide vector vertex passed to fragment shader (new version)
|
||||
@@ -221,8 +221,8 @@ constant constexpr float4 discardPt(0,0,-1e6,NAN);
|
||||
// Performance version of wide vector shader
|
||||
vertex ProjVertexTriWideVecPerf vertexTri_wideVecPerf(
|
||||
thread const VertexTriWideVecB vert [[ stage_in ]],
|
||||
constant Uniforms &uniforms [[ buffer(3) ]],
|
||||
constant UniformWideVec &wideVec [[ buffer(4) ]],
|
||||
constant Uniforms &uniforms [[ buffer(0) ]],
|
||||
constant UniformWideVec &wideVec [[ buffer(1) ]],
|
||||
uint instanceID [[ instance_id ]],
|
||||
constant VertexTriWideVecInstance *wideVecInsts [[ buffer(5) ]])
|
||||
{
|
||||
@@ -563,7 +563,7 @@ vertex ProjVertexTriWideVecPerf vertexTri_wideVecPerf(
|
||||
// Fragment shader that takes the back of the globe into account
|
||||
fragment float4 fragmentTri_wideVecPerf(
|
||||
ProjVertexTriWideVecPerf vert [[stage_in]],
|
||||
constant Uniforms &uniforms [[ buffer(3) ]])
|
||||
constant Uniforms &uniforms [[ buffer(0) ]])
|
||||
{
|
||||
float patternAlpha = 1.0;
|
||||
|
||||
|
||||
@@ -7,6 +7,10 @@ namespace shaders {
|
||||
|
||||
struct alignas(16) RasterDrawableUBO {
|
||||
std::array<float, 4 * 4> matrix;
|
||||
};
|
||||
static_assert(sizeof(RasterDrawableUBO) == 64);
|
||||
|
||||
struct alignas(16) RasterEvaluatedPropsUBO {
|
||||
std::array<float, 4> spin_weights;
|
||||
std::array<float, 2> tl_parent;
|
||||
float scale_parent;
|
||||
@@ -19,11 +23,11 @@ struct alignas(16) RasterDrawableUBO {
|
||||
float contrast_factor;
|
||||
float pad1, pad2;
|
||||
};
|
||||
static_assert(sizeof(RasterDrawableUBO) == 128);
|
||||
static_assert(sizeof(RasterDrawableUBO) % 16 == 0);
|
||||
static_assert(sizeof(RasterEvaluatedPropsUBO) == 64);
|
||||
|
||||
enum {
|
||||
idRasterDrawableUBO,
|
||||
idRasterEvaluatedPropsUBO,
|
||||
rasterUBOCount
|
||||
};
|
||||
|
||||
|
||||
@@ -34,19 +34,12 @@ static constexpr auto maxUBOCountPerShader = std::max({static_cast<size_t>(backg
|
||||
static_cast<size_t>(customSymbolUBOCount),
|
||||
static_cast<size_t>(debugUBOCount),
|
||||
static_cast<size_t>(fillUBOCount),
|
||||
static_cast<size_t>(fillOutlineUBOCount),
|
||||
static_cast<size_t>(fillPatternUBOCount),
|
||||
static_cast<size_t>(fillOutlinePatternUBOCount),
|
||||
static_cast<size_t>(fillOutlineTriangulatedUBOCount),
|
||||
static_cast<size_t>(fillExtrusionUBOCount),
|
||||
static_cast<size_t>(heatmapUBOCount),
|
||||
static_cast<size_t>(heatmapTextureUBOCount),
|
||||
static_cast<size_t>(hillshadeUBOCount),
|
||||
static_cast<size_t>(hillshadePrepareUBOCount),
|
||||
static_cast<size_t>(lineUBOCount),
|
||||
static_cast<size_t>(lineGradientUBOCount),
|
||||
static_cast<size_t>(linePatternUBOCount),
|
||||
static_cast<size_t>(lineSDFUBOCount),
|
||||
static_cast<size_t>(rasterUBOCount),
|
||||
static_cast<size_t>(symbolUBOCount),
|
||||
static_cast<size_t>(wideVectorUBOCount)});
|
||||
|
||||
@@ -5,31 +5,15 @@
|
||||
namespace mbgl {
|
||||
namespace shaders {
|
||||
|
||||
/// Evaluated properties that depend on the tile
|
||||
struct alignas(16) SymbolDrawableTilePropsUBO {
|
||||
/* 0 */ /*bool*/ int is_text;
|
||||
/* 4 */ /*bool*/ int is_halo;
|
||||
/* 8 */ /*bool*/ int pitch_with_map;
|
||||
/* 12 */ /*bool*/ int is_size_zoom_constant;
|
||||
/* 16 */ /*bool*/ int is_size_feature_constant;
|
||||
/* 20 */ float size_t;
|
||||
/* 24 */ float size;
|
||||
/* 28 */ float padding;
|
||||
/* 32 */
|
||||
/// Dynamic UBO
|
||||
struct alignas(16) SymbolDynamicUBO {
|
||||
/* 0 */ float fade_change;
|
||||
/* 4 */ float camera_to_center_distance;
|
||||
/* 8 */ float aspect_ratio;
|
||||
/* 12 */ float pad;
|
||||
/* 16 */
|
||||
};
|
||||
static_assert(sizeof(SymbolDrawableTilePropsUBO) == 2 * 16);
|
||||
|
||||
/// Attribute interpolations
|
||||
struct alignas(16) SymbolDrawableInterpolateUBO {
|
||||
/* 0 */ float fill_color_t;
|
||||
/* 4 */ float halo_color_t;
|
||||
/* 8 */ float opacity_t;
|
||||
/* 12 */ float halo_width_t;
|
||||
/* 16 */ float halo_blur_t;
|
||||
/* 20 */ float pad1, pad2, pad3;
|
||||
/* 32 */
|
||||
};
|
||||
static_assert(sizeof(SymbolDrawableInterpolateUBO) == 32);
|
||||
static_assert(sizeof(SymbolDynamicUBO) == 16);
|
||||
|
||||
struct alignas(16) SymbolDrawableUBO {
|
||||
/* 0 */ std::array<float, 4 * 4> matrix;
|
||||
@@ -47,34 +31,56 @@ struct alignas(16) SymbolDrawableUBO {
|
||||
};
|
||||
static_assert(sizeof(SymbolDrawableUBO) == 14 * 16);
|
||||
|
||||
/// Dynamic UBO
|
||||
struct alignas(16) SymbolDynamicUBO {
|
||||
/* 0 */ float fade_change;
|
||||
/* 4 */ float camera_to_center_distance;
|
||||
/* 8 */ float aspect_ratio;
|
||||
/* 12 */ float pad;
|
||||
/* 16 */
|
||||
/// Evaluated properties that depend on the tile
|
||||
struct alignas(16) SymbolTilePropsUBO {
|
||||
/* 0 */ /*bool*/ int is_text;
|
||||
/* 4 */ /*bool*/ int is_halo;
|
||||
/* 8 */ /*bool*/ int pitch_with_map;
|
||||
/* 12 */ /*bool*/ int is_size_zoom_constant;
|
||||
/* 16 */ /*bool*/ int is_size_feature_constant;
|
||||
/* 20 */ float size_t;
|
||||
/* 24 */ float size;
|
||||
/* 28 */ float padding;
|
||||
/* 32 */
|
||||
};
|
||||
static_assert(sizeof(SymbolDynamicUBO) == 16);
|
||||
static_assert(sizeof(SymbolTilePropsUBO) == 2 * 16);
|
||||
|
||||
/// Attribute interpolations
|
||||
struct alignas(16) SymbolInterpolateUBO {
|
||||
/* 0 */ float fill_color_t;
|
||||
/* 4 */ float halo_color_t;
|
||||
/* 8 */ float opacity_t;
|
||||
/* 12 */ float halo_width_t;
|
||||
/* 16 */ float halo_blur_t;
|
||||
/* 20 */ float pad1, pad2, pad3;
|
||||
/* 32 */
|
||||
};
|
||||
static_assert(sizeof(SymbolInterpolateUBO) == 32);
|
||||
|
||||
/// Evaluated properties that do not depend on the tile
|
||||
struct alignas(16) SymbolDrawablePaintUBO {
|
||||
/* 0 */ Color fill_color;
|
||||
/* 16 */ Color halo_color;
|
||||
/* 32 */ float opacity;
|
||||
/* 36 */ float halo_width;
|
||||
/* 40 */ float halo_blur;
|
||||
/* 44 */ float padding;
|
||||
/* 48 */
|
||||
struct alignas(16) SymbolEvaluatedPropsUBO {
|
||||
/* 0 */ Color text_fill_color;
|
||||
/* 16 */ Color text_halo_color;
|
||||
/* 32 */ float text_opacity;
|
||||
/* 36 */ float text_halo_width;
|
||||
/* 40 */ float text_halo_blur;
|
||||
/* 44 */ float pad1;
|
||||
/* 48 */ Color icon_fill_color;
|
||||
/* 64 */ Color icon_halo_color;
|
||||
/* 80 */ float icon_opacity;
|
||||
/* 84 */ float icon_halo_width;
|
||||
/* 88 */ float icon_halo_blur;
|
||||
/* 92 */ float pad2;
|
||||
/* 96 */
|
||||
};
|
||||
static_assert(sizeof(SymbolDrawablePaintUBO) == 3 * 16);
|
||||
static_assert(sizeof(SymbolEvaluatedPropsUBO) == 6 * 16);
|
||||
|
||||
enum {
|
||||
idSymbolDrawableUBO,
|
||||
idSymbolDynamicUBO,
|
||||
idSymbolDrawablePaintUBO,
|
||||
idSymbolDrawableTilePropsUBO,
|
||||
idSymbolDrawableInterpolateUBO,
|
||||
idSymbolDrawableUBO,
|
||||
idSymbolTilePropsUBO,
|
||||
idSymbolInterpolateUBO,
|
||||
idSymbolEvaluatedPropsUBO,
|
||||
symbolUBOCount
|
||||
};
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
layout (std140) uniform BackgroundLayerUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec4 u_opacity_pad3;
|
||||
highp float u_opacity;
|
||||
highp float layer_pad1, layer_pad2, layer_pad3;
|
||||
};
|
||||
|
||||
void main() {
|
||||
fragColor = u_color * u_opacity_pad3.x;
|
||||
fragColor = u_color * u_opacity;
|
||||
#ifdef OVERDRAW_INSPECTOR
|
||||
fragColor = vec4(1.0);
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
layout (std140) uniform BackgroundLayerUBO {
|
||||
layout (std140) uniform BackgroundPatternLayerUBO {
|
||||
highp vec2 u_pattern_tl_a;
|
||||
highp vec2 u_pattern_br_a;
|
||||
highp vec2 u_pattern_tl_b;
|
||||
@@ -6,14 +6,11 @@ layout (std140) uniform BackgroundLayerUBO {
|
||||
highp vec2 u_texsize;
|
||||
highp vec2 u_pattern_size_a;
|
||||
highp vec2 u_pattern_size_b;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp float u_tile_units_to_pixels;
|
||||
highp float u_scale_a;
|
||||
highp float u_scale_b;
|
||||
highp float u_mix;
|
||||
highp float u_opacity;
|
||||
highp float pad;
|
||||
highp float layer_pad1, layer_pad2;
|
||||
};
|
||||
|
||||
uniform sampler2D u_image;
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
layout (std140) uniform BackgroundDrawableUBO {
|
||||
layout (std140) uniform BackgroundPatternDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp float u_tile_units_to_pixels;
|
||||
highp float drawable_pad1, drawable_pad2, drawable_pad3;
|
||||
};
|
||||
layout (std140) uniform BackgroundLayerUBO {
|
||||
layout (std140) uniform BackgroundPatternLayerUBO {
|
||||
highp vec2 u_pattern_tl_a;
|
||||
highp vec2 u_pattern_br_a;
|
||||
highp vec2 u_pattern_tl_b;
|
||||
@@ -9,14 +13,11 @@ layout (std140) uniform BackgroundLayerUBO {
|
||||
highp vec2 u_texsize;
|
||||
highp vec2 u_pattern_size_a;
|
||||
highp vec2 u_pattern_size_b;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp float u_tile_units_to_pixels;
|
||||
highp float u_scale_a;
|
||||
highp float u_scale_b;
|
||||
highp float u_mix;
|
||||
highp float u_opacity;
|
||||
highp float pad;
|
||||
highp float layer_pad1, layer_pad2;
|
||||
};
|
||||
|
||||
layout (location = 0) in vec2 a_pos;
|
||||
|
||||
@@ -10,7 +10,7 @@ layout (std140) uniform CircleEvaluatedPropsUBO {
|
||||
lowp float u_stroke_opacity;
|
||||
bool u_scale_with_map;
|
||||
bool u_pitch_with_map;
|
||||
lowp float pad0_;
|
||||
lowp float props_pad1;
|
||||
};
|
||||
|
||||
#pragma mapbox: define highp vec4 color
|
||||
|
||||
@@ -4,13 +4,13 @@ out vec3 v_data;
|
||||
layout (std140) uniform CircleDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec2 u_extrude_scale;
|
||||
lowp vec2 pad2_;
|
||||
lowp vec2 drawable_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform CirclePaintParamsUBO {
|
||||
highp float u_camera_to_center_distance;
|
||||
lowp float pad3_;
|
||||
lowp vec2 pad4_;
|
||||
lowp float params_pad1;
|
||||
lowp vec2 params_pad2;
|
||||
};
|
||||
|
||||
layout (std140) uniform CircleEvaluatedPropsUBO {
|
||||
@@ -23,7 +23,7 @@ layout (std140) uniform CircleEvaluatedPropsUBO {
|
||||
lowp float u_stroke_opacity;
|
||||
bool u_scale_with_map;
|
||||
bool u_pitch_with_map;
|
||||
lowp float pad0_;
|
||||
lowp float props_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform CircleInterpolateUBO {
|
||||
@@ -34,7 +34,7 @@ layout (std140) uniform CircleInterpolateUBO {
|
||||
lowp float u_stroke_color_t;
|
||||
lowp float u_stroke_width_t;
|
||||
lowp float u_stroke_opacity_t;
|
||||
lowp float pad1_;
|
||||
lowp float interp_pad1;
|
||||
};
|
||||
|
||||
#pragma mapbox: define highp vec4 color
|
||||
|
||||
@@ -13,7 +13,7 @@ layout(std140) uniform CustomSymbolIconParametersUBO {
|
||||
bool u_pitch_with_map;
|
||||
highp float u_camera_to_center_distance;
|
||||
highp float u_aspect_ratio;
|
||||
highp float pad0, pad1, pad3;
|
||||
highp float params_pad1, params_pad2, params_pad3;
|
||||
};
|
||||
|
||||
out vec2 v_tex;
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp float u_opacity;
|
||||
highp float padding_props1;
|
||||
highp float padding_props2;
|
||||
highp float padding_props3;
|
||||
};
|
||||
layout (std140) uniform FillInterpolateUBO {
|
||||
highp float u_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float pad_interp_1, pad_interp_2;
|
||||
highp float interp_pad1, interp_pad2;
|
||||
};
|
||||
layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_width;
|
||||
highp float props_pad1;
|
||||
};
|
||||
|
||||
#pragma mapbox: define highp vec4 color
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
layout (std140) uniform FillDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
};
|
||||
layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp float u_opacity;
|
||||
highp float padding_props1;
|
||||
highp float padding_props2;
|
||||
highp float padding_props3;
|
||||
};
|
||||
layout (std140) uniform FillInterpolateUBO {
|
||||
highp float u_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float pad_interp_1, pad_interp_2;
|
||||
highp float interp_pad1, interp_pad2;
|
||||
};
|
||||
layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_width;
|
||||
highp float props_pad1;
|
||||
};
|
||||
|
||||
layout (location = 0) in vec2 a_pos;
|
||||
|
||||
@@ -2,7 +2,29 @@ layout (location = 0) in vec2 a_pos;
|
||||
layout (location = 1) in vec4 a_normal_ed;
|
||||
out vec4 v_color;
|
||||
|
||||
layout (std140) uniform FillExtrusionDrawableTilePropsUBO {
|
||||
layout (std140) uniform FillExtrusionDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec4 u_scale;
|
||||
highp vec2 u_texsize;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp float u_height_factor;
|
||||
highp float drawable_pad1;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec3 u_lightcolor;
|
||||
highp float props_pad1;
|
||||
highp vec3 u_lightpos;
|
||||
highp float u_base;
|
||||
highp float u_height;
|
||||
highp float u_lightintensity;
|
||||
highp float u_vertical_gradient;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float props_pad2, props_pad3, props_pad4;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionTilePropsUBO {
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
};
|
||||
@@ -12,31 +34,8 @@ layout (std140) uniform FillExtrusionInterpolateUBO {
|
||||
highp float u_color_t;
|
||||
highp float u_pattern_from_t;
|
||||
highp float u_pattern_to_t;
|
||||
highp float u_pad_interp1, u_pad_interp2, u_pad_interp3;
|
||||
highp float interp_pad1, interp_pad2, interp_pad3;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec4 u_scale;
|
||||
highp vec2 u_texsize;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp float u_height_factor;
|
||||
highp float u_pad_drawable;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionDrawablePropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec3 u_lightcolor;
|
||||
highp float u_pad1;
|
||||
highp vec3 u_lightpos;
|
||||
highp float u_base;
|
||||
highp float u_height;
|
||||
highp float u_lightintensity;
|
||||
highp float u_vertical_gradient;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_pad_props2, u_pad_props3, u_pad_props4;
|
||||
};
|
||||
|
||||
#pragma mapbox: define highp float base
|
||||
#pragma mapbox: define highp float height
|
||||
#pragma mapbox: define highp vec4 color
|
||||
|
||||
@@ -2,7 +2,29 @@ in vec2 v_pos_a;
|
||||
in vec2 v_pos_b;
|
||||
in vec4 v_lighting;
|
||||
|
||||
layout (std140) uniform FillExtrusionDrawableTilePropsUBO {
|
||||
layout (std140) uniform FillExtrusionDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec4 u_scale;
|
||||
highp vec2 u_texsize;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp float u_height_factor;
|
||||
highp float drawable_pad1;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec3 u_lightcolor;
|
||||
highp float props_pad1;
|
||||
highp vec3 u_lightpos;
|
||||
highp float u_base;
|
||||
highp float u_height;
|
||||
highp float u_lightintensity;
|
||||
highp float u_vertical_gradient;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float props_pad2, props_pad3, props_pad4;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionTilePropsUBO {
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
};
|
||||
@@ -12,29 +34,7 @@ layout (std140) uniform FillExtrusionInterpolateUBO {
|
||||
highp float u_color_t;
|
||||
highp float u_pattern_from_t;
|
||||
highp float u_pattern_to_t;
|
||||
highp float u_pad_interp1, u_pad_interp2, u_pad_interp3;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec4 u_scale;
|
||||
highp vec2 u_texsize;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp float u_height_factor;
|
||||
highp float u_pad_drawable;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionDrawablePropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec3 u_lightcolor;
|
||||
highp float u_pad1;
|
||||
highp vec3 u_lightpos;
|
||||
highp float u_base;
|
||||
highp float u_height;
|
||||
highp float u_lightintensity;
|
||||
highp float u_vertical_gradient;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_pad_props2, u_pad_props3, u_pad_props4;
|
||||
highp float interp_pad1, interp_pad2, interp_pad3;
|
||||
};
|
||||
|
||||
uniform sampler2D u_image;
|
||||
|
||||
@@ -5,7 +5,29 @@ out vec2 v_pos_a;
|
||||
out vec2 v_pos_b;
|
||||
out vec4 v_lighting;
|
||||
|
||||
layout (std140) uniform FillExtrusionDrawableTilePropsUBO {
|
||||
layout (std140) uniform FillExtrusionDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec4 u_scale;
|
||||
highp vec2 u_texsize;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp float u_height_factor;
|
||||
highp float drawable_pad1;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec3 u_lightcolor;
|
||||
highp float props_pad1;
|
||||
highp vec3 u_lightpos;
|
||||
highp float u_base;
|
||||
highp float u_height;
|
||||
highp float u_lightintensity;
|
||||
highp float u_vertical_gradient;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float props_pad2, props_pad3, props_pad4;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionTilePropsUBO {
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
};
|
||||
@@ -15,29 +37,7 @@ layout (std140) uniform FillExtrusionInterpolateUBO {
|
||||
highp float u_color_t;
|
||||
highp float u_pattern_from_t;
|
||||
highp float u_pattern_to_t;
|
||||
highp float u_pad_interp1, u_pad_interp2, u_pad_interp3;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec4 u_scale;
|
||||
highp vec2 u_texsize;
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp float u_height_factor;
|
||||
highp float u_pad_drawable;
|
||||
};
|
||||
layout (std140) uniform FillExtrusionDrawablePropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec3 u_lightcolor;
|
||||
highp float u_pad1;
|
||||
highp vec3 u_lightpos;
|
||||
highp float u_base;
|
||||
highp float u_height;
|
||||
highp float u_lightintensity;
|
||||
highp float u_vertical_gradient;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_pad_props2, u_pad_props3, u_pad_props4;
|
||||
highp float interp_pad1, interp_pad2, interp_pad3;
|
||||
};
|
||||
|
||||
#pragma mapbox: define lowp float base
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
layout (std140) uniform FillOutlineEvaluatedPropsUBO {
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float padding_props1;
|
||||
highp float padding_props2;
|
||||
highp float padding_props3;
|
||||
};
|
||||
layout (std140) uniform FillOutlineInterpolateUBO {
|
||||
highp float u_outline_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_padding_interp1;
|
||||
highp float u_padding_interp2;
|
||||
highp float interp_pad1;
|
||||
highp float interp_pad2;
|
||||
};
|
||||
layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_width;
|
||||
highp float props_pad1;
|
||||
};
|
||||
|
||||
in vec2 v_pos;
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
layout (std140) uniform FillOutlineDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec2 u_world;
|
||||
highp vec2 pad;
|
||||
};
|
||||
layout (std140) uniform FillOutlineEvaluatedPropsUBO {
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float padding_props1;
|
||||
highp float padding_props2;
|
||||
highp float padding_props3;
|
||||
highp vec2 drawable_pad1;
|
||||
};
|
||||
layout (std140) uniform FillOutlineInterpolateUBO {
|
||||
highp float u_outline_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_padding_interp1;
|
||||
highp float u_padding_interp2;
|
||||
highp float interp_pad1;
|
||||
highp float interp_pad2;
|
||||
};
|
||||
layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_width;
|
||||
highp float props_pad1;
|
||||
};
|
||||
|
||||
layout (location = 0) in vec2 a_pos;
|
||||
|
||||
@@ -6,21 +6,23 @@ layout (std140) uniform FillOutlinePatternDrawableUBO {
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp vec2 u_texsize;
|
||||
};
|
||||
layout (std140) uniform FillOutlinePatternEvaluatedPropsUBO {
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float padding_props1;
|
||||
highp float padding_props2;
|
||||
layout (std140) uniform FillOutlinePatternTilePropsUBO {
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
};
|
||||
layout (std140) uniform FillOutlinePatternInterpolateUBO {
|
||||
highp float u_pattern_from_t;
|
||||
highp float u_pattern_to_t;
|
||||
highp float u_opacity_t;
|
||||
highp float pad1;
|
||||
highp float interp_pad1;
|
||||
};
|
||||
layout (std140) uniform FillOutlinePatternTilePropsUBO {
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_width;
|
||||
highp float props_pad1;
|
||||
};
|
||||
|
||||
uniform sampler2D u_image;
|
||||
|
||||
@@ -6,21 +6,23 @@ layout (std140) uniform FillOutlinePatternDrawableUBO {
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp vec2 u_texsize;
|
||||
};
|
||||
layout (std140) uniform FillOutlinePatternEvaluatedPropsUBO {
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float padding_props1;
|
||||
highp float padding_props2;
|
||||
layout (std140) uniform FillOutlinePatternTilePropsUBO {
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
};
|
||||
layout (std140) uniform FillOutlinePatternInterpolateUBO {
|
||||
highp float u_pattern_from_t;
|
||||
highp float u_pattern_to_t;
|
||||
highp float u_opacity_t;
|
||||
highp float pad1;
|
||||
highp float interp_pad1;
|
||||
};
|
||||
layout (std140) uniform FillOutlinePatternTilePropsUBO {
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_width;
|
||||
highp float props_pad1;
|
||||
};
|
||||
|
||||
layout (location = 0) in vec2 a_pos;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
layout (std140) uniform FillOutlineTriangulatedPropertiesUBO {
|
||||
layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_opacity;
|
||||
mediump float u_width;
|
||||
highp vec2 pad1;
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_width;
|
||||
highp float props_pad1;
|
||||
};
|
||||
|
||||
in float v_width;
|
||||
@@ -19,7 +21,7 @@ void main() {
|
||||
float blur2 = (1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;
|
||||
float alpha = clamp(min(dist + blur2, v_width - dist) / blur2, 0.0, 1.0);
|
||||
|
||||
fragColor = u_color * (alpha * u_opacity);
|
||||
fragColor = u_outline_color * (alpha * u_opacity);
|
||||
|
||||
#ifdef OVERDRAW_INSPECTOR
|
||||
fragColor = vec4(1.0);
|
||||
|
||||
@@ -13,14 +13,15 @@ layout (std140) uniform FillOutlineTriangulatedDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec2 u_units_to_pixels;
|
||||
mediump float u_ratio;
|
||||
lowp float pad0;
|
||||
lowp float drawable_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform FillOutlineTriangulatedPropertiesUBO {
|
||||
layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_opacity;
|
||||
mediump float u_width;
|
||||
highp vec2 pad1;
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_width;
|
||||
highp float props_pad1;
|
||||
};
|
||||
|
||||
out vec2 v_normal;
|
||||
|
||||
@@ -4,24 +4,26 @@ layout (std140) uniform FillPatternDrawableUBO {
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp vec2 u_texsize;
|
||||
highp float pad1;
|
||||
highp float pad2;
|
||||
highp float drawable_pad1;
|
||||
highp float drawable_pad2;
|
||||
};
|
||||
layout (std140) uniform FillPatternEvaluatedPropsUBO {
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float padding_props1;
|
||||
highp float padding_props2;
|
||||
layout (std140) uniform FillPatternTilePropsUBO {
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
};
|
||||
layout (std140) uniform FillPatternInterpolateUBO {
|
||||
highp float u_pattern_from_t;
|
||||
highp float u_pattern_to_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_padding_interp1;
|
||||
highp float interp_pad1;
|
||||
};
|
||||
layout (std140) uniform FillPatternTilePropsUBO {
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_width;
|
||||
highp float props_pad1;
|
||||
};
|
||||
|
||||
uniform sampler2D u_image;
|
||||
|
||||
@@ -4,24 +4,26 @@ layout (std140) uniform FillPatternDrawableUBO {
|
||||
highp vec2 u_pixel_coord_upper;
|
||||
highp vec2 u_pixel_coord_lower;
|
||||
highp vec2 u_texsize;
|
||||
highp float pad1;
|
||||
highp float pad2;
|
||||
highp float drawable_pad1;
|
||||
highp float drawable_pad2;
|
||||
};
|
||||
layout (std140) uniform FillPatternEvaluatedPropsUBO {
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float padding_props1;
|
||||
highp float padding_props2;
|
||||
layout (std140) uniform FillPatternTilePropsUBO {
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
};
|
||||
layout (std140) uniform FillPatternInterpolateUBO {
|
||||
highp float u_pattern_from_t;
|
||||
highp float u_pattern_to_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_padding_interp1;
|
||||
highp float interp_pad1;
|
||||
};
|
||||
layout (std140) uniform FillPatternTilePropsUBO {
|
||||
highp vec4 u_pattern_from;
|
||||
highp vec4 u_pattern_to;
|
||||
layout (std140) uniform FillEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
highp vec4 u_outline_color;
|
||||
highp float u_opacity;
|
||||
highp float u_fade;
|
||||
highp float u_width;
|
||||
highp float props_pad1;
|
||||
};
|
||||
|
||||
layout (location = 0) in vec2 a_pos;
|
||||
|
||||
@@ -4,7 +4,7 @@ layout (std140) uniform HeatmapEvaluatedPropsUBO {
|
||||
highp float u_weight;
|
||||
highp float u_radius;
|
||||
highp float u_intensity;
|
||||
lowp float pad0_;
|
||||
lowp float props_pad1;
|
||||
};
|
||||
|
||||
#pragma mapbox: define highp float weight
|
||||
|
||||
@@ -4,21 +4,21 @@ out vec2 v_extrude;
|
||||
layout (std140) uniform HeatmapDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp float u_extrude_scale;
|
||||
lowp float pad1_;
|
||||
lowp vec2 pad2_;
|
||||
lowp float drawable_pad1;
|
||||
lowp vec2 drawable_pad2;
|
||||
};
|
||||
|
||||
layout (std140) uniform HeatmapEvaluatedPropsUBO {
|
||||
highp float u_weight;
|
||||
highp float u_radius;
|
||||
highp float u_intensity;
|
||||
lowp float pad0_;
|
||||
lowp float props_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform HeatmapInterpolateUBO {
|
||||
lowp float u_weight_t;
|
||||
lowp float u_radius_t;
|
||||
lowp vec2 pad3_;
|
||||
lowp vec2 interp_pad1;
|
||||
};
|
||||
|
||||
#pragma mapbox: define highp float weight
|
||||
|
||||
@@ -2,11 +2,11 @@ in vec2 v_pos;
|
||||
uniform sampler2D u_image;
|
||||
uniform sampler2D u_color_ramp;
|
||||
|
||||
layout (std140) uniform HeatmapTextureDrawableUBO {
|
||||
layout (std140) uniform HeatmapTexturePropsUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec2 u_world;
|
||||
highp float u_opacity;
|
||||
lowp float pad0_;
|
||||
lowp float props_pad1;
|
||||
};
|
||||
|
||||
void main() {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
layout (location = 0) in vec2 a_pos;
|
||||
out vec2 v_pos;
|
||||
|
||||
layout (std140) uniform HeatmapTextureDrawableUBO {
|
||||
layout (std140) uniform HeatmapTexturePropsUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec2 u_world;
|
||||
highp float u_opacity;
|
||||
lowp float pad0_;
|
||||
lowp float props_pad1;
|
||||
};
|
||||
|
||||
void main() {
|
||||
|
||||
@@ -1,19 +1,7 @@
|
||||
layout (std140) uniform LineUBO {
|
||||
layout (std140) uniform LineDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
mediump float u_ratio;
|
||||
lowp float pad2, pad3, pad4;
|
||||
};
|
||||
|
||||
layout (std140) uniform LinePropertiesUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
|
||||
highp float pad5;
|
||||
highp vec2 pad6;
|
||||
lowp float drawable_pad1, drawable_pad2, drawable_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineInterpolationUBO {
|
||||
@@ -23,8 +11,19 @@ layout (std140) uniform LineInterpolationUBO {
|
||||
lowp float u_gapwidth_t;
|
||||
lowp float u_offset_t;
|
||||
lowp float u_width_t;
|
||||
highp vec2 interp_pad1;
|
||||
};
|
||||
|
||||
highp vec2 pad7;
|
||||
layout (std140) uniform LineEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
lowp float u_floorwidth;
|
||||
highp float props_pad1;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
in vec2 v_width2;
|
||||
|
||||
@@ -11,25 +11,13 @@ layout (location = 1) in vec4 a_data;
|
||||
|
||||
layout (std140) uniform LineDynamicUBO {
|
||||
highp vec2 u_units_to_pixels;
|
||||
lowp float pad0, pad1;
|
||||
lowp float dynamic_pad1, dynamic_pad2;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineUBO {
|
||||
layout (std140) uniform LineDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
mediump float u_ratio;
|
||||
lowp float pad2, pad3, pad4;
|
||||
};
|
||||
|
||||
layout (std140) uniform LinePropertiesUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
|
||||
highp float pad5;
|
||||
highp vec2 pad6;
|
||||
lowp float drawable_pad1, drawable_pad2, drawable_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineInterpolationUBO {
|
||||
@@ -39,8 +27,19 @@ layout (std140) uniform LineInterpolationUBO {
|
||||
lowp float u_gapwidth_t;
|
||||
lowp float u_offset_t;
|
||||
lowp float u_width_t;
|
||||
highp vec2 interp_pad1;
|
||||
};
|
||||
|
||||
highp vec2 pad7;
|
||||
layout (std140) uniform LineEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
lowp float u_floorwidth;
|
||||
highp float props_pad1;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
out vec2 v_normal;
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
layout (std140) uniform LineGradientUBO {
|
||||
layout (std140) uniform LineGradientDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
mediump float u_ratio;
|
||||
lowp float pad2, pad3, pad4;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineGradientPropertiesUBO {
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
|
||||
highp float pad5;
|
||||
highp vec2 pad6;
|
||||
lowp float drawable_pad1, drawable_pad2, drawable_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineGradientInterpolationUBO {
|
||||
@@ -21,9 +10,20 @@ layout (std140) uniform LineGradientInterpolationUBO {
|
||||
lowp float u_gapwidth_t;
|
||||
lowp float u_offset_t;
|
||||
lowp float u_width_t;
|
||||
highp float interp_pad1;
|
||||
highp vec2 interp_pad2;
|
||||
};
|
||||
|
||||
highp float pad7;
|
||||
highp vec2 pad8;
|
||||
layout (std140) uniform LineEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
lowp float u_floorwidth;
|
||||
highp float props_pad1;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
uniform sampler2D u_image;
|
||||
|
||||
@@ -15,24 +15,13 @@ layout (location = 1) in vec4 a_data;
|
||||
|
||||
layout (std140) uniform LineDynamicUBO {
|
||||
highp vec2 u_units_to_pixels;
|
||||
lowp float pad0, pad1;
|
||||
lowp float dynamic_pad1, dynamic_pad2;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineGradientUBO {
|
||||
layout (std140) uniform LineGradientDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
mediump float u_ratio;
|
||||
lowp float pad2, pad3, pad4;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineGradientPropertiesUBO {
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
|
||||
highp float pad5;
|
||||
highp vec2 pad6;
|
||||
lowp float drawable_pad1, drawable_pad2, drawable_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineGradientInterpolationUBO {
|
||||
@@ -41,9 +30,20 @@ layout (std140) uniform LineGradientInterpolationUBO {
|
||||
lowp float u_gapwidth_t;
|
||||
lowp float u_offset_t;
|
||||
lowp float u_width_t;
|
||||
highp float interp_pad1;
|
||||
highp vec2 interp_pad2;
|
||||
};
|
||||
|
||||
highp float pad7;
|
||||
highp vec2 pad8;
|
||||
layout (std140) uniform LineEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
lowp float u_floorwidth;
|
||||
highp float props_pad1;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
out vec2 v_normal;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
layout (std140) uniform LinePatternUBO {
|
||||
layout (std140) uniform LinePatternDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
mediump vec4 u_scale;
|
||||
highp vec2 u_texsize;
|
||||
@@ -6,22 +6,6 @@ layout (std140) uniform LinePatternUBO {
|
||||
highp float u_fade;
|
||||
};
|
||||
|
||||
layout (std140) uniform LinePatternPropertiesUBO {
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
lowp float u_offset;
|
||||
mediump float u_gapwidth;
|
||||
mediump float u_width;
|
||||
|
||||
highp float pad2;
|
||||
highp vec2 pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform LinePatternTilePropertiesUBO {
|
||||
lowp vec4 u_pattern_from;
|
||||
lowp vec4 u_pattern_to;
|
||||
};
|
||||
|
||||
layout (std140) uniform LinePatternInterpolationUBO {
|
||||
lowp float u_blur_t;
|
||||
lowp float u_opacity_t;
|
||||
@@ -30,8 +14,24 @@ layout (std140) uniform LinePatternInterpolationUBO {
|
||||
lowp float u_width_t;
|
||||
lowp float u_pattern_from_t;
|
||||
lowp float u_pattern_to_t;
|
||||
highp float interp_pad1;
|
||||
};
|
||||
|
||||
highp float pad4;
|
||||
layout (std140) uniform LinePatternTilePropertiesUBO {
|
||||
lowp vec4 u_pattern_from;
|
||||
lowp vec4 u_pattern_to;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
lowp float u_floorwidth;
|
||||
highp float props_pad1;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
uniform sampler2D u_image;
|
||||
|
||||
@@ -15,10 +15,10 @@ layout (location = 1) in vec4 a_data;
|
||||
|
||||
layout (std140) uniform LineDynamicUBO {
|
||||
highp vec2 u_units_to_pixels;
|
||||
lowp float pad0, pad1;
|
||||
lowp float dynamic_pad1, dynamic_pad2;
|
||||
};
|
||||
|
||||
layout (std140) uniform LinePatternUBO {
|
||||
layout (std140) uniform LinePatternDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
mediump vec4 u_scale;
|
||||
highp vec2 u_texsize;
|
||||
@@ -26,22 +26,6 @@ layout (std140) uniform LinePatternUBO {
|
||||
highp float u_fade;
|
||||
};
|
||||
|
||||
layout (std140) uniform LinePatternPropertiesUBO {
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
lowp float u_offset;
|
||||
mediump float u_gapwidth;
|
||||
mediump float u_width;
|
||||
|
||||
highp float pad2;
|
||||
highp vec2 pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform LinePatternTilePropertiesUBO {
|
||||
lowp vec4 u_pattern_from;
|
||||
lowp vec4 u_pattern_to;
|
||||
};
|
||||
|
||||
layout (std140) uniform LinePatternInterpolationUBO {
|
||||
lowp float u_blur_t;
|
||||
lowp float u_opacity_t;
|
||||
@@ -50,8 +34,24 @@ layout (std140) uniform LinePatternInterpolationUBO {
|
||||
lowp float u_width_t;
|
||||
lowp float u_pattern_from_t;
|
||||
lowp float u_pattern_to_t;
|
||||
highp float interp_pad1;
|
||||
};
|
||||
|
||||
highp float pad4;
|
||||
layout (std140) uniform LinePatternTilePropertiesUBO {
|
||||
lowp vec4 u_pattern_from;
|
||||
lowp vec4 u_pattern_to;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
lowp float u_floorwidth;
|
||||
highp float props_pad1;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
out vec2 v_normal;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
layout (std140) uniform LineSDFUBO {
|
||||
layout (std140) uniform LineSDFDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec2 u_patternscale_a;
|
||||
highp vec2 u_patternscale_b;
|
||||
@@ -8,20 +8,7 @@ layout (std140) uniform LineSDFUBO {
|
||||
highp float u_tex_y_b;
|
||||
highp float u_sdfgamma;
|
||||
highp float u_mix;
|
||||
|
||||
lowp float pad2, pad3, pad4;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineSDFPropertiesUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
lowp float u_floorwidth;
|
||||
|
||||
highp vec2 pad5;
|
||||
lowp float drawable_pad1, drawable_pad2, drawable_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineSDFInterpolationUBO {
|
||||
@@ -32,8 +19,19 @@ layout (std140) uniform LineSDFInterpolationUBO {
|
||||
lowp float u_offset_t;
|
||||
lowp float u_width_t;
|
||||
lowp float u_floorwidth_t;
|
||||
highp float interp_pad1;
|
||||
};
|
||||
|
||||
highp float pad6;
|
||||
layout (std140) uniform LineEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
lowp float u_floorwidth;
|
||||
highp float props_pad1;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
uniform sampler2D u_image;
|
||||
|
||||
@@ -15,10 +15,10 @@ layout (location = 1) in vec4 a_data;
|
||||
|
||||
layout (std140) uniform LineDynamicUBO {
|
||||
highp vec2 u_units_to_pixels;
|
||||
lowp float pad0, pad1;
|
||||
lowp float dynamic_pad1, dynamic_pad2;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineSDFUBO {
|
||||
layout (std140) uniform LineSDFDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp vec2 u_patternscale_a;
|
||||
highp vec2 u_patternscale_b;
|
||||
@@ -27,19 +27,7 @@ layout (std140) uniform LineSDFUBO {
|
||||
highp float u_tex_y_b;
|
||||
highp float u_sdfgamma;
|
||||
highp float u_mix;
|
||||
lowp float pad2, pad3, pad4;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineSDFPropertiesUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
lowp float u_floorwidth;
|
||||
|
||||
highp vec2 pad5;
|
||||
lowp float drawable_pad1, drawable_pad2, drawable_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform LineSDFInterpolationUBO {
|
||||
@@ -50,8 +38,19 @@ layout (std140) uniform LineSDFInterpolationUBO {
|
||||
lowp float u_offset_t;
|
||||
lowp float u_width_t;
|
||||
lowp float u_floorwidth_t;
|
||||
highp float interp_pad1;
|
||||
};
|
||||
|
||||
highp float pad6;
|
||||
layout (std140) uniform LineEvaluatedPropsUBO {
|
||||
highp vec4 u_color;
|
||||
lowp float u_blur;
|
||||
lowp float u_opacity;
|
||||
mediump float u_gapwidth;
|
||||
lowp float u_offset;
|
||||
mediump float u_width;
|
||||
lowp float u_floorwidth;
|
||||
highp float props_pad1;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
out vec2 v_normal;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
layout (std140) uniform RasterDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
layout (std140) uniform RasterEvaluatedPropsUBO {
|
||||
highp vec3 u_spin_weights;
|
||||
highp vec2 u_tl_parent;
|
||||
highp float u_scale_parent;
|
||||
@@ -10,8 +9,8 @@ layout (std140) uniform RasterDrawableUBO {
|
||||
highp float u_brightness_high;
|
||||
highp float u_saturation_factor;
|
||||
highp float u_contrast_factor;
|
||||
highp float pad1;
|
||||
highp float pad2;
|
||||
highp float props_pad1;
|
||||
highp float props_pad2;
|
||||
};
|
||||
uniform sampler2D u_image0;
|
||||
uniform sampler2D u_image1;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
layout (std140) uniform RasterDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
};
|
||||
layout (std140) uniform RasterEvaluatedPropsUBO {
|
||||
highp vec3 u_spin_weights;
|
||||
highp vec2 u_tl_parent;
|
||||
highp float u_scale_parent;
|
||||
@@ -10,8 +12,8 @@ layout (std140) uniform RasterDrawableUBO {
|
||||
highp float u_brightness_high;
|
||||
highp float u_saturation_factor;
|
||||
highp float u_contrast_factor;
|
||||
highp float pad1;
|
||||
highp float pad2;
|
||||
highp float props_pad1;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
layout (location = 0) in vec2 a_pos;
|
||||
|
||||
@@ -1,21 +1,38 @@
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
layout (std140) uniform SymbolDrawablePaintUBO {
|
||||
highp vec4 u_fill_color;
|
||||
highp vec4 u_halo_color;
|
||||
highp float u_opacity;
|
||||
highp float u_halo_width;
|
||||
highp float u_halo_blur;
|
||||
highp float u_padding;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableInterpolateUBO {
|
||||
layout (std140) uniform SymbolInterpolateUBO {
|
||||
highp float u_fill_color_t;
|
||||
highp float u_halo_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_halo_width_t;
|
||||
highp float u_halo_blur_t;
|
||||
highp float u_pad4,u_pad5,u_pad6;
|
||||
highp float interp_pad1, interp_pad2,interp_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolTilePropsUBO {
|
||||
bool u_is_text;
|
||||
bool u_is_halo;
|
||||
bool u_pitch_with_map;
|
||||
bool u_is_size_zoom_constant;
|
||||
bool u_is_size_feature_constant;
|
||||
highp float u_size_t; // used to interpolate between zoom stops when size is a composite function
|
||||
highp float u_size; // used when size is both zoom and feature constant
|
||||
bool tileprops_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolEvaluatedPropsUBO {
|
||||
highp vec4 u_text_fill_color;
|
||||
highp vec4 u_text_halo_color;
|
||||
highp float u_text_opacity;
|
||||
highp float u_text_halo_width;
|
||||
highp float u_text_halo_blur;
|
||||
highp float props_pad1;
|
||||
highp vec4 u_icon_fill_color;
|
||||
highp vec4 u_icon_halo_color;
|
||||
highp float u_icon_opacity;
|
||||
highp float u_icon_halo_width;
|
||||
highp float u_icon_halo_blur;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
in vec2 v_tex;
|
||||
@@ -24,6 +41,8 @@ in float v_fade_opacity;
|
||||
#pragma mapbox: define lowp float opacity
|
||||
|
||||
void main() {
|
||||
highp float u_opacity = u_is_text ? u_text_opacity : u_icon_opacity;
|
||||
|
||||
#pragma mapbox: initialize lowp float opacity
|
||||
|
||||
lowp float alpha = opacity * v_fade_opacity;
|
||||
|
||||
@@ -4,6 +4,13 @@ layout (location = 2) in vec4 a_pixeloffset;
|
||||
layout (location = 3) in vec3 a_projected_pos;
|
||||
layout (location = 4) in float a_fade_opacity;
|
||||
|
||||
layout (std140) uniform SymbolDynamicUBO {
|
||||
highp float u_fade_change;
|
||||
highp float u_camera_to_center_distance;
|
||||
highp float u_aspect_ratio;
|
||||
highp float dynamic_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp mat4 u_label_plane_matrix;
|
||||
@@ -14,26 +21,10 @@ layout (std140) uniform SymbolDrawableUBO {
|
||||
|
||||
highp float u_gamma_scale;
|
||||
bool u_rotate_symbol;
|
||||
highp vec2 u_pad1;
|
||||
highp vec2 drawable_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDynamicUBO {
|
||||
highp float u_fade_change;
|
||||
highp float u_camera_to_center_distance;
|
||||
highp float u_aspect_ratio;
|
||||
highp float pad0;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawablePaintUBO {
|
||||
highp vec4 u_fill_color;
|
||||
highp vec4 u_halo_color;
|
||||
highp float u_opacity;
|
||||
highp float u_halo_width;
|
||||
highp float u_halo_blur;
|
||||
highp float u_padding;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableTilePropsUBO {
|
||||
layout (std140) uniform SymbolTilePropsUBO {
|
||||
bool u_is_text;
|
||||
bool u_is_halo;
|
||||
bool u_pitch_with_map;
|
||||
@@ -41,16 +32,31 @@ layout (std140) uniform SymbolDrawableTilePropsUBO {
|
||||
bool u_is_size_feature_constant;
|
||||
highp float u_size_t; // used to interpolate between zoom stops when size is a composite function
|
||||
highp float u_size; // used when size is both zoom and feature constant
|
||||
bool u_pad3;
|
||||
bool tileprops_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableInterpolateUBO {
|
||||
layout (std140) uniform SymbolInterpolateUBO {
|
||||
highp float u_fill_color_t;
|
||||
highp float u_halo_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_halo_width_t;
|
||||
highp float u_halo_blur_t;
|
||||
highp float u_pad4,u_pad5,u_pad6;
|
||||
highp float interp_pad1, interp_pad2, interp_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolEvaluatedPropsUBO {
|
||||
highp vec4 u_text_fill_color;
|
||||
highp vec4 u_text_halo_color;
|
||||
highp float u_text_opacity;
|
||||
highp float u_text_halo_width;
|
||||
highp float u_text_halo_blur;
|
||||
highp float props_pad1;
|
||||
highp vec4 u_icon_fill_color;
|
||||
highp vec4 u_icon_halo_color;
|
||||
highp float u_icon_opacity;
|
||||
highp float u_icon_halo_width;
|
||||
highp float u_icon_halo_blur;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
out vec2 v_tex;
|
||||
@@ -59,6 +65,8 @@ out float v_fade_opacity;
|
||||
#pragma mapbox: define lowp float opacity
|
||||
|
||||
void main() {
|
||||
highp float u_opacity = u_is_text ? u_text_opacity : u_icon_opacity;
|
||||
|
||||
#pragma mapbox: initialize lowp float opacity
|
||||
|
||||
vec2 a_pos = a_pos_offset.xy;
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
#define SDF_PX 8.0
|
||||
|
||||
layout (std140) uniform SymbolDynamicUBO {
|
||||
highp float u_fade_change;
|
||||
highp float u_camera_to_center_distance;
|
||||
highp float u_aspect_ratio;
|
||||
highp float dynamic_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp mat4 u_label_plane_matrix;
|
||||
@@ -10,26 +17,10 @@ layout (std140) uniform SymbolDrawableUBO {
|
||||
|
||||
highp float u_gamma_scale;
|
||||
bool u_rotate_symbol;
|
||||
highp vec2 u_pad1;
|
||||
highp vec2 drawable_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDynamicUBO {
|
||||
highp float u_fade_change;
|
||||
highp float u_camera_to_center_distance;
|
||||
highp float u_aspect_ratio;
|
||||
highp float pad0;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawablePaintUBO {
|
||||
highp vec4 u_fill_color;
|
||||
highp vec4 u_halo_color;
|
||||
highp float u_opacity;
|
||||
highp float u_halo_width;
|
||||
highp float u_halo_blur;
|
||||
highp float u_padding;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableTilePropsUBO {
|
||||
layout (std140) uniform SymbolTilePropsUBO {
|
||||
bool u_is_text;
|
||||
bool u_is_halo;
|
||||
bool u_pitch_with_map;
|
||||
@@ -37,16 +28,31 @@ layout (std140) uniform SymbolDrawableTilePropsUBO {
|
||||
bool u_is_size_feature_constant;
|
||||
highp float u_size_t; // used to interpolate between zoom stops when size is a composite function
|
||||
highp float u_size; // used when size is both zoom and feature constant
|
||||
bool u_pad3;
|
||||
bool tileprops_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableInterpolateUBO {
|
||||
layout (std140) uniform SymbolInterpolateUBO {
|
||||
highp float u_fill_color_t;
|
||||
highp float u_halo_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_halo_width_t;
|
||||
highp float u_halo_blur_t;
|
||||
highp float u_pad4,u_pad5,u_pad6;
|
||||
highp float interp_pad1, interp_pad2, interp_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolEvaluatedPropsUBO {
|
||||
highp vec4 u_text_fill_color;
|
||||
highp vec4 u_text_halo_color;
|
||||
highp float u_text_opacity;
|
||||
highp float u_text_halo_width;
|
||||
highp float u_text_halo_blur;
|
||||
highp float props_pad1;
|
||||
highp vec4 u_icon_fill_color;
|
||||
highp vec4 u_icon_halo_color;
|
||||
highp float u_icon_opacity;
|
||||
highp float u_icon_halo_width;
|
||||
highp float u_icon_halo_blur;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
@@ -61,6 +67,12 @@ in vec3 v_data1;
|
||||
#pragma mapbox: define lowp float halo_blur
|
||||
|
||||
void main() {
|
||||
highp vec4 u_fill_color = u_is_text ? u_text_fill_color : u_icon_fill_color;
|
||||
highp vec4 u_halo_color = u_is_text ? u_text_halo_color : u_icon_halo_color;
|
||||
highp float u_opacity = u_is_text ? u_text_opacity : u_icon_opacity;
|
||||
highp float u_halo_width = u_is_text ? u_text_halo_width : u_icon_halo_width;
|
||||
highp float u_halo_blur = u_is_text ? u_text_halo_blur : u_icon_halo_blur;
|
||||
|
||||
#pragma mapbox: initialize highp vec4 fill_color
|
||||
#pragma mapbox: initialize highp vec4 halo_color
|
||||
#pragma mapbox: initialize lowp float opacity
|
||||
|
||||
@@ -12,6 +12,13 @@ layout (location = 4) in float a_fade_opacity;
|
||||
// [ text-size(lowerZoomStop, feature),
|
||||
// text-size(upperZoomStop, feature) ]
|
||||
|
||||
layout (std140) uniform SymbolDynamicUBO {
|
||||
highp float u_fade_change;
|
||||
highp float u_camera_to_center_distance;
|
||||
highp float u_aspect_ratio;
|
||||
highp float dynamic_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp mat4 u_label_plane_matrix;
|
||||
@@ -22,26 +29,10 @@ layout (std140) uniform SymbolDrawableUBO {
|
||||
|
||||
highp float u_gamma_scale;
|
||||
bool u_rotate_symbol;
|
||||
highp vec2 u_pad1;
|
||||
highp vec2 drawable_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDynamicUBO {
|
||||
highp float u_fade_change;
|
||||
highp float u_camera_to_center_distance;
|
||||
highp float u_aspect_ratio;
|
||||
highp float pad0;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawablePaintUBO {
|
||||
highp vec4 u_fill_color;
|
||||
highp vec4 u_halo_color;
|
||||
highp float u_opacity;
|
||||
highp float u_halo_width;
|
||||
highp float u_halo_blur;
|
||||
highp float u_padding;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableTilePropsUBO {
|
||||
layout (std140) uniform SymbolTilePropsUBO {
|
||||
bool u_is_text;
|
||||
bool u_is_halo;
|
||||
bool u_pitch_with_map;
|
||||
@@ -49,16 +40,31 @@ layout (std140) uniform SymbolDrawableTilePropsUBO {
|
||||
bool u_is_size_feature_constant;
|
||||
highp float u_size_t; // used to interpolate between zoom stops when size is a composite function
|
||||
highp float u_size; // used when size is both zoom and feature constant
|
||||
bool u_pad3;
|
||||
bool tileprops_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableInterpolateUBO {
|
||||
layout (std140) uniform SymbolInterpolateUBO {
|
||||
highp float u_fill_color_t;
|
||||
highp float u_halo_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_halo_width_t;
|
||||
highp float u_halo_blur_t;
|
||||
highp float u_pad4,u_pad5,u_pad6;
|
||||
highp float interp_pad1, interp_pad2, interp_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolEvaluatedPropsUBO {
|
||||
highp vec4 u_text_fill_color;
|
||||
highp vec4 u_text_halo_color;
|
||||
highp float u_text_opacity;
|
||||
highp float u_text_halo_width;
|
||||
highp float u_text_halo_blur;
|
||||
highp float props_pad1;
|
||||
highp vec4 u_icon_fill_color;
|
||||
highp vec4 u_icon_halo_color;
|
||||
highp float u_icon_opacity;
|
||||
highp float u_icon_halo_width;
|
||||
highp float u_icon_halo_blur;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
out vec2 v_data0;
|
||||
@@ -71,6 +77,12 @@ out vec3 v_data1;
|
||||
#pragma mapbox: define lowp float halo_blur
|
||||
|
||||
void main() {
|
||||
highp vec4 u_fill_color = u_is_text ? u_text_fill_color : u_icon_fill_color;
|
||||
highp vec4 u_halo_color = u_is_text ? u_text_halo_color : u_icon_halo_color;
|
||||
highp float u_opacity = u_is_text ? u_text_opacity : u_icon_opacity;
|
||||
highp float u_halo_width = u_is_text ? u_text_halo_width : u_icon_halo_width;
|
||||
highp float u_halo_blur = u_is_text ? u_text_halo_blur : u_icon_halo_blur;
|
||||
|
||||
#pragma mapbox: initialize highp vec4 fill_color
|
||||
#pragma mapbox: initialize highp vec4 halo_color
|
||||
#pragma mapbox: initialize lowp float opacity
|
||||
|
||||
@@ -3,6 +3,13 @@
|
||||
#define SDF 1.0
|
||||
#define ICON 0.0
|
||||
|
||||
layout (std140) uniform SymbolDynamicUBO {
|
||||
highp float u_fade_change;
|
||||
highp float u_camera_to_center_distance;
|
||||
highp float u_aspect_ratio;
|
||||
highp float dynamic_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp mat4 u_label_plane_matrix;
|
||||
@@ -13,26 +20,10 @@ layout (std140) uniform SymbolDrawableUBO {
|
||||
|
||||
highp float u_gamma_scale;
|
||||
bool u_rotate_symbol;
|
||||
highp vec2 u_pad1;
|
||||
highp vec2 drawable_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDynamicUBO {
|
||||
highp float u_fade_change;
|
||||
highp float u_camera_to_center_distance;
|
||||
highp float u_aspect_ratio;
|
||||
highp float pad0;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawablePaintUBO {
|
||||
highp vec4 u_fill_color;
|
||||
highp vec4 u_halo_color;
|
||||
highp float u_opacity;
|
||||
highp float u_halo_width;
|
||||
highp float u_halo_blur;
|
||||
highp float u_padding;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableTilePropsUBO {
|
||||
layout (std140) uniform SymbolTilePropsUBO {
|
||||
bool u_is_text;
|
||||
bool u_is_halo;
|
||||
bool u_pitch_with_map;
|
||||
@@ -40,16 +31,31 @@ layout (std140) uniform SymbolDrawableTilePropsUBO {
|
||||
bool u_is_size_feature_constant;
|
||||
highp float u_size_t; // used to interpolate between zoom stops when size is a composite function
|
||||
highp float u_size; // used when size is both zoom and feature constant
|
||||
bool u_pad3;
|
||||
bool tileprops_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableInterpolateUBO {
|
||||
layout (std140) uniform SymbolInterpolateUBO {
|
||||
highp float u_fill_color_t;
|
||||
highp float u_halo_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_halo_width_t;
|
||||
highp float u_halo_blur_t;
|
||||
highp float u_pad4,u_pad5,u_pad6;
|
||||
highp float interp_pad1, interp_pad2,interp_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolEvaluatedPropsUBO {
|
||||
highp vec4 u_text_fill_color;
|
||||
highp vec4 u_text_halo_color;
|
||||
highp float u_text_opacity;
|
||||
highp float u_text_halo_width;
|
||||
highp float u_text_halo_blur;
|
||||
highp float props_pad1;
|
||||
highp vec4 u_icon_fill_color;
|
||||
highp vec4 u_icon_halo_color;
|
||||
highp float u_icon_opacity;
|
||||
highp float u_icon_halo_width;
|
||||
highp float u_icon_halo_blur;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
uniform sampler2D u_texture;
|
||||
@@ -65,6 +71,12 @@ in vec4 v_data1;
|
||||
#pragma mapbox: define lowp float halo_blur
|
||||
|
||||
void main() {
|
||||
highp vec4 u_fill_color = u_is_text ? u_text_fill_color : u_icon_fill_color;
|
||||
highp vec4 u_halo_color = u_is_text ? u_text_halo_color : u_icon_halo_color;
|
||||
highp float u_opacity = u_is_text ? u_text_opacity : u_icon_opacity;
|
||||
highp float u_halo_width = u_is_text ? u_text_halo_width : u_icon_halo_width;
|
||||
highp float u_halo_blur = u_is_text ? u_text_halo_blur : u_icon_halo_blur;
|
||||
|
||||
#pragma mapbox: initialize highp vec4 fill_color
|
||||
#pragma mapbox: initialize highp vec4 halo_color
|
||||
#pragma mapbox: initialize lowp float opacity
|
||||
|
||||
@@ -11,6 +11,13 @@ layout (location = 3) in float a_fade_opacity;
|
||||
// [ text-size(lowerZoomStop, feature),
|
||||
// text-size(upperZoomStop, feature) ]
|
||||
|
||||
layout (std140) uniform SymbolDynamicUBO {
|
||||
highp float u_fade_change;
|
||||
highp float u_camera_to_center_distance;
|
||||
highp float u_aspect_ratio;
|
||||
highp float dynamic_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableUBO {
|
||||
highp mat4 u_matrix;
|
||||
highp mat4 u_label_plane_matrix;
|
||||
@@ -21,26 +28,10 @@ layout (std140) uniform SymbolDrawableUBO {
|
||||
|
||||
highp float u_gamma_scale;
|
||||
bool u_rotate_symbol;
|
||||
highp vec2 u_pad1;
|
||||
highp vec2 drawable_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDynamicUBO {
|
||||
highp float u_fade_change;
|
||||
highp float u_camera_to_center_distance;
|
||||
highp float u_aspect_ratio;
|
||||
highp float pad0;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawablePaintUBO {
|
||||
highp vec4 u_fill_color;
|
||||
highp vec4 u_halo_color;
|
||||
highp float u_opacity;
|
||||
highp float u_halo_width;
|
||||
highp float u_halo_blur;
|
||||
highp float u_padding;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableTilePropsUBO {
|
||||
layout (std140) uniform SymbolTilePropsUBO {
|
||||
bool u_is_text;
|
||||
bool u_is_halo;
|
||||
bool u_pitch_with_map;
|
||||
@@ -48,16 +39,31 @@ layout (std140) uniform SymbolDrawableTilePropsUBO {
|
||||
bool u_is_size_feature_constant;
|
||||
highp float u_size_t; // used to interpolate between zoom stops when size is a composite function
|
||||
highp float u_size; // used when size is both zoom and feature constant
|
||||
bool u_pad3;
|
||||
bool tileprops_pad1;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolDrawableInterpolateUBO {
|
||||
layout (std140) uniform SymbolInterpolateUBO {
|
||||
highp float u_fill_color_t;
|
||||
highp float u_halo_color_t;
|
||||
highp float u_opacity_t;
|
||||
highp float u_halo_width_t;
|
||||
highp float u_halo_blur_t;
|
||||
highp float u_pad4,u_pad5,u_pad6;
|
||||
highp float interp_pad1, interp_pad2, interp_pad3;
|
||||
};
|
||||
|
||||
layout (std140) uniform SymbolEvaluatedPropsUBO {
|
||||
highp vec4 u_text_fill_color;
|
||||
highp vec4 u_text_halo_color;
|
||||
highp float u_text_opacity;
|
||||
highp float u_text_halo_width;
|
||||
highp float u_text_halo_blur;
|
||||
highp float props_pad1;
|
||||
highp vec4 u_icon_fill_color;
|
||||
highp vec4 u_icon_halo_color;
|
||||
highp float u_icon_opacity;
|
||||
highp float u_icon_halo_width;
|
||||
highp float u_icon_halo_blur;
|
||||
highp float props_pad2;
|
||||
};
|
||||
|
||||
out vec4 v_data0;
|
||||
@@ -70,6 +76,12 @@ out vec4 v_data1;
|
||||
#pragma mapbox: define lowp float halo_blur
|
||||
|
||||
void main() {
|
||||
highp vec4 u_fill_color = u_is_text ? u_text_fill_color : u_icon_fill_color;
|
||||
highp vec4 u_halo_color = u_is_text ? u_text_halo_color : u_icon_halo_color;
|
||||
highp float u_opacity = u_is_text ? u_text_opacity : u_icon_opacity;
|
||||
highp float u_halo_width = u_is_text ? u_text_halo_width : u_icon_halo_width;
|
||||
highp float u_halo_blur = u_is_text ? u_text_halo_blur : u_icon_halo_blur;
|
||||
|
||||
#pragma mapbox: initialize highp vec4 fill_color
|
||||
#pragma mapbox: initialize highp vec4 halo_color
|
||||
#pragma mapbox: initialize lowp float opacity
|
||||
|
||||
@@ -108,17 +108,9 @@ void DrawableGL::bindUniformBuffers() const {
|
||||
const auto& block = uniformBlocks.get(id);
|
||||
if (!block) continue;
|
||||
const auto& uniformBuffer = getUniformBuffers().get(id);
|
||||
assert(uniformBuffer && "UBO missing, drawable skipped");
|
||||
if (!uniformBuffer) {
|
||||
using namespace std::string_literals;
|
||||
const auto tileIDStr = getTileID() ? util::toString(*getTileID()) : "<no tile>";
|
||||
Log::Error(Event::General,
|
||||
"bindUniformBuffers: UBO "s + util::toString(block->getIndex()) + " not found for " +
|
||||
util::toString(getID()) + " / " + getName() + " / " + tileIDStr + ". skipping.");
|
||||
assert(false);
|
||||
continue;
|
||||
if (uniformBuffer) {
|
||||
block->bindBuffer(*uniformBuffer);
|
||||
}
|
||||
block->bindBuffer(*uniformBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,7 +120,9 @@ void DrawableGL::unbindUniformBuffers() const {
|
||||
const auto& uniformBlocks = shader->getUniformBlocks();
|
||||
for (size_t id = 0; id < uniformBlocks.allocatedSize(); id++) {
|
||||
const auto& block = uniformBlocks.get(id);
|
||||
if (block) {
|
||||
if (!block) continue;
|
||||
const auto& uniformBuffer = getUniformBuffers().get(id);
|
||||
if (uniformBuffer) {
|
||||
block->unbindBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user