-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Data-driven line-dasharray
and line-cap
#10591
Conversation
The attribute names used for dashes were the same as those used for patterns. This was leading to incorrectly generated shaders. Since there was no pattern set for the dash layer it was setting the defines that generate the shader without those attributes. The line atlas texture is now bound with gl.REPEAT to render more than one dash.
This looks good to me. Can we add render tests to cover the all the possible variations? |
After these changes load times are a bit more than 1% slower. It probably makes sense to merge these results anyways. @mourner can you comment to document why this is probably not something we can optimize away right now? There is a slight bias in the results that we still need to fix but that only accounts for about 5ms of the difference. |
The minor slowdown comes mostly from 2 things:
The first item could potentially be addressed by keeping a separate global line atlas for non-data-driven dash layers, but this would add considerable complexity and isn't worth doing at the moment, at least until we reduced the overall complexity of dashed lines implementation by removing cross-fading #10605. It's not clear how to address the second one without a major refactoring of how data-driven styling works, so we'll leave that for future optimizations. |
@mourner Data-driven line-dasharray still not support on mapbox-gl 3.7.0?I have try this ,but got error blow: Need you help please! @mourner |
Closes #3045. Implements data-driven expressions support for
line-dasharray
andline-cap
. Example:Similar to
imageAtlas
andglyphAtlas
,lineAtlas
is now generated per tile rather than globally, allowing for more dash values to fit the atlas, and moving dash SDF generation to the worker.Implementation status
Something to follow up but not necessarily in this PR: we could switch to a statically packed sprite layout with
potpack
, similar to glyph and image atlases. This should drastically reduce the line atlas sizes while also improving rendering for more complex dashes, since the current dash SDF is fixed 256px x 1px or 15px (round) regardless of its configuration or expected line width range.Launch Checklist
mapbox-gl-js
changelog:<changelog>Add support for data-driven expressions in line-dasharray and line-cap properties.</changelog>