summaryrefslogtreecommitdiff
path: root/src/mbgl/renderer
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2018-01-17 14:26:36 -0800
committerChris Loer <chris.loer@mapbox.com>2018-01-18 14:36:22 -0800
commit656a6373b91ad0c757fdeb8fb1ffb80e9f53d649 (patch)
treeca3837fc9e51ec522b54f89af2b4e954aeb17de0 /src/mbgl/renderer
parent42845ad63fc2147426b6379ed4acd51d3328a0e4 (diff)
downloadqtlocation-mapboxgl-656a6373b91ad0c757fdeb8fb1ffb80e9f53d649.tar.gz
[core] Synchronize state of CollisionIndex and FeatureIndexes.
Fixes issue #10778, in which mismatch between FeatureIndex and CollisionIndex could lead to inconsistent results or even invalid array access.
Diffstat (limited to 'src/mbgl/renderer')
-rw-r--r--src/mbgl/renderer/renderer_impl.cpp13
-rw-r--r--src/mbgl/renderer/renderer_impl.hpp1
2 files changed, 14 insertions, 0 deletions
diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp
index 9fe421fa14..8e5968d4c2 100644
--- a/src/mbgl/renderer/renderer_impl.cpp
+++ b/src/mbgl/renderer/renderer_impl.cpp
@@ -389,6 +389,10 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
}
placementChanged = newPlacement->commit(*placement, parameters.timePoint);
+ // commitFeatureIndexes depends on the assumption that no new FeatureIndex has been loaded since placement
+ // started. If we violate this assumption, then we need to either make CollisionIndex completely independendent of
+ // FeatureIndex, or find a way for its entries to point to multiple FeatureIndexes.
+ commitFeatureIndexes();
if (placementChanged || symbolBucketsChanged) {
placement = std::move(newPlacement);
}
@@ -768,6 +772,15 @@ bool Renderer::Impl::hasTransitions(TimePoint timePoint) const {
return false;
}
+void Renderer::Impl::commitFeatureIndexes() {
+ for (auto& source : renderSources) {
+ for (auto& renderTile : source.second->getRenderTiles()) {
+ Tile& tile = renderTile.get().tile;
+ tile.commitFeatureIndex();
+ }
+ }
+}
+
void Renderer::Impl::updateFadingTiles() {
fadingTiles = false;
for (auto& source : renderSources) {
diff --git a/src/mbgl/renderer/renderer_impl.hpp b/src/mbgl/renderer/renderer_impl.hpp
index 5d0200a5df..4f45d514a5 100644
--- a/src/mbgl/renderer/renderer_impl.hpp
+++ b/src/mbgl/renderer/renderer_impl.hpp
@@ -74,6 +74,7 @@ private:
void onTileChanged(RenderSource&, const OverscaledTileID&) override;
void onTileError(RenderSource&, const OverscaledTileID&, std::exception_ptr) override;
+ void commitFeatureIndexes();
void updateFadingTiles();
friend class Renderer;