Commit Graph

4292 Commits

Author SHA1 Message Date
Alexander Shalamov
12d350ec3c Revert "[core] Fix excessive onSpriteLoaded() notifications"
This reverts commit 80cb05420a.
2020-02-14 11:54:02 +02:00
Mikhail Pozdnyakov
80cb05420a [core] Fix excessive onSpriteLoaded() notifications
What happened:

The excessive `onSpriteLoaded()` notifications were caused by the trick inside `OnlineFileRequest::completed()` implemenation,
which causes receving of two file source updates pointing to the *same* data in case the network response is `notModified` and
the local storage has the sprite sheet already stored inside.

In the SpriteLoader` implementation, it resulted in 2 extra `parseSprite()` calls and 2 extra `onSpriteLoaded()` notifications.

Then, the excessive `onSpriteLoaded()` notifications affected style images and all the unnecessarily added image dupes (btw,
the amount of these dupes `= 2 * number of style images`) were treated by the `RenderOrchestrator` as *updated* images.

Further, `RenderOrchestrator` called `ImageManager::updateImage()` for the updated images and the `ImageManager` populated the
`updatedImageVersions` map.

Finally, at every frame all the geometry tiles iterated through the `updatedImageVersions` to check whether their uploaded
textures needed patching.

All the mentioned above had a negative performance impact.

The fix:

Now, `SpriteLoader` sends `onSpriteLoaded()` notifications only if the data in the file source response is different comparing
to the existing one.
2020-02-12 20:49:26 +02:00
zmiao
759dfe8bf6 [core] Support [within expression] with layout property 2020-02-12 17:35:18 +02:00
zmiao
7fda6ecad3 reserve vecotr capacity, fix for points within polygon
Address review findings/nit
2020-02-12 12:24:05 +02:00
zmiao
2963afa010 Add support for expression test
Fix polygon within algorithm
Add Unit tests

Fix incorrect metrics folder for ios-render-test-runner job
2020-02-12 12:24:05 +02:00
zmiao
1bd2ccf239 Enable within expression with Filter
add canonical as pointer

fix review findings
2020-02-12 12:24:05 +02:00
zmiao
3e99c08ea6 Enable parse within expression
Add geometry type checker
2020-02-12 12:24:05 +02:00
Ansis Brammanis
4f18d5fa92 [core] sort symbols using symbol-sort-key before placement (#16023)
fix #15964
partially port mapbox/mapbox-gl-js#9054
2020-02-11 11:24:14 -05:00
Mikhail Pozdnyakov
3bd2d0e4d7 style::Style::getImage() returns optional<style::Image> 2020-02-11 14:34:46 +02:00
Mikhail Pozdnyakov
64e2bcdf43 [core] Loading images to style optimization
This change enables attaching images to the style with batches and
avoids massive re-allocations. Thus, it improves UI performance
especially at start-up time.
2020-02-11 14:34:46 +02:00
zmiao
7424c4eecb Bump GL-JS
Backport GL-JS fix 'Hide glyphs behind the camera'(https://github.com/mapbox/mapbox-gl-js/pull/9229)
2020-02-11 11:05:18 +02:00
Alexander Shalamov
07c0c63fda [core] Clear tile pyramid for custom source only if there is a significant change
Clear tile pyramid only if updated source has different tile options,
zoom range or initialization state for a custom tile loader.
2020-02-11 10:40:30 +02:00
Alexander Shalamov
ac50f5275b [core] Make CustomGeometrySource::TileOptions immutable 2020-02-11 10:40:30 +02:00
Alexander Shalamov
def38cf4db [core] Override default prefetch delta if source has it's own setting 2020-02-11 10:40:30 +02:00
Alexander Shalamov
fce4129435 [core] Add runtime API for setting tile prefetch delta for Source
New setPrefetchZoomDelta(optional<uint8_t> delta) method allow overriding
default tile prefetch setting that is defined by the Map instance. The
method can be moved to generic style specification if found to be useful
for gl-js engine.
2020-02-11 10:40:30 +02:00
Thiago Marcos P. Santos
47f2b20435 [build] Remove unused files
Buck build is no longer needed, neither is the previous
CMake buildsystem.
2020-02-07 20:12:44 +02:00
Alexander Shalamov
bb85ec442d [core] Add hooks for setting experimental thread priorities for mbgl threads 2020-02-06 23:54:19 +02:00
Alexander Shalamov
f30aec6c1a [core] Add global settings object 2020-02-06 23:54:19 +02:00
Mikhail Pozdnyakov
1f5c6beb64 [tile mode] Improvements in symbol placement on tile borders
This change fixes the following problems:
1) Before this change, when multiple symbols were grouped close to the
tile borders, different tiles could place different symbols, because each
tile arbitrary assigned feature ids, and these ids defined the placement
order being applied. This caused artifacts at the tile boundaries.

With this change, in tile mode the placement order of two symbols crossing
a tile border is defined by their anchor `y` values. It means that the
symbols are being placed the same order across all the tiles.

2) Before this change, the engine did not place with priority the symbols
crossing the borders between two neighboring tiles. Now it does, and it
improves a lot symbol placement stability in the tile map mode.
2020-02-03 21:26:35 +02:00
Thomas Moenicke
b64ed75444 [build] Adding a build flag to build without GL if needed (#16120)
* [build] Adding a build flag to build without GL if needed

* [build] Moving custom layer to mbgl/gl
2020-02-03 19:10:57 +02:00
Alexander Shalamov
0b727108c8 [core] Add getSharedExpression to property expression
New method can be used for aggregating property expressions from
multiple properties(layers) into single match / case expression.
2020-02-03 16:45:42 +03:00
Alexander Shalamov
1334de089f [core] Use std::list instead of std::map for factory instance
Factory 'get' method can be invoked recursively and stable iterators
are required to guarantee safety.
2020-02-03 16:45:23 +03:00
Mikhail Pozdnyakov
951b90c778 [tile mode] Fix variable symbols placement
This commit allows the variable symbols to cross the tile border only
if their anchor is the first anchor from the `text-variable-anchor` list.
2020-01-27 17:51:07 +02:00
Mikhail Pozdnyakov
61ab64906e GeoJSONSource is re-using the existing scheduler
Thus avoiding spawing new threads on `setGeoJSONData()` calls.
2020-01-24 14:15:37 +02:00
Alexander Shalamov
84b0b35f6d [core] Use weak scheduler inside mailbox
There is no guarantee that scheduler is alive when message
is pushed to the mailbox.
2020-01-23 12:55:57 +03:00
Alexander Shalamov
7bf4de9f39 [core] Move resource loader to dedicated thread with scheduler 2020-01-23 12:55:57 +03:00
galinelle
4678b3d70c [core] remove std::vector copy step in SymbolLayout::anchorIsTooClose (#16131)
A const reference is enough here.
2020-01-22 16:04:31 +02:00
Mikhail Pozdnyakov
a9d04d7b1a [core] Do not index and place the off-screen symbols for overscaled tiles
For overscaled tiles the viewport might be showing only a small part of the
tile, so we filter out the off-screen symbols to improve the performance.
2020-01-22 14:30:26 +02:00
Mikhail Pozdnyakov
4dac2f61c2 [core] Simplify Placement::addLayer() 2020-01-22 14:30:26 +02:00
Mikhail Pozdnyakov
e6ddcf9beb [core] Simplify CrossTileSymbolIndex::addLayer() 2020-01-22 14:30:26 +02:00
Mikhail Pozdnyakov
5a4568b2ac [core] Avoid repeated calculations in symbol placement 2020-01-22 14:30:26 +02:00
Mikhail Pozdnyakov
f70cadf2e0 [core] Cache showCollisionBoxes in Placement 2020-01-22 14:30:26 +02:00
Mikhail Pozdnyakov
769a822fec [core] Pass UpdateParameters to Placement constructor 2020-01-22 14:30:26 +02:00
Mikhail Pozdnyakov
d24c1d625a [core] Pass std::shared_ptr<UpdateParameters> to the render orchestrator
So that it can retain ownership of the given parameters.
2020-01-22 14:30:26 +02:00
Mikhail Pozdnyakov
5af128f205 [core] Pass placement commit parameters in constructor 2020-01-22 14:30:26 +02:00
Mikhail Pozdnyakov
4735845a6e [core] Consider symbol bucket leader id in cross-tile symbol indexing
Only buckets with the same leader id participate in `TileLayerIndex::findMatches()`
in order to improve its performace.

`TileLayerIndex` constness is fixed.
2020-01-22 14:30:26 +02:00
Konstantin Käfer
5a1e4c6b81 [core] implement stretchable icons for icon-text-fit 2020-01-15 15:02:11 +02:00
Konstantin Käfer
027e803b72 [core] move icon rotation from shaping to quad generation to mirror JS 2020-01-15 15:02:11 +02:00
Konstantin Käfer
1342cb44b3 [core] Remove unused WritingMode from getIconQuads 2020-01-15 15:02:11 +02:00
Konstantin Käfer
7d8d13ce04 [core] Change ImagePosition from storing non-padded rect to padded rect to mirror the JS implementation 2020-01-15 15:02:11 +02:00
Konstantin Käfer
c80baa35b3 [core] add stretches + content to ImagePosition 2020-01-15 15:02:11 +02:00
Konstantin Käfer
47dc5727ab [core] parse stretchX, stretchX, and content from sprite JSON files 2020-01-15 15:02:11 +02:00
Konstantin Käfer
62b0f4cde2 [core] Add stretches and content to style::Image 2020-01-15 15:02:11 +02:00
Konstantin Käfer
4b171cccf1 [core] getGlyphQuad -> getGlyphQuads 2020-01-15 15:02:11 +02:00
Konstantin Käfer
d8d336160c [core] add pixelOffset and minFontScale to SymbolQuads 2020-01-15 15:02:11 +02:00
Konstantin Käfer
f82d4e6857 [core] Upgrade shaders and add new vertices to SymbolLayout 2020-01-15 15:02:11 +02:00
Alexander Shalamov
879c44f661 [core] Modularize FileSource codebase (#15768)
* [core] Introduce FileSourceManager and use it for default platform impl

  - Add `FileSourceManager` interface that provides access to `FileSource`
    instances and means of registering / unregistering `FileSource` factories
  - Split `DefaultFileSource` into smaller parts
  - Add `DatabaseFileSource` interface and it's default implementation
  - Remove inter-dependencies between concrete `FileSource` classes

* [build] Add files to next build system

* [core] Add generic property setters / getters

* [core] Remove setOnlineStatus from OnlineFileSource interface

* [core] Hide threading implementation details from DatabaseFileSource interface

* [core] Make DB file source methods virtual

* [core] Add documentation for DatabaseFileSource and rename one method

* [core] Use simple callback instead of ActorRef

* [core] Remove ActorRef from OnlineFileSource public header

* [core] Add callback to FileSource::forward async API

* [core] Pass OfflineRegionDefinition by value

* [core] Update tests to use modular file sources

* [core] Update unit tests

* [core] Update unit tests after rebase

* [core] Backport low prio fix for cached requests

* [core] Backport pack database

* [core] Return removed factory from unRegisterFileSourceFactory

* [core] Rename shadowed args in onlinefilesource

* [core] Remove simple std::function callback aliases

* [core] Expose online file source property keys in public header file

* [test-runner] Add proxy file source test runner

* [cache] Update mbgl-cache utility to use new file source

* [metrics] Rebaseline binary size metrics

* [offline] Update offline utility

* [core] Update changelog
2020-01-13 10:57:23 +02:00
Mikhail Pozdnyakov
3ea459233a [core] Fix GeoJSONVTData ownership and life cycle
Before this change, the `GeoJSONVTData` instance was retained at the scheduled
lambda, which run on the worker thread represented by the `GeoJSONVTData::scheduler`
class member:

```
        std::weak_ptr<GeoJSONVTData> weak = shared_from_this();
        scheduler->scheduleAndReplyValue(
            [id, weak, this]() -> TileFeatures {
                if (auto self = weak.lock()) {
                    return impl.getTile(id.z, id.x, id.y).features;
                }
                return {};
            },
            fn);
```

It caused program termination in case `self` turned to be the last reference to `this`,
as the `std::thread` destructor was called from the thread it represented.

Now, only the `GeoJSONVTData::impl` class member is retained.
2020-01-09 16:52:13 +02:00
Peng Liu
236afc0395 [android][core] Add Map::latLngBoundsForCameraUnwrapped and jni binding for getVisibleCoordinateBounds. (#16069)
* [android] Add getVisibleCoordinateBounds method.
* Fix Map::latLngBoundsForCamera, add Android binding for getVisibleRegionBounds.
* Add unit tests for CameraToLatLngBoundsWithRotation and CameraToLatLngBoundsCrossDateLine.
* Move API breaking changes to a new method name latLngBoundsForCameraUnwrapped.
2020-01-09 15:53:23 +02:00
Mikhail Pozdnyakov
0379615388 [core] Introduce CollisionIndex::getProjectedCollisionBoundaries()
In order to remove the repeated code.
2020-01-08 12:43:26 +02:00