summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-10-13 17:53:30 -0700
committerKonstantin Käfer <mail@kkaefer.com>2017-10-13 18:04:03 -0700
commit4fa976eaf89aee3de70b3a1b75dccb0d6073f5df (patch)
treea5db4c987e12a880cc86e2378ad2e5b8fce180a2
parent98bb8613c341bc9e07692f6172c661e8f700272d (diff)
downloadqtlocation-mapboxgl-upstream/10198-dont-generate-clip-ids-needlessly.tar.gz
[core] don't generate clip IDs for buckets/layers that don't need to be clippedupstream/10198-dont-generate-clip-ids-needlessly
-rw-r--r--src/mbgl/algorithm/generate_clip_ids_impl.hpp2
-rw-r--r--src/mbgl/renderer/render_tile.hpp1
-rw-r--r--src/mbgl/renderer/renderer_impl.cpp3
-rw-r--r--test/algorithm/generate_clip_ids.test.cpp7
4 files changed, 10 insertions, 3 deletions
diff --git a/src/mbgl/algorithm/generate_clip_ids_impl.hpp b/src/mbgl/algorithm/generate_clip_ids_impl.hpp
index db62214220..6a316dcdad 100644
--- a/src/mbgl/algorithm/generate_clip_ids_impl.hpp
+++ b/src/mbgl/algorithm/generate_clip_ids_impl.hpp
@@ -17,7 +17,7 @@ void ClipIDGenerator::update(std::vector<std::reference_wrapper<Renderable>> ren
const auto end = renderables.end();
for (auto it = renderables.begin(); it != end; it++) {
auto& renderable = it->get();
- if (!renderable.used) {
+ if (!renderable.used || !renderable.needsClipping) {
continue;
}
diff --git a/src/mbgl/renderer/render_tile.hpp b/src/mbgl/renderer/render_tile.hpp
index b498972f5c..3db02393d2 100644
--- a/src/mbgl/renderer/render_tile.hpp
+++ b/src/mbgl/renderer/render_tile.hpp
@@ -28,6 +28,7 @@ public:
mat4 matrix;
mat4 nearClippedMatrix;
bool used = false;
+ bool needsClipping = false;
mat4 translatedMatrix(const std::array<float, 2>& translate,
style::TranslateAnchorType anchor,
diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp
index 1a828b80a3..21f5a342f9 100644
--- a/src/mbgl/renderer/renderer_impl.cpp
+++ b/src/mbgl/renderer/renderer_impl.cpp
@@ -370,6 +370,9 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
if (bucket) {
sortedTilesForInsertion.emplace_back(tile);
tile.used = true;
+ if (!symbolLayer || parameters.mapMode == MapMode::Still) {
+ tile.needsClipping = true;
+ }
}
}
layer->setRenderTiles(std::move(sortedTilesForInsertion));
diff --git a/test/algorithm/generate_clip_ids.test.cpp b/test/algorithm/generate_clip_ids.test.cpp
index 1ebdccb99e..9dc86305af 100644
--- a/test/algorithm/generate_clip_ids.test.cpp
+++ b/test/algorithm/generate_clip_ids.test.cpp
@@ -8,13 +8,16 @@ struct Renderable {
UnwrappedTileID id;
ClipID clip;
bool used;
+ bool needsClipping;
Renderable(UnwrappedTileID id_,
ClipID clip_,
- bool used_ = true)
+ bool used_ = true,
+ bool needsClipping_ = true)
: id(std::move(id_)),
clip(std::move(clip_)),
- used(used_) {}
+ used(used_),
+ needsClipping(needsClipping_) {}
bool operator==(const Renderable& rhs) const {
return id == rhs.id && clip == rhs.clip;