You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Setting a layout property needs to trigger tile reparse #5701
When a layout property is modified, all existing tiles for that source need to be reparsed, so that vertex arrays that are calculated based on that property are recalculated.
Right now, we're throwing away the parsed representation of a tile after we created all buckets, and when reparsing a tile, we'll have to do a new request (which is fast because it'll likely be served from cache, but still slower because it needs to be decompressed etc.). We should change this behavior and instead have all tiles/buckets hang on to the data they loaded so that we can do faster reparses.
Unfortunately I can't seem to get things to re-render even by adding a layer. However in trying it I got this simple way to replicate the issue, at least on my Nexus 5X with 6.0.1.
Behaviour above also confirmed with the Android Demo App's SimpleMapViewActivity after updating to latest sdk snapshot and making the following change:
This is currently a blocker for runtime style API on both mobile platforms (and core technically, as well). Anything involving styling existing layers (and not adding or removing a layer) triggers this bug and doesn't show style updates.
We should change this behavior and instead have all tiles/buckets hang on to the data they loaded so that we can do faster reparses.
This looks kind of tricky. Currently, the data (std::unique_ptr<GeometryTileData>) is retained after parsing in order to support queryRenderedFeatures. Ownership works like this:
Ownership is passed into GeometryTile::setData, which passes it on to the worker's parseGeometryTile.
The worker owns it during parsing/layout.
When complete, ownership is passed back to the main thread via TileParseResultData, and then is available for use by queryRenderedFeatures.
I'm not seeing a simple way to introduce retention for purposes of re-layouts to this scheme.
TileWorker can't retain ownership, because then queryRenderedFeatures won't work. For similar reasons, once GeometryTile has ownership, we don't want it to give it up, because then queryRenderedFeatures would behave unpredictably.
GeometryTile is the current eventual owner, but we need to be able to cancel a pending layout and restart it with the same tile data but different layer data. [Hmm, maybe not. JS does not do this. Instead it waits for the initial layout, then re-layouts.]
Implementations of GeometryTile may not be (and in fact are not) safe for concurrent use from multiple threads. Let's not try to share ownership.
What does GL JS do? The worker is responsible for making the request. When parsing and layout are complete, it transfers the raw data to the main thread but retains a reference to the parsed representation for subsequent re-layouts. The main thread lazily reparses the raw data for queryRenderedFeatures. I think we'll need to mimic this approach.
@jfirebaugh would it be OK to defer queryRenderedFeatures results until the tile finishes reparsing so that you can transfer ownership there and back again?
Not allowing would manifest pretty weirdly in the mobile SDKs, for one. The querying feature would just not work intermittently if runtime styling was involved, for example.
I'm going to introduce a layer of indirection, and have GeometryTile work with a GeometryTileDataProvider which can, on demand, produce a fresh std::unique_ptr<const GeometryTileData> copy. GeometryTile will keep one copy, and pass another to the worker.
Hi, I'm experiencing a bug where updating a layer filter (setting the NSPredicate in iOS) fails to update (or invalidate) a source that's currently not visible, causing it to show with the old filter when re-appering.
Given a MGLVectorSource with minzoom=maxzoom=9 and a MGLLineStyleLayer with minzoom=9, maxzoom=13 and a filter/predicate A.
Zoom map through zoom 9 -> 13 (layer rendered according to filter A) -> 14 (layer disappear as expected).
Update the layer filter to filter B.
Zooming back to 13 the layer still shows according to filter A, as opposed to filter B that was expected.
Activity
kkaefer commentedon Jul 18, 2016
Right now, we're throwing away the parsed representation of a tile after we created all buckets, and when reparsing a tile, we'll have to do a new request (which is fast because it'll likely be served from cache, but still slower because it needs to be decompressed etc.). We should change this behavior and instead have all tiles/buckets hang on to the data they loaded so that we can do faster reparses.
mkv123 commentedon Aug 18, 2016
Is there some workaround on Android to force the reparse after changing runtime styles until this gets fixed?
incanus commentedon Aug 18, 2016
Adding and removing layers seems to cause reloads, so perhaps a dummy (possibly even unstyled?) layer could help here.
mkv123 commentedon Aug 19, 2016
Unfortunately I can't seem to get things to re-render even by adding a layer. However in trying it I got this simple way to replicate the issue, at least on my Nexus 5X with 6.0.1.
mkv123 commentedon Aug 19, 2016
Behaviour above also confirmed with the Android Demo App's SimpleMapViewActivity after updating to latest sdk snapshot and making the following change:
incanus commentedon Aug 22, 2016
This is currently a blocker for runtime style API on both mobile platforms (and core technically, as well). Anything involving styling existing layers (and not adding or removing a layer) triggers this bug and doesn't show style updates.
jfirebaugh commentedon Aug 24, 2016
This looks kind of tricky. Currently, the data (
std::unique_ptr<GeometryTileData>) is retained after parsing in order to supportqueryRenderedFeatures. Ownership works like this:GeometryTile::setData, which passes it on to the worker'sparseGeometryTile.TileParseResultData, and then is available for use byqueryRenderedFeatures.I'm not seeing a simple way to introduce retention for purposes of re-layouts to this scheme.
TileWorkercan't retain ownership, because thenqueryRenderedFeatureswon't work. For similar reasons, onceGeometryTilehas ownership, we don't want it to give it up, because thenqueryRenderedFeatureswould behave unpredictably.GeometryTileis the current eventual owner, but we need to be able to cancel a pending layout and restart it with the same tile data but different layer data. [Hmm, maybe not. JS does not do this. Instead it waits for the initial layout, then re-layouts.]GeometryTilemay not be (and in fact are not) safe for concurrent use from multiple threads. Let's not try to share ownership.What does GL JS do? The worker is responsible for making the request. When parsing and layout are complete, it transfers the raw data to the main thread but retains a reference to the parsed representation for subsequent re-layouts. The main thread lazily reparses the raw data for
queryRenderedFeatures. I think we'll need to mimic this approach.mourner commentedon Aug 24, 2016
@jfirebaugh would it be OK to defer
queryRenderedFeaturesresults until the tile finishes reparsing so that you can transfer ownership there and back again?jfirebaugh commentedon Aug 24, 2016
No,
queryRenderedFeaturesis synchronous.mourner commentedon Aug 24, 2016
@jfirebaugh how about just not allowing it while reload is in progress? I could be an OK tradeoff.
incanus commentedon Aug 24, 2016
Not allowing would manifest pretty weirdly in the mobile SDKs, for one. The querying feature would just not work intermittently if runtime styling was involved, for example.
jfirebaugh commentedon Aug 25, 2016
I'm going to introduce a layer of indirection, and have
GeometryTilework with aGeometryTileDataProviderwhich can, on demand, produce a freshstd::unique_ptr<const GeometryTileData>copy.GeometryTilewill keep one copy, and pass another to the worker.Add regression tests for tile-reloading related issues in native
jonkan commentedon Mar 22, 2017
Hi, I'm experiencing a bug where updating a layer filter (setting the NSPredicate in iOS) fails to update (or invalidate) a source that's currently not visible, causing it to show with the old filter when re-appering.
Given a MGLVectorSource with minzoom=maxzoom=9 and a MGLLineStyleLayer with minzoom=9, maxzoom=13 and a filter/predicate A.
I found that in the
void Style::relayout()tiles are only reloaded if the source isenabledwhich according to the comment is when "the source is used by any layers visible at the current zoom level". Removing the&& source->baseImpl->enabled-part of the if-statement (i.e. reverting part of 9127299 "don't load tiles from sources that aren't used") does solve my issue.Maybe @kkaefer have some ideas?
jfirebaugh commentedon Mar 22, 2017
@jonkan Can you please file a new issue?
jonkan commentedon Mar 23, 2017
Sure! #8505