summaryrefslogtreecommitdiff
path: root/src/mbgl/programs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/programs')
-rw-r--r--src/mbgl/programs/attributes.hpp157
-rw-r--r--src/mbgl/programs/circle_program.hpp2
-rw-r--r--src/mbgl/programs/collision_box_program.hpp34
-rw-r--r--src/mbgl/programs/debug_program.hpp2
-rw-r--r--src/mbgl/programs/extrusion_texture_program.hpp2
-rw-r--r--src/mbgl/programs/fill_extrusion_program.hpp2
-rw-r--r--src/mbgl/programs/heatmap_program.hpp2
-rw-r--r--src/mbgl/programs/heatmap_texture_program.hpp2
-rw-r--r--src/mbgl/programs/hillshade_prepare_program.hpp2
-rw-r--r--src/mbgl/programs/hillshade_program.hpp2
-rw-r--r--src/mbgl/programs/line_program.hpp2
-rw-r--r--src/mbgl/programs/program.hpp33
-rw-r--r--src/mbgl/programs/raster_program.hpp2
-rw-r--r--src/mbgl/programs/symbol_program.hpp60
14 files changed, 97 insertions, 207 deletions
diff --git a/src/mbgl/programs/attributes.hpp b/src/mbgl/programs/attributes.hpp
index d5508e8f1a..42079bfd57 100644
--- a/src/mbgl/programs/attributes.hpp
+++ b/src/mbgl/programs/attributes.hpp
@@ -1,23 +1,10 @@
#pragma once
-#include <mbgl/gl/attribute.hpp>
-#include <mbgl/gl/uniform.hpp>
-
-#include <cstdint>
+#include <mbgl/gfx/attribute.hpp>
namespace mbgl {
namespace attributes {
-/*
- * Pack a pair of values, interpreted as uint8's, into a single float.
- * Used to conserve vertex attributes. Values are unpacked in the vertex
- * shader using the `unpack_float()` function, defined in _prelude.vertex.glsl.
- */
-template <typename T>
-inline uint16_t packUint8Pair(T a, T b) {
- return static_cast<uint16_t>(a) * 256 + static_cast<uint16_t>(b);
-}
-
// Layout attributes
MBGL_DEFINE_ATTRIBUTE(int16_t, 2, a_pos);
@@ -31,134 +18,40 @@ MBGL_DEFINE_ATTRIBUTE(uint16_t, 2, a_texture_pos);
MBGL_DEFINE_ATTRIBUTE(int16_t, 4, a_normal_ed);
MBGL_DEFINE_ATTRIBUTE(uint8_t, 1, a_fade_opacity);
MBGL_DEFINE_ATTRIBUTE(uint8_t, 2, a_placed);
+MBGL_DEFINE_ATTRIBUTE(uint16_t, 3, a_size);
+MBGL_DEFINE_ATTRIBUTE(float, 1, a_offset);
template <typename T, std::size_t N>
struct a_data {
+ using Type = gfx::AttributeType<T, N>;
static auto name() { return "a_data"; }
- using Type = gl::Attribute<T, N>;
-};
-
-struct a_size {
- static auto name() { return "a_size"; }
- using Type = gl::Attribute<uint16_t, 3>;
-};
-
-template <std::size_t N>
-struct a_offset {
- static auto name() { return "a_offset"; }
- using Type = gl::Attribute<int16_t, N>;
};
// Paint attributes
-struct a_color {
- static auto name() { return "a_color"; }
- using Type = gl::Attribute<float, 2>;
-};
-
-struct a_fill_color {
- static auto name() { return "a_fill_color"; }
- using Type = gl::Attribute<float, 2>;
-};
-
-struct a_halo_color {
- static auto name() { return "a_halo_color"; }
- using Type = gl::Attribute<float, 2>;
-};
-
-struct a_stroke_color {
- static auto name() { return "a_stroke_color"; }
- using Type = gl::Attribute<float, 2>;
-};
-
-struct a_outline_color {
- static auto name() { return "a_outline_color"; }
- using Type = gl::Attribute<float, 2>;
-};
-
-struct a_opacity {
- static auto name() { return "a_opacity"; }
- using Type = gl::Attribute<float, 1>;
-};
-
-struct a_stroke_opacity {
- static auto name() { return "a_stroke_opacity"; }
- using Type = gl::Attribute<float, 1>;
-};
-
-struct a_blur {
- static auto name() { return "a_blur"; }
- using Type = gl::Attribute<float, 1>;
-};
-
-struct a_radius {
- static auto name() { return "a_radius"; }
- using Type = gl::Attribute<float, 1>;
-};
-
-struct a_width {
- static auto name() { return "a_width"; }
- using Type = gl::Attribute<float, 1>;
-};
-
-struct a_floorwidth {
- static auto name() { return "a_floorwidth"; }
- using Type = gl::Attribute<float, 1>;
-};
-
-struct a_height {
- static auto name() { return "a_height"; }
- using Type = gl::Attribute<float, 1>;
-};
-
-struct a_base {
- static auto name() { return "a_base"; }
- using Type = gl::Attribute<float, 1>;
-};
-
-struct a_gapwidth {
- static auto name() { return "a_gapwidth"; }
- using Type = gl::Attribute<float, 1>;
-};
-
-struct a_stroke_width {
- static auto name() { return "a_stroke_width"; }
- using Type = gl::Attribute<float, 1>;
-};
-
-template <>
-struct a_offset<1> {
- static auto name() { return "a_offset"; }
- using Type = gl::Attribute<float, 1>;
-};
-
-struct a_halo_width {
- static auto name() { return "a_halo_width"; }
- using Type = gl::Attribute<float, 1>;
-};
-
-struct a_halo_blur {
- static auto name() { return "a_halo_blur"; }
- using Type = gl::Attribute<float, 1>;
-};
-
-struct a_weight {
- static auto name() { return "a_weight"; }
- using Type = gl::Attribute<float, 1>;
-};
-
-struct a_pattern_to {
- static auto name() { return "a_pattern_to"; }
- using Type = gl::Attribute<uint16_t, 4>;
-};
-
-struct a_pattern_from {
- static auto name() { return "a_pattern_from"; }
- using Type = gl::Attribute<uint16_t, 4>;
-};
+MBGL_DEFINE_ATTRIBUTE(float, 2, a_color);
+MBGL_DEFINE_ATTRIBUTE(float, 2, a_fill_color);
+MBGL_DEFINE_ATTRIBUTE(float, 2, a_halo_color);
+MBGL_DEFINE_ATTRIBUTE(float, 2, a_stroke_color);
+MBGL_DEFINE_ATTRIBUTE(float, 2, a_outline_color);
+MBGL_DEFINE_ATTRIBUTE(float, 1, a_opacity);
+MBGL_DEFINE_ATTRIBUTE(float, 1, a_stroke_opacity);
+MBGL_DEFINE_ATTRIBUTE(float, 1, a_blur);
+MBGL_DEFINE_ATTRIBUTE(float, 1, a_radius);
+MBGL_DEFINE_ATTRIBUTE(float, 1, a_width);
+MBGL_DEFINE_ATTRIBUTE(float, 1, a_floorwidth);
+MBGL_DEFINE_ATTRIBUTE(float, 1, a_height);
+MBGL_DEFINE_ATTRIBUTE(float, 1, a_base);
+MBGL_DEFINE_ATTRIBUTE(float, 1, a_gapwidth);
+MBGL_DEFINE_ATTRIBUTE(float, 1, a_stroke_width);
+MBGL_DEFINE_ATTRIBUTE(float, 1, a_halo_width);
+MBGL_DEFINE_ATTRIBUTE(float, 1, a_halo_blur);
+MBGL_DEFINE_ATTRIBUTE(float, 1, a_weight);
+MBGL_DEFINE_ATTRIBUTE(uint16_t, 4, a_pattern_to);
+MBGL_DEFINE_ATTRIBUTE(uint16_t, 4, a_pattern_from);
} // namespace attributes
-using PositionOnlyLayoutAttributes = gl::Attributes<attributes::a_pos>;
+using PositionOnlyLayoutAttributes = TypeList<attributes::a_pos>;
} // namespace mbgl
diff --git a/src/mbgl/programs/circle_program.hpp b/src/mbgl/programs/circle_program.hpp
index debf7a81c2..3e59402a87 100644
--- a/src/mbgl/programs/circle_program.hpp
+++ b/src/mbgl/programs/circle_program.hpp
@@ -16,7 +16,7 @@ MBGL_DEFINE_UNIFORM_SCALAR(bool, u_scale_with_map);
class CircleProgram : public Program<
shaders::circle,
gl::Triangle,
- gl::Attributes<
+ TypeList<
attributes::a_pos>,
TypeList<
uniforms::u_matrix,
diff --git a/src/mbgl/programs/collision_box_program.hpp b/src/mbgl/programs/collision_box_program.hpp
index 1a34ebbb11..46fe882f44 100644
--- a/src/mbgl/programs/collision_box_program.hpp
+++ b/src/mbgl/programs/collision_box_program.hpp
@@ -12,17 +12,17 @@
namespace mbgl {
-using CollisionBoxLayoutAttributes = gl::Attributes<
+using CollisionBoxLayoutAttributes = TypeList<
attributes::a_pos,
attributes::a_anchor_pos,
attributes::a_extrude>;
-using CollisionBoxDynamicAttributes = gl::Attributes<attributes::a_placed>;
+using CollisionBoxDynamicAttributes = TypeList<attributes::a_placed>;
class CollisionBoxProgram : public Program<
shaders::collision_box,
gl::Line,
- gl::ConcatenateAttributes<CollisionBoxLayoutAttributes, CollisionBoxDynamicAttributes>,
+ TypeListConcat<CollisionBoxLayoutAttributes, CollisionBoxDynamicAttributes>,
TypeList<
uniforms::u_matrix,
uniforms::u_extrude_scale,
@@ -32,7 +32,7 @@ class CollisionBoxProgram : public Program<
public:
using Program::Program;
- static CollisionBoxLayoutAttributes::Vertex layoutVertex(Point<float> a, Point<float> anchor, Point<float> o) {
+ static gfx::Vertex<CollisionBoxLayoutAttributes> layoutVertex(Point<float> a, Point<float> anchor, Point<float> o) {
return {
{{
static_cast<int16_t>(a.x),
@@ -49,7 +49,7 @@ public:
};
}
- static CollisionBoxDynamicAttributes::Vertex dynamicVertex(bool placed, bool notUsed) {
+ static gfx::Vertex<CollisionBoxDynamicAttributes> dynamicVertex(bool placed, bool notUsed) {
return {
{{ static_cast<uint8_t>(placed), static_cast<uint8_t>(notUsed) }}
};
@@ -63,19 +63,19 @@ public:
gl::ColorMode colorMode,
gl::CullFaceMode cullFaceMode,
const UniformValues& uniformValues,
- const gl::VertexBuffer<CollisionBoxLayoutAttributes::Vertex>& layoutVertexBuffer,
- const gl::VertexBuffer<CollisionBoxDynamicAttributes::Vertex>& dynamicVertexBuffer,
+ const gl::VertexBuffer<gfx::Vertex<CollisionBoxLayoutAttributes>>& layoutVertexBuffer,
+ const gl::VertexBuffer<gfx::Vertex<CollisionBoxDynamicAttributes>>& dynamicVertexBuffer,
const gl::IndexBuffer<DrawMode>& indexBuffer,
const SegmentVector<Attributes>& segments,
- const PaintPropertyBinders& paintPropertyBinders,
+ const Binders& paintPropertyBinders,
const typename PaintProperties::PossiblyEvaluated& currentProperties,
float currentZoom,
const std::string& layerID) {
typename AllUniforms::Values allUniformValues = uniformValues
.concat(paintPropertyBinders.uniformValues(currentZoom, currentProperties));
- typename Attributes::Bindings allAttributeBindings = CollisionBoxLayoutAttributes::bindings(layoutVertexBuffer)
- .concat(CollisionBoxDynamicAttributes::bindings(dynamicVertexBuffer))
+ typename Attributes::Bindings allAttributeBindings = gl::Attributes<CollisionBoxLayoutAttributes>::bindings(layoutVertexBuffer)
+ .concat(gl::Attributes<CollisionBoxDynamicAttributes>::bindings(dynamicVertexBuffer))
.concat(paintPropertyBinders.attributeBindings(currentProperties));
assert(layoutVertexBuffer.vertexCount == dynamicVertexBuffer.vertexCount);
@@ -108,7 +108,7 @@ public:
class CollisionCircleProgram : public Program<
shaders::collision_circle,
gl::Triangle,
- gl::ConcatenateAttributes<CollisionBoxLayoutAttributes, CollisionBoxDynamicAttributes>,
+ TypeListConcat<CollisionBoxLayoutAttributes, CollisionBoxDynamicAttributes>,
TypeList<
uniforms::u_matrix,
uniforms::u_extrude_scale,
@@ -119,7 +119,7 @@ class CollisionCircleProgram : public Program<
public:
using Program::Program;
- static CollisionBoxLayoutAttributes::Vertex vertex(Point<float> a, Point<float> anchor, Point<float> o) {
+ static gfx::Vertex<CollisionBoxLayoutAttributes> vertex(Point<float> a, Point<float> anchor, Point<float> o) {
return {
{{
static_cast<int16_t>(a.x),
@@ -144,19 +144,19 @@ public:
gl::ColorMode colorMode,
gl::CullFaceMode cullFaceMode,
const UniformValues& uniformValues,
- const gl::VertexBuffer<CollisionBoxLayoutAttributes::Vertex>& layoutVertexBuffer,
- const gl::VertexBuffer<CollisionBoxDynamicAttributes::Vertex>& dynamicVertexBuffer,
+ const gl::VertexBuffer<gfx::Vertex<CollisionBoxLayoutAttributes>>& layoutVertexBuffer,
+ const gl::VertexBuffer<gfx::Vertex<CollisionBoxDynamicAttributes>>& dynamicVertexBuffer,
const gl::IndexBuffer<DrawMode>& indexBuffer,
const SegmentVector<Attributes>& segments,
- const PaintPropertyBinders& paintPropertyBinders,
+ const Binders& paintPropertyBinders,
const typename PaintProperties::PossiblyEvaluated& currentProperties,
float currentZoom,
const std::string& layerID) {
typename AllUniforms::Values allUniformValues = uniformValues
.concat(paintPropertyBinders.uniformValues(currentZoom, currentProperties));
- typename Attributes::Bindings allAttributeBindings = CollisionBoxLayoutAttributes::bindings(layoutVertexBuffer)
- .concat(CollisionBoxDynamicAttributes::bindings(dynamicVertexBuffer))
+ typename Attributes::Bindings allAttributeBindings = gl::Attributes<CollisionBoxLayoutAttributes>::bindings(layoutVertexBuffer)
+ .concat(gl::Attributes<CollisionBoxDynamicAttributes>::bindings(dynamicVertexBuffer))
.concat(paintPropertyBinders.attributeBindings(currentProperties));
for (auto& segment : segments) {
diff --git a/src/mbgl/programs/debug_program.hpp b/src/mbgl/programs/debug_program.hpp
index 0accd490ab..17e7d638f9 100644
--- a/src/mbgl/programs/debug_program.hpp
+++ b/src/mbgl/programs/debug_program.hpp
@@ -11,7 +11,7 @@ namespace mbgl {
class DebugProgram : public Program<
shaders::debug,
gl::Line,
- gl::Attributes<
+ TypeList<
attributes::a_pos>,
TypeList<
uniforms::u_matrix,
diff --git a/src/mbgl/programs/extrusion_texture_program.hpp b/src/mbgl/programs/extrusion_texture_program.hpp
index fc53563e74..d1ae773f90 100644
--- a/src/mbgl/programs/extrusion_texture_program.hpp
+++ b/src/mbgl/programs/extrusion_texture_program.hpp
@@ -12,7 +12,7 @@ namespace mbgl {
class ExtrusionTextureProgram : public Program<
shaders::extrusion_texture,
gl::Triangle,
- gl::Attributes<attributes::a_pos>,
+ TypeList<attributes::a_pos>,
TypeList<
uniforms::u_matrix,
uniforms::u_world,
diff --git a/src/mbgl/programs/fill_extrusion_program.hpp b/src/mbgl/programs/fill_extrusion_program.hpp
index d29f988e7e..4b8c148f11 100644
--- a/src/mbgl/programs/fill_extrusion_program.hpp
+++ b/src/mbgl/programs/fill_extrusion_program.hpp
@@ -29,7 +29,7 @@ MBGL_DEFINE_UNIFORM_SCALAR(float, u_lightintensity);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_height_factor);
} // namespace uniforms
-using FillExtrusionLayoutAttributes = gl::Attributes<
+using FillExtrusionLayoutAttributes = TypeList<
attributes::a_pos,
attributes::a_normal_ed>;
diff --git a/src/mbgl/programs/heatmap_program.hpp b/src/mbgl/programs/heatmap_program.hpp
index 98208c02c8..d2fe0320ab 100644
--- a/src/mbgl/programs/heatmap_program.hpp
+++ b/src/mbgl/programs/heatmap_program.hpp
@@ -17,7 +17,7 @@ MBGL_DEFINE_UNIFORM_SCALAR(float, u_intensity);
class HeatmapProgram : public Program<
shaders::heatmap,
gl::Triangle,
- gl::Attributes<
+ TypeList<
attributes::a_pos>,
TypeList<
uniforms::u_intensity,
diff --git a/src/mbgl/programs/heatmap_texture_program.hpp b/src/mbgl/programs/heatmap_texture_program.hpp
index 060e0cc397..dea33edc03 100644
--- a/src/mbgl/programs/heatmap_texture_program.hpp
+++ b/src/mbgl/programs/heatmap_texture_program.hpp
@@ -16,7 +16,7 @@ MBGL_DEFINE_UNIFORM_SCALAR(uint32_t, u_color_ramp);
class HeatmapTextureProgram : public Program<
shaders::heatmap_texture,
gl::Triangle,
- gl::Attributes<attributes::a_pos>,
+ TypeList<attributes::a_pos>,
TypeList<
uniforms::u_matrix,
uniforms::u_world,
diff --git a/src/mbgl/programs/hillshade_prepare_program.hpp b/src/mbgl/programs/hillshade_prepare_program.hpp
index fe077611f8..10decd0343 100644
--- a/src/mbgl/programs/hillshade_prepare_program.hpp
+++ b/src/mbgl/programs/hillshade_prepare_program.hpp
@@ -16,7 +16,7 @@ MBGL_DEFINE_UNIFORM_SCALAR(float, u_maxzoom);
class HillshadePrepareProgram : public Program<
shaders::hillshade_prepare,
gl::Triangle,
- gl::Attributes<
+ TypeList<
attributes::a_pos,
attributes::a_texture_pos>,
TypeList<
diff --git a/src/mbgl/programs/hillshade_program.hpp b/src/mbgl/programs/hillshade_program.hpp
index 10143146de..9c71afdb9c 100644
--- a/src/mbgl/programs/hillshade_program.hpp
+++ b/src/mbgl/programs/hillshade_program.hpp
@@ -21,7 +21,7 @@ MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_latrange);
class HillshadeProgram : public Program<
shaders::hillshade,
gl::Triangle,
- gl::Attributes<
+ TypeList<
attributes::a_pos,
attributes::a_texture_pos>,
TypeList<
diff --git a/src/mbgl/programs/line_program.hpp b/src/mbgl/programs/line_program.hpp
index 089c2b2c07..1c96ecbf34 100644
--- a/src/mbgl/programs/line_program.hpp
+++ b/src/mbgl/programs/line_program.hpp
@@ -29,7 +29,7 @@ MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_patternscale_b);
MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_gl_units_to_pixels);
} // namespace uniforms
-using LineLayoutAttributes = gl::Attributes<
+using LineLayoutAttributes = TypeList<
attributes::a_pos_normal,
attributes::a_data<uint8_t, 4>>;
diff --git a/src/mbgl/programs/program.hpp b/src/mbgl/programs/program.hpp
index 30d226854f..429937dd7d 100644
--- a/src/mbgl/programs/program.hpp
+++ b/src/mbgl/programs/program.hpp
@@ -7,6 +7,7 @@
#include <mbgl/programs/attributes.hpp>
#include <mbgl/programs/program_parameters.hpp>
#include <mbgl/style/paint_property.hpp>
+#include <mbgl/renderer/paint_property_binder.hpp>
#include <mbgl/shaders/shaders.hpp>
#include <mbgl/util/io.hpp>
@@ -16,22 +17,22 @@ namespace mbgl {
template <class Shaders,
class Primitive,
- class LayoutAttrs,
- class UniformTypeList,
+ class LayoutAttributeList,
+ class UniformList,
class PaintProps>
class Program {
public:
- using LayoutAttributes = LayoutAttrs;
- using LayoutVertex = typename LayoutAttributes::Vertex;
+ using LayoutAttributes = gl::Attributes<LayoutAttributeList>;
+ using LayoutVertex = gfx::Vertex<LayoutAttributeList>;
using PaintProperties = PaintProps;
- using PaintPropertyBinders = typename PaintProperties::Binders;
- using PaintAttributes = typename PaintPropertyBinders::Attributes;
- using Attributes = gl::ConcatenateAttributes<LayoutAttributes, PaintAttributes>;
+ using Binders = PaintPropertyBinders<typename PaintProperties::DataDrivenProperties>;
+ using PaintAttributeList = typename Binders::AttributeList;
+ using Attributes = gl::Attributes<TypeListConcat<LayoutAttributeList, PaintAttributeList>>;
- using UniformValues = gfx::UniformValues<UniformTypeList>;
- using PaintUniformTypeList = typename PaintPropertyBinders::UniformTypeList;
- using AllUniforms = typename TypeListConcat<UniformTypeList, PaintUniformTypeList>::template ExpandInto<gl::Uniforms>;
+ using UniformValues = gfx::UniformValues<UniformList>;
+ using PaintUniformList = typename Binders::UniformList;
+ using AllUniforms = gl::Uniforms<TypeListConcat<UniformList, PaintUniformList>>;
using ProgramType = gl::Program<Primitive, Attributes, AllUniforms>;
@@ -48,7 +49,7 @@ public:
static typename AllUniforms::Values computeAllUniformValues(
const UniformValues& uniformValues,
- const PaintPropertyBinders& paintPropertyBinders,
+ const Binders& paintPropertyBinders,
const typename PaintProperties::PossiblyEvaluated& currentProperties,
float currentZoom) {
return uniformValues
@@ -57,7 +58,7 @@ public:
static typename Attributes::Bindings computeAllAttributeBindings(
const gl::VertexBuffer<LayoutVertex>& layoutVertexBuffer,
- const PaintPropertyBinders& paintPropertyBinders,
+ const Binders& paintPropertyBinders,
const typename PaintProperties::PossiblyEvaluated& currentProperties) {
return LayoutAttributes::bindings(layoutVertexBuffer)
.concat(paintPropertyBinders.attributeBindings(currentProperties));
@@ -107,8 +108,8 @@ template <class Program>
class ProgramMap {
public:
using PaintProperties = typename Program::PaintProperties;
- using PaintPropertyBinders = typename Program::PaintPropertyBinders;
- using Bitset = typename PaintPropertyBinders::Bitset;
+ using Binders = typename Program::Binders;
+ using Bitset = typename Binders::Bitset;
ProgramMap(gl::Context& context_, ProgramParameters parameters_)
: context(context_),
@@ -116,7 +117,7 @@ public:
}
Program& get(const typename PaintProperties::PossiblyEvaluated& currentProperties) {
- Bitset bits = PaintPropertyBinders::constants(currentProperties);
+ Bitset bits = Binders::constants(currentProperties);
auto it = programs.find(bits);
if (it != programs.end()) {
return it->second;
@@ -124,7 +125,7 @@ public:
return programs.emplace(std::piecewise_construct,
std::forward_as_tuple(bits),
std::forward_as_tuple(context,
- parameters.withAdditionalDefines(PaintPropertyBinders::defines(currentProperties)))).first->second;
+ parameters.withAdditionalDefines(Binders::defines(currentProperties)))).first->second;
}
private:
diff --git a/src/mbgl/programs/raster_program.hpp b/src/mbgl/programs/raster_program.hpp
index b470ff6841..45b324696d 100644
--- a/src/mbgl/programs/raster_program.hpp
+++ b/src/mbgl/programs/raster_program.hpp
@@ -26,7 +26,7 @@ MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_tl_parent);
class RasterProgram : public Program<
shaders::raster,
gl::Triangle,
- gl::Attributes<
+ TypeList<
attributes::a_pos,
attributes::a_texture_pos>,
TypeList<
diff --git a/src/mbgl/programs/symbol_program.hpp b/src/mbgl/programs/symbol_program.hpp
index 155c277f11..d6bad6da77 100644
--- a/src/mbgl/programs/symbol_program.hpp
+++ b/src/mbgl/programs/symbol_program.hpp
@@ -46,13 +46,13 @@ MBGL_DEFINE_UNIFORM_SCALAR(bool, u_rotate_symbol);
MBGL_DEFINE_UNIFORM_SCALAR(float, u_aspect_ratio);
} // namespace uniforms
-using SymbolLayoutAttributes = gl::Attributes<
+using SymbolLayoutAttributes = TypeList<
attributes::a_pos_offset,
attributes::a_data<uint16_t, 4>>;
-using SymbolDynamicLayoutAttributes = gl::Attributes<attributes::a_projected_pos>;
+using SymbolDynamicLayoutAttributes = TypeList<attributes::a_projected_pos>;
-using SymbolOpacityAttributes = gl::Attributes<attributes::a_fade_opacity>;
+using SymbolOpacityAttributes = TypeList<attributes::a_fade_opacity>;
struct ZoomEvaluatedSize {
bool isZoomConstant;
@@ -69,12 +69,12 @@ class SymbolSizeBinder {
public:
virtual ~SymbolSizeBinder() = default;
- using UniformTypeList = TypeList<
+ using UniformList = TypeList<
uniforms::u_is_size_zoom_constant,
uniforms::u_is_size_feature_constant,
uniforms::u_size_t,
uniforms::u_size>;
- using UniformValues = gfx::UniformValues<UniformTypeList>;
+ using UniformValues = gfx::UniformValues<UniformList>;
static std::unique_ptr<SymbolSizeBinder> create(const float tileZoom,
const style::PropertyValue<float>& sizeProperty,
@@ -146,10 +146,6 @@ public:
class SourceFunctionSymbolSizeBinder final : public SymbolSizeBinder {
public:
- using Vertex = gl::detail::Vertex<gl::Attribute<uint16_t, 1>>;
- using VertexVector = gl::VertexVector<Vertex>;
- using VertexBuffer = gl::VertexBuffer<Vertex>;
-
SourceFunctionSymbolSizeBinder(const float /*tileZoom*/, style::PropertyExpression<float> expression_, const float defaultValue_)
: expression(std::move(expression_)),
defaultValue(defaultValue_) {
@@ -204,7 +200,7 @@ public:
class SymbolProgramBase {
public:
- static SymbolLayoutAttributes::Vertex layoutVertex(Point<float> labelAnchor,
+ static gfx::Vertex<SymbolLayoutAttributes> layoutVertex(Point<float> labelAnchor,
Point<float> o,
float glyphOffsetY,
uint16_t tx,
@@ -227,7 +223,7 @@ public:
};
}
- static SymbolDynamicLayoutAttributes::Vertex dynamicLayoutVertex(Point<float> anchorPoint, float labelAngle) {
+ static gfx::Vertex<SymbolDynamicLayoutAttributes> dynamicLayoutVertex(Point<float> anchorPoint, float labelAngle) {
return {
{{
anchorPoint.x,
@@ -237,7 +233,7 @@ public:
};
}
- static SymbolOpacityAttributes::Vertex opacityVertex(bool placed, float opacity) {
+ static gfx::Vertex<SymbolOpacityAttributes> opacityVertex(bool placed, float opacity) {
return {
{{ static_cast<uint8_t>((static_cast<uint8_t>(opacity * 127) << 1) | static_cast<uint8_t>(placed)) }}
};
@@ -246,25 +242,25 @@ public:
template <class Shaders,
class Primitive,
- class LayoutAttrs,
- class UniformTypeList,
+ class LayoutAttributeList,
+ class UniformList,
class PaintProps>
class SymbolProgram : public SymbolProgramBase {
public:
- using LayoutAttributes = LayoutAttrs;
- using LayoutVertex = typename LayoutAttributes::Vertex;
+ using LayoutAttributes = gl::Attributes<LayoutAttributeList>;
+ using LayoutVertex = gfx::Vertex<LayoutAttributeList>;
- using LayoutAndSizeAttributes = gl::ConcatenateAttributes<LayoutAttributes, SymbolDynamicLayoutAttributes, SymbolOpacityAttributes>;
+ using LayoutAndSizeAttributeList = TypeListConcat<LayoutAttributeList, SymbolDynamicLayoutAttributes, SymbolOpacityAttributes>;
using PaintProperties = PaintProps;
- using PaintPropertyBinders = typename PaintProperties::Binders;
- using PaintAttributes = typename PaintPropertyBinders::Attributes;
- using Attributes = gl::ConcatenateAttributes<LayoutAndSizeAttributes, PaintAttributes>;
+ using Binders = PaintPropertyBinders<typename PaintProperties::DataDrivenProperties>;
+ using PaintAttributeList = typename Binders::AttributeList;
+ using Attributes = gl::Attributes<TypeListConcat<LayoutAndSizeAttributeList, PaintAttributeList>>;
- using UniformValues = gfx::UniformValues<UniformTypeList>;
- using SizeUniformTypeList = typename SymbolSizeBinder::UniformTypeList;
- using PaintUniformTypeList = typename PaintPropertyBinders::UniformTypeList;
- using AllUniforms = typename TypeListConcat<UniformTypeList, SizeUniformTypeList, PaintUniformTypeList>::template ExpandInto<gl::Uniforms>;
+ using UniformValues = gfx::UniformValues<UniformList>;
+ using SizeUniformList = typename SymbolSizeBinder::UniformList;
+ using PaintUniformList = typename Binders::UniformList;
+ using AllUniforms = gl::Uniforms<TypeListConcat<UniformList, SizeUniformList, PaintUniformList>>;
using ProgramType = gl::Program<Primitive, Attributes, AllUniforms>;
@@ -282,7 +278,7 @@ public:
static typename AllUniforms::Values computeAllUniformValues(
const UniformValues& uniformValues,
const SymbolSizeBinder& symbolSizeBinder,
- const PaintPropertyBinders& paintPropertyBinders,
+ const Binders& paintPropertyBinders,
const typename PaintProperties::PossiblyEvaluated& currentProperties,
float currentZoom) {
return uniformValues.concat(symbolSizeBinder.uniformValues(currentZoom))
@@ -291,15 +287,15 @@ public:
static typename Attributes::Bindings computeAllAttributeBindings(
const gl::VertexBuffer<LayoutVertex>& layoutVertexBuffer,
- const gl::VertexBuffer<SymbolDynamicLayoutAttributes::Vertex>& dynamicLayoutVertexBuffer,
- const gl::VertexBuffer<SymbolOpacityAttributes::Vertex>& opacityVertexBuffer,
- const PaintPropertyBinders& paintPropertyBinders,
+ const gl::VertexBuffer<gfx::Vertex<SymbolDynamicLayoutAttributes>>& dynamicLayoutVertexBuffer,
+ const gl::VertexBuffer<gfx::Vertex<SymbolOpacityAttributes>>& opacityVertexBuffer,
+ const Binders& paintPropertyBinders,
const typename PaintProperties::PossiblyEvaluated& currentProperties) {
assert(layoutVertexBuffer.vertexCount == dynamicLayoutVertexBuffer.vertexCount &&
layoutVertexBuffer.vertexCount == opacityVertexBuffer.vertexCount);
- return LayoutAttributes::bindings(layoutVertexBuffer)
- .concat(SymbolDynamicLayoutAttributes::bindings(dynamicLayoutVertexBuffer))
- .concat(SymbolOpacityAttributes::bindings(opacityVertexBuffer))
+ return gl::Attributes<LayoutAttributeList>::bindings(layoutVertexBuffer)
+ .concat(gl::Attributes<SymbolDynamicLayoutAttributes>::bindings(dynamicLayoutVertexBuffer))
+ .concat(gl::Attributes<SymbolOpacityAttributes>::bindings(opacityVertexBuffer))
.concat(paintPropertyBinders.attributeBindings(currentProperties));
}
@@ -446,7 +442,7 @@ public:
using SymbolSDFIconProgram = SymbolSDFProgram<style::IconPaintProperties>;
using SymbolSDFTextProgram = SymbolSDFProgram<style::TextPaintProperties>;
-using SymbolLayoutVertex = SymbolLayoutAttributes::Vertex;
+using SymbolLayoutVertex = gfx::Vertex<SymbolLayoutAttributes>;
using SymbolIconAttributes = SymbolIconProgram::Attributes;
using SymbolTextAttributes = SymbolSDFTextProgram::Attributes;