diff options
author | Chris Loer <chris.loer@gmail.com> | 2017-06-02 17:18:19 -0700 |
---|---|---|
committer | Chris Loer <chris.loer@gmail.com> | 2017-06-06 09:01:18 -0700 |
commit | 967fdfc80eccd28fc0a78d9a5dc7b81dac063bd0 (patch) | |
tree | 73670b1d03da046d46a8e02c56a49d52be8d1f5d | |
parent | 2eaf9978c89a5b73259eaa1bc5dd01ba860eeccf (diff) | |
download | qtlocation-mapboxgl-967fdfc80eccd28fc0a78d9a5dc7b81dac063bd0.tar.gz |
[core] [DO NOT MERGE] No longer specialize Segment on Attributes, so that Programs with different bindings can share the same segments.
This change completely disables the VAO optimization that was implemented in segment.hpp -- we need to re-enable it for the common case that a program is only drawing one segment.
-rw-r--r-- | src/mbgl/gl/program.hpp | 16 | ||||
-rw-r--r-- | src/mbgl/gl/segment.hpp | 33 | ||||
-rw-r--r-- | src/mbgl/programs/program.hpp | 2 | ||||
-rw-r--r-- | src/mbgl/programs/symbol_program.hpp | 42 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/circle_bucket.hpp | 2 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/debug_bucket.hpp | 2 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/fill_bucket.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/fill_extrusion_bucket.hpp | 2 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/line_bucket.hpp | 2 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/raster_bucket.hpp | 2 | ||||
-rw-r--r-- | src/mbgl/renderer/buckets/symbol_bucket.hpp | 6 | ||||
-rw-r--r-- | src/mbgl/renderer/layers/render_symbol_layer.cpp | 46 | ||||
-rw-r--r-- | src/mbgl/renderer/layers/render_symbol_layer.hpp | 43 | ||||
-rw-r--r-- | src/mbgl/renderer/paint_property_binder.hpp | 33 | ||||
-rw-r--r-- | src/mbgl/renderer/painter.hpp | 8 | ||||
-rw-r--r-- | src/mbgl/renderer/painters/painter_symbol.cpp | 22 | ||||
-rw-r--r-- | src/mbgl/style/properties.hpp | 1 |
17 files changed, 175 insertions, 91 deletions
diff --git a/src/mbgl/gl/program.hpp b/src/mbgl/gl/program.hpp index 1b23abe2b1..863e8cda5d 100644 --- a/src/mbgl/gl/program.hpp +++ b/src/mbgl/gl/program.hpp @@ -118,7 +118,7 @@ public: UniformValues&& uniformValues, AttributeBindings&& attributeBindings, const IndexBuffer<DrawMode>& indexBuffer, - const SegmentVector<Attributes>& segments) { + const SegmentVector& segments) { static_assert(std::is_same<Primitive, typename DrawMode::Primitive>::value, "incompatible draw mode"); context.setDrawMode(drawMode); @@ -131,10 +131,16 @@ public: Uniforms::bind(uniformsState, std::move(uniformValues)); for (const auto& segment : segments) { - segment.bind(context, - indexBuffer.buffer, + // TODO: (Re-add VAO support) No VAO support. Force attributes to be rebound. + context.elementBuffer = indexBuffer.buffer; + variableBindings = {}; + + Attributes::bind(context, attributeLocations, - attributeBindings); + variableBindings, + attributeBindings, + segment.vertexOffset); + context.draw(drawMode.primitiveType, segment.indexOffset, @@ -146,6 +152,8 @@ private: UniqueProgram program; typename Attributes::Locations attributeLocations; + typename Attributes::VariableBindings variableBindings; + typename Uniforms::State uniformsState; }; diff --git a/src/mbgl/gl/segment.hpp b/src/mbgl/gl/segment.hpp index 45c81973f2..c8b85e4195 100644 --- a/src/mbgl/gl/segment.hpp +++ b/src/mbgl/gl/segment.hpp @@ -11,7 +11,6 @@ namespace mbgl { namespace gl { -template <class Attributes> class Segment { public: Segment(std::size_t vertexOffset_, @@ -29,42 +28,12 @@ public: std::size_t vertexLength; std::size_t indexLength; - void bind(Context& context, - BufferID indexBuffer_, - const typename Attributes::Locations& attributeLocations, - const typename Attributes::Bindings& attributeBindings_) const { - if (context.supportsVertexArrays()) { - if (!vao) { - vao = context.createVertexArray(); - context.vertexBuffer.setDirty(); - } - context.vertexArrayObject = *vao; - if (indexBuffer != indexBuffer_) { - indexBuffer = indexBuffer_; - context.elementBuffer.setDirty(); - context.elementBuffer = indexBuffer_; - } - } else { - // No VAO support. Force attributes to be rebound. - context.elementBuffer = indexBuffer_; - variableBindings = {}; - } - - Attributes::bind(context, - attributeLocations, - variableBindings, - attributeBindings_, - vertexOffset); - } - private: mutable optional<UniqueVertexArray> vao; mutable optional<BufferID> indexBuffer; - mutable typename Attributes::VariableBindings variableBindings; }; -template <class Attributes> -class SegmentVector : public std::vector<Segment<Attributes>> { +class SegmentVector : public std::vector<Segment> { public: SegmentVector() = default; }; diff --git a/src/mbgl/programs/program.hpp b/src/mbgl/programs/program.hpp index a5db5cf8dc..b5d7010707 100644 --- a/src/mbgl/programs/program.hpp +++ b/src/mbgl/programs/program.hpp @@ -51,7 +51,7 @@ public: UniformValues&& uniformValues, const gl::VertexBuffer<LayoutVertex>& layoutVertexBuffer, const gl::IndexBuffer<DrawMode>& indexBuffer, - const gl::SegmentVector<Attributes>& segments, + const gl::SegmentVector& segments, const PaintPropertyBinders& paintPropertyBinders, const typename PaintProperties::PossiblyEvaluated& currentProperties, float currentZoom) { diff --git a/src/mbgl/programs/symbol_program.hpp b/src/mbgl/programs/symbol_program.hpp index 091de72e9d..b91285412b 100644 --- a/src/mbgl/programs/symbol_program.hpp +++ b/src/mbgl/programs/symbol_program.hpp @@ -339,11 +339,13 @@ public: using PaintPropertyBinders = typename PaintProperties::Binders; using PaintAttributes = typename PaintPropertyBinders::Attributes; + using PaintAttributeBindings = typename PaintAttributes::Bindings; using Attributes = gl::ConcatenateAttributes<LayoutAndSizeAttributes, PaintAttributes>; using UniformValues = typename Uniforms::Values; using SizeUniforms = typename SymbolSizeBinder::Uniforms; using PaintUniforms = typename PaintPropertyBinders::Uniforms; + using PaintUniformValues = typename PaintUniforms::Values; using AllUniforms = gl::ConcatenateUniforms<Uniforms, gl::ConcatenateUniforms<SizeUniforms, PaintUniforms>>; using ProgramType = gl::Program<Primitive, Attributes, AllUniforms>; @@ -370,9 +372,9 @@ public: const SymbolSizeBinder& symbolSizeBinder, const PossiblyEvaluatedPropertyValue<float>& currentSizeValue, const gl::IndexBuffer<DrawMode>& indexBuffer, - const gl::SegmentVector<Attributes>& segments, - const PaintPropertyBinders& paintPropertyBinders, - const typename PaintProperties::PossiblyEvaluated& currentProperties, + const gl::SegmentVector& segments, + const PaintUniformValues& paintPropertyUniformValues, + const PaintAttributeBindings& paintPropertyAttributeBindings, float currentZoom) { program.draw( context, @@ -382,10 +384,10 @@ public: std::move(colorMode), uniformValues .concat(symbolSizeBinder.uniformValues(currentZoom)) - .concat(paintPropertyBinders.uniformValues(currentZoom)), + .concat(paintPropertyUniformValues), LayoutAttributes::allVariableBindings(layoutVertexBuffer) .concat(symbolSizeBinder.attributeBindings(currentSizeValue)) - .concat(paintPropertyBinders.attributeBindings(currentProperties)), + .concat(paintPropertyAttributeBindings), indexBuffer, segments ); @@ -444,7 +446,6 @@ using SymbolSDFUniforms = gl::Uniforms< uniforms::u_pitch, uniforms::u_max_camera_distance, uniforms::u_gamma_scale, - uniforms::u_pitch, uniforms::u_bearing, uniforms::u_aspect_ratio, uniforms::u_pitch_with_map, @@ -464,51 +465,30 @@ using SymbolSDFIconFillProgram = SymbolProgram< gl::Triangle, SymbolLayoutAttributes, SymbolSDFUniforms, - style::Properties< - style::IconOpacity, - style::IconTranslate, - style::IconTranslateAnchor, - style::IconColor>>; + style::IconFillPaintProperties>; using SymbolSDFIconHaloProgram = SymbolProgram< shaders::symbol_sdf, gl::Triangle, SymbolLayoutAttributes, SymbolSDFUniforms, - style::Properties< - style::IconOpacity, - style::IconTranslate, - style::IconTranslateAnchor, - style::IconHaloColor, - style::IconHaloWidth, - style::IconHaloBlur>>; + style::IconHaloPaintProperties>; using SymbolSDFTextFillProgram = SymbolProgram< shaders::symbol_sdf, gl::Triangle, SymbolLayoutAttributes, SymbolSDFUniforms, - style::Properties< - style::TextOpacity, - style::TextTranslate, - style::TextTranslateAnchor, - style::TextColor>>; + style::TextFillPaintProperties>; using SymbolSDFTextHaloProgram = SymbolProgram< shaders::symbol_sdf, gl::Triangle, SymbolLayoutAttributes, SymbolSDFUniforms, - style::Properties< - style::TextOpacity, - style::TextTranslate, - style::TextTranslateAnchor, - style::TextHaloColor, - style::TextHaloWidth, - style::TextHaloBlur>>; + style::TextHaloPaintProperties>; using SymbolLayoutVertex = SymbolLayoutAttributes::Vertex; using SymbolIconAttributes = SymbolIconProgram::Attributes; -//using SymbolTextAttributes = SymbolSDFTextProgram::Attributes; } // namespace mbgl diff --git a/src/mbgl/renderer/buckets/circle_bucket.hpp b/src/mbgl/renderer/buckets/circle_bucket.hpp index b048fd7675..11ae3ececc 100644 --- a/src/mbgl/renderer/buckets/circle_bucket.hpp +++ b/src/mbgl/renderer/buckets/circle_bucket.hpp @@ -29,7 +29,7 @@ public: gl::VertexVector<CircleLayoutVertex> vertices; gl::IndexVector<gl::Triangles> triangles; - gl::SegmentVector<CircleAttributes> segments; + gl::SegmentVector segments; optional<gl::VertexBuffer<CircleLayoutVertex>> vertexBuffer; optional<gl::IndexBuffer<gl::Triangles>> indexBuffer; diff --git a/src/mbgl/renderer/buckets/debug_bucket.hpp b/src/mbgl/renderer/buckets/debug_bucket.hpp index 756e58a6de..579c58ffe1 100644 --- a/src/mbgl/renderer/buckets/debug_bucket.hpp +++ b/src/mbgl/renderer/buckets/debug_bucket.hpp @@ -33,7 +33,7 @@ public: const optional<Timestamp> expires; const MapDebugOptions debugMode; - gl::SegmentVector<DebugAttributes> segments; + gl::SegmentVector segments; optional<gl::VertexBuffer<DebugLayoutVertex>> vertexBuffer; optional<gl::IndexBuffer<gl::Lines>> indexBuffer; }; diff --git a/src/mbgl/renderer/buckets/fill_bucket.hpp b/src/mbgl/renderer/buckets/fill_bucket.hpp index 421d8b332b..bcd5bec8b1 100644 --- a/src/mbgl/renderer/buckets/fill_bucket.hpp +++ b/src/mbgl/renderer/buckets/fill_bucket.hpp @@ -30,8 +30,8 @@ public: gl::VertexVector<FillLayoutVertex> vertices; gl::IndexVector<gl::Lines> lines; gl::IndexVector<gl::Triangles> triangles; - gl::SegmentVector<FillAttributes> lineSegments; - gl::SegmentVector<FillAttributes> triangleSegments; + gl::SegmentVector lineSegments; + gl::SegmentVector triangleSegments; optional<gl::VertexBuffer<FillLayoutVertex>> vertexBuffer; optional<gl::IndexBuffer<gl::Lines>> lineIndexBuffer; diff --git a/src/mbgl/renderer/buckets/fill_extrusion_bucket.hpp b/src/mbgl/renderer/buckets/fill_extrusion_bucket.hpp index c54805d743..50c32f0458 100644 --- a/src/mbgl/renderer/buckets/fill_extrusion_bucket.hpp +++ b/src/mbgl/renderer/buckets/fill_extrusion_bucket.hpp @@ -27,7 +27,7 @@ public: gl::VertexVector<FillExtrusionLayoutVertex> vertices; gl::IndexVector<gl::Triangles> triangles; - gl::SegmentVector<FillExtrusionAttributes> triangleSegments; + gl::SegmentVector triangleSegments; optional<gl::VertexBuffer<FillExtrusionLayoutVertex>> vertexBuffer; optional<gl::IndexBuffer<gl::Triangles>> indexBuffer; diff --git a/src/mbgl/renderer/buckets/line_bucket.hpp b/src/mbgl/renderer/buckets/line_bucket.hpp index 34d8935953..77a0db6256 100644 --- a/src/mbgl/renderer/buckets/line_bucket.hpp +++ b/src/mbgl/renderer/buckets/line_bucket.hpp @@ -34,7 +34,7 @@ public: gl::VertexVector<LineLayoutVertex> vertices; gl::IndexVector<gl::Triangles> triangles; - gl::SegmentVector<LineAttributes> segments; + gl::SegmentVector segments; optional<gl::VertexBuffer<LineLayoutVertex>> vertexBuffer; optional<gl::IndexBuffer<gl::Triangles>> indexBuffer; diff --git a/src/mbgl/renderer/buckets/raster_bucket.hpp b/src/mbgl/renderer/buckets/raster_bucket.hpp index b5cf7997d5..25d7693269 100644 --- a/src/mbgl/renderer/buckets/raster_bucket.hpp +++ b/src/mbgl/renderer/buckets/raster_bucket.hpp @@ -31,7 +31,7 @@ public: // Raster Tile Sources use the default buffers from Painter gl::VertexVector<RasterLayoutVertex> vertices; gl::IndexVector<gl::Triangles> indices; - gl::SegmentVector<RasterAttributes> segments; + gl::SegmentVector segments; optional<gl::VertexBuffer<RasterLayoutVertex>> vertexBuffer; optional<gl::IndexBuffer<gl::Triangles>> indexBuffer; diff --git a/src/mbgl/renderer/buckets/symbol_bucket.hpp b/src/mbgl/renderer/buckets/symbol_bucket.hpp index 3f6149dfc9..042bd18abf 100644 --- a/src/mbgl/renderer/buckets/symbol_bucket.hpp +++ b/src/mbgl/renderer/buckets/symbol_bucket.hpp @@ -47,7 +47,7 @@ public: struct TextBuffer { gl::VertexVector<SymbolLayoutVertex> vertices; gl::IndexVector<gl::Triangles> triangles; - gl::SegmentVector<SymbolTextAttributes> segments; + gl::SegmentVector segments; optional<gl::VertexBuffer<SymbolLayoutVertex>> vertexBuffer; optional<gl::IndexBuffer<gl::Triangles>> indexBuffer; @@ -58,7 +58,7 @@ public: struct IconBuffer { gl::VertexVector<SymbolLayoutVertex> vertices; gl::IndexVector<gl::Triangles> triangles; - gl::SegmentVector<SymbolIconAttributes> segments; + gl::SegmentVector segments; optional<gl::VertexBuffer<SymbolLayoutVertex>> vertexBuffer; optional<gl::IndexBuffer<gl::Triangles>> indexBuffer; @@ -67,7 +67,7 @@ public: struct CollisionBoxBuffer { gl::VertexVector<CollisionBoxVertex> vertices; gl::IndexVector<gl::Lines> lines; - gl::SegmentVector<CollisionBoxAttributes> segments; + gl::SegmentVector segments; optional<gl::VertexBuffer<CollisionBoxVertex>> vertexBuffer; optional<gl::IndexBuffer<gl::Lines>> indexBuffer; diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp index f038f202a2..8480c50289 100644 --- a/src/mbgl/renderer/layers/render_symbol_layer.cpp +++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp @@ -66,6 +66,34 @@ style::IconPaintProperties::PossiblyEvaluated RenderSymbolLayer::iconPaintProper }; } +style::PlainIconPaintProperties::PossiblyEvaluated RenderSymbolLayer::plainIconPaintProperties() const { + return style::PlainIconPaintProperties::PossiblyEvaluated { + evaluated.get<style::IconOpacity>(), + evaluated.get<style::IconTranslate>(), + evaluated.get<style::IconTranslateAnchor>() + }; +} + +style::IconFillPaintProperties::PossiblyEvaluated RenderSymbolLayer::iconFillPaintProperties() const { + return style::IconFillPaintProperties::PossiblyEvaluated { + evaluated.get<style::IconOpacity>(), + evaluated.get<style::IconColor>(), + evaluated.get<style::IconTranslate>(), + evaluated.get<style::IconTranslateAnchor>() + }; +} + +style::IconHaloPaintProperties::PossiblyEvaluated RenderSymbolLayer::iconHaloPaintProperties() const { + return style::IconHaloPaintProperties::PossiblyEvaluated { + evaluated.get<style::IconOpacity>(), + evaluated.get<style::IconHaloColor>(), + evaluated.get<style::IconHaloWidth>(), + evaluated.get<style::IconHaloBlur>(), + evaluated.get<style::IconTranslate>(), + evaluated.get<style::IconTranslateAnchor>() + }; +} + style::TextPaintProperties::PossiblyEvaluated RenderSymbolLayer::textPaintProperties() const { return style::TextPaintProperties::PossiblyEvaluated { evaluated.get<style::TextOpacity>(), @@ -78,6 +106,24 @@ style::TextPaintProperties::PossiblyEvaluated RenderSymbolLayer::textPaintProper }; } +style::TextFillPaintProperties::PossiblyEvaluated RenderSymbolLayer::textFillPaintProperties() const { + return style::TextFillPaintProperties::PossiblyEvaluated { + evaluated.get<style::TextOpacity>(), + evaluated.get<style::TextColor>(), + evaluated.get<style::TextTranslate>(), + evaluated.get<style::TextTranslateAnchor>() + }; +} +style::TextHaloPaintProperties::PossiblyEvaluated RenderSymbolLayer::textHaloPaintProperties() const { + return style::TextHaloPaintProperties::PossiblyEvaluated { + evaluated.get<style::TextOpacity>(), + evaluated.get<style::TextHaloColor>(), + evaluated.get<style::TextHaloWidth>(), + evaluated.get<style::TextHaloBlur>(), + evaluated.get<style::TextTranslate>(), + evaluated.get<style::TextTranslateAnchor>() + }; +} style::SymbolPropertyValues RenderSymbolLayer::iconPropertyValues(const style::SymbolLayoutProperties::PossiblyEvaluated& layout_) const { return style::SymbolPropertyValues { diff --git a/src/mbgl/renderer/layers/render_symbol_layer.hpp b/src/mbgl/renderer/layers/render_symbol_layer.hpp index c2305c561f..edb385b988 100644 --- a/src/mbgl/renderer/layers/render_symbol_layer.hpp +++ b/src/mbgl/renderer/layers/render_symbol_layer.hpp @@ -23,6 +23,28 @@ class IconPaintProperties : public Properties< IconTranslateAnchor > {}; +class PlainIconPaintProperties : public Properties< + IconOpacity, + IconTranslate, + IconTranslateAnchor +> {}; + +class IconFillPaintProperties : public Properties< + IconOpacity, + IconColor, + IconTranslate, + IconTranslateAnchor +> {}; + +class IconHaloPaintProperties : public Properties< + IconOpacity, + IconHaloColor, + IconHaloWidth, + IconHaloBlur, + IconTranslate, + IconTranslateAnchor +> {}; + class TextPaintProperties : public Properties< TextOpacity, TextColor, @@ -33,6 +55,22 @@ class TextPaintProperties : public Properties< TextTranslateAnchor > {}; +class TextFillPaintProperties : public Properties< + TextOpacity, + TextColor, + TextTranslate, + TextTranslateAnchor +> {}; + +class TextHaloPaintProperties : public Properties< + TextOpacity, + TextHaloColor, + TextHaloWidth, + TextHaloBlur, + TextTranslate, + TextTranslateAnchor +> {}; + // Repackaging evaluated values from SymbolLayoutProperties + SymbolPaintProperties // for genericity over icons vs. text. class SymbolPropertyValues { @@ -71,7 +109,12 @@ public: bool hasTransition() const override; style::IconPaintProperties::PossiblyEvaluated iconPaintProperties() const; + style::PlainIconPaintProperties::PossiblyEvaluated plainIconPaintProperties() const; + style::IconFillPaintProperties::PossiblyEvaluated iconFillPaintProperties() const; + style::IconHaloPaintProperties::PossiblyEvaluated iconHaloPaintProperties() const; style::TextPaintProperties::PossiblyEvaluated textPaintProperties() const; + style::TextFillPaintProperties::PossiblyEvaluated textFillPaintProperties() const; + style::TextHaloPaintProperties::PossiblyEvaluated textHaloPaintProperties() const; style::SymbolPropertyValues iconPropertyValues(const style::SymbolLayoutProperties::PossiblyEvaluated&) const; style::SymbolPropertyValues textPropertyValues(const style::SymbolLayoutProperties::PossiblyEvaluated&) const; diff --git a/src/mbgl/renderer/paint_property_binder.hpp b/src/mbgl/renderer/paint_property_binder.hpp index a3dc2e1372..c51ab66a77 100644 --- a/src/mbgl/renderer/paint_property_binder.hpp +++ b/src/mbgl/renderer/paint_property_binder.hpp @@ -324,6 +324,7 @@ public: } UniformValues uniformValues(float currentZoom) const { + (void)currentZoom; // Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56958 return UniformValues { uniformValue<Ps>(currentZoom)... }; @@ -338,4 +339,36 @@ private: Binders binders; }; + +template <class Ps> +struct PaintPropertyBindersFacade; + +template <class... Ps> +struct PaintPropertyBindersFacade<TypeList<Ps...>> { + template <class P> + using Attribute = ZoomInterpolatedAttribute<typename P::Attribute>; + using Attributes = gl::Attributes<Attribute<Ps>...>; + using AttributeBindings = typename Attributes::Bindings; + + template <class EvaluatedProperties, class... Rs> + AttributeBindings attributeBindings(const EvaluatedProperties& currentProperties, const PaintPropertyBinders<Rs...>& binders) const { + return AttributeBindings { + binders.template attributeBinding<Ps>(currentProperties)... + }; + } + + template <class P> + using Uniform = InterpolationUniform<typename P::Attribute>; + using Uniforms = gl::Uniforms<Uniform<Ps>...>; + using UniformValues = typename Uniforms::Values; + + template <class... Rs> + UniformValues uniformValues(float currentZoom, const PaintPropertyBinders<Rs...>& binders) const { + return UniformValues { + binders.template uniformValue<Ps>(currentZoom)... + }; + } + +}; + } // namespace mbgl diff --git a/src/mbgl/renderer/painter.hpp b/src/mbgl/renderer/painter.hpp index fddaff6318..39cbab1014 100644 --- a/src/mbgl/renderer/painter.hpp +++ b/src/mbgl/renderer/painter.hpp @@ -172,10 +172,10 @@ private: gl::IndexBuffer<gl::Triangles> quadTriangleIndexBuffer; gl::IndexBuffer<gl::LineStrip> tileBorderIndexBuffer; - gl::SegmentVector<FillAttributes> tileTriangleSegments; - gl::SegmentVector<DebugAttributes> tileBorderSegments; - gl::SegmentVector<RasterAttributes> rasterSegments; - gl::SegmentVector<ExtrusionTextureAttributes> extrusionTextureSegments; + gl::SegmentVector tileTriangleSegments; + gl::SegmentVector tileBorderSegments; + gl::SegmentVector rasterSegments; + gl::SegmentVector extrusionTextureSegments; }; } // namespace mbgl diff --git a/src/mbgl/renderer/painters/painter_symbol.cpp b/src/mbgl/renderer/painters/painter_symbol.cpp index 3286b79294..33f68d25ab 100644 --- a/src/mbgl/renderer/painters/painter_symbol.cpp +++ b/src/mbgl/renderer/painters/painter_symbol.cpp @@ -35,6 +35,7 @@ void Painter::renderSymbol(PaintParameters& parameters, const auto& buffers, const auto& symbolSizeBinder, const SymbolPropertyValues& values_, + const auto& bindersFacade, const auto& binders, const auto& paintProperties) { @@ -57,15 +58,14 @@ void Painter::renderSymbol(PaintParameters& parameters, values_.layoutSize, *buffers.indexBuffer, buffers.segments, - binders, - paintProperties, + bindersFacade.uniformValues(state.getZoom(), binders), + bindersFacade.attributeBindings(paintProperties, binders), state.getZoom() ); }; if (bucket.hasIconData()) { auto values = layer.iconPropertyValues(layout); - auto paintPropertyValues = layer.iconPaintProperties(); const bool iconScaled = layout.get<IconSize>().constantOr(1.0) != 1.0 || bucket.iconsNeedLinear; const bool iconTransformed = values.rotationAlignment == AlignmentType::Map || state.getPitch() != 0; @@ -80,8 +80,9 @@ void Painter::renderSymbol(PaintParameters& parameters, bucket.icon, bucket.iconSizeBinder, values, + IconHaloPaintProperties::BindersFacade(), bucket.paintPropertyBinders.at(layer.getID()).first, - paintPropertyValues); + layer.iconHaloPaintProperties()); } if (values.hasFill) { @@ -90,8 +91,9 @@ void Painter::renderSymbol(PaintParameters& parameters, bucket.icon, bucket.iconSizeBinder, values, + IconFillPaintProperties::BindersFacade(), bucket.paintPropertyBinders.at(layer.getID()).first, - paintPropertyValues); + layer.iconFillPaintProperties()); } } else { draw(parameters.programs.symbolIcon, @@ -99,8 +101,9 @@ void Painter::renderSymbol(PaintParameters& parameters, bucket.icon, bucket.iconSizeBinder, values, + PlainIconPaintProperties::BindersFacade(), bucket.paintPropertyBinders.at(layer.getID()).first, - paintPropertyValues); + layer.plainIconPaintProperties()); } } @@ -108,7 +111,6 @@ void Painter::renderSymbol(PaintParameters& parameters, glyphAtlas->bind(context, 0); auto values = layer.textPropertyValues(layout); - auto paintPropertyValues = layer.textPaintProperties(); const Size texsize = glyphAtlas->getSize(); @@ -118,8 +120,9 @@ void Painter::renderSymbol(PaintParameters& parameters, bucket.text, bucket.textSizeBinder, values, + TextHaloPaintProperties::BindersFacade(), bucket.paintPropertyBinders.at(layer.getID()).second, - paintPropertyValues); + layer.textHaloPaintProperties()); } if (values.hasFill) { @@ -128,8 +131,9 @@ void Painter::renderSymbol(PaintParameters& parameters, bucket.text, bucket.textSizeBinder, values, + TextFillPaintProperties::BindersFacade(), bucket.paintPropertyBinders.at(layer.getID()).second, - paintPropertyValues); + layer.textFillPaintProperties()); } } diff --git a/src/mbgl/style/properties.hpp b/src/mbgl/style/properties.hpp index 24ac030541..696535cdc9 100644 --- a/src/mbgl/style/properties.hpp +++ b/src/mbgl/style/properties.hpp @@ -119,6 +119,7 @@ public: using DataDrivenProperties = FilteredTypeList<PropertyTypes, IsDataDriven>; using Binders = PaintPropertyBinders<DataDrivenProperties>; + using BindersFacade = PaintPropertyBindersFacade<DataDrivenProperties>; template <class TypeList> using Tuple = IndexedTuple<PropertyTypes, TypeList>; |