Commit Graph

1290 Commits

Author SHA1 Message Date
Konstantin Käfer
61fa436193 coalesce buffer deletions and run them in bulk during rendering
On iOS, the main thread does framebuffer operations just before it requests a rerender of the view contents. This means that GL operations on the Map thread will interfere with that and cause a crash. While most GL operations happen throughout rendering (which is synchronized with the main thread), deletion of shared_ptrs release in turn their OpenGL objects. This may happen at any time and isn't synced with rendering.

This patch changes this so instead of deleting all objects immediately, we are collecting all abandoned IDs and delete them in bulk once the main thread has given us permission to use OpenGL calls (i.e. during render()).
2015-03-20 19:47:54 +01:00
Thiago Marcos P. Santos
ceb7049389 Delete the data buffer of LineAtlas
Data buffer is allocated but never deleted.
2015-03-20 14:38:08 +02:00
Mike Morris
ae7bd9ac6a Merge pull request #946 from friedbunny/931-fullwidth-block
Fix end of acceptable glyph/unicode range
2015-03-18 11:47:47 -04:00
Thiago Marcos P. Santos
3254cdc85c Log the Environment ID and the Thread name
To make it easier to debug, add the Environment ID and the Thread name
to the log messages. For instance log messages from the TileParser will look like:

[WARNING] {0}{TileWorker_15/18653/9486}[ParseTile]: some relevant warning message
   |       |             |                  |
   |       |             |                  +-> Component
   |       |             +--------------------> Thread name
   |       +----------------------------------> Environment ID
   +------------------------------------------> Severity level

Log messages that are not inside an Environment::Scope will work
normally and will look like:

[WARNING] [JNI]: some relevant warning message

Fixes #882.
2015-03-18 12:51:33 +01:00
Thiago Marcos P. Santos
66841bf7eb Add an ID to Environment
Environment will now have an incremental unique ID to that will
help distinguish between threads scoped to different Environments
when logging.
2015-03-18 12:51:33 +01:00
Thiago Marcos P. Santos
aa9adbb8f8 Scope the Tile worker thread to an Environment
We are also removing the code that is passing the Environment around
and instead, we get now the Environment in the TileData using
Environment::Get().

When processing the job, the work will be temporally registered to
the Environment as "TileWorker_0/0/0" which can be used for logging
in the future. At the end of the job, it gets unregistered
automatically from the Environment.
2015-03-18 12:51:33 +01:00
Thiago Marcos P. Santos
b5facd35bc Scope the Map thread to an Environment
Also, replace manual thread type checks with Environment::currentlyOn().
2015-03-18 12:51:33 +01:00
Thiago Marcos P. Santos
b52aab5f7c Introduce the ThreadInfoStore and Environment::Scope
The Environment will now keep track of every thread that is running
within a Environment::Scope. Once the Scope object is created, it will
automatically register the thread to the ThreadInfoStore with some
additional information and it will automatically deregister as the stack
frame rewinds (which can be useful for Threads that are temporally in
use by an Environment like Workers).

The ThreadInfoStore could be using the thread-local storage, but I think
that making the Environment aware of what threads are associated to it
can be useful for writing a mechanism for posting messages between threads.

Withing a Scope, the Environment associated to the thread can be queried
at any time which will save us from juggling a reference to the
Environemnt around. Finally, the type of thread (Main, Map, etc) can
also be queried at any moment to make sure a piece of code is running
on the desired thread.
2015-03-18 12:38:39 +01:00
Justin R. Miller
93abf881fb feature() -> getFeature() to clear up ambiguity / Linux compiler error 2015-03-17 19:25:32 -07:00
Justin R. Miller
02cccfe7e8 properly clean up tile annotations on delete 2015-03-17 17:46:33 -07:00
Justin R. Miller
76f8a3d846 fix passing of annotation manager 2015-03-17 17:45:09 -07:00
Justin R. Miller
e049ce6df1 refs #893 #992: point annotations API 2015-03-17 17:30:24 -07:00
Konstantin Käfer
48c55af5c1 fix sprites for pixel ratios that are not 1 and 2
- OpenGL ES 2 doesn't allow NPOT textures with wrap-around
- The Sprite object reported the map's pixelRatio, even though it loaded @2x assets
- Copying icons from the sprite into the atlas now uses bilinear scaling to scale up to the actual size
2015-03-17 12:30:40 +01:00
John Firebaugh
0c985c024b Revert "Move atlas ownership to Style"
This reverts commit bffee07154.
2015-03-13 13:05:32 -07:00
John Firebaugh
6325f1e25a Index glyph use by tile pointer value, not tile ID
There can be multiple tiles with the same ID, but from different
sources.

Fixes #957
2015-03-13 10:55:49 -07:00
John Firebaugh
96682a02af Remove unused declaration 2015-03-13 10:55:49 -07:00
John Firebaugh
998092e5b2 Remove needless indirection 2015-03-13 10:55:49 -07:00
John Firebaugh
762e4bdfbe Clean up GlyphAtlas 2015-03-13 10:55:49 -07:00
John Firebaugh
bffee07154 Move atlas ownership to Style
This follows gl-js and just makes sense -- whenever the style changes
the atlases should be blown away.

Refs #957
2015-03-13 10:55:47 -07:00
Konstantin Käfer
069505fe75 fix rare issue that had the notify and cancel callbacks called in the wrong order 2015-03-13 15:30:10 +01:00
John Firebaugh
ba933b3f45 Merge pull request #984 from mapbox/log_stderr_printf
Get rid of printf and cout by using Log::*
2015-03-12 15:39:07 -07:00
Konstantin Käfer
74ef8840ce tolerate missing sprites
Do not try to fulfil the promise twice in case both requests to the sprite JSON and image fail. this will crash the program. Instead, we always continue with the promise, instead of throwing an exception. This allows the program to continue parsing tiles, but without an image sprite available. This means the map will render, but without the sprite images
2015-03-12 15:27:56 +01:00
Thiago Marcos P. Santos
124b49562d Get rid of printf and cout by using Log::*
Use our logging system that will route the message accordingly on
the target platform.

Fixes #613
2015-03-12 14:19:32 +02:00
Thiago Marcos P. Santos
2b6afe6a54 Merge pull request #972 from mapbox/log_cleanup
Refactoring of the log system
2015-03-12 14:18:25 +02:00
Thiago Marcos P. Santos
79f3149d9d Update the FixtureLog
Now the FixtureLog is an Log::Observer instead of a backend. The
observer can sniff and filter log messages, that can be used
for fail a test if it emits a warning for example.
2015-03-12 13:28:41 +02:00
Thiago Marcos P. Santos
51bc265db3 Make the logging system static
No initialization is needed anymore and we can use the logging functions
safely at any point of the code (threading is not handled though, so you
might get multiplexed messages if you log from two threads
simultaneously).
2015-03-12 13:28:41 +02:00
Thiago Marcos P. Santos
2948e7d121 Simplify the logging mechanism
Move the implementation of the more specialized methods to the base
class and let the platform implement only the most generic method that
takes all the possible arguments.

These specialized methods will then map to the generic implementation
that must be provided by the platforms we support.
2015-03-12 13:28:40 +02:00
Konstantin Käfer
47ede853c4 fixes black flicker on rotating the device
fixes #838

instead of rendering ad libitum on the map thread, we are now driving rendering from the UI thread on iOS via the map.renderSync() function. There are still white bars during the rotation, but the general content of the view is kept visible.

- upgrades GLFW to 3.1
- removes swapped/needsSwap in favor of a more explicit scheme
- View#invalidate() now replaces View#swap() and is called whenever the View needs to trigger a rerender. GLFW and Android to this right away, while iOS goes back to the main thread and does the Map redrawing as part of the GLKView update
- sets all iOS deployment targets to 7.0
- disables SQLite3 version check, since the library version changed on iOS 8.2
2015-03-12 12:16:38 +01:00
John Firebaugh
d6c037d2bc Don't copy VT keys / values into each feature
Instead, maintain a key index ⇢ value index map and look up the
value in getValue().
2015-03-10 16:12:52 -07:00
John Firebaugh
7212accffd More include fixes 2015-03-10 16:07:33 -07:00
John Firebaugh
c13227e35f Move parseValue(pbf) to vector_tile.cpp
This code is specific to the vector tile format.
2015-03-10 12:14:13 -07:00
John Firebaugh
9e1f17a25b Remove unused header 2015-03-10 12:13:50 -07:00
John Firebaugh
062d33c8db virtual ⇢ override in derived class 2015-03-10 10:33:04 -07:00
John Firebaugh
05df041c15 Don't use const on value-type returns 2015-03-10 10:32:25 -07:00
John Firebaugh
5fa628bc00 Inline PBFGeometry 2015-03-10 10:31:24 -07:00
John Firebaugh
4d3dcea82c Revert FeatureType rename 2015-03-09 18:32:20 -07:00
John Firebaugh
b7f04ee7c2 Use single geometry format 2015-03-09 18:32:09 -07:00
John Firebaugh
50b5c15653 Rework GeometryTile* interface 2015-03-09 18:32:08 -07:00
Justin R. Miller
2d8bf823fc unique -> shared ptr 2015-03-09 11:57:34 -07:00
Justin R. Miller
0652174465 reference cleanups 2015-03-09 11:57:34 -07:00
Justin R. Miller
7361f8566b move to shared pointers for queried layers passed to buckets 2015-03-09 11:57:34 -07:00
Justin R. Miller
a45ae199cf move from range-based for loop to iterator for to be clearer 2015-03-09 11:57:34 -07:00
Justin R. Miller
fbb2d17f43 fix iterator comparator 2015-03-09 11:57:34 -07:00
Justin R. Miller
a6b6a8d67e move to abstract interfaces to more be in line with original API 2015-03-09 11:57:34 -07:00
Justin R. Miller
e01fe2fb56 doesn't make sense to move shared pointers 2015-03-09 11:57:33 -07:00
Justin R. Miller
cf623e96c5 safely check points 2015-03-09 11:57:33 -07:00
Justin R. Miller
56bc3052ac refactor vars 2015-03-09 11:57:33 -07:00
Justin R. Miller
e57703d711 properly iterate geometries 2015-03-09 11:57:33 -07:00
Justin R. Miller
b523d0256b increment feature filter on creation 2015-03-09 11:57:33 -07:00
Justin R. Miller
c170f8887d get rid of unused member 2015-03-09 11:57:33 -07:00