mapbox / mapbox-gl-js

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL
https://docs.mapbox.com/mapbox-gl-js/
Other
11.21k stars 2.22k forks source link

Decouple layout and populating paint attribute buffers #4576

Open anandthakker opened 7 years ago

anandthakker commented 7 years ago

Currently, the following two processes are always done together:

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. https://github.com/mapbox/mapbox-gl-js/issues/4575)

anandthakker commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

@anandthakker This would also be an enabler for transitions for DDS property style updates https://github.com/mapbox/mapbox-gl-js/issues/3170

cc @averas

keyofj commented 7 years ago

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 commented 7 years ago

@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 commented 7 years ago

Thanks.

Get Outlook for Androidhttps://aka.ms/ghei36


From: Anand Thakker notifications@github.com Sent: Friday, June 2, 2017 5:08:02 PM To: mapbox/mapbox-gl-js Cc: Michael Clark; Mention Subject: Re: [mapbox/mapbox-gl-js] Decouple layout and populating paint attribute buffers (#4576)

@keyofjhttps://github.com/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 šŸ™ )!

ā€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/mapbox/mapbox-gl-js/issues/4576#issuecomment-305909548, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHoyQDTjl4Y70rYkPXno-AWrWIlGgajNks5sAHmygaJpZM4M6uMB.

asheemmamoowala commented 6 years ago

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.