diff options
-rw-r--r-- | src/mbgl/renderer/layers/render_heatmap_layer.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/renderer/layers/render_heatmap_layer.hpp | 2 | ||||
-rw-r--r-- | src/mbgl/renderer/layers/render_line_layer.cpp | 39 | ||||
-rw-r--r-- | src/mbgl/renderer/layers/render_line_layer.hpp | 3 | ||||
-rw-r--r-- | src/mbgl/renderer/render_layer.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/renderer/renderer_impl.cpp | 9 |
6 files changed, 25 insertions, 34 deletions
diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.cpp b/src/mbgl/renderer/layers/render_heatmap_layer.cpp index ba6e6b7a26..e6dddf501b 100644 --- a/src/mbgl/renderer/layers/render_heatmap_layer.cpp +++ b/src/mbgl/renderer/layers/render_heatmap_layer.cpp @@ -55,7 +55,7 @@ bool RenderHeatmapLayer::hasCrossfade() const { return false; } -void RenderHeatmapLayer::upload(gfx::UploadPass& uploadPass, UploadParameters&) { +void RenderHeatmapLayer::upload(gfx::UploadPass& uploadPass) { if (!colorRampTexture) { colorRampTexture = uploadPass.createTexture(colorRamp, gfx::TextureChannelDataType::UnsignedByte); diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.hpp b/src/mbgl/renderer/layers/render_heatmap_layer.hpp index f331ef8435..27e27adb28 100644 --- a/src/mbgl/renderer/layers/render_heatmap_layer.hpp +++ b/src/mbgl/renderer/layers/render_heatmap_layer.hpp @@ -19,7 +19,7 @@ private: void evaluate(const PropertyEvaluationParameters&) override; bool hasTransition() const override; bool hasCrossfade() const override; - void upload(gfx::UploadPass&, UploadParameters&) override; + void upload(gfx::UploadPass&) override; void render(PaintParameters&) override; bool queryIntersectsFeature( diff --git a/src/mbgl/renderer/layers/render_line_layer.cpp b/src/mbgl/renderer/layers/render_line_layer.cpp index 5b20e4667c..2fd48045e9 100644 --- a/src/mbgl/renderer/layers/render_line_layer.cpp +++ b/src/mbgl/renderer/layers/render_line_layer.cpp @@ -59,34 +59,27 @@ bool RenderLineLayer::hasCrossfade() const { return getCrossfade<LineLayerProperties>(evaluatedProperties).t != 1; } -void RenderLineLayer::upload(gfx::UploadPass& uploadPass, UploadParameters& uploadParameters) { +void RenderLineLayer::prepare(const LayerPrepareParameters& params) { + RenderLayer::prepare(params); for (const RenderTile& tile : renderTiles) { const LayerRenderData* renderData = tile.getLayerRenderData(*baseImpl); - if (!renderData) { - continue; - } - auto& bucket = static_cast<LineBucket&>(*renderData->bucket); - const auto& evaluated = getEvaluated<LineLayerProperties>(renderData->layerProperties); - - if (!evaluated.get<LineDasharray>().from.empty()) { - const LinePatternCap cap = bucket.layout.get<LineCap>() == LineCapType::Round - ? LinePatternCap::Round : LinePatternCap::Square; - // Ensures that the dash data gets added and uploaded to the atlas. - uploadParameters.lineAtlas.getDashPosition(evaluated.get<LineDasharray>().from, cap); - uploadParameters.lineAtlas.getDashPosition(evaluated.get<LineDasharray>().to, cap); + if (!renderData) continue; - } else if (!unevaluated.get<LinePattern>().isUndefined()) { - const auto& linePatternValue = evaluated.get<LinePattern>().constantOr(Faded<std::basic_string<char>>{ "", ""}); + const auto& evaluated = getEvaluated<LineLayerProperties>(renderData->layerProperties); + if (evaluated.get<LineDasharray>().from.empty()) continue; - // Ensures that the pattern gets added and uplodated to the atlas. - tile.getPattern(linePatternValue.from); - tile.getPattern(linePatternValue.to); + auto& bucket = static_cast<LineBucket&>(*renderData->bucket); + const LinePatternCap cap = bucket.layout.get<LineCap>() == LineCapType::Round + ? LinePatternCap::Round : LinePatternCap::Square; + // Ensures that the dash data gets added to the atlas. + params.lineAtlas.getDashPosition(evaluated.get<LineDasharray>().from, cap); + params.lineAtlas.getDashPosition(evaluated.get<LineDasharray>().to, cap); + } +} - } else if (!unevaluated.get<LineGradient>().getValue().isUndefined()) { - if (!colorRampTexture) { - colorRampTexture = uploadPass.createTexture(colorRamp); - } - } +void RenderLineLayer::upload(gfx::UploadPass& uploadPass) { + if (!unevaluated.get<LineGradient>().getValue().isUndefined() && !colorRampTexture) { + colorRampTexture = uploadPass.createTexture(colorRamp); } } diff --git a/src/mbgl/renderer/layers/render_line_layer.hpp b/src/mbgl/renderer/layers/render_line_layer.hpp index f57686e1c8..4454d215d9 100644 --- a/src/mbgl/renderer/layers/render_line_layer.hpp +++ b/src/mbgl/renderer/layers/render_line_layer.hpp @@ -20,7 +20,8 @@ private: void evaluate(const PropertyEvaluationParameters&) override; bool hasTransition() const override; bool hasCrossfade() const override; - void upload(gfx::UploadPass&, UploadParameters&) override; + void prepare(const LayerPrepareParameters&) override; + void upload(gfx::UploadPass&) override; void render(PaintParameters&) override; bool queryIntersectsFeature( diff --git a/src/mbgl/renderer/render_layer.hpp b/src/mbgl/renderer/render_layer.hpp index 94d7384ba4..1eaa79ab2b 100644 --- a/src/mbgl/renderer/render_layer.hpp +++ b/src/mbgl/renderer/render_layer.hpp @@ -19,6 +19,7 @@ class RenderSource; class RenderTile; class TransformState; class PatternAtlas; +class LineAtlas; class LayerRenderData { public: @@ -37,6 +38,7 @@ public: RenderSource* source; ImageManager& imageManager; PatternAtlas& patternAtlas; + LineAtlas& lineAtlas; const TransformState& state; }; @@ -77,7 +79,7 @@ public: // Checks whether the given zoom is inside this layer zoom range. bool supportsZoom(float zoom) const; - virtual void upload(gfx::UploadPass&, UploadParameters&) {} + virtual void upload(gfx::UploadPass&) {} virtual void render(PaintParameters&) = 0; // Check wether the given geometry intersects diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp index c7cca3a659..9ab65e57bf 100644 --- a/src/mbgl/renderer/renderer_impl.cpp +++ b/src/mbgl/renderer/renderer_impl.cpp @@ -308,7 +308,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { for (auto& renderItem : renderItems) { RenderLayer& renderLayer = renderItem.layer; - renderLayer.prepare({renderItem.source, *imageManager, *patternAtlas, updateParameters.transformState}); + renderLayer.prepare({renderItem.source, *imageManager, *patternAtlas, *lineAtlas, updateParameters.transformState}); if (renderLayer.needsPlacement()) { layersNeedPlacement.emplace_back(renderLayer); } @@ -386,15 +386,10 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { } } - UploadParameters uploadParameters{ - updateParameters.transformState, - *lineAtlas, - }; - for (auto& renderItem : renderItems) { RenderLayer& renderLayer = renderItem.layer; if (renderLayer.hasRenderPass(RenderPass::Upload)) { - renderLayer.upload(*uploadPass, uploadParameters); + renderLayer.upload(*uploadPass); } } |