Commit Graph

1481 Commits

Author SHA1 Message Date
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
John Firebaugh
2d8d375356 Fix intended identity comparisons 2015-05-01 10:06:04 -04:00
John Firebaugh
bb3eb8d83d Fix uninitialized variable 2015-05-01 10:06:04 -04:00
Ansis Brammanis
ed9ef0f7d1 fix pixelForLatLng during animated zoom
fix #1160
2015-04-30 16:03:35 -07:00
John Firebaugh
f3f3e1b443 Copy resource
Fixes #1368
2015-04-30 12:55:36 -04:00
John Firebaugh
7584599ea6 uv::handle base class 2015-04-30 12:40:26 -04:00
John Firebaugh
64251eec75 Introduce and use uv::timer 2015-04-30 12:40:10 -04:00
John Firebaugh
bbcc7c26d9 Merge pull request #1065 from mapbox/1065-separate-ui-from-map-thread
Better separation between UI thread and Map thread
2015-04-30 10:22:06 -04:00
John Firebaugh
1d957d6898 Deactivate after cleanup 2015-04-30 09:57:58 -04:00
Dane Springmeyer
226799e811 Merge pull request #1342 from mapbox/clipper-even-odd
Use evenodd fill type for pre-tessellation union
2015-04-29 10:35:14 -07:00
Ansis Brammanis
3e928f41c8 fix line tessellation
-js: 7cf7ef763d
2015-04-28 18:14:34 -07:00
John Firebaugh
481fa0e69f Restructure *Request and Context
The previous implementation, based on thread-local storage, did not
ensure that the context was destructed before the FileSource run loop.
This resulted in implementations attempting to uv_close handles for a
loop that had already been destroyed.

This change also fixes #1262.
2015-04-28 19:26:35 -04:00
John Firebaugh
2c3952af66 Avoid binding a shared_ptr<TileData> in the work callback
It's possible that the work callback can outlive the after callback,
since work callback destruction and after callback execution happen in
two different threads. This could account for the crash seen in
https://github.com/mapbox/mapbox-gl-native/issues/1309#issuecomment-96108868
2015-04-28 14:32:26 -04:00
John Firebaugh
cdb466e7f7 Convert Style to unique_ptr and pass by reference
Fixes #1277
Fixes #1309
2015-04-28 14:32:26 -04:00
John Firebaugh
0c280adebc Move Worker to Style
This ensures that worker tasks are entirely complete by the
time the style is destructed, and enables us to pass Style&
rather than a shared pointer.
2015-04-28 14:32:26 -04:00
John Firebaugh
4ccf246c10 Rewrite Worker in terms of Thread<> 2015-04-28 14:32:26 -04:00
John Firebaugh
59255a3d9e MapContext::updated doesn't need to be atomic 2015-04-28 14:32:25 -04:00
John Firebaugh
8bb7fc64ff Move Environment to MapContext 2015-04-28 14:32:25 -04:00
John Firebaugh
bb7c453b3e Inline getWorker() 2015-04-28 14:32:25 -04:00
John Firebaugh
3bf0bf9538 Remove unused includes 2015-04-28 14:32:25 -04:00
John Firebaugh
f8db45f19a Move still image callback to MapContext 2015-04-28 14:32:25 -04:00
John Firebaugh
f0b229730f Move style info to MapContext 2015-04-28 14:32:25 -04:00
John Firebaugh
b5b58086a8 Combine update and triggerUpdate 2015-04-28 14:32:25 -04:00
John Firebaugh
230027e514 Resize view from map thread 2015-04-28 14:32:24 -04:00
John Firebaugh
a625ba8a09 Remove Map::start/stop
Both Android and iOS now use pause/resume. The map thread is
always running, and be able to receive messages. When paused,
it will just refuse to render.
2015-04-28 14:32:24 -04:00
John Firebaugh
5f76ab270e Encapsulate access to Thread's uv_loop_t
The Thread object gets access via its constructor. No other object
should have access; off-thread objects can't safely do anything with
it except pass it back to the thread.
2015-04-28 14:32:24 -04:00
John Firebaugh
f27641bcb5 Fully cancel the sprite requests 2015-04-28 14:32:24 -04:00