summaryrefslogtreecommitdiff
path: root/src/mbgl/algorithm/generate_clip_ids_impl.hpp
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-01-18 13:12:04 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-01-18 14:35:15 +0200
commitb83030aa9bb1a8d9f14ae8160698c1ee4d5a4c72 (patch)
tree26b9f39ef19bf0c1934f712f986df4600368dd97 /src/mbgl/algorithm/generate_clip_ids_impl.hpp
parentd5659aa6647f1fc77159567bd22029a2dc9cd7a3 (diff)
downloadqtlocation-mapboxgl-b83030aa9bb1a8d9f14ae8160698c1ee4d5a4c72.tar.gz
[core] Remove tile sorting from the clip and mask algorithms
The tile sorting can be now removed from the algorithms, which calculate tile mask and clip ids, because their client code provides tiles being already sorted (in `TilePyramid`). This patch brings significant improvements to the Tile-related performance tests results, for example the `TileMaskGeneration` benchmark test runs 33 times faster with these changes applied.
Diffstat (limited to 'src/mbgl/algorithm/generate_clip_ids_impl.hpp')
-rw-r--r--src/mbgl/algorithm/generate_clip_ids_impl.hpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/mbgl/algorithm/generate_clip_ids_impl.hpp b/src/mbgl/algorithm/generate_clip_ids_impl.hpp
index fedab06022..a4af9c8cbb 100644
--- a/src/mbgl/algorithm/generate_clip_ids_impl.hpp
+++ b/src/mbgl/algorithm/generate_clip_ids_impl.hpp
@@ -10,12 +10,11 @@ namespace algorithm {
template <typename Renderable>
void ClipIDGenerator::update(std::vector<std::reference_wrapper<Renderable>> renderables) {
std::size_t size = 0;
-
- std::sort(renderables.begin(), renderables.end(),
- [](const auto& a, const auto& b) { return a.get().id < b.get().id; });
+ assert(std::is_sorted(renderables.begin(), renderables.end(),
+ [](const Renderable& a, const Renderable& b) { return a.id < b.id; }));
const auto end = renderables.end();
- for (auto it = renderables.begin(); it != end; it++) {
+ for (auto it = renderables.begin(); it != end; ++it) {
auto& renderable = it->get();
if (!renderable.used || !renderable.needsClipping) {
continue;