Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd a fast path for clips with uniform radii. #1661
Comments
|
The ellipse shader code handles circles in the easy/fast way (because the SDF impl for ellipses doesn't work for that special case) here, currently: webrender/webrender/res/ellipse.glsl Lines 58 to 67 in 6a7b538 Is the idea in this issue to create a separate fragment shader (a variant of If so: when would we decide to use it? I see two options (I'm looking at WebRender for the first time, excuse me if this is way off the mark :) )
("nice": all corners use circles) |
|
Hm, total list of shaders using the shared ellipse code:
|
|
That's the basic idea, yep! Although, the clipping code is undergoing quite a lot of changes right now, so it's perhaps not the best time to work on this task. One step towards this task that would be super useful is to create a wrench test case that does only require circle clips, locally replace the ellipse code by a shader that only does the circle clip, and measure the performance difference. It may be that there's minimal performance gain from this anyway, in which case it won't be worth pursuing. In terms of an actual implementation, I'm hoping to have the major clip changes done in the next 2-3 weeks, which would then be a good time to work on this. Thanks! |
|
Alright, sounds good. I'll give the wrench test idea a go tomorrow and report back. |
|
I did some profiling and there's no noticeable performance improvement when modifying the clip mask shader to assume only circular radii (@pcwalton did land some changes to make the ellipse evaluation use far fewer instructions, so it may be explained by this). |
The clipping shader currently evaluates an ellipse, since the x/y radii of a rounded rect can be different.
The ellipse evaluation is much slower than evaluating a clip against a circle, and elliptical clips are actually very rare in practice.
We should add a fast path clip mask shader that is used when the radii are equal that just evaluates the SDF of a circle.