Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decouple layout and populating paint attribute buffers #4576

Open
anandthakker opened this issue Apr 11, 2017 · 7 comments
Open

Decouple layout and populating paint attribute buffers #4576

anandthakker opened this issue Apr 11, 2017 · 7 comments
Labels
cross-platform 📺 Requires coordination with Mapbox GL Native (style specification, rendering tests, etc.) performance ⚡ Speed, stability, CPU usage, memory usage, or power usage

Comments

@anandthakker
Copy link
Contributor

anandthakker commented Apr 11, 2017

Currently, the following two processes are always done together:

  • layout - i.e., parsing vector tile feature geometries into a "layout vertex array" for each layer. This includes, e.g., symbol placement (and collision detection), triangulating polygons with earcut, etc.
  • populating paint attribute buffers - when a layer has data-driven paint properties (i.e. feature-property-dependent), we populate a "paint vertex array" (or more than one, in GL Native), parallel to the layout array, containing paint attribute data for each vertex.

The principal reason for building these arrays in tandem is that it prevents us from having to keep track of which vertices belong to each vector tile feature. We could track this, though, and it would allow us to update paint buffers without redoing layout, which might significantly improve runtime styling performance in the case where a user sets a paint property to a data-driven value. (E.g. #4575)

@anandthakker anandthakker added cross-platform 📺 Requires coordination with Mapbox GL Native (style specification, rendering tests, etc.) performance ⚡ Speed, stability, CPU usage, memory usage, or power usage labels Apr 11, 2017
@anandthakker
Copy link
Contributor Author

I forgot to add: this decoupling would also largely clear the path towards updateable feature property data -- i.e., updating feature properties without wasting time reparsing geometries.

@ReevesSher
Copy link

I am in the same situation with #4575, i wonder that if i set stops[ [ 'uuid', '#fff'] ] , does it mean that compare this uuid with all other features of the layer?
if so, is it possible to do this just in the current viewport or some other limitation?

@ryanbaumann
Copy link
Contributor

ryanbaumann commented Apr 24, 2017

@anandthakker This would also be an enabler for transitions for DDS property style updates #3170

cc @averas

@keyofj
Copy link

keyofj commented Jun 2, 2017

I may have two paint properties to update such as line-color, line-width in some cases.

It seems like calling setPaintProperty for each redraws on each call which is visually slowing user performance.
_mapCanvas.setPaintProperty("nmap-boundary-layer", "line-color", _layerPaintProperties[0]); _mapCanvas.setPaintProperty("nmap-boundary-layer", "line-width", _layerPaintProperties[1]);

Is there a way to set both properties and result in only one redraw?

@anandthakker
Copy link
Contributor Author

@keyofj style updates are batched per animation frame, so two consecutive calls shouldn't result in duplicate work. If you are, in fact, seeing this, then it's a bug--in which case, please do open a new issue (with an example if possible 🙏 )!

@keyofj
Copy link

keyofj commented Jun 3, 2017 via email

@asheemmamoowala
Copy link
Contributor

#6263 Keeps track of paint buffers per feature and may help with this. I suspect that this would only be useful in a narrow range where a layer already uses data-driven styling and wants to change the expression for a paint property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cross-platform 📺 Requires coordination with Mapbox GL Native (style specification, rendering tests, etc.) performance ⚡ Speed, stability, CPU usage, memory usage, or power usage
5 participants