diff options
41 files changed, 131 insertions, 145 deletions
diff --git a/include/mbgl/layermanager/circle_layer_factory.hpp b/include/mbgl/layermanager/circle_layer_factory.hpp index b632d892f4..e9eb0f59cc 100644 --- a/include/mbgl/layermanager/circle_layer_factory.hpp +++ b/include/mbgl/layermanager/circle_layer_factory.hpp @@ -8,6 +8,7 @@ class CircleLayerFactory : public LayerFactory { protected: const style::LayerTypeInfo* getTypeInfo() const noexcept final; std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; + std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) noexcept final; std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final; }; diff --git a/include/mbgl/layermanager/fill_extrusion_layer_factory.hpp b/include/mbgl/layermanager/fill_extrusion_layer_factory.hpp index c524f61950..3430d3da1c 100644 --- a/include/mbgl/layermanager/fill_extrusion_layer_factory.hpp +++ b/include/mbgl/layermanager/fill_extrusion_layer_factory.hpp @@ -8,6 +8,7 @@ class FillExtrusionLayerFactory : public LayerFactory { protected: const style::LayerTypeInfo* getTypeInfo() const noexcept final; std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; + std::unique_ptr<Layout> createLayout(const LayoutParameters&, std::unique_ptr<GeometryTileLayer>, const std::vector<const RenderLayer*>&) noexcept final; std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final; }; diff --git a/include/mbgl/layermanager/fill_layer_factory.hpp b/include/mbgl/layermanager/fill_layer_factory.hpp index eec7d0e7a0..22762d1290 100644 --- a/include/mbgl/layermanager/fill_layer_factory.hpp +++ b/include/mbgl/layermanager/fill_layer_factory.hpp @@ -8,6 +8,7 @@ class FillLayerFactory : public LayerFactory { protected: const style::LayerTypeInfo* getTypeInfo() const noexcept final; std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; + std::unique_ptr<Layout> createLayout(const LayoutParameters&, std::unique_ptr<GeometryTileLayer>, const std::vector<const RenderLayer*>&) noexcept final; std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final; }; diff --git a/include/mbgl/layermanager/heatmap_layer_factory.hpp b/include/mbgl/layermanager/heatmap_layer_factory.hpp index b375dc9eb0..306af60938 100644 --- a/include/mbgl/layermanager/heatmap_layer_factory.hpp +++ b/include/mbgl/layermanager/heatmap_layer_factory.hpp @@ -8,6 +8,7 @@ class HeatmapLayerFactory : public LayerFactory { protected: const style::LayerTypeInfo* getTypeInfo() const noexcept final; std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; + std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) noexcept final; std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final; }; diff --git a/include/mbgl/layermanager/layer_factory.hpp b/include/mbgl/layermanager/layer_factory.hpp index 3e2b2c3ddd..037de1b647 100644 --- a/include/mbgl/layermanager/layer_factory.hpp +++ b/include/mbgl/layermanager/layer_factory.hpp @@ -2,8 +2,15 @@ #include <mbgl/style/layer.hpp> +#include <vector> + namespace mbgl { +class Bucket; +class BucketParameters; +class GeometryTileLayer; +class Layout; +class LayoutParameters; class RenderLayer; /** @@ -16,10 +23,14 @@ public: virtual ~LayerFactory() = default; /// Returns the layer type data. virtual const style::LayerTypeInfo* getTypeInfo() const noexcept = 0; - /// Returns a new Layer instance on success call; returns `nulltptr` otherwise. + /// Returns a new Layer instance on success call; returns `nullptr` otherwise. virtual std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept = 0; - /// Returns a new RenderLayer instance on success call; returns `nulltptr` otherwise. + /// Returns a new RenderLayer instance. virtual std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept = 0; + /// Returns a new Bucket instance on success call; returns `nullptr` otherwise. + virtual std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) noexcept; + /// Returns a new Layout instance on success call; returns `nullptr` otherwise. + virtual std::unique_ptr<Layout> createLayout(const LayoutParameters&, std::unique_ptr<GeometryTileLayer>, const std::vector<const RenderLayer*>&) noexcept; protected: optional<std::string> getSource(const style::conversion::Convertible& value) const noexcept; diff --git a/include/mbgl/layermanager/layer_manager.hpp b/include/mbgl/layermanager/layer_manager.hpp index 038a6dcb04..de10b0207c 100644 --- a/include/mbgl/layermanager/layer_manager.hpp +++ b/include/mbgl/layermanager/layer_manager.hpp @@ -2,10 +2,16 @@ #include <mbgl/style/layer.hpp> -namespace mbgl { +#include <vector> +namespace mbgl { +class GeometryTileLayer; class LayerFactory; class RenderLayer; +class Bucket; +class BucketParameters; +class Layout; +class LayoutParameters; /** * @brief A singleton class responsible for creating layer instances. @@ -25,11 +31,15 @@ public: */ static LayerManager* get() noexcept; - /// Returns a new Layer instance on success call; returns `nulltptr` otherwise. + /// Returns a new Layer instance on success call; returns `nullptr` otherwise. std::unique_ptr<style::Layer> createLayer(const std::string& type, const std::string& id, const style::conversion::Convertible& value, style::conversion::Error& error) noexcept; - /// Returns a new RenderLayer instance on success call; returns `nulltptr` otherwise. + /// Returns a new RenderLayer instance on success call; returns `nullptr` otherwise. std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept; + /// Returns a new Bucket instance on success call; returns `nullptr` otherwise. + std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) noexcept; + /// Returns a new Layout instance on success call; returns `nullptr` otherwise. + std::unique_ptr<Layout> createLayout(const LayoutParameters&, std::unique_ptr<GeometryTileLayer>, const std::vector<const RenderLayer*>&) noexcept; /** * @brief a build-time flag to enable/disable annotations in mapbox-gl-native core. diff --git a/include/mbgl/layermanager/line_layer_factory.hpp b/include/mbgl/layermanager/line_layer_factory.hpp index 8aa7e5105b..a7081228ee 100644 --- a/include/mbgl/layermanager/line_layer_factory.hpp +++ b/include/mbgl/layermanager/line_layer_factory.hpp @@ -8,6 +8,9 @@ class LineLayerFactory : public LayerFactory { protected: const style::LayerTypeInfo* getTypeInfo() const noexcept final; std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; + std::unique_ptr<Layout> createLayout(const LayoutParameters& parameters, + std::unique_ptr<GeometryTileLayer> tileLayer, + const std::vector<const RenderLayer*>& group) noexcept final; std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final; }; diff --git a/include/mbgl/layermanager/symbol_layer_factory.hpp b/include/mbgl/layermanager/symbol_layer_factory.hpp index c10b100af6..dac515c9dc 100644 --- a/include/mbgl/layermanager/symbol_layer_factory.hpp +++ b/include/mbgl/layermanager/symbol_layer_factory.hpp @@ -8,6 +8,9 @@ class SymbolLayerFactory : public LayerFactory { protected: const style::LayerTypeInfo* getTypeInfo() const noexcept final; std::unique_ptr<style::Layer> createLayer(const std::string& id, const style::conversion::Convertible& value) noexcept final; + std::unique_ptr<Layout> createLayout(const LayoutParameters& parameters, + std::unique_ptr<GeometryTileLayer> tileLayer, + const std::vector<const RenderLayer*>& group) noexcept final; std::unique_ptr<RenderLayer> createRenderLayer(Immutable<style::Layer::Impl>) noexcept final; }; diff --git a/src/mbgl/layermanager/circle_layer_factory.cpp b/src/mbgl/layermanager/circle_layer_factory.cpp index 215f228aa2..0ea56e5711 100644 --- a/src/mbgl/layermanager/circle_layer_factory.cpp +++ b/src/mbgl/layermanager/circle_layer_factory.cpp @@ -1,5 +1,6 @@ #include <mbgl/layermanager/circle_layer_factory.hpp> +#include <mbgl/renderer/buckets/circle_bucket.hpp> #include <mbgl/renderer/layers/render_circle_layer.hpp> #include <mbgl/style/layers/circle_layer.hpp> #include <mbgl/style/layers/circle_layer_impl.hpp> @@ -23,6 +24,10 @@ std::unique_ptr<style::Layer> CircleLayerFactory::createLayer(const std::string& return layer; } +std::unique_ptr<Bucket> CircleLayerFactory::createBucket(const BucketParameters& parameters, const std::vector<const RenderLayer*>& layers) noexcept { + return std::make_unique<CircleBucket>(parameters, layers); +} + std::unique_ptr<RenderLayer> CircleLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept { assert(impl->getTypeInfo() == getTypeInfo()); return std::make_unique<RenderCircleLayer>(staticImmutableCast<style::CircleLayer::Impl>(std::move(impl))); diff --git a/src/mbgl/layermanager/fill_extrusion_layer_factory.cpp b/src/mbgl/layermanager/fill_extrusion_layer_factory.cpp index 8b90d950d0..b2558825ef 100644 --- a/src/mbgl/layermanager/fill_extrusion_layer_factory.cpp +++ b/src/mbgl/layermanager/fill_extrusion_layer_factory.cpp @@ -1,5 +1,6 @@ #include <mbgl/layermanager/fill_extrusion_layer_factory.hpp> +#include <mbgl/renderer/buckets/fill_extrusion_bucket.hpp> #include <mbgl/renderer/layers/render_fill_extrusion_layer.hpp> #include <mbgl/style/layers/fill_extrusion_layer.hpp> #include <mbgl/style/layers/fill_extrusion_layer_impl.hpp> @@ -23,6 +24,12 @@ std::unique_ptr<style::Layer> FillExtrusionLayerFactory::createLayer(const std:: return layer; } +std::unique_ptr<Layout> FillExtrusionLayerFactory::createLayout(const LayoutParameters& parameters, + std::unique_ptr<GeometryTileLayer> layer, + const std::vector<const RenderLayer*>& group) noexcept { + return std::make_unique<PatternLayout<FillExtrusionBucket>>(parameters.bucketParameters, group, std::move(layer), parameters.imageDependencies); +} + std::unique_ptr<RenderLayer> FillExtrusionLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept { assert(impl->getTypeInfo() == getTypeInfo()); return std::make_unique<RenderFillExtrusionLayer>(staticImmutableCast<style::FillExtrusionLayer::Impl>(std::move(impl))); diff --git a/src/mbgl/layermanager/fill_layer_factory.cpp b/src/mbgl/layermanager/fill_layer_factory.cpp index 664788de17..60a1818585 100644 --- a/src/mbgl/layermanager/fill_layer_factory.cpp +++ b/src/mbgl/layermanager/fill_layer_factory.cpp @@ -1,5 +1,6 @@ #include <mbgl/layermanager/fill_layer_factory.hpp> +#include <mbgl/renderer/buckets/fill_bucket.hpp> #include <mbgl/renderer/layers/render_fill_layer.hpp> #include <mbgl/style/layers/fill_layer.hpp> #include <mbgl/style/layers/fill_layer_impl.hpp> @@ -23,6 +24,13 @@ std::unique_ptr<style::Layer> FillLayerFactory::createLayer(const std::string& i return layer; } +std::unique_ptr<Layout> +FillLayerFactory::createLayout(const LayoutParameters& parameters, + std::unique_ptr<GeometryTileLayer> layer, + const std::vector<const RenderLayer*>& group) noexcept { + return std::make_unique<PatternLayout<FillBucket>>(parameters.bucketParameters, group, std::move(layer), parameters.imageDependencies); +} + std::unique_ptr<RenderLayer> FillLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept { assert(impl->getTypeInfo() == getTypeInfo()); return std::make_unique<RenderFillLayer>(staticImmutableCast<style::FillLayer::Impl>(std::move(impl))); diff --git a/src/mbgl/layermanager/heatmap_layer_factory.cpp b/src/mbgl/layermanager/heatmap_layer_factory.cpp index 4785b7c010..5d6a595b46 100644 --- a/src/mbgl/layermanager/heatmap_layer_factory.cpp +++ b/src/mbgl/layermanager/heatmap_layer_factory.cpp @@ -1,5 +1,6 @@ #include <mbgl/layermanager/heatmap_layer_factory.hpp> +#include <mbgl/renderer/buckets/heatmap_bucket.hpp> #include <mbgl/renderer/layers/render_heatmap_layer.hpp> #include <mbgl/style/layers/heatmap_layer.hpp> #include <mbgl/style/layers/heatmap_layer_impl.hpp> @@ -23,6 +24,10 @@ std::unique_ptr<style::Layer> HeatmapLayerFactory::createLayer(const std::string return layer; } +std::unique_ptr<Bucket> HeatmapLayerFactory::createBucket(const BucketParameters& parameters, const std::vector<const RenderLayer*>& layers) noexcept { + return std::make_unique<HeatmapBucket>(parameters, layers); +} + std::unique_ptr<RenderLayer> HeatmapLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept { assert(impl->getTypeInfo() == getTypeInfo()); return std::make_unique<RenderHeatmapLayer>(staticImmutableCast<style::HeatmapLayer::Impl>(std::move(impl))); diff --git a/src/mbgl/layermanager/layer_factory.cpp b/src/mbgl/layermanager/layer_factory.cpp index c7f63b8699..ceeb304f44 100644 --- a/src/mbgl/layermanager/layer_factory.cpp +++ b/src/mbgl/layermanager/layer_factory.cpp @@ -1,5 +1,9 @@ #include <mbgl/layermanager/layer_factory.hpp> +#include <mbgl/layout/layout.hpp> +#include <mbgl/renderer/bucket.hpp> +#include <mbgl/renderer/bucket_parameters.hpp> + #include <mbgl/style/conversion/constant.hpp> #include <mbgl/style/conversion/filter.hpp> #include <mbgl/style/conversion_impl.hpp> @@ -21,6 +25,16 @@ optional<std::string> LayerFactory::getSource(const style::conversion::Convertib return source; } +std::unique_ptr<Bucket> LayerFactory::createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) noexcept { + assert(false); + return nullptr; +} + +std::unique_ptr<Layout> LayerFactory::createLayout(const LayoutParameters&, std::unique_ptr<GeometryTileLayer>, const std::vector<const RenderLayer*>&) noexcept { + assert(false); + return nullptr; +} + bool LayerFactory::initSourceLayerAndFilter(style::Layer* layer, const style::conversion::Convertible& value) const noexcept { auto sourceLayerValue = objectMember(value, "source-layer"); if (sourceLayerValue) { diff --git a/src/mbgl/layermanager/layer_manager.cpp b/src/mbgl/layermanager/layer_manager.cpp index 8f42bc9218..e6195caeba 100644 --- a/src/mbgl/layermanager/layer_manager.cpp +++ b/src/mbgl/layermanager/layer_manager.cpp @@ -1,6 +1,9 @@ #include <mbgl/layermanager/layer_manager.hpp> +#include <mbgl/layout/layout.hpp> #include <mbgl/layermanager/layer_factory.hpp> +#include <mbgl/renderer/bucket.hpp> +#include <mbgl/renderer/bucket_parameters.hpp> #include <mbgl/renderer/render_layer.hpp> #include <mbgl/style/layer.hpp> #include <mbgl/style/layer_impl.hpp> @@ -22,6 +25,24 @@ std::unique_ptr<style::Layer> LayerManager::createLayer( return nullptr; } +std::unique_ptr<Bucket> LayerManager::createBucket(const BucketParameters& parameters, const std::vector<const RenderLayer*>& layers) noexcept { + assert(!layers.empty()); + assert(parameters.layerType->layout == style::LayerTypeInfo::Layout::NotRequired); + LayerFactory* factory = getFactory(parameters.layerType); + assert(factory); + return factory->createBucket(parameters, layers); +} + +std::unique_ptr<Layout> LayerManager::createLayout(const LayoutParameters& parameters, + std::unique_ptr<GeometryTileLayer> tileLayer, + const std::vector<const RenderLayer*>& layers) noexcept { + assert(!layers.empty()); + assert(parameters.bucketParameters.layerType->layout == style::LayerTypeInfo::Layout::Required); + LayerFactory* factory = getFactory(parameters.bucketParameters.layerType); + assert(factory); + return factory->createLayout(parameters, std::move(tileLayer), layers); +} + std::unique_ptr<RenderLayer> LayerManager::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept { LayerFactory* factory = getFactory(impl->getTypeInfo()); assert(factory); diff --git a/src/mbgl/layermanager/line_layer_factory.cpp b/src/mbgl/layermanager/line_layer_factory.cpp index 7a8ea01d79..8bf756e159 100644 --- a/src/mbgl/layermanager/line_layer_factory.cpp +++ b/src/mbgl/layermanager/line_layer_factory.cpp @@ -1,5 +1,6 @@ #include <mbgl/layermanager/line_layer_factory.hpp> +#include <mbgl/renderer/buckets/line_bucket.hpp> #include <mbgl/renderer/layers/render_line_layer.hpp> #include <mbgl/style/layers/line_layer.hpp> #include <mbgl/style/layers/line_layer_impl.hpp> @@ -23,6 +24,12 @@ std::unique_ptr<style::Layer> LineLayerFactory::createLayer(const std::string& i return layer; } +std::unique_ptr<Layout> LineLayerFactory::createLayout(const LayoutParameters& parameters, + std::unique_ptr<GeometryTileLayer> layer, + const std::vector<const RenderLayer*>& group) noexcept { + return std::make_unique<PatternLayout<LineBucket>>(parameters.bucketParameters, group, std::move(layer), parameters.imageDependencies); +} + std::unique_ptr<RenderLayer> LineLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept { assert(impl->getTypeInfo() == getTypeInfo()); return std::make_unique<RenderLineLayer>(staticImmutableCast<style::LineLayer::Impl>(std::move(impl))); diff --git a/src/mbgl/layermanager/symbol_layer_factory.cpp b/src/mbgl/layermanager/symbol_layer_factory.cpp index 8acefb9f41..d992741551 100644 --- a/src/mbgl/layermanager/symbol_layer_factory.cpp +++ b/src/mbgl/layermanager/symbol_layer_factory.cpp @@ -1,5 +1,6 @@ #include <mbgl/layermanager/symbol_layer_factory.hpp> +#include <mbgl/layout/symbol_layout.hpp> #include <mbgl/renderer/layers/render_symbol_layer.hpp> #include <mbgl/style/layers/symbol_layer.hpp> #include <mbgl/style/layers/symbol_layer_impl.hpp> @@ -23,6 +24,16 @@ std::unique_ptr<style::Layer> SymbolLayerFactory::createLayer(const std::string& return layer; } +std::unique_ptr<Layout> SymbolLayerFactory::createLayout(const LayoutParameters& parameters, + std::unique_ptr<GeometryTileLayer> tileLayer, + const std::vector<const RenderLayer*>& group) noexcept { + return std::make_unique<SymbolLayout>(parameters.bucketParameters, + group, + std::move(tileLayer), + parameters.imageDependencies, + parameters.glyphDependencies); +} + std::unique_ptr<RenderLayer> SymbolLayerFactory::createRenderLayer(Immutable<style::Layer::Impl> impl) noexcept { assert(impl->getTypeInfo() == getTypeInfo()); return std::make_unique<RenderSymbolLayer>(staticImmutableCast<style::SymbolLayer::Impl>(std::move(impl))); diff --git a/src/mbgl/layout/layout.hpp b/src/mbgl/layout/layout.hpp index 601c5fb184..1deaf13193 100644 --- a/src/mbgl/layout/layout.hpp +++ b/src/mbgl/layout/layout.hpp @@ -2,6 +2,7 @@ #include <mbgl/renderer/image_atlas.hpp> #include <mbgl/text/glyph_atlas.hpp> +#include <mbgl/tile/geometry_tile_data.hpp> #include <memory> namespace mbgl { @@ -13,7 +14,6 @@ class FeatureIndex; class Layout { public: - Layout() = default; virtual ~Layout() = default; virtual void createBucket(const ImagePositions&, @@ -32,4 +32,11 @@ public: virtual bool hasDependencies() const = 0; }; +class LayoutParameters { +public: + const BucketParameters& bucketParameters; + GlyphDependencies& glyphDependencies; + ImageDependencies& imageDependencies; +}; + } // namespace mbgl diff --git a/src/mbgl/renderer/bucket_parameters.hpp b/src/mbgl/renderer/bucket_parameters.hpp index 50ec4cf521..7547f4517b 100644 --- a/src/mbgl/renderer/bucket_parameters.hpp +++ b/src/mbgl/renderer/bucket_parameters.hpp @@ -4,12 +4,16 @@ #include <mbgl/tile/tile_id.hpp> namespace mbgl { +namespace style { + struct LayerTypeInfo; +} // namespace style class BucketParameters { public: const OverscaledTileID tileID; const MapMode mode; const float pixelRatio; + const style::LayerTypeInfo* layerType; }; } // namespace mbgl diff --git a/src/mbgl/renderer/layers/render_background_layer.cpp b/src/mbgl/renderer/layers/render_background_layer.cpp index b80bffa6df..a563d49611 100644 --- a/src/mbgl/renderer/layers/render_background_layer.cpp +++ b/src/mbgl/renderer/layers/render_background_layer.cpp @@ -22,12 +22,6 @@ const style::BackgroundLayer::Impl& RenderBackgroundLayer::impl() const { return static_cast<const style::BackgroundLayer::Impl&>(*baseImpl); } -std::unique_ptr<Bucket> RenderBackgroundLayer::createBucket(const BucketParameters &, - const std::vector<const RenderLayer *> &) const { - assert(false); - return nullptr; -} - void RenderBackgroundLayer::transition(const TransitionParameters ¶meters) { unevaluated = impl().paint.transitioned(parameters, std::move(unevaluated)); } diff --git a/src/mbgl/renderer/layers/render_background_layer.hpp b/src/mbgl/renderer/layers/render_background_layer.hpp index fea3890484..3cb30ac2a3 100644 --- a/src/mbgl/renderer/layers/render_background_layer.hpp +++ b/src/mbgl/renderer/layers/render_background_layer.hpp @@ -18,8 +18,6 @@ public: optional<Color> getSolidBackground() const final; void render(PaintParameters&, RenderSource*) override; - std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const override; - // Paint properties style::BackgroundPaintProperties::Unevaluated unevaluated; style::BackgroundPaintProperties::PossiblyEvaluated evaluated; diff --git a/src/mbgl/renderer/layers/render_circle_layer.cpp b/src/mbgl/renderer/layers/render_circle_layer.cpp index 65550991a9..c868839084 100644 --- a/src/mbgl/renderer/layers/render_circle_layer.cpp +++ b/src/mbgl/renderer/layers/render_circle_layer.cpp @@ -23,10 +23,6 @@ const style::CircleLayer::Impl& RenderCircleLayer::impl() const { return static_cast<const style::CircleLayer::Impl&>(*baseImpl); } -std::unique_ptr<Bucket> RenderCircleLayer::createBucket(const BucketParameters& parameters, const std::vector<const RenderLayer*>& layers) const { - return std::make_unique<CircleBucket>(parameters, layers); -} - void RenderCircleLayer::transition(const TransitionParameters& parameters) { unevaluated = impl().paint.transitioned(parameters, std::move(unevaluated)); } diff --git a/src/mbgl/renderer/layers/render_circle_layer.hpp b/src/mbgl/renderer/layers/render_circle_layer.hpp index 5515aa0452..8b0678f6d8 100644 --- a/src/mbgl/renderer/layers/render_circle_layer.hpp +++ b/src/mbgl/renderer/layers/render_circle_layer.hpp @@ -25,8 +25,6 @@ public: const float, const mat4&) const override; - std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const override; - // Paint properties style::CirclePaintProperties::Unevaluated unevaluated; style::CirclePaintProperties::PossiblyEvaluated evaluated; diff --git a/src/mbgl/renderer/layers/render_custom_layer.cpp b/src/mbgl/renderer/layers/render_custom_layer.cpp index 22c1b4c5d2..d3ce84be2e 100644 --- a/src/mbgl/renderer/layers/render_custom_layer.cpp +++ b/src/mbgl/renderer/layers/render_custom_layer.cpp @@ -46,11 +46,6 @@ void RenderCustomLayer::markContextDestroyed() { contextDestroyed = true; } -std::unique_ptr<Bucket> RenderCustomLayer::createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const { - assert(false); - return nullptr; -} - void RenderCustomLayer::render(PaintParameters& paintParameters, RenderSource*) { if (host != impl().host) { //If the context changed, deinitialize the previous one before initializing the new one. diff --git a/src/mbgl/renderer/layers/render_custom_layer.hpp b/src/mbgl/renderer/layers/render_custom_layer.hpp index a6c1696493..37b8592172 100644 --- a/src/mbgl/renderer/layers/render_custom_layer.hpp +++ b/src/mbgl/renderer/layers/render_custom_layer.hpp @@ -16,7 +16,6 @@ public: bool hasCrossfade() const override; void markContextDestroyed() final; - std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const final; void render(PaintParameters&, RenderSource*) final; const style::CustomLayer::Impl& impl() const; diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp index 2672af5135..0a22f89341 100644 --- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp @@ -27,20 +27,6 @@ const style::FillExtrusionLayer::Impl& RenderFillExtrusionLayer::impl() const { return static_cast<const style::FillExtrusionLayer::Impl&>(*baseImpl); } -std::unique_ptr<Bucket> RenderFillExtrusionLayer::createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const { - // Should be calling createLayout() instead. - assert(baseImpl->getTypeInfo()->layout == LayerTypeInfo::Layout::NotRequired); - return nullptr; -} - -std::unique_ptr<Layout> RenderFillExtrusionLayer::createLayout(const BucketParameters& parameters, - const std::vector<const RenderLayer*>& group, - std::unique_ptr<GeometryTileLayer> layer, - GlyphDependencies&, - ImageDependencies& imageDependencies) const { - return std::make_unique<PatternLayout<FillExtrusionBucket>>(parameters, group, std::move(layer), imageDependencies); -} - void RenderFillExtrusionLayer::transition(const TransitionParameters& parameters) { unevaluated = impl().paint.transitioned(parameters, std::move(unevaluated)); } diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.hpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.hpp index e73a152df5..886362f28e 100644 --- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.hpp +++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.hpp @@ -35,10 +35,6 @@ public: const float, const mat4&) const override; - std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const override; - std::unique_ptr<Layout> createLayout(const BucketParameters&, const std::vector<const RenderLayer*>&, - std::unique_ptr<GeometryTileLayer>, GlyphDependencies&, ImageDependencies&) const override; - // Paint properties style::FillExtrusionPaintProperties::Unevaluated unevaluated; style::FillExtrusionPaintProperties::PossiblyEvaluated evaluated; diff --git a/src/mbgl/renderer/layers/render_fill_layer.cpp b/src/mbgl/renderer/layers/render_fill_layer.cpp index 891db976f6..c2e62acae2 100644 --- a/src/mbgl/renderer/layers/render_fill_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_layer.cpp @@ -25,21 +25,6 @@ const style::FillLayer::Impl& RenderFillLayer::impl() const { return static_cast<const style::FillLayer::Impl&>(*baseImpl); } -std::unique_ptr<Bucket> RenderFillLayer::createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const { - // Should be calling createLayout() instead. - assert(baseImpl->getTypeInfo()->layout == LayerTypeInfo::Layout::NotRequired); - return nullptr; -} - -std::unique_ptr<Layout> -RenderFillLayer::createLayout(const BucketParameters& parameters, - const std::vector<const RenderLayer*>& group, - std::unique_ptr<GeometryTileLayer> layer, - GlyphDependencies&, - ImageDependencies& imageDependencies) const { - return std::make_unique<PatternLayout<FillBucket>>(parameters, group, std::move(layer), imageDependencies); -} - void RenderFillLayer::transition(const TransitionParameters& parameters) { unevaluated = impl().paint.transitioned(parameters, std::move(unevaluated)); } diff --git a/src/mbgl/renderer/layers/render_fill_layer.hpp b/src/mbgl/renderer/layers/render_fill_layer.hpp index 57bebec7be..1c7ee6556e 100644 --- a/src/mbgl/renderer/layers/render_fill_layer.hpp +++ b/src/mbgl/renderer/layers/render_fill_layer.hpp @@ -31,10 +31,6 @@ public: const float, const mat4&) const override; - std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const override; - std::unique_ptr<Layout> createLayout(const BucketParameters&, const std::vector<const RenderLayer*>&, - std::unique_ptr<GeometryTileLayer>, GlyphDependencies&, ImageDependencies&) const override; - // Paint properties style::FillPaintProperties::Unevaluated unevaluated; style::FillPaintProperties::PossiblyEvaluated evaluated; diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.cpp b/src/mbgl/renderer/layers/render_heatmap_layer.cpp index 2c27da2f04..5e9283c6b3 100644 --- a/src/mbgl/renderer/layers/render_heatmap_layer.cpp +++ b/src/mbgl/renderer/layers/render_heatmap_layer.cpp @@ -25,10 +25,6 @@ const style::HeatmapLayer::Impl& RenderHeatmapLayer::impl() const { return static_cast<const style::HeatmapLayer::Impl&>(*baseImpl); } -std::unique_ptr<Bucket> RenderHeatmapLayer::createBucket(const BucketParameters& parameters, const std::vector<const RenderLayer*>& layers) const { - return std::make_unique<HeatmapBucket>(parameters, layers); -} - void RenderHeatmapLayer::transition(const TransitionParameters& parameters) { unevaluated = impl().paint.transitioned(parameters, std::move(unevaluated)); } diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.hpp b/src/mbgl/renderer/layers/render_heatmap_layer.hpp index a0148fb4a3..edb36255cb 100644 --- a/src/mbgl/renderer/layers/render_heatmap_layer.hpp +++ b/src/mbgl/renderer/layers/render_heatmap_layer.hpp @@ -28,8 +28,6 @@ public: const float, const mat4&) const override; - std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const override; - // Paint properties style::HeatmapPaintProperties::Unevaluated unevaluated; style::HeatmapPaintProperties::PossiblyEvaluated evaluated; diff --git a/src/mbgl/renderer/layers/render_hillshade_layer.cpp b/src/mbgl/renderer/layers/render_hillshade_layer.cpp index 8c245fa7fd..8fd8504848 100644 --- a/src/mbgl/renderer/layers/render_hillshade_layer.cpp +++ b/src/mbgl/renderer/layers/render_hillshade_layer.cpp @@ -24,11 +24,6 @@ const style::HillshadeLayer::Impl& RenderHillshadeLayer::impl() const { return static_cast<const style::HillshadeLayer::Impl&>(*baseImpl); } -std::unique_ptr<Bucket> RenderHillshadeLayer::createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const { - assert(false); - return nullptr; -} - const std::array<float, 2> RenderHillshadeLayer::getLatRange(const UnwrappedTileID& id) { const LatLng latlng0 = LatLng(id); const LatLng latlng1 = LatLng(UnwrappedTileID(id.canonical.z, id.canonical.x, id.canonical.y + 1)); diff --git a/src/mbgl/renderer/layers/render_hillshade_layer.hpp b/src/mbgl/renderer/layers/render_hillshade_layer.hpp index 3f3ddaccf0..3985389763 100644 --- a/src/mbgl/renderer/layers/render_hillshade_layer.hpp +++ b/src/mbgl/renderer/layers/render_hillshade_layer.hpp @@ -19,8 +19,6 @@ public: void render(PaintParameters&, RenderSource* src) override; - std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const override; - // Paint properties style::HillshadePaintProperties::Unevaluated unevaluated; style::HillshadePaintProperties::PossiblyEvaluated evaluated; diff --git a/src/mbgl/renderer/layers/render_line_layer.cpp b/src/mbgl/renderer/layers/render_line_layer.cpp index 7026175bfc..ea6f948068 100644 --- a/src/mbgl/renderer/layers/render_line_layer.cpp +++ b/src/mbgl/renderer/layers/render_line_layer.cpp @@ -1,5 +1,4 @@ #include <mbgl/renderer/layers/render_line_layer.hpp> -#include <mbgl/renderer/buckets/line_bucket.hpp> #include <mbgl/renderer/render_tile.hpp> #include <mbgl/renderer/paint_parameters.hpp> #include <mbgl/renderer/image_manager.hpp> @@ -27,20 +26,6 @@ const style::LineLayer::Impl& RenderLineLayer::impl() const { return static_cast<const style::LineLayer::Impl&>(*baseImpl); } -std::unique_ptr<Bucket> RenderLineLayer::createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const { - // Should be calling createLayout() instead. - assert(baseImpl->getTypeInfo()->layout == LayerTypeInfo::Layout::NotRequired); - return nullptr; -} - -std::unique_ptr<Layout> RenderLineLayer::createLayout(const BucketParameters& parameters, - const std::vector<const RenderLayer*>& group, - std::unique_ptr<GeometryTileLayer> layer, - GlyphDependencies&, - ImageDependencies& imageDependencies) const { - return std::make_unique<PatternLayout<LineBucket>>(parameters, group, std::move(layer), imageDependencies); -} - void RenderLineLayer::transition(const TransitionParameters& parameters) { unevaluated = impl().paint.transitioned(parameters, std::move(unevaluated)); } diff --git a/src/mbgl/renderer/layers/render_line_layer.hpp b/src/mbgl/renderer/layers/render_line_layer.hpp index d586725f54..2809c7ceb1 100644 --- a/src/mbgl/renderer/layers/render_line_layer.hpp +++ b/src/mbgl/renderer/layers/render_line_layer.hpp @@ -41,14 +41,6 @@ public: const float, const mat4&) const override; - - std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const override; - std::unique_ptr<Layout> createLayout(const BucketParameters&, - const std::vector<const RenderLayer*>&, - std::unique_ptr<GeometryTileLayer>, - GlyphDependencies&, - ImageDependencies&) const override; - // Paint properties style::LinePaintProperties::Unevaluated unevaluated; RenderLinePaintProperties::PossiblyEvaluated evaluated; diff --git a/src/mbgl/renderer/layers/render_raster_layer.cpp b/src/mbgl/renderer/layers/render_raster_layer.cpp index b93d0775bd..4969b3ea52 100644 --- a/src/mbgl/renderer/layers/render_raster_layer.cpp +++ b/src/mbgl/renderer/layers/render_raster_layer.cpp @@ -22,11 +22,6 @@ const style::RasterLayer::Impl& RenderRasterLayer::impl() const { return static_cast<const style::RasterLayer::Impl&>(*baseImpl); } -std::unique_ptr<Bucket> RenderRasterLayer::createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const { - assert(false); - return nullptr; -} - void RenderRasterLayer::transition(const TransitionParameters& parameters) { unevaluated = impl().paint.transitioned(parameters, std::move(unevaluated)); } diff --git a/src/mbgl/renderer/layers/render_raster_layer.hpp b/src/mbgl/renderer/layers/render_raster_layer.hpp index 7783d924b7..516c163c27 100644 --- a/src/mbgl/renderer/layers/render_raster_layer.hpp +++ b/src/mbgl/renderer/layers/render_raster_layer.hpp @@ -18,8 +18,6 @@ public: void render(PaintParameters&, RenderSource*) override; - std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const override; - // Paint properties style::RasterPaintProperties::Unevaluated unevaluated; style::RasterPaintProperties::PossiblyEvaluated evaluated; diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp index bc605fe9eb..19ddd6c1cb 100644 --- a/src/mbgl/renderer/layers/render_symbol_layer.cpp +++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp @@ -12,7 +12,6 @@ #include <mbgl/tile/geometry_tile.hpp> #include <mbgl/tile/geometry_tile_data.hpp> #include <mbgl/style/layers/symbol_layer_impl.hpp> -#include <mbgl/layout/symbol_layout.hpp> #include <mbgl/layout/symbol_projection.hpp> #include <mbgl/util/math.hpp> @@ -31,24 +30,6 @@ const style::SymbolLayer::Impl& RenderSymbolLayer::impl() const { return static_cast<const style::SymbolLayer::Impl&>(*baseImpl); } -std::unique_ptr<Bucket> RenderSymbolLayer::createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const { - // Should be calling createLayout() instead. - assert(baseImpl->getTypeInfo()->layout == LayerTypeInfo::Layout::NotRequired); - return nullptr; -} - -std::unique_ptr<Layout> RenderSymbolLayer::createLayout(const BucketParameters& parameters, - const std::vector<const RenderLayer*>& group, - std::unique_ptr<GeometryTileLayer> layer, - GlyphDependencies& glyphDependencies, - ImageDependencies& imageDependencies) const { - return std::make_unique<SymbolLayout>(parameters, - group, - std::move(layer), - imageDependencies, - glyphDependencies); -} - void RenderSymbolLayer::transition(const TransitionParameters& parameters) { unevaluated = impl().paint.transitioned(parameters, std::move(unevaluated)); } diff --git a/src/mbgl/renderer/layers/render_symbol_layer.hpp b/src/mbgl/renderer/layers/render_symbol_layer.hpp index 6b43f91a22..e44ad398f4 100644 --- a/src/mbgl/renderer/layers/render_symbol_layer.hpp +++ b/src/mbgl/renderer/layers/render_symbol_layer.hpp @@ -71,13 +71,6 @@ public: static style::IconPaintProperties::PossiblyEvaluated iconPaintProperties(const style::SymbolPaintProperties::PossiblyEvaluated&); static style::TextPaintProperties::PossiblyEvaluated textPaintProperties(const style::SymbolPaintProperties::PossiblyEvaluated&); - std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const override; - std::unique_ptr<Layout> createLayout(const BucketParameters&, - const std::vector<const RenderLayer*>&, - std::unique_ptr<GeometryTileLayer>, - GlyphDependencies&, - ImageDependencies&) const override; - // RenderLayerSymbolInterface overrides const RenderLayerSymbolInterface* getSymbolInterface() const final; const std::string& layerID() const final; diff --git a/src/mbgl/renderer/render_layer.hpp b/src/mbgl/renderer/render_layer.hpp index 758412f932..ec4c71b08c 100644 --- a/src/mbgl/renderer/render_layer.hpp +++ b/src/mbgl/renderer/render_layer.hpp @@ -62,15 +62,6 @@ public: const float, const mat4&) const { return false; }; - virtual std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const = 0; - virtual std::unique_ptr<Layout> createLayout(const BucketParameters&, - const std::vector<const RenderLayer*>&, - std::unique_ptr<GeometryTileLayer>, - GlyphDependencies&, - ImageDependencies&) const { - return nullptr; - } - using RenderTiles = std::vector<std::reference_wrapper<RenderTile>>; void setRenderTiles(RenderTiles, const TransformState&); diff --git a/src/mbgl/tile/geometry_tile_worker.cpp b/src/mbgl/tile/geometry_tile_worker.cpp index 854bfcf1a4..943e782af1 100644 --- a/src/mbgl/tile/geometry_tile_worker.cpp +++ b/src/mbgl/tile/geometry_tile_worker.cpp @@ -2,6 +2,7 @@ #include <mbgl/tile/geometry_tile_data.hpp> #include <mbgl/tile/geometry_tile.hpp> #include <mbgl/layermanager/layer_manager.hpp> +#include <mbgl/layout/layout.hpp> #include <mbgl/layout/symbol_layout.hpp> #include <mbgl/layout/pattern_layout.hpp> #include <mbgl/renderer/bucket_parameters.hpp> @@ -340,7 +341,6 @@ void GeometryTileWorker::parse() { layouts.clear(); featureIndex = std::make_unique<FeatureIndex>(*data ? (*data)->clone() : nullptr); - BucketParameters parameters { id, mode, pixelRatio }; GlyphDependencies glyphDependencies; ImageDependencies imageDependencies; @@ -359,6 +359,7 @@ void GeometryTileWorker::parse() { } const RenderLayer& leader = *group.at(0); + BucketParameters parameters { id, mode, pixelRatio, leader.baseImpl->getTypeInfo() }; auto geometryLayer = (*data)->getLayer(leader.baseImpl->sourceLayer); if (!geometryLayer) { @@ -377,7 +378,7 @@ void GeometryTileWorker::parse() { // and either immediately create a bucket if no images/glyphs are used, or the Layout is stored until // the images/glyphs are available to add the features to the buckets. if (leader.baseImpl->getTypeInfo()->layout == LayerTypeInfo::Layout::Required) { - auto layout = leader.createLayout(parameters, group, std::move(geometryLayer), glyphDependencies, imageDependencies); + auto layout = LayerManager::get()->createLayout({parameters, glyphDependencies, imageDependencies}, std::move(geometryLayer), group); if (layout->hasDependencies()) { layouts.push_back(std::move(layout)); } else { @@ -386,7 +387,7 @@ void GeometryTileWorker::parse() { } else { const Filter& filter = leader.baseImpl->filter; const std::string& sourceLayerID = leader.baseImpl->sourceLayer; - std::shared_ptr<Bucket> bucket = leader.createBucket(parameters, group); + std::shared_ptr<Bucket> bucket = LayerManager::get()->createBucket(parameters, group); for (std::size_t i = 0; !obsolete && i < geometryLayer->featureCount(); i++) { std::unique_ptr<GeometryTileFeature> feature = geometryLayer->getFeature(i); diff --git a/test/gl/bucket.test.cpp b/test/gl/bucket.test.cpp index 04e6447ad8..56d8ef372d 100644 --- a/test/gl/bucket.test.cpp +++ b/test/gl/bucket.test.cpp @@ -47,7 +47,7 @@ TEST(Buckets, CircleBucket) { BackendScope scope { backend }; gl::Context context; - CircleBucket bucket { { {0, 0, 0}, MapMode::Static, 1.0 }, {} }; + CircleBucket bucket { { {0, 0, 0}, MapMode::Static, 1.0, nullptr }, {} }; ASSERT_FALSE(bucket.hasData()); ASSERT_FALSE(bucket.needsUpload()); |