Commit Graph

1507 Commits

Author SHA1 Message Date
John Firebaugh
bc7e2b9b94 Set correct strata for background render
Fixes #1478
2015-05-12 11:15:42 +02:00
Konstantin Käfer
24ea920810 ignore Transform changes with NaN parameters 2015-05-08 20:25:47 +02:00
Konstantin Käfer
9014890d44 initialize TransformState helper variables correctly 2015-05-08 20:25:38 +02:00
John Firebaugh
1cf5af9c31 Merge remote-tracking branch 'origin/1369-alternate-fix' 2015-05-08 11:20:10 -07:00
Konstantin Käfer
8ee40a544e make WorkRequests cancelable 2015-05-08 16:43:18 +02:00
Konstantin Käfer
bd8d10bab6 make DefaultFileRequest movable only 2015-05-08 11:34:46 +02:00
Konstantin Käfer
fb984a22d1 don't trigger a HTTP request twice 2015-05-08 11:30:26 +02:00
Minh Nguyễn
dcbf4940da Merge pull request #1464 from mapbox/1ec5-type-in
Parse feature types in set filters
2015-05-07 11:35:48 -07:00
Minh Nguyễn
6292e95f80 Parse feature types in set filters
A filter key of `$type` should work in an `in` filter, just like in an `==` filter.
2015-05-07 08:35:41 -07:00
Thiago Marcos P. Santos
8ad81a6676 Removed unused method from MapContext 2015-05-07 16:21:01 +03:00
John Firebaugh
5b4015ccba Reference safety for Worker after callbacks
Joining a WorkRequest now ensures that either the after callback has
already been executed, or will never be executed.

Fixes #1438
2015-05-06 14:30:02 -07:00
John Firebaugh
a7df0781f8 Don't crash if ResourceLoader::_sprite is null 2015-05-05 13:34:46 -07:00
Thiago Marcos P. Santos
19881f8b24 Cancel all pending requests before leaving
This still has the unwanted side effect off blocking the Map thread
waiting for the workers to return (because they hold a reference
to the Map thread main loop).

Maybe the only way to solve this would be having a I/O thread for
dispatching messages.

The Request is not bound anymore to the invoker thread because the workers
will request for glyphs, but the reply will arrive at the Map thread.
2015-05-05 18:35:40 +03:00
Thiago Marcos P. Santos
071e2e1731 Do not process buckets depending on Glyphs that were not loaded
For now, the buckets depending on Glyphs that are not yet available
are simply not created (or created and discarded). In the future
we could refactor the code to not create the bucket at all or put
the bucket in a suspended state until the glyph range is available.
2015-05-05 18:35:40 +03:00
Thiago Marcos P. Santos
f10839bac2 Make GlyphStore observable
GlyphStore will notify observers when a glyph range is loaded. By now
the notification is generic, but could be fine grained, causing the
processing of buckets depending on this particular range.
2015-05-05 18:35:40 +03:00
Thiago Marcos P. Santos
1455e5e53c Add partial tile parsing
This change will add a new state to the tile called "partial" which
is a state where the tile can be rendered but some information might
be missing.

For now we skip the SymbolBucket if the Sprites are not loaded (will
also do the same for the glyphs in the future). When the Sprites are
finally loaded, we trigger another update, this time the Tile will
get completely re-rendered and change the state to "parsed".
2015-05-05 18:35:40 +03:00
Thiago Marcos P. Santos
c487c521b4 Move the Sprite handling to ResourceLoader
This is the first concrete step to remove promises from the parsing
pipeline. Buckets depending on the Sprite (i.e. SymbolBucket) won't
be created if the Sprite is not loaded yet. When the Sprite finally gets
loaded, it will fire a signal that will ultimately trigger a reparse.

We still have to expose the Sprite to the Map object as it is needed
for getting offset pixels for annotation symbols, but we can probably
improve that.
2015-05-05 18:10:21 +03:00
Thiago Marcos P. Santos
d726613f6f Update the tiles via ResourceLoader 2015-05-05 18:10:21 +03:00
Thiago Marcos P. Santos
f4baa0ba3e Notify data changes using Observer pattern
This pattern, in contrast with callbacks, allows us to clearly see
the dependency and hierarchy between the objects. It will also help
on writing unit tests as we can count how many times a notification
was triggered.
2015-05-05 18:10:20 +03:00
Thiago Marcos P. Santos
4956da61b9 Introduce the ResourceLoader
ResourceLoader will handle all the tile changes and notifications
through the Source object owned by the Style. This object lives
entirely on the Map thread and should be only accessed by it.

The observer will receive notifications every time the tile data changes
and this will probably trigger a new rendering operation.

This first patch will delegate Source loading to the ResourceLoader.
2015-05-05 18:04:54 +03:00
Konstantin Käfer
5aa0caf5c5 don't trigger cleanups when we're not rendering 2015-05-05 11:53:23 +02:00
Konstantin Käfer
691c305467 add Map::isFullyLoaded()
returns whether the Map is still loading/parsing any assets or whether everything is there and a render will likely be complete
2015-05-05 11:47:23 +02:00
Konstantin Käfer
4cf3d4ef9f show failed glyph URL 2015-05-05 11:47:22 +02:00
Konstantin Käfer
63bb10a06b apply the framebuffer size before calling updateMatrices() 2015-05-05 11:16:02 +02:00
John Firebaugh
00a1f44cfc Ensure no GL commands are executed after pause 2015-05-04 18:27:48 -07:00
John Firebaugh
5c7867f435 Join worker tasks before destroying TileData
Fixes #1309
2015-05-04 15:09:19 -07:00
John Firebaugh
2b0892aaaa Build with gcc 4.9 2015-05-04 11:59:39 -07:00
Konstantin Käfer
27d8e82e1c lower thread priority of worker threads 2015-05-04 17:33:05 +02:00
Konstantin Käfer
7390062c45 check for errors 2015-05-04 17:33:05 +02:00
Konstantin Käfer
99ad8a4036 fix needsUpload() 2015-05-04 17:33:05 +02:00
Konstantin Käfer
78073d6fdd don't reallocate the Glyph atlas too often
- previously, we reallocated the glyph atlas on every upload. Instead, we're now using glTexSubImage2D to reuse the existing buffer
- we're no longer forcing a texture upload when we remove glyphs; they won't be rendered anyway
- we're now only doing a texture upload once per frame; previously, worker threads that added glyphs mid-render could trigger a texture upload while rendering is in progress
2015-05-04 17:33:05 +02:00
Konstantin Käfer
72964f5bef only update GL state when it actually changed 2015-05-04 17:33:05 +02:00
Konstantin Käfer
914b6f01f8 add gl::groups back for easier debugging in Xcode 2015-05-04 17:33:05 +02:00
Konstantin Käfer
f89f7f1bc2 rename prepare => upload and determine passes per layer instead of per bucket 2015-05-04 17:33:05 +02:00
Konstantin Käfer
c43016ce6c make sure we always to a full upload after sprite atlas resizes
We always need to do a full upload to adjust the image buffer size when we adjust the size of our sprite atlas. This can happen when we change the pixelRatio of the map we're rendering.
2015-05-04 17:33:05 +02:00
Konstantin Käfer
97a22b6f5f upload all GL objects before rendering a frame
This moves all texture updates and buffer uploads to the beginning of every frame, before we issue any drawing commands. This means the GPU typically has much more time to upload the data in the background until we actually need it, and doesn't have to pause to store/load the framebuffer.
2015-05-04 17:33:05 +02:00
Konstantin Käfer
28b9b3f9d6 add prepare() function 2015-05-04 17:33:04 +02:00
Konstantin Käfer
839b19330e remove hasData() from Bucket interface 2015-05-04 17:33:04 +02:00
Konstantin Käfer
c891df0b5f add upload API to gl objects 2015-05-04 17:33:04 +02:00
Konstantin Käfer
5beb635028 create the tile list statically 2015-05-04 17:33:04 +02:00
Konstantin Käfer
5f496d8f0c build render order array once instead of recursing through lots of different objects 2015-05-04 17:33:04 +02:00
Dane Springmeyer
cfa2eaf5c2 fix more 'result is not floating point' coverity warnings 2015-05-03 23:28:52 -07:00
Dane Springmeyer
33f30aae93 fix integer division to work in doubles in transform.cpp 2015-05-03 23:23:13 -07:00
John Firebaugh
aa19f07ccf RunLoop must outlive Object
~Object is likely to join threads that want to dispatch results
back to this RunLoop. This happens, for example, when MapContext
is destructed: it joins the worker threads, which need to complete
work before shutting down.
2015-05-02 12:57:25 -04:00
John Firebaugh
b713930c7f Merge branch 'uv_leak' 2015-05-01 18:24:58 -04:00
John Firebaugh
4c8f716f20 Eliminate uv::async leak (fixes #1393) 2015-05-01 18:13:35 -04:00
John Firebaugh
24695f6c02 More bandaids to avoid #1309
Even though we only bind the shared_ptr in the after callback, the
worker thread was still copying the callback and therefore gaining
a shared reference. Here we try to eliminate the copies.
2015-05-01 17:14:06 -04:00
John Firebaugh
dac4b7d3c9 Reset previous style before creating new one
This ensures that the worker threads associated with the
style are joined before new worker threads are launched.
I don't know exactly why, but it seems to fix #1384.
2015-05-01 16:29:06 -04:00
Dane Springmeyer
74604af9c5 fix compile with clang-3.6 2015-05-01 11:00:01 -07:00
John Firebaugh
51c0695028 Replace unsafe use of future with packaged_task 2015-05-01 12:07:34 -04:00