summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mbgl/renderer/layers/render_background_layer.cpp21
-rw-r--r--src/mbgl/renderer/layers/render_background_layer.hpp2
-rw-r--r--src/mbgl/renderer/layers/render_custom_layer.cpp3
-rw-r--r--src/mbgl/renderer/layers/render_custom_layer.hpp1
-rw-r--r--src/mbgl/renderer/render_layer.hpp1
-rw-r--r--src/mbgl/renderer/renderer_impl.cpp6
-rw-r--r--src/mbgl/renderer/upload_parameters.hpp3
7 files changed, 16 insertions, 21 deletions
diff --git a/src/mbgl/renderer/layers/render_background_layer.cpp b/src/mbgl/renderer/layers/render_background_layer.cpp
index 818b458145..9d78315afa 100644
--- a/src/mbgl/renderer/layers/render_background_layer.cpp
+++ b/src/mbgl/renderer/layers/render_background_layer.cpp
@@ -38,9 +38,6 @@ void RenderBackgroundLayer::evaluate(const PropertyEvaluationParameters &paramet
passes = properties->evaluated.get<style::BackgroundOpacity>() > 0 ? RenderPass::Translucent
: RenderPass::None;
- if (passes != RenderPass::None && !properties->evaluated.get<style::BackgroundPattern>().to.empty()) {
- passes |= RenderPass::Upload;
- }
evaluatedProperties = std::move(properties);
}
@@ -52,15 +49,6 @@ bool RenderBackgroundLayer::hasCrossfade() const {
return getCrossfade<BackgroundLayerProperties>(evaluatedProperties).t != 1;
}
-void RenderBackgroundLayer::upload(gfx::UploadPass&, UploadParameters& parameters) {
- const auto& evaluated = static_cast<const BackgroundLayerProperties&>(*evaluatedProperties).evaluated;
- if (!evaluated.get<BackgroundPattern>().to.empty()) {
- // Ensures that the texture gets added and uploaded to the atlas.
- parameters.imageManager.getPattern(evaluated.get<BackgroundPattern>().from);
- parameters.imageManager.getPattern(evaluated.get<BackgroundPattern>().to);
- }
-}
-
void RenderBackgroundLayer::render(PaintParameters& parameters) {
// Note that for bottommost layers without a pattern, the background color is drawn with
// glClear rather than this method.
@@ -152,4 +140,13 @@ optional<Color> RenderBackgroundLayer::getSolidBackground() const {
return { evaluated.get<BackgroundColor>() * evaluated.get<BackgroundOpacity>() };
}
+void RenderBackgroundLayer::prepare(const LayerPrepareParameters& params) {
+ const auto& evaluated = static_cast<const BackgroundLayerProperties&>(*evaluatedProperties).evaluated;
+ if (!evaluated.get<BackgroundPattern>().to.empty()) {
+ // Ensures that the texture gets added and uploaded to the atlas.
+ params.imageManager.getPattern(evaluated.get<BackgroundPattern>().from);
+ params.imageManager.getPattern(evaluated.get<BackgroundPattern>().to);
+ }
+}
+
} // namespace mbgl
diff --git a/src/mbgl/renderer/layers/render_background_layer.hpp b/src/mbgl/renderer/layers/render_background_layer.hpp
index 7dcbdc0b80..dfc2adf76e 100644
--- a/src/mbgl/renderer/layers/render_background_layer.hpp
+++ b/src/mbgl/renderer/layers/render_background_layer.hpp
@@ -17,8 +17,8 @@ private:
bool hasTransition() const override;
bool hasCrossfade() const override;
optional<Color> getSolidBackground() const override;
- void upload(gfx::UploadPass&, UploadParameters&) override;
void render(PaintParameters&) override;
+ void prepare(const LayerPrepareParameters&) override;
// Paint properties
style::BackgroundPaintProperties::Unevaluated unevaluated;
diff --git a/src/mbgl/renderer/layers/render_custom_layer.cpp b/src/mbgl/renderer/layers/render_custom_layer.cpp
index 1371326963..75c21997b0 100644
--- a/src/mbgl/renderer/layers/render_custom_layer.cpp
+++ b/src/mbgl/renderer/layers/render_custom_layer.cpp
@@ -50,6 +50,9 @@ void RenderCustomLayer::markContextDestroyed() {
contextDestroyed = true;
}
+void RenderCustomLayer::prepare(const LayerPrepareParameters&) {
+}
+
void RenderCustomLayer::render(PaintParameters& paintParameters) {
if (host != impl(baseImpl).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 32450e643f..698621eae6 100644
--- a/src/mbgl/renderer/layers/render_custom_layer.hpp
+++ b/src/mbgl/renderer/layers/render_custom_layer.hpp
@@ -16,6 +16,7 @@ private:
bool hasTransition() const override;
bool hasCrossfade() const override;
void markContextDestroyed() override;
+ void prepare(const LayerPrepareParameters&) override;
void render(PaintParameters&) override;
diff --git a/src/mbgl/renderer/render_layer.hpp b/src/mbgl/renderer/render_layer.hpp
index 3d5bc2c545..887acdfb59 100644
--- a/src/mbgl/renderer/render_layer.hpp
+++ b/src/mbgl/renderer/render_layer.hpp
@@ -34,6 +34,7 @@ public:
class LayerPrepareParameters {
public:
RenderSource* source;
+ ImageManager& imageManager;
const TransformState& state;
};
diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp
index 294b4dfa1c..993a912535 100644
--- a/src/mbgl/renderer/renderer_impl.cpp
+++ b/src/mbgl/renderer/renderer_impl.cpp
@@ -301,11 +301,8 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
}
for (auto& renderItem : renderItems) {
- if (!renderItem.source) {
- continue;
- }
RenderLayer& renderLayer = renderItem.layer;
- renderLayer.prepare({renderItem.source, updateParameters.transformState});
+ renderLayer.prepare({renderItem.source, *imageManager, updateParameters.transformState});
if (renderLayer.needsPlacement()) {
layersNeedPlacement.emplace_back(renderLayer);
}
@@ -385,7 +382,6 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
UploadParameters uploadParameters{
updateParameters.transformState,
- *imageManager,
*lineAtlas,
};
diff --git a/src/mbgl/renderer/upload_parameters.hpp b/src/mbgl/renderer/upload_parameters.hpp
index 14da1026c6..74fb6a8c86 100644
--- a/src/mbgl/renderer/upload_parameters.hpp
+++ b/src/mbgl/renderer/upload_parameters.hpp
@@ -11,15 +11,12 @@ class LineAtlas;
class UploadParameters {
public:
UploadParameters(const TransformState& state_,
- ImageManager& imageManager_,
LineAtlas& lineAtlas_)
: state(state_),
- imageManager(imageManager_),
lineAtlas(lineAtlas_) {
}
const TransformState& state;
- ImageManager& imageManager;
LineAtlas& lineAtlas;
};