summaryrefslogtreecommitdiff
path: root/src/mbgl/programs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/programs')
-rw-r--r--src/mbgl/programs/attributes.hpp206
-rw-r--r--src/mbgl/programs/circle_program.cpp2
-rw-r--r--src/mbgl/programs/circle_program.hpp34
-rw-r--r--src/mbgl/programs/collision_box_program.cpp2
-rw-r--r--src/mbgl/programs/collision_box_program.hpp23
-rw-r--r--src/mbgl/programs/debug_program.hpp14
-rw-r--r--src/mbgl/programs/fill_program.cpp8
-rw-r--r--src/mbgl/programs/fill_program.hpp72
-rw-r--r--src/mbgl/programs/line_program.cpp14
-rw-r--r--src/mbgl/programs/line_program.hpp90
-rw-r--r--src/mbgl/programs/program.hpp56
-rw-r--r--src/mbgl/programs/programs.hpp4
-rw-r--r--src/mbgl/programs/raster_program.cpp2
-rw-r--r--src/mbgl/programs/raster_program.hpp29
-rw-r--r--src/mbgl/programs/symbol_program.cpp90
-rw-r--r--src/mbgl/programs/symbol_program.hpp109
16 files changed, 480 insertions, 275 deletions
diff --git a/src/mbgl/programs/attributes.hpp b/src/mbgl/programs/attributes.hpp
index 38bbe89377..bb90f2c13c 100644
--- a/src/mbgl/programs/attributes.hpp
+++ b/src/mbgl/programs/attributes.hpp
@@ -1,23 +1,221 @@
#pragma once
#include <mbgl/gl/attribute.hpp>
+#include <mbgl/gl/uniform.hpp>
+#include <mbgl/gl/normalization.hpp>
#include <cstdint>
namespace mbgl {
namespace attributes {
-// Attributes common to several shaders.
+// Layout attributes
MBGL_DEFINE_ATTRIBUTE(int16_t, 2, a_pos);
-MBGL_DEFINE_ATTRIBUTE(int16_t, 2, a_offset);
MBGL_DEFINE_ATTRIBUTE(int16_t, 2, a_extrude);
MBGL_DEFINE_ATTRIBUTE(uint16_t, 2, a_texture_pos);
template <std::size_t N>
-struct a_data : gl::Attribute<a_data<N>, uint8_t, N> {
- static constexpr auto name = "a_data";
+struct a_data : gl::Attribute<uint8_t, N> {
+ static auto name() { return "a_data"; }
};
+template <std::size_t N>
+struct a_offset : gl::Attribute<int16_t, N> {
+ static auto name() { return "a_offset"; }
+};
+
+// Paint attributes
+
+template <class Attr>
+struct Min : Attr {
+ static auto name() {
+ static const std::string name = Attr::name() + std::string("_min");
+ return name.c_str();
+ }
+};
+
+template <class Attr>
+struct Max : Attr {
+ static auto name() {
+ static const std::string name = Attr::name() + std::string("_max");
+ return name.c_str();
+ }
+};
+
+template <class Attr>
+struct InterpolationUniform : gl::UniformScalar<InterpolationUniform<Attr>, float> {
+ static auto name() {
+ static const std::string name = Attr::name() + std::string("_t");
+ return name.c_str();
+ }
+};
+
+struct a_color : gl::Attribute<gl::Normalized<uint8_t>, 4> {
+ static auto name() { return "a_color"; }
+
+ static Value value(const Color& color) {
+ return {{
+ gl::Normalized<uint8_t>(color.r),
+ gl::Normalized<uint8_t>(color.g),
+ gl::Normalized<uint8_t>(color.b),
+ gl::Normalized<uint8_t>(color.a)
+ }};
+ }
+};
+
+// used in the symbol sdf shader
+struct a_fill_color : gl::Attribute<gl::Normalized<uint8_t>, 4> {
+ static auto name() { return "a_fill_color"; }
+
+ static Value value(const Color& color) {
+ return {{
+ gl::Normalized<uint8_t>(color.r),
+ gl::Normalized<uint8_t>(color.g),
+ gl::Normalized<uint8_t>(color.b),
+ gl::Normalized<uint8_t>(color.a)
+ }};
+ }
+};
+
+// used in the symbol sdf shader
+struct a_halo_color : gl::Attribute<gl::Normalized<uint8_t>, 4> {
+ static auto name() { return "a_halo_color"; }
+
+ static Value value(const Color& color) {
+ return {{
+ gl::Normalized<uint8_t>(color.r),
+ gl::Normalized<uint8_t>(color.g),
+ gl::Normalized<uint8_t>(color.b),
+ gl::Normalized<uint8_t>(color.a)
+ }};
+ }
+};
+
+struct a_stroke_color : gl::Attribute<gl::Normalized<uint8_t>, 4> {
+ static auto name() { return "a_stroke_color"; }
+
+ static Value value(const Color& color) {
+ return {{
+ gl::Normalized<uint8_t>(color.r),
+ gl::Normalized<uint8_t>(color.g),
+ gl::Normalized<uint8_t>(color.b),
+ gl::Normalized<uint8_t>(color.a)
+ }};
+ }
+};
+
+struct a_outline_color : gl::Attribute<gl::Normalized<uint8_t>, 4> {
+ static auto name() { return "a_outline_color"; }
+
+ static Value value(const Color& color) {
+ return {{
+ gl::Normalized<uint8_t>(color.r),
+ gl::Normalized<uint8_t>(color.g),
+ gl::Normalized<uint8_t>(color.b),
+ gl::Normalized<uint8_t>(color.a)
+ }};
+ }
+};
+
+struct a_opacity : gl::Attribute<gl::Normalized<uint8_t>, 1> {
+ static auto name() { return "a_opacity"; }
+
+ static Value value(float opacity) {
+ return {{ gl::Normalized<uint8_t>(opacity) }};
+ }
+};
+
+struct a_stroke_opacity : gl::Attribute<gl::Normalized<uint8_t>, 1> {
+ static auto name() { return "a_stroke_opacity"; }
+
+ static Value value(float opacity) {
+ return {{ gl::Normalized<uint8_t>(opacity) }};
+ }
+};
+
+struct a_blur : gl::Attribute<float, 1> {
+ static auto name() { return "a_blur"; }
+
+ static Value value(float blur) {
+ return {{ blur }};
+ }
+};
+
+struct a_radius : gl::Attribute<float, 1> {
+ static auto name() { return "a_radius"; }
+
+ static Value value(float radius) {
+ return {{ radius }};
+ }
+};
+
+struct a_width : gl::Attribute<float, 1> {
+ static auto name() { return "a_width"; }
+
+ static Value value(float width) {
+ return {{ width }};
+ }
+};
+
+struct a_height : gl::Attribute<float, 1> {
+ static auto name() { return "a_height"; }
+
+ static Value value(float width) {
+ return {{ width }};
+ }
+};
+
+struct a_base : gl::Attribute<float, 1> {
+ static auto name() { return "a_base"; }
+
+ static Value value(float width) {
+ return {{ width }};
+ }
+};
+
+struct a_gap_width : gl::Attribute<float, 1> {
+ static auto name() { return "a_gapwidth"; }
+
+ static Value value(float width) {
+ return {{ width }};
+ }
+};
+
+struct a_stroke_width : gl::Attribute<float, 1> {
+ static auto name() { return "a_stroke_width"; }
+
+ static Value value(float width) {
+ return {{ width }};
+ }
+};
+
+template <>
+struct a_offset<1> : gl::Attribute<float, 1> {
+ static auto name() { return "a_offset"; }
+
+ static Value value(float offset) {
+ return {{ offset }};
+ }
+};
+
+struct a_halo_width : gl::Attribute<float, 1> {
+ static auto name() { return "a_halo_width"; }
+
+ static Value value(float width) {
+ return {{ width }};
+ }
+};
+
+struct a_halo_blur : gl::Attribute<float, 1> {
+ static auto name() { return "a_halo_blur"; }
+
+ static Value value(float blur) {
+ return {{ blur }};
+ }
+};
+
+
+
} // namespace attributes
} // namespace mbgl
diff --git a/src/mbgl/programs/circle_program.cpp b/src/mbgl/programs/circle_program.cpp
index d6bc439feb..99b47dd5c0 100644
--- a/src/mbgl/programs/circle_program.cpp
+++ b/src/mbgl/programs/circle_program.cpp
@@ -2,6 +2,6 @@
namespace mbgl {
-static_assert(sizeof(CircleProgram::Vertex) == 4, "expected CircleVertex size");
+static_assert(sizeof(CircleLayoutVertex) == 4, "expected CircleLayoutVertex size");
} // namespace mbgl
diff --git a/src/mbgl/programs/circle_program.hpp b/src/mbgl/programs/circle_program.hpp
index c9aea1d137..8f056048b1 100644
--- a/src/mbgl/programs/circle_program.hpp
+++ b/src/mbgl/programs/circle_program.hpp
@@ -3,37 +3,26 @@
#include <mbgl/programs/program.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/programs/uniforms.hpp>
-#include <mbgl/shader/circle.hpp>
+#include <mbgl/shaders/circle.hpp>
#include <mbgl/util/geometry.hpp>
+#include <mbgl/style/layers/circle_layer_properties.hpp>
namespace mbgl {
namespace uniforms {
-MBGL_DEFINE_UNIFORM_SCALAR(float, u_radius);
-MBGL_DEFINE_UNIFORM_SCALAR(Color, u_stroke_color);
-MBGL_DEFINE_UNIFORM_SCALAR(float, u_stroke_width);
-MBGL_DEFINE_UNIFORM_SCALAR(float, u_stroke_opacity);
MBGL_DEFINE_UNIFORM_SCALAR(bool, u_scale_with_map);
} // namespace uniforms
-using CircleAttributes = gl::Attributes<
- attributes::a_pos>;
-
class CircleProgram : public Program<
shaders::circle,
gl::Triangle,
- CircleAttributes,
+ gl::Attributes<
+ attributes::a_pos>,
gl::Uniforms<
uniforms::u_matrix,
- uniforms::u_opacity,
- uniforms::u_color,
- uniforms::u_radius,
- uniforms::u_blur,
- uniforms::u_stroke_color,
- uniforms::u_stroke_width,
- uniforms::u_stroke_opacity,
uniforms::u_scale_with_map,
- uniforms::u_extrude_scale>>
+ uniforms::u_extrude_scale>,
+ style::CirclePaintProperties>
{
public:
using Program::Program;
@@ -44,16 +33,17 @@ public:
* @param {number} ex extrude normal
* @param {number} ey extrude normal
*/
- static Vertex vertex(Point<int16_t> p, float ex, float ey) {
- return Vertex {
- {
+ static LayoutVertex vertex(Point<int16_t> p, float ex, float ey) {
+ return LayoutVertex {
+ {{
static_cast<int16_t>((p.x * 2) + ((ex + 1) / 2)),
static_cast<int16_t>((p.y * 2) + ((ey + 1) / 2))
- }
+ }}
};
}
};
-using CircleVertex = CircleProgram::Vertex;
+using CircleLayoutVertex = CircleProgram::LayoutVertex;
+using CircleAttributes = CircleProgram::Attributes;
} // namespace mbgl
diff --git a/src/mbgl/programs/collision_box_program.cpp b/src/mbgl/programs/collision_box_program.cpp
index d6a36e54a1..a3dc01ebe4 100644
--- a/src/mbgl/programs/collision_box_program.cpp
+++ b/src/mbgl/programs/collision_box_program.cpp
@@ -2,6 +2,6 @@
namespace mbgl {
-static_assert(sizeof(CollisionBoxProgram::Vertex) == 10, "expected CollisionBoxVertex size");
+static_assert(sizeof(CollisionBoxProgram::LayoutVertex) == 10, "expected CollisionBoxVertex size");
} // namespace mbgl
diff --git a/src/mbgl/programs/collision_box_program.hpp b/src/mbgl/programs/collision_box_program.hpp
index 26e38419a4..78ed6aa0c9 100644
--- a/src/mbgl/programs/collision_box_program.hpp
+++ b/src/mbgl/programs/collision_box_program.hpp
@@ -3,7 +3,7 @@
#include <mbgl/programs/program.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/programs/uniforms.hpp>
-#include <mbgl/shader/collision_box.hpp>
+#include <mbgl/shaders/collision_box.hpp>
#include <mbgl/util/geometry.hpp>
#include <cmath>
@@ -28,29 +28,30 @@ class CollisionBoxProgram : public Program<
uniforms::u_matrix,
uniforms::u_scale,
uniforms::u_zoom,
- uniforms::u_maxzoom>>
+ uniforms::u_maxzoom>,
+ style::PaintProperties<>>
{
public:
using Program::Program;
- static Vertex vertex(Point<float> a, Point<float> o, float maxzoom, float placementZoom) {
- return Vertex {
- {
+ static LayoutVertex vertex(Point<float> a, Point<float> o, float maxzoom, float placementZoom) {
+ return LayoutVertex {
+ {{
static_cast<int16_t>(a.x),
static_cast<int16_t>(a.y)
- },
- {
+ }},
+ {{
static_cast<int16_t>(::round(o.x)),
static_cast<int16_t>(::round(o.y))
- },
- {
+ }},
+ {{
static_cast<uint8_t>(maxzoom * 10),
static_cast<uint8_t>(placementZoom * 10)
- }
+ }}
};
}
};
-using CollisionBoxVertex = CollisionBoxProgram::Vertex;
+using CollisionBoxVertex = CollisionBoxProgram::LayoutVertex;
} // namespace mbgl
diff --git a/src/mbgl/programs/debug_program.hpp b/src/mbgl/programs/debug_program.hpp
index cd4e08b1bc..de1666b4a8 100644
--- a/src/mbgl/programs/debug_program.hpp
+++ b/src/mbgl/programs/debug_program.hpp
@@ -3,25 +3,25 @@
#include <mbgl/programs/program.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/programs/uniforms.hpp>
-#include <mbgl/shader/debug.hpp>
+#include <mbgl/shaders/debug.hpp>
namespace mbgl {
-using DebugAttributes = gl::Attributes<
- attributes::a_pos>;
-
class DebugProgram : public Program<
shaders::debug,
gl::Line,
- DebugAttributes,
+ gl::Attributes<
+ attributes::a_pos>,
gl::Uniforms<
uniforms::u_matrix,
- uniforms::u_color>>
+ uniforms::u_color>,
+ style::PaintProperties<>>
{
public:
using Program::Program;
};
-using DebugVertex = DebugProgram::Vertex;
+using DebugLayoutVertex = DebugProgram::LayoutVertex;
+using DebugAttributes = DebugProgram::Attributes;
} // namespace mbgl
diff --git a/src/mbgl/programs/fill_program.cpp b/src/mbgl/programs/fill_program.cpp
index a8154d08f9..eebcffd2cb 100644
--- a/src/mbgl/programs/fill_program.cpp
+++ b/src/mbgl/programs/fill_program.cpp
@@ -8,14 +8,13 @@ namespace mbgl {
using namespace style;
-static_assert(sizeof(FillAttributes::Vertex) == 4, "expected FillVertex size");
+static_assert(sizeof(FillLayoutVertex) == 4, "expected FillLayoutVertex size");
FillPatternUniforms::Values
FillPatternUniforms::values(mat4 matrix,
- float opacity,
Size framebufferSize,
- const SpriteAtlasPosition& a,
- const SpriteAtlasPosition& b,
+ const SpriteAtlasElement& a,
+ const SpriteAtlasElement& b,
const Faded<std::string>& fading,
const UnwrappedTileID& tileID,
const TransformState& state)
@@ -26,7 +25,6 @@ FillPatternUniforms::values(mat4 matrix,
return FillPatternUniforms::Values {
uniforms::u_matrix::Value{ matrix },
- uniforms::u_opacity::Value{ opacity },
uniforms::u_world::Value{ framebufferSize },
uniforms::u_pattern_tl_a::Value{ a.tl },
uniforms::u_pattern_br_a::Value{ a.br },
diff --git a/src/mbgl/programs/fill_program.hpp b/src/mbgl/programs/fill_program.hpp
index d885215c59..84ca2748d6 100644
--- a/src/mbgl/programs/fill_program.hpp
+++ b/src/mbgl/programs/fill_program.hpp
@@ -3,19 +3,20 @@
#include <mbgl/programs/program.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/programs/uniforms.hpp>
-#include <mbgl/shader/fill.hpp>
-#include <mbgl/shader/fill_pattern.hpp>
-#include <mbgl/shader/fill_outline.hpp>
-#include <mbgl/shader/fill_outline_pattern.hpp>
+#include <mbgl/shaders/fill.hpp>
+#include <mbgl/shaders/fill_pattern.hpp>
+#include <mbgl/shaders/fill_outline.hpp>
+#include <mbgl/shaders/fill_outline_pattern.hpp>
#include <mbgl/util/geometry.hpp>
#include <mbgl/util/mat4.hpp>
#include <mbgl/util/size.hpp>
+#include <mbgl/style/layers/fill_layer_properties.hpp>
#include <string>
namespace mbgl {
-class SpriteAtlasPosition;
+class SpriteAtlasElement;
class UnwrappedTileID;
class TransformState;
@@ -25,7 +26,6 @@ template <class> class Faded;
namespace uniforms {
MBGL_DEFINE_UNIFORM_SCALAR(Size, u_world);
-MBGL_DEFINE_UNIFORM_SCALAR(Color, u_outline_color);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_scale_a);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_scale_b);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_tile_units_to_pixels);
@@ -33,32 +33,17 @@ MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_pixel_coord_upper);
MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_pixel_coord_lower);
} // namespace uniforms
-struct FillAttributes : gl::Attributes<
+struct FillLayoutAttributes : gl::Attributes<
attributes::a_pos>
-{
- static Vertex vertex(Point<int16_t> p) {
- return Vertex {
- {
- p.x,
- p.y
- }
- };
- }
-};
-
-using FillVertex = FillAttributes::Vertex;
+{};
struct FillUniforms : gl::Uniforms<
uniforms::u_matrix,
- uniforms::u_opacity,
- uniforms::u_color,
- uniforms::u_outline_color,
uniforms::u_world>
{};
struct FillPatternUniforms : gl::Uniforms<
uniforms::u_matrix,
- uniforms::u_opacity,
uniforms::u_world,
uniforms::u_pattern_tl_a,
uniforms::u_pattern_br_a,
@@ -75,10 +60,9 @@ struct FillPatternUniforms : gl::Uniforms<
uniforms::u_tile_units_to_pixels>
{
static Values values(mat4 matrix,
- float opacity,
Size framebufferSize,
- const SpriteAtlasPosition&,
- const SpriteAtlasPosition&,
+ const SpriteAtlasElement&,
+ const SpriteAtlasElement&,
const style::Faded<std::string>&,
const UnwrappedTileID&,
const TransformState&);
@@ -87,37 +71,57 @@ struct FillPatternUniforms : gl::Uniforms<
class FillProgram : public Program<
shaders::fill,
gl::Triangle,
- FillAttributes,
- FillUniforms>
+ FillLayoutAttributes,
+ FillUniforms,
+ style::FillPaintProperties>
{
+public:
using Program::Program;
+
+ static LayoutVertex layoutVertex(Point<int16_t> p) {
+ return LayoutVertex {
+ {{
+ p.x,
+ p.y
+ }}
+ };
+ }
};
class FillPatternProgram : public Program<
shaders::fill_pattern,
gl::Triangle,
- FillAttributes,
- FillPatternUniforms>
+ FillLayoutAttributes,
+ FillPatternUniforms,
+ style::FillPaintProperties>
{
+public:
using Program::Program;
};
class FillOutlineProgram : public Program<
shaders::fill_outline,
gl::Line,
- FillAttributes,
- FillUniforms>
+ FillLayoutAttributes,
+ FillUniforms,
+ style::FillPaintProperties>
{
+public:
using Program::Program;
};
class FillOutlinePatternProgram : public Program<
shaders::fill_outline_pattern,
gl::Line,
- FillAttributes,
- FillPatternUniforms>
+ FillLayoutAttributes,
+ FillPatternUniforms,
+ style::FillPaintProperties>
{
+public:
using Program::Program;
};
+using FillLayoutVertex = FillProgram::LayoutVertex;
+using FillAttributes = FillProgram::Attributes;
+
} // namespace mbgl
diff --git a/src/mbgl/programs/line_program.cpp b/src/mbgl/programs/line_program.cpp
index f7054d3398..d9778ba7ce 100644
--- a/src/mbgl/programs/line_program.cpp
+++ b/src/mbgl/programs/line_program.cpp
@@ -10,7 +10,7 @@ namespace mbgl {
using namespace style;
-static_assert(sizeof(LineAttributes::Vertex) == 8, "expected LineVertex size");
+static_assert(sizeof(LineLayoutVertex) == 8, "expected LineLayoutVertex size");
template <class Values, class...Args>
Values makeValues(const LinePaintProperties::Evaluated& properties,
@@ -25,11 +25,7 @@ Values makeValues(const LinePaintProperties::Evaluated& properties,
properties.get<LineTranslateAnchor>(),
state)
},
- uniforms::u_opacity::Value{ properties.get<LineOpacity>() },
uniforms::u_width::Value{ properties.get<LineWidth>() },
- uniforms::u_gapwidth::Value{ properties.get<LineGapWidth>() },
- uniforms::u_blur::Value{ properties.get<LineBlur>() },
- uniforms::u_offset::Value{ properties.get<LineOffset>() },
uniforms::u_ratio::Value{ 1.0f / tile.id.pixelsToTileUnits(1.0, state.getZoom()) },
uniforms::u_gl_units_to_pixels::Value{{{ 1.0f / pixelsToGLUnits[0], 1.0f / pixelsToGLUnits[1] }}},
std::forward<Args>(args)...
@@ -45,8 +41,7 @@ LineProgram::uniformValues(const LinePaintProperties::Evaluated& properties,
properties,
tile,
state,
- pixelsToGLUnits,
- uniforms::u_color::Value{ properties.get<LineColor>() }
+ pixelsToGLUnits
);
}
@@ -78,7 +73,6 @@ LineSDFProgram::uniformValues(const LinePaintProperties::Evaluated& properties,
tile,
state,
pixelsToGLUnits,
- uniforms::u_color::Value{ properties.get<LineColor>() },
uniforms::u_patternscale_a::Value{ scaleA },
uniforms::u_patternscale_b::Value{ scaleB },
uniforms::u_tex_y_a::Value{ posA.y },
@@ -94,8 +88,8 @@ LinePatternProgram::uniformValues(const LinePaintProperties::Evaluated& properti
const RenderTile& tile,
const TransformState& state,
const std::array<float, 2>& pixelsToGLUnits,
- const SpriteAtlasPosition& posA,
- const SpriteAtlasPosition& posB) {
+ const SpriteAtlasElement& posA,
+ const SpriteAtlasElement& posB) {
std::array<float, 2> sizeA {{
tile.id.pixelsToTileUnits(posA.size[0] * properties.get<LinePattern>().fromScale, state.getIntegerZoom()),
posA.size[1]
diff --git a/src/mbgl/programs/line_program.hpp b/src/mbgl/programs/line_program.hpp
index 9b97cc47a9..842b4cc602 100644
--- a/src/mbgl/programs/line_program.hpp
+++ b/src/mbgl/programs/line_program.hpp
@@ -3,11 +3,11 @@
#include <mbgl/programs/program.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/programs/uniforms.hpp>
-#include <mbgl/shader/line.hpp>
-#include <mbgl/shader/line_pattern.hpp>
-#include <mbgl/shader/line_sdf.hpp>
-#include <mbgl/style/layers/line_layer_properties.hpp>
+#include <mbgl/shaders/line.hpp>
+#include <mbgl/shaders/line_pattern.hpp>
+#include <mbgl/shaders/line_sdf.hpp>
#include <mbgl/util/geometry.hpp>
+#include <mbgl/style/layers/line_layer_properties.hpp>
#include <cmath>
@@ -16,13 +16,11 @@ namespace mbgl {
class RenderTile;
class TransformState;
class LinePatternPos;
-class SpriteAtlasPosition;
+class SpriteAtlasElement;
namespace uniforms {
MBGL_DEFINE_UNIFORM_SCALAR(float, u_ratio);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_width);
-MBGL_DEFINE_UNIFORM_SCALAR(float, u_gapwidth);
-MBGL_DEFINE_UNIFORM_SCALAR(float, u_offset);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_tex_y_a);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_tex_y_b);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_sdfgamma);
@@ -32,24 +30,39 @@ MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_patternscale_b);
MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_gl_units_to_pixels);
} // namespace uniforms
-struct LineAttributes : gl::Attributes<
+struct LineLayoutAttributes : gl::Attributes<
attributes::a_pos,
attributes::a_data<4>>
+{};
+
+class LineProgram : public Program<
+ shaders::line,
+ gl::Triangle,
+ LineLayoutAttributes,
+ gl::Uniforms<
+ uniforms::u_matrix,
+ uniforms::u_width,
+ uniforms::u_ratio,
+ uniforms::u_gl_units_to_pixels>,
+ style::LinePaintProperties>
{
+public:
+ using Program::Program;
+
/*
* @param p vertex position
* @param e extrude normal
* @param t texture normal
* @param dir direction of the line cap (-1/0/1)
*/
- static Vertex vertex(Point<int16_t> p, Point<double> e, Point<bool> t, int8_t dir, int32_t linesofar = 0) {
- return Vertex {
- {
+ static LayoutVertex layoutVertex(Point<int16_t> p, Point<double> e, Point<bool> t, int8_t dir, int32_t linesofar = 0) {
+ return LayoutVertex {
+ {{
static_cast<int16_t>((p.x * 2) | t.x),
static_cast<int16_t>((p.y * 2) | t.y)
- },
- {
- // add 128 to store an byte in an unsigned byte
+ }},
+ {{
+ // add 128 to store a byte in an unsigned byte
static_cast<uint8_t>(::round(extrudeScale * e.x) + 128),
static_cast<uint8_t>(::round(extrudeScale * e.y) + 128),
@@ -65,7 +78,7 @@ struct LineAttributes : gl::Attributes<
// so we need to shift the linesofar.
static_cast<uint8_t>(((dir == 0 ? 0 : (dir < 0 ? -1 : 1 )) + 1) | ((linesofar & 0x3F) << 2)),
static_cast<uint8_t>(linesofar >> 6)
- }
+ }}
};
}
@@ -77,27 +90,6 @@ struct LineAttributes : gl::Attributes<
* the acute/bevelled line join.
*/
static const int8_t extrudeScale = 63;
-};
-
-using LineVertex = LineAttributes::Vertex;
-
-class LineProgram : public Program<
- shaders::line,
- gl::Triangle,
- LineAttributes,
- gl::Uniforms<
- uniforms::u_matrix,
- uniforms::u_opacity,
- uniforms::u_width,
- uniforms::u_gapwidth,
- uniforms::u_blur,
- uniforms::u_offset,
- uniforms::u_ratio,
- uniforms::u_gl_units_to_pixels,
- uniforms::u_color>>
-{
-public:
- using Program::Program;
static UniformValues uniformValues(const style::LinePaintProperties::Evaluated&,
const RenderTile&,
@@ -108,14 +100,10 @@ public:
class LinePatternProgram : public Program<
shaders::line_pattern,
gl::Triangle,
- LineAttributes,
+ LineLayoutAttributes,
gl::Uniforms<
uniforms::u_matrix,
- uniforms::u_opacity,
uniforms::u_width,
- uniforms::u_gapwidth,
- uniforms::u_blur,
- uniforms::u_offset,
uniforms::u_ratio,
uniforms::u_gl_units_to_pixels,
uniforms::u_pattern_tl_a,
@@ -125,7 +113,8 @@ class LinePatternProgram : public Program<
uniforms::u_pattern_size_a,
uniforms::u_pattern_size_b,
uniforms::u_fade,
- uniforms::u_image>>
+ uniforms::u_image>,
+ style::LinePaintProperties>
{
public:
using Program::Program;
@@ -134,31 +123,27 @@ public:
const RenderTile&,
const TransformState&,
const std::array<float, 2>& pixelsToGLUnits,
- const SpriteAtlasPosition& posA,
- const SpriteAtlasPosition& posB);
+ const SpriteAtlasElement& posA,
+ const SpriteAtlasElement& posB);
};
class LineSDFProgram : public Program<
shaders::line_sdf,
gl::Triangle,
- LineAttributes,
+ LineLayoutAttributes,
gl::Uniforms<
uniforms::u_matrix,
- uniforms::u_opacity,
uniforms::u_width,
- uniforms::u_gapwidth,
- uniforms::u_blur,
- uniforms::u_offset,
uniforms::u_ratio,
uniforms::u_gl_units_to_pixels,
- uniforms::u_color,
uniforms::u_patternscale_a,
uniforms::u_patternscale_b,
uniforms::u_tex_y_a,
uniforms::u_tex_y_b,
uniforms::u_mix,
uniforms::u_sdfgamma,
- uniforms::u_image>>
+ uniforms::u_image>,
+ style::LinePaintProperties>
{
public:
using Program::Program;
@@ -174,4 +159,7 @@ public:
float atlasWidth);
};
+using LineLayoutVertex = LineProgram::LayoutVertex;
+using LineAttributes = LineProgram::Attributes;
+
} // namespace mbgl
diff --git a/src/mbgl/programs/program.hpp b/src/mbgl/programs/program.hpp
index e5aae24997..e75dbebf18 100644
--- a/src/mbgl/programs/program.hpp
+++ b/src/mbgl/programs/program.hpp
@@ -2,21 +2,40 @@
#include <mbgl/gl/program.hpp>
#include <mbgl/programs/program_parameters.hpp>
+#include <mbgl/programs/attributes.hpp>
+#include <mbgl/style/paint_property.hpp>
#include <sstream>
#include <cassert>
namespace mbgl {
-template <class Shaders, class Primitive, class Attributes, class Uniforms>
-class Program : public gl::Program<Primitive, Attributes, Uniforms> {
+template <class Shaders,
+ class Primitive,
+ class LayoutAttrs,
+ class Uniforms,
+ class PaintProperties>
+class Program {
public:
- using ParentType = gl::Program<Primitive, Attributes, Uniforms>;
+ using LayoutAttributes = LayoutAttrs;
+ using LayoutVertex = typename LayoutAttributes::Vertex;
+
+ using PaintPropertyBinders = typename PaintProperties::Binders;
+ using PaintAttributes = typename PaintPropertyBinders::Attributes;
+ using Attributes = gl::ConcatenateAttributes<LayoutAttributes, PaintAttributes>;
+
+ using UniformValues = typename Uniforms::Values;
+ using PaintUniforms = typename PaintPropertyBinders::Uniforms;
+ using AllUniforms = gl::ConcatenateUniforms<Uniforms, PaintUniforms>;
+
+ using ProgramType = gl::Program<Primitive, Attributes, AllUniforms>;
+
+ ProgramType program;
Program(gl::Context& context, const ProgramParameters& programParameters)
- : ParentType(context, vertexSource(programParameters), fragmentSource(programParameters))
+ : program(context, vertexSource(programParameters), fragmentSource(programParameters))
{}
-
+
static std::string pixelRatioDefine(const ProgramParameters& parameters) {
std::ostringstream pixelRatioSS;
pixelRatioSS.imbue(std::locale("C"));
@@ -38,6 +57,33 @@ public:
return pixelRatioDefine(parameters) + Shaders::vertexSource;
}
+ template <class DrawMode>
+ void draw(gl::Context& context,
+ DrawMode drawMode,
+ gl::DepthMode depthMode,
+ gl::StencilMode stencilMode,
+ gl::ColorMode colorMode,
+ UniformValues&& uniformValues,
+ const gl::VertexBuffer<LayoutVertex>& layoutVertexBuffer,
+ const gl::IndexBuffer<DrawMode>& indexBuffer,
+ const gl::SegmentVector<Attributes>& segments,
+ const PaintPropertyBinders& paintPropertyBinders,
+ const typename PaintProperties::Evaluated& currentProperties,
+ float currentZoom) {
+ program.draw(
+ context,
+ std::move(drawMode),
+ std::move(depthMode),
+ std::move(stencilMode),
+ std::move(colorMode),
+ uniformValues
+ .concat(paintPropertyBinders.uniformValues(currentZoom)),
+ LayoutAttributes::allVariableBindings(layoutVertexBuffer)
+ .concat(paintPropertyBinders.attributeBindings(currentProperties)),
+ indexBuffer,
+ segments
+ );
+ }
};
} // namespace mbgl
diff --git a/src/mbgl/programs/programs.hpp b/src/mbgl/programs/programs.hpp
index dd71c2ce97..742c5a221b 100644
--- a/src/mbgl/programs/programs.hpp
+++ b/src/mbgl/programs/programs.hpp
@@ -40,8 +40,8 @@ public:
LinePatternProgram linePattern;
RasterProgram raster;
SymbolIconProgram symbolIcon;
- SymbolSDFProgram symbolIconSDF;
- SymbolSDFProgram symbolGlyph;
+ SymbolSDFIconProgram symbolIconSDF;
+ SymbolSDFTextProgram symbolGlyph;
DebugProgram debug;
CollisionBoxProgram collisionBox;
diff --git a/src/mbgl/programs/raster_program.cpp b/src/mbgl/programs/raster_program.cpp
index ebec4c68cc..6906903e6b 100644
--- a/src/mbgl/programs/raster_program.cpp
+++ b/src/mbgl/programs/raster_program.cpp
@@ -2,6 +2,6 @@
namespace mbgl {
-static_assert(sizeof(RasterProgram::Vertex) == 8, "expected RasterVertex size");
+static_assert(sizeof(RasterLayoutVertex) == 8, "expected RasterLayoutVertex size");
} // namespace mbgl
diff --git a/src/mbgl/programs/raster_program.hpp b/src/mbgl/programs/raster_program.hpp
index 9aa25cf90c..09cb94ac17 100644
--- a/src/mbgl/programs/raster_program.hpp
+++ b/src/mbgl/programs/raster_program.hpp
@@ -3,8 +3,9 @@
#include <mbgl/programs/program.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/programs/uniforms.hpp>
-#include <mbgl/shader/raster.hpp>
+#include <mbgl/shaders/raster.hpp>
#include <mbgl/util/geometry.hpp>
+#include <mbgl/style/layers/raster_layer_properties.hpp>
namespace mbgl {
@@ -22,14 +23,12 @@ MBGL_DEFINE_UNIFORM_VECTOR(float, 3, u_spin_weights);
MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_tl_parent);
} // namespace uniforms
-using RasterAttributes = gl::Attributes<
- attributes::a_pos,
- attributes::a_texture_pos>;
-
class RasterProgram : public Program<
shaders::raster,
gl::Triangle,
- RasterAttributes,
+ gl::Attributes<
+ attributes::a_pos,
+ attributes::a_texture_pos>,
gl::Uniforms<
uniforms::u_matrix,
uniforms::u_image0,
@@ -43,25 +42,27 @@ class RasterProgram : public Program<
uniforms::u_spin_weights,
uniforms::u_buffer_scale,
uniforms::u_scale_parent,
- uniforms::u_tl_parent>>
+ uniforms::u_tl_parent>,
+ style::RasterPaintProperties>
{
public:
using Program::Program;
- static Vertex vertex(Point<int16_t> p, Point<uint16_t> t) {
- return Vertex {
- {
+ static LayoutVertex layoutVertex(Point<int16_t> p, Point<uint16_t> t) {
+ return LayoutVertex {
+ {{
p.x,
p.y
- },
- {
+ }},
+ {{
t.x,
t.y
- }
+ }}
};
}
};
-using RasterVertex = RasterProgram::Vertex;
+using RasterLayoutVertex = RasterProgram::LayoutVertex;
+using RasterAttributes = RasterProgram::Attributes;
} // namespace mbgl
diff --git a/src/mbgl/programs/symbol_program.cpp b/src/mbgl/programs/symbol_program.cpp
index d609dada8d..19fe2bc2f6 100644
--- a/src/mbgl/programs/symbol_program.cpp
+++ b/src/mbgl/programs/symbol_program.cpp
@@ -2,12 +2,13 @@
#include <mbgl/renderer/render_tile.hpp>
#include <mbgl/map/transform_state.hpp>
#include <mbgl/style/layers/symbol_layer_impl.hpp>
+#include <mbgl/util/enum.hpp>
namespace mbgl {
using namespace style;
-static_assert(sizeof(SymbolAttributes::Vertex) == 16, "expected SymbolVertex size");
+static_assert(sizeof(SymbolLayoutVertex) == 16, "expected SymbolLayoutVertex size");
template <class Values, class...Args>
Values makeValues(const style::SymbolPropertyValues& values,
@@ -19,6 +20,7 @@ Values makeValues(const style::SymbolPropertyValues& values,
std::array<float, 2> extrudeScale;
const float scale = values.paintSize / values.sdfScale;
+
if (values.pitchAlignment == AlignmentType::Map) {
extrudeScale.fill(tile.id.pixelsToTileUnits(1, state.getZoom()) * scale);
} else {
@@ -27,7 +29,7 @@ Values makeValues(const style::SymbolPropertyValues& values,
pixelsToGLUnits[1] * scale * state.getCameraToCenterDistance()
}};
}
-
+
// adjust min/max zooms for variable font sies
float zoomAdjust = std::log(values.paintSize / values.layoutSize) / std::log(2);
@@ -35,7 +37,6 @@ Values makeValues(const style::SymbolPropertyValues& values,
uniforms::u_matrix::Value{ tile.translatedMatrix(values.translate,
values.translateAnchor,
state) },
- uniforms::u_opacity::Value{ values.opacity },
uniforms::u_extrude_scale::Value{ extrudeScale },
uniforms::u_texsize::Value{ std::array<float, 2> {{ float(texsize.width) / 4, float(texsize.height) / 4 }} },
uniforms::u_zoom::Value{ float((state.getZoom() - zoomAdjust) * 10) },
@@ -62,84 +63,37 @@ SymbolIconProgram::uniformValues(const style::SymbolPropertyValues& values,
);
}
-static SymbolSDFProgram::UniformValues makeSDFValues(const style::SymbolPropertyValues& values,
- const Size& texsize,
- const std::array<float, 2>& pixelsToGLUnits,
- const RenderTile& tile,
- const TransformState& state,
- float pixelRatio,
- Color color,
- float buffer,
- float gammaAdjust)
-{
- // The default gamma value has to be adjust for the current pixelratio so that we're not
- // drawing blurry font on retina screens.
- const float gammaBase = 0.105 * values.sdfScale / values.paintSize / pixelRatio;
- const float gammaScale = (values.pitchAlignment == AlignmentType::Map
- ? 1.0 / std::cos(state.getPitch())
- : 1.0) / state.getCameraToCenterDistance();
-
- return makeValues<SymbolSDFProgram::UniformValues>(
- values,
- texsize,
- pixelsToGLUnits,
- tile,
- state,
- uniforms::u_color::Value{ color },
- uniforms::u_buffer::Value{ buffer },
- uniforms::u_gamma::Value{ (gammaBase + gammaAdjust) * gammaScale },
- uniforms::u_pitch::Value{ state.getPitch() },
- uniforms::u_bearing::Value{ -1.0f * state.getAngle() },
- uniforms::u_aspect_ratio::Value{ (state.getSize().width * 1.0f) / (state.getSize().height * 1.0f) },
- uniforms::u_pitch_with_map::Value{ values.pitchAlignment == AlignmentType::Map }
- );
-}
-
-SymbolSDFProgram::UniformValues
-SymbolSDFProgram::haloUniformValues(const style::SymbolPropertyValues& values,
+template <class PaintProperties>
+typename SymbolSDFProgram<PaintProperties>::UniformValues SymbolSDFProgram<PaintProperties>::uniformValues(const style::SymbolPropertyValues& values,
const Size& texsize,
const std::array<float, 2>& pixelsToGLUnits,
const RenderTile& tile,
const TransformState& state,
- float pixelRatio)
+ const SymbolSDFPart part)
{
const float scale = values.paintSize / values.sdfScale;
- const float sdfPx = 8.0f;
- const float blurOffset = 1.19f;
- const float haloOffset = 6.0f;
-
- return makeSDFValues(
+
+ const float gammaScale = scale * (values.pitchAlignment == AlignmentType::Map
+ ? std::cos(state.getPitch())
+ : 1.0) * state.getCameraToCenterDistance();
+
+ return makeValues<SymbolSDFProgram<PaintProperties>::UniformValues>(
values,
texsize,
pixelsToGLUnits,
tile,
state,
- pixelRatio,
- values.haloColor,
- (haloOffset - values.haloWidth / scale) / sdfPx,
- values.haloBlur * blurOffset / scale / sdfPx
+ uniforms::u_font_scale::Value{ scale },
+ uniforms::u_gamma_scale::Value{ gammaScale },
+ uniforms::u_pitch::Value{ state.getPitch() },
+ uniforms::u_bearing::Value{ -1.0f * state.getAngle() },
+ uniforms::u_aspect_ratio::Value{ (state.getSize().width * 1.0f) / (state.getSize().height * 1.0f) },
+ uniforms::u_pitch_with_map::Value{ values.pitchAlignment == AlignmentType::Map },
+ uniforms::u_is_halo::Value{ part == SymbolSDFPart::Halo }
);
}
-SymbolSDFProgram::UniformValues
-SymbolSDFProgram::foregroundUniformValues(const style::SymbolPropertyValues& values,
- const Size& texsize,
- const std::array<float, 2>& pixelsToGLUnits,
- const RenderTile& tile,
- const TransformState& state,
- float pixelRatio)
-{
- return makeSDFValues(
- values,
- texsize,
- pixelsToGLUnits,
- tile,
- state,
- pixelRatio,
- values.color,
- (256.0f - 64.0f) / 256.0f,
- 0
- );
-}
+template class SymbolSDFProgram<style::IconPaintProperties>;
+template class SymbolSDFProgram<style::TextPaintProperties>;
} // namespace mbgl
diff --git a/src/mbgl/programs/symbol_program.hpp b/src/mbgl/programs/symbol_program.hpp
index be987551c0..0537c25a2c 100644
--- a/src/mbgl/programs/symbol_program.hpp
+++ b/src/mbgl/programs/symbol_program.hpp
@@ -3,10 +3,12 @@
#include <mbgl/programs/program.hpp>
#include <mbgl/programs/attributes.hpp>
#include <mbgl/programs/uniforms.hpp>
-#include <mbgl/shader/symbol_icon.hpp>
-#include <mbgl/shader/symbol_sdf.hpp>
+#include <mbgl/shaders/symbol_icon.hpp>
+#include <mbgl/shaders/symbol_sdf.hpp>
#include <mbgl/util/geometry.hpp>
#include <mbgl/util/size.hpp>
+#include <mbgl/style/layers/symbol_layer_properties.hpp>
+#include <mbgl/style/layers/symbol_layer_impl.hpp>
#include <cmath>
#include <array>
@@ -26,14 +28,15 @@ MBGL_DEFINE_UNIFORM_SCALAR(bool, u_rotate_with_map);
MBGL_DEFINE_UNIFORM_SCALAR(bool, u_pitch_with_map);
MBGL_DEFINE_UNIFORM_SCALAR(gl::TextureUnit, u_texture);
MBGL_DEFINE_UNIFORM_SCALAR(gl::TextureUnit, u_fadetexture);
-MBGL_DEFINE_UNIFORM_SCALAR(float, u_buffer);
-MBGL_DEFINE_UNIFORM_SCALAR(float, u_gamma);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_aspect_ratio);
+MBGL_DEFINE_UNIFORM_SCALAR(bool, u_is_halo);
+MBGL_DEFINE_UNIFORM_SCALAR(float, u_font_scale);
+MBGL_DEFINE_UNIFORM_SCALAR(float, u_gamma_scale);
} // namespace uniforms
-struct SymbolAttributes : gl::Attributes<
+struct SymbolLayoutAttributes : gl::Attributes<
attributes::a_pos,
- attributes::a_offset,
+ attributes::a_offset<2>,
attributes::a_texture_pos,
attributes::a_data<4>>
{
@@ -46,43 +49,41 @@ struct SymbolAttributes : gl::Attributes<
float labelminzoom,
uint8_t labelangle) {
return Vertex {
- {
+ {{
static_cast<int16_t>(a.x),
static_cast<int16_t>(a.y)
- },
- {
+ }},
+ {{
static_cast<int16_t>(::round(o.x * 64)), // use 1/64 pixels for placement
static_cast<int16_t>(::round(o.y * 64))
- },
- {
+ }},
+ {{
static_cast<uint16_t>(tx / 4),
static_cast<uint16_t>(ty / 4)
- },
- {
+ }},
+ {{
static_cast<uint8_t>(labelminzoom * 10), // 1/10 zoom levels: z16 == 160
static_cast<uint8_t>(labelangle),
static_cast<uint8_t>(minzoom * 10),
static_cast<uint8_t>(::fmin(maxzoom, 25) * 10)
- }
+ }}
};
}
};
-using SymbolVertex = SymbolAttributes::Vertex;
-
class SymbolIconProgram : public Program<
shaders::symbol_icon,
gl::Triangle,
- SymbolAttributes,
+ SymbolLayoutAttributes,
gl::Uniforms<
uniforms::u_matrix,
- uniforms::u_opacity,
uniforms::u_extrude_scale,
uniforms::u_texsize,
uniforms::u_zoom,
uniforms::u_rotate_with_map,
uniforms::u_texture,
- uniforms::u_fadetexture>>
+ uniforms::u_fadetexture>,
+ style::IconPaintProperties>
{
public:
using Program::Program;
@@ -94,43 +95,73 @@ public:
const TransformState&);
};
+enum class SymbolSDFPart {
+ Fill = 1,
+ Halo = 0
+};
+
+template <class PaintProperties>
class SymbolSDFProgram : public Program<
shaders::symbol_sdf,
gl::Triangle,
- SymbolAttributes,
+ SymbolLayoutAttributes,
gl::Uniforms<
uniforms::u_matrix,
- uniforms::u_opacity,
uniforms::u_extrude_scale,
uniforms::u_texsize,
uniforms::u_zoom,
uniforms::u_rotate_with_map,
uniforms::u_texture,
uniforms::u_fadetexture,
- uniforms::u_color,
- uniforms::u_buffer,
- uniforms::u_gamma,
+ uniforms::u_font_scale,
+ uniforms::u_gamma_scale,
uniforms::u_pitch,
uniforms::u_bearing,
uniforms::u_aspect_ratio,
- uniforms::u_pitch_with_map>>
+ uniforms::u_pitch_with_map,
+ uniforms::u_is_halo>,
+ PaintProperties>
{
public:
- using Program::Program;
+ using BaseProgram = Program<shaders::symbol_sdf,
+ gl::Triangle,
+ SymbolLayoutAttributes,
+ gl::Uniforms<
+ uniforms::u_matrix,
+ uniforms::u_extrude_scale,
+ uniforms::u_texsize,
+ uniforms::u_zoom,
+ uniforms::u_rotate_with_map,
+ uniforms::u_texture,
+ uniforms::u_fadetexture,
+ uniforms::u_font_scale,
+ uniforms::u_gamma_scale,
+ uniforms::u_pitch,
+ uniforms::u_bearing,
+ uniforms::u_aspect_ratio,
+ uniforms::u_pitch_with_map,
+ uniforms::u_is_halo>,
+ PaintProperties>;
+
+ using UniformValues = typename BaseProgram::UniformValues;
+
+
+
+ using BaseProgram::BaseProgram;
- static UniformValues haloUniformValues(const style::SymbolPropertyValues&,
- const Size& texsize,
- const std::array<float, 2>& pixelsToGLUnits,
- const RenderTile&,
- const TransformState&,
- float pixelRatio);
-
- static UniformValues foregroundUniformValues(const style::SymbolPropertyValues&,
- const Size& texsize,
- const std::array<float, 2>& pixelsToGLUnits,
- const RenderTile&,
- const TransformState&,
- float pixelRatio);
+ static UniformValues uniformValues(const style::SymbolPropertyValues&,
+ const Size& texsize,
+ const std::array<float, 2>& pixelsToGLUnits,
+ const RenderTile&,
+ const TransformState&,
+ const SymbolSDFPart);
};
+using SymbolSDFIconProgram = SymbolSDFProgram<style::IconPaintProperties>;
+using SymbolSDFTextProgram = SymbolSDFProgram<style::TextPaintProperties>;
+
+using SymbolLayoutVertex = SymbolLayoutAttributes::Vertex;
+using SymbolIconAttributes = SymbolIconProgram::Attributes;
+using SymbolTextAttributes = SymbolSDFTextProgram::Attributes;
+
} // namespace mbgl