-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Add support for property functions in line-color #2938
Conversation
@@ -347,6 +359,12 @@ LineBucket.prototype.addLine = function(vertices, join, cap, miterLimit, roundLi | |||
startOfLine = false; | |||
} | |||
|
|||
this.populatePaintArrays( | |||
'line', {zoom: this.zoom}, | |||
feature.properties, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we only use feature.properties
, should we pass featureProperties
in the outer function directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored in the next commit.
This looks great overall. How are the benchmarks looking? |
The benchmarks are looking pretty good. I was seeing around 5% slowdown in |
Daaang awesome job keeping perf 🏃 ! |
cd3dd12
to
b60c2d9
Compare
Branch Benchmarks7.2 ms, 0% > 16ms Master Benchmarksframe-duration:
EDIT: The previous |
b60c2d9
to
dd1b520
Compare
dd1b520
to
4998566
Compare
I got this running as fast or faster than |
4998566
to
cd78412
Compare
I found the problem with |
Interesting, what was the fix about? It's hard to tell because of the rebased commit. |
Ah! My apologies. I've gotten into the habit of squashing bugfixes. I'll unsquash and push so you can see. In short, there was a mistake leading to early loop termination. The performance gains / losses make a lot of sense. |
cd78412
to
62564e8
Compare
The fix for the test is in 62564e8. It's obvious how this led to artificial performance gains 😢 I am going to remove all ineffective perf optimizations from this branch, leaving only the initial commit. |
62564e8
to
e4c7367
Compare
Oh wow. It's fascinating that this was caught by just a single obscure test. :) It may be worth adding a "functional" render test that renders a relatively detailed map tile with all stuff at once to catch things like this. I agree that we can merge this now — the changes look good, and we can follow-up with perf improvements later if they're possible. |
|
@lucaswoj Thanks for this :) Note: I made a few tests using categorical stops but it's a bit heavy when rendering railways from OSM since they use hundreds of different colors in some areas. |
@sguignot the closest thing is a proposal for |
... and pave the way for all other line properties
This PR
line-color
property functionsThe naive implementation of line-color property functions was too slow, prompting me to investigate ways to reduce the perf overhead of setting uniforms per tile. We need to set uniforms per tile as if each were a different GL program because different tiles may actually require different GL programs due to a pending asynchronous operation.My solution was aPainter#setUniforms(uniforms: Object)
method, something I've been thinking about writing for a while anyway as part of #145 (needed for #281).ref #2729
cc @mollymerp @mourner