Commit Graph

1164 Commits

Author SHA1 Message Date
Thiago Marcos P. Santos
48ddfef89f [core] Make sure ThreadLocal will not own the pointer it is managing
ThreadLocal should not own the pointer it is managing because
the use case in Mapbox GL is to keep a pointer to a stack allocated
object, like:

```
MyObject foo;
threadLocal.set(&foo);
```

To keep consistency, it is required that we clear the managed
object before ThreadLocal gets destroyed by setting it to `nullptr`.
2017-07-14 15:18:54 +03:00
Chris Loer
3b26177e9d [test] Fix undefined behavior warning:
quads.test.cpp used a bin with unsupported x/y coordinates.
Issue #9499.
2017-07-14 09:45:06 +02:00
Konstantin Käfer
04fba1e01f [core] add unused default template parameter to keep Xcode 9's Clang from crashing 2017-07-13 18:46:39 +02:00
John Firebaugh
c61041b44c [core] Rework attribute binding (again)
These changes are necessary for programs whose set of active attributes is not fixed at compile time by a template parameter pack, but rather varies based on the generated shader text at runtime. In such cases, the attribute location of a given named attribute may vary between instances of the same Program.

Previously, attribute bindings were implicitly associated with a location based on template parameter order, and -1 was used to indicate an inactive attribute. This left us unable to disable the appropriate attribute when it went from active to inactive. Now, the state tracker for bindings explicitly associates locations and state, and an empty optional is used to indicate an inactive attribute.

In addition, a gl::VertexArray class is now exposed, allowing more flexibility in the relationship between Programs, Segments, and attribute bindings. In this commit, that relationship does not change, but the subsequent commit adjusts it to match gl-js, reduce rebinds, and work around buggy VAO implementations.

VertexArray uses a pimpl idiom in order to support implementations that lack the VAO extension. In that case, all VertexArrays share global binding state, reflecting the platform reality in the absence of VAOs, while still providing a uniform API.
2017-07-12 14:48:22 -07:00
Bruno de Oliveira Abinader
4014aa6721 [core] GCC 4.9 bracket initialization issues 2017-07-12 20:42:29 +03:00
Bruno de Oliveira Abinader
2fae373fc9 [core] GCC 4.9 is unable to deduce ctors when using bracket init 2017-07-12 20:42:29 +03:00
Bruno de Oliveira Abinader
3afbfa2de7 [core] GCC 4.9 shadow member warnings 2017-07-12 20:42:29 +03:00
Thiago Marcos P. Santos
32bef80eec [test] Add utest to assert our dtoa implementation precision 2017-07-12 15:13:33 +03:00
Ansis Brammanis
e514138b69 [core] improve legibility of labels that follow lines
port https://github.com/mapbox/mapbox-gl-js/pull/4781

This improves legibility of labels that follow lines in pitched views.
The previous approach used the limited information in the shader to
calculate put the glyph in approximatelyright place. The new approach
does this more accurately by doing it on the cpu where we have access to
the entire line geometry.
2017-07-11 09:10:24 -07:00
Chris Loer
a432a289a3 [core] Change OverscaledTileID to also include a "wrap" value.
This prevents TilePyramid from sharing wrapped copies of tiles.
This is necessary because two wrapped tiles no longer share the same CollisionTile.
2017-07-11 09:10:24 -07:00
Thiago Marcos P. Santos
7c117281bc [core] Isolate pthread-based tls implementation 2017-07-07 18:10:06 +03:00
Thiago Marcos P. Santos
69c8f602de [tests] Add unit test for tile prefetching 2017-07-07 14:28:52 +03:00
Bruno de Oliveira Abinader
06a0c4ad15 [test] Added bucket feature insertion tests 2017-07-06 16:17:58 +03:00
Bruno de Oliveira Abinader
0395271b9d [test] Reuse StubGeometryTileFeature in MergeLines 2017-07-06 16:17:58 +03:00
Bruno de Oliveira Abinader
a1ed9f8794 [core] Don't upload empty buckets 2017-07-06 16:17:58 +03:00
Konstantin Käfer
64a827c325 [core] rename getStencils() to getClipIDs() to better reflect what it actually does 2017-07-06 12:32:54 +02:00
Konstantin Käfer
107622a72b [core] don't use unordered_* collections for things we need to sort anyway 2017-07-06 12:32:54 +02:00
Konstantin Käfer
6d526c7b1d [core] refactor ClipID generation 2017-07-06 12:32:54 +02:00
Bruno de Oliveira Abinader
a744e35f44 [test] Added API.ZoomHistory 2017-07-04 15:50:50 +03:00
Bruno de Oliveira Abinader
9a0c5b4dfa [test] Use test::checkImage in API.RepeatedRender 2017-07-04 15:50:50 +03:00
Bruno de Oliveira Abinader
1df45a5e42 [core] Check if frameZoom is NaN in Transform::flyTo callback 2017-06-28 20:59:56 +03:00
Bruno de Oliveira Abinader
433e54e636 [core] Clamp to scale boundaries in TransformState::setLatLngZoom 2017-06-28 20:59:56 +03:00
Ivo van Dongen
24a00231f3 [core] fix render doesn’t flag style mutation 2017-06-26 16:19:06 -07:00
Thiago Marcos P. Santos
ea34cb5725 [core] Use the ResourceTransform instead of callbacks
Based on the actor model, can be considered safer to use since
we don't need to worry about object lifetime anymore.
2017-06-26 16:32:21 +03:00
John Firebaugh
40e4755621 [core] Move setStyleJSON/URL to Style; add Map::setStyle 2017-06-22 08:04:39 -07:00
John Firebaugh
1520a56813 [all] Promote Style to public API 2017-06-22 08:04:39 -07:00
John Firebaugh
be7e9bbb8d [core] Refactor CustomLayer internals
Move the responsibility for initialization/deinitialization/rendering to RenderCustomLayer. This eliminates special case code from Map and Style.
2017-06-22 08:04:39 -07:00
John Firebaugh
e4201e207c [tests] Add tests for MapObserver::on{WillStart,DidFinish}LoadingMap 2017-06-22 08:04:39 -07:00
Konstantin Käfer
7b90af5d35 [core] always return owning pointers for GeometryTileData::getLayer() 2017-06-21 17:18:08 -07:00
Konstantin Käfer
6ec406b6af [core] add MBGL_CHECK_ERROR to some locations where it was missing 2017-06-21 15:53:51 -07:00
Thiago Marcos P. Santos
7e8bdadb91 [core] Rename ThreadedObject to Thread
Now that the old Thread class is gone, we can give ThreadedObject
a better name.
2017-06-21 14:30:09 +03:00
Thiago Marcos P. Santos
1427628c56 [core] Remove util::Thread
Fixes #6425
2017-06-21 14:30:09 +03:00
Thiago Marcos P. Santos
bfdc4ef646 [tests] Port the ThreadLocalStorage test to the actor model 2017-06-21 14:30:09 +03:00
Thiago Marcos P. Santos
1178256ae9 [tests] Port the AsyncTask test to the actor model 2017-06-21 14:30:09 +03:00
Thiago Marcos P. Santos
495f06ac4d [core] Convert AssetFileSource to ThreadedObject 2017-06-21 14:30:09 +03:00
Thiago Marcos P. Santos
c34d1cfaa7 [tests] Added tests for ThreadedObject 2017-06-21 14:30:09 +03:00
Asheem Mamoowala
a33cad9855 [core] Trigger repaint on source changes 2017-06-19 09:50:08 -07:00
Asheem Mamoowala
7f36e0cf76 [iOS][macOS] Export MGLImageSource, add and update documentation. Use animated ImageSource demo in iOS test app 2017-06-19 09:50:08 -07:00
John Firebaugh
e361bcf668 [core] Fix composite function approximation for non-integer stops 2017-06-16 12:46:12 -07:00
John Firebaugh
fe024bbdf6 [core] Implement "smart setStyle" 2017-06-15 07:43:51 -07:00
John Firebaugh
244819f2da [core] Remove unused binpack.hppp 2017-06-13 10:18:43 -07:00
John Firebaugh
3270440f23 [core] Per-tile glyph/icon atlases 2017-06-13 10:18:43 -07:00
John Firebaugh
0b68731207 [core] Per-bucket icon atlases 2017-06-13 10:18:43 -07:00
John Firebaugh
92252849c1 [core] Per-bucket glyph atlases 2017-06-13 10:18:43 -07:00
Bruno de Oliveira Abinader
a05f060153 [core] Added Backend::{assume,set}ScissorTest 2017-06-13 13:37:41 +03:00
Anand Thakker
f59eb822e1 Fix undefined memory access in getCoveringRanges() (#9227)
* Add simple unit tests for SymbolSizeBinder

* Fix bug in symbol size uniform value calculation

For camera functions we were setting the zoom levels in "covering ranges" to
`[(zoom stop <= tile zoom), (zoom stop >= 1 + tile zoom)]`, but then evaluating
the function at `[tile_zoom, tile_zoom + 1]`.

* Check for it != end() before accessing it->first
2017-06-09 06:28:14 -04:00
John Firebaugh
9dfc2d924d [core] Collection-level immutability
Introduce a second level of immutability, over each of the collections held by a style: sources, images, and layers. Tracking immutability at this level allows us to short-circuit significant portions of the RenderStyle update logic via a simple equality check, greatly improving performance.
2017-06-05 19:38:08 -07:00
John Firebaugh
f983c2716b [core] Fix several bugs in AnnotationManager 2017-06-05 19:38:08 -07:00
John Firebaugh
74af076d40 [core] Split RenderStyle from Style 2017-06-05 19:38:08 -07:00
John Firebaugh
1cf46d93b9 [core] Simplify LayerObserver API 2017-06-05 19:38:08 -07:00