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 up[DO NOT MERGE] Box shadow performance optimization. #1891
Conversation
Now that box shadows are rendered via a normal mask + blur, we can just pass through radii for each corner to handle this case. Right now, the brush mask assumes it will handle the entire rect. The next step is to support segmenting parts of the mask generation, which will greatly help with the performance of the new box shadow implementation. Fixes #1430.
This drastically reduces the size of the region that the blur shader operates on. The blur shader itself is already much slower than it should be, so this is a big performance win on large box shadows.
|
The performance of box shadows can be quite bad with the new blur approach on very large shadows, due to a simplistic initial implementation aiming for correctness only. My plan is to work on the proper segment / brush support discussed in previous issues over the next few days. Once that lands, the performance of the box shadows will be significantly faster than previously, and support all the new features of this implementation. My preference would be to hold off for a few more days until the "proper" solution is in place to reduce the size of box shadows clips and blurs, but this is here in case we decide the current box shadow performance is intolerable, as a stopgap solution. |
|
(This also includes #1889 which is still in the merge queue, so the patch isn't as big as it looks). |
|
Note to self: doesn't scale with device pixel ratio correctly - need to update the cache image shader. |
|
looks pretty good! Reviewed 7 of 10 files at r2. webrender/src/picture.rs, line 162 at r2 (raw file):
nit: let cache_size = (prim_metadata.local_rect.size * prim_context.device_pixel_ratio).ceil().to_i32();webrender/src/tiling.rs, line 593 at r2 (raw file):
nit: would be nice to have some indication here on what Comments from Reviewable |
|
|
|
Closing in favor of #1896 which is a simpler solution. |
glennw commentedOct 18, 2017
•
edited by larsbergstrom
Use a 9-patch for outset box shadows to improve performance.
This drastically reduces the size of the region that the blur
shader operates on. The blur shader itself is already much
slower than it should be, so this is a big performance win
on large box shadows.
This change is