Commit Graph

3141 Commits

Author SHA1 Message Date
John Firebaugh
bb8dd4705c [core] Fix fill layer z-fighting
Hand-ports b05e5ddd34
2017-09-12 08:22:08 -07:00
John Firebaugh
73e9ba1439 [core] Align line vertex to 4-byte boundary
10 byte vertices are heavily penalized by common GL implementations.

Cherry-picks aa4dff1095
2017-09-12 08:21:51 -07:00
Konstantin Käfer
fb07beebb4 [build] Don't use maybe-uninitialized and misleading-indentation in Clang, since they're not implemented there
Cherry-pick of d03fd0dce2.
2017-08-25 15:36:30 -04:00
John Firebaugh
1188707dc3 [core] Use separate attribute component for line normals
Selective cherry pick of 822df3dd51
2017-08-18 11:43:24 +02:00
Antonio Zugaldia
fa0b307680 [android] Disable program caching on Adreno 3xx, 4xx, and 5xx GPUs due to known bugs (#9625) 2017-07-27 09:20:40 -04:00
John Firebaugh
ea337866e9 [core] Work around Adreno 2xx GPU bugs (#9573) 2017-07-21 15:04:36 +02:00
John Firebaugh
4416441663 [core] Revert conditional attribute binding
Reverts eed89fcf9d, which causes issues on certain Android devices. We don't actually need this change on this branch, I brought it over only to make the subsequent commits cleanly cherry-pickable.
2017-07-19 10:44:00 -07:00
Ivo van Dongen
733661948c [core] BackendScope prevent double (de-)activation
- Guards against duplicate activations by checking wether the backend of the prior scope is the same as the current ones
- Makes sure that only the most outer backend scope deactivates by tracking activation state
2017-07-19 17:34:07 +02:00
John Firebaugh
2d147470a5 [android] Force previously cached program binaries to be regenerated 2017-07-17 09:19:02 -07:00
John Firebaugh
550da70cf7 [core] Pass correct sources to programIdentifier 2017-07-17 09:19:02 -07:00
John Firebaugh
902d9442da [core] No need for optional in map of VertexArrays 2017-07-17 09:19:02 -07:00
John Firebaugh
cf83f117f0 [core] Reduce memory requirements of VertexArrays 2017-07-17 09:19:02 -07:00
John Firebaugh
de91e68090 [core] Per-segment-per-layer vertex arrays
Reduces rebinding, matches gl-js, and works around the buggy VAO implementation on PowerVR SGX544 GPUs.
2017-07-17 09:19:02 -07:00
John Firebaugh
d7bdc7a60d [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-17 09:19:02 -07:00
John Firebaugh
fbd4376899 [core] Inline getActiveAttributes details 2017-07-17 09:19:02 -07:00
John Firebaugh
f9fe0de806 [core] Include what you use 2017-07-17 09:19:02 -07:00
Lauren Budorick
eed89fcf9d [core] Bind only active attributes in order to avoid exceeding attribute limits (#9373)
Introducing two new attributes to enable property functions for line-width (#9250) pushed the attribute count over GL_MAX_VERTEX_ATTRIBS on some devices. Now we selectively bind only attributes that are used, making it unlikely to surpass GL_MAX_VERTEX_ATTRIBS.
2017-07-17 09:19:02 -07:00
Konstantin Käfer
e8272ebdbb [core] rename a_gap_width => a_gapwidth, u_gap_width => u_gapwidth to reflect naming in the shader
not sure how this ever worked
2017-07-17 09:19:02 -07:00
John Firebaugh
874244a656 [core] Eliminate constant attribute bindings
Rather than binding constant attributes that will never be used, just disable the attribute.
2017-07-17 09:19:02 -07:00
John Firebaugh
ccb5255537 [core] Don't use "current" icon/text-size when binding
The current value is not passed to `SymbolSizeBinder::uniformValues`, so we shouldn't check `currentValue.isConstant()` in `SymbolSizeBinder::attributeBindings`. If it were true, then we might end up using attribute bindings that are appropriate only for a constant property, but uniform bindings that are appropriate only for a source or composite function.

Instead, just wait for a new bucket to be generated. This will happen automatically, since icon/text-size are layout properties.
2017-07-17 09:19:02 -07:00
John Firebaugh
34453eb4e2 [core] Fix iterator invalidation in erase_if
vector::erase invalidates iterators. It's not safe for erase_if to cache the end iterator nor increment, then erase.
2017-06-28 17:56:51 -07:00
John Firebaugh
f6bfa078af [core] Trigger repaint on source changes 2017-06-19 16:58:47 -07:00
John Firebaugh
1de8aeed31 [core] Fix composite function approximation for non-integer stops 2017-06-19 09:15:08 -07:00
John Firebaugh
d27740650b [core] Don't upload the FrameHistory texture in frames where it's not changing 2017-06-14 11:13:43 -07:00
John Firebaugh
d618d4a274 [core] Dynamic program compilation for data-driven properties 2017-06-14 11:13:43 -07:00
John Firebaugh
212ae5273d [core] cleanup ProgramParameters 2017-06-14 11:13:43 -07:00
Konstantin Käfer
a64828218a [core] add constant DDS values as uniforms 2017-06-14 11:13:43 -07:00
Konstantin Käfer
cf85873f36 [core] add uniforms to DataDrivenPaintPropertys 2017-06-14 11:13:43 -07:00
Konstantin Käfer
b141707b8d [core] add shader defines for enabling/disabling attributes/uniforms for DDS 2017-06-14 11:13:43 -07:00
Konstantin Käfer
eaa8f23672 [core] only bind uniforms that exist in the program 2017-06-14 11:13:43 -07:00
Konstantin Käfer
951f599706 [core] store vertex attribute binding to prevent duplicate binds
We have an "oldBinding" value that we use for checking whether the vertex attribute was already
bound to the current VAO, but we never set the state. Additionally, we're also checking whether
the previous state was already any binding (optional is set), and don't re-enable the vertex
attribute array. Additionally, we now only disable the vertex attribute array when the previous
state was in fact an array attribute. We still don't deduplicate constant glVertexAttrib* calls,
but that's a little trickier.
2017-06-14 11:13:43 -07:00
John Firebaugh
441b80d574 [core] Reduce number of varyings to 8 or less
For #pragmas, don't generate varyings for attributes that aren't used by the fragment shader. Pack other varyings more tightly.
2017-06-14 11:13:43 -07:00
Tobrun
6ec5e4f8cd Cherry picks to release branch (#9230)
* [ios][macos] test remove source in use

* [android] test remove source in use

* [core] check source usage before remove

* [core] ensure layer::accept works with non-void return values on gcc

* [android] - remove upgrade runtime exceptions (#9191)
2017-06-09 12:05:54 +02:00
Ansis Brammanis
facc3d54a0 fix #8300 flyTo for close points
The isClose threshold is switched from 0.000001 pixels to 1 pixel.
As a backup, it checks whether r0 and r1 are finite. It might be
possible to have just the threshold check or just the finiteness check,
but I don't see the harm in having both.

std::abs(w0 - w1) < 0.000001 is removed because it doesn't look like
it's needed. All calculations should run fine even if w0 === w1.

Finally, the point interpolation is tweaked so that at the end of the
flying (when k === 1) it ends up at the exact end point. I didn't see
any bugs related to this, but it seems like a good thing to have
explicitly.
2017-06-06 14:13:31 -07:00
Bruno de Oliveira Abinader
0d171dbe0e [core] Make TransformState LatLngBounds optional 2017-06-01 13:46:53 -04:00
Fabian Guerra Soto
fe17f7e8db Cherry-pick arabic text to release branch v3.6.0 (#9071)
* [core] Throttle tiles to redo symbol placement at most once every 300ms.
Fixes issue #8435 and prepares for pitch-scaling changes in issue #8967.

* [core] Disable letter-spacing for Arabic labels (issue #9057)
2017-05-23 12:02:09 -04:00
Konstantin Käfer
b52e171b67 [core] add error for non-virtual destructor deletes + add virtual dtors 2017-05-19 12:12:47 +02:00
Konstantin Käfer
f0b0167640 [core] Make destructor virtual to avoid object splicing during destruction 2017-05-19 12:12:47 +02:00
John Firebaugh
db370a02b1 [core] When a layer is added, reload its source's tiles 2017-05-11 11:21:31 -07:00
John Firebaugh
baaae99a03 [core, android] Factor JSON string conversions
This adds a `convertJSON` template, to be used like:

   Error error
   optional<Foo> foo = convertJSON<Foo>(string, error);

Internally, it parses the string with RapidJSON and then calls `convert<Foo>(parsed, error)`.

While here, rationalize GeoJSON converters and fix error handling for Tileset conversion in OfflineDownload.
2017-05-08 13:48:57 -07:00
Ivo van Dongen
6fd40867d6 [core] delegate light changes to render light 2017-05-08 19:39:55 +03:00
Ivo van Dongen
feae5e22ee [core] generated accessor methods on light 2017-05-08 19:39:55 +03:00
Ivo van Dongen
20810f988a [core] render light 2017-05-08 19:39:55 +03:00
Lauren Budorick
1c9af3226f [core] Reuse fill-extrusion textures between frames (#8896) 2017-05-08 09:06:07 -07:00
John Firebaugh
dd353a60d1 [core] Reset observers of removed Sources and Layers
This ensures that the observer is not an invalid reference if the removed Source/Layer is retained, but the Style is deallocated.
2017-05-05 09:23:01 -07:00
John Firebaugh
7ca8fd07e0 [core] Remove unused declaration 2017-05-05 08:57:30 -07:00
John Firebaugh
66da759426 [core] Reduce use of RecalculateStyle
* Don't use it to track zoom changes. Instead, Style::update can use the zoom history to check for a change in zoom from the previous frame.
* Don't use it to track active property transitions. Style already knows which layers/light have an active transition, and can re-evaluate only those that do.

This leaves layer property changes as the only use of RecalculateStyle.
2017-05-05 08:56:36 -07:00
Konstantin Käfer
fd104dd3c2 [core] Throw exceptions by value 2017-05-05 14:42:47 +02:00
John Firebaugh
e7d2796762 [core] Omnibus Style::update method
Combine Style::cascade, recalculate, relayout, and updateTiles into a single method. This allows multiple loops over sources and layers to be consolidated and prepares for additional Style-Map decoupling: rather than tracking pending updates via a set of Update flags held by the Map and passed to the Style, the Style can use its own data to determine what to update.
2017-05-04 09:59:56 -07:00
John Firebaugh
89f1ffc6d2 [core] UpdateParameters ⇢ TileParameters 2017-05-04 07:29:08 -07:00