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 upFirst round of optimizations for box shadows. #1954
Conversation
|
r? @kvark |
|
@jrmuizel This provides a large performance win on https://bugzilla.mozilla.org/show_bug.cgi?id=1408612. In the profile bars below, the pink segments are blurs for box shadows. They are an almost negligible amount of time with this optimization. On my HD4600, this drops the GPU time on bugzilla from ~20ms to ~8ms. The performance with this fix is reasonable now, but there's three major issues outstanding:
Follow ups:
|
|
Servo WPT sanity tests pass, I need to do a full run through. |
|
Amazing work Reviewed 15 of 15 files at r1. webrender/res/brush_image.glsl, line 90 at r1 (raw file):
this seems incorrect, given that webrender/res/brush_image.glsl, line 98 at r1 (raw file):
given that webrender/res/brush_mask_rounded_rect.glsl, line 72 at r1 (raw file):
I think we should rather move the AA stuff out of webrender/src/box_shadow.rs, line 20 at r1 (raw file):
hmm, should this depend on the border radius then? webrender/src/picture.rs, line 41 at r1 (raw file):
would be nice to have it as an webrender/src/picture.rs, line 142 at r1 (raw file):
nit: webrender/src/prim_store.rs, line 190 at r1 (raw file):
nit: given the paths are so different, might as well match Comments from Reviewable |
This applies two optimizations to outset box shadows: * If border radii are uniform, render only the top left corner of the box shadow, and mirror that across the primitive. * If border radii are non-uniform, render a minimal mask rect and stretch that across the primitive. There are several remaining box shadow / clip related optimizations to come, but this provides some large immediate wins on large outset box shadows. Fixes #1571.
|
Review status: 9 of 17 files reviewed at latest revision, 7 unresolved discussions. webrender/res/brush_image.glsl, line 90 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
The UV coords passed are divided by the size of the patch, so 0.5 is the UV when we reach half of the source patch. webrender/res/brush_image.glsl, line 98 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Same as above - the UV space is local_rect_size / patch_size. webrender/res/brush_mask_rounded_rect.glsl, line 72 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Done. webrender/src/box_shadow.rs, line 20 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
It's added as padding in addition to the border radii sizes below. webrender/src/picture.rs, line 41 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Done. webrender/src/picture.rs, line 142 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Done. webrender/src/prim_store.rs, line 190 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Done. Comments from Reviewable |
|
@kvark Thanks! All comments addressed, I think. This is ready for re-review, but I still need to do a gecko try run to see what the differences are and if they are within expected fuzziness tolerance. |
|
Looks like there are a few failures in a gecko try run - will investigate those today. |
|
This is the try run: It has 1 new PASS and 3 new FAILs. Unfortunately those fails seem to pass locally on my machine. Still investigating... |
|
There is a 3rd commit which fixes / works around some of the Gecko try failures above. Specifically:
With those changes, we have: The Two new PASS in
One new FAIL in
With @staktrace 's blessing, I think we should add some fuzziness to r? @kvark |
|
/me blesses |
|
@bors-servo r+ |
|
|
First round of optimizations for box shadows. This applies two optimizations to outset box shadows: * If border radii are uniform, render only the top left corner of the box shadow, and mirror that across the primitive. * If border radii are non-uniform, render a minimal mask rect and stretch that across the primitive. There are several remaining box shadow / clip related optimizations to come, but this provides some large immediate wins on large outset box shadows. Fixes #1571. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1954) <!-- Reviewable:end -->
|
|
931a42d
into
servo:master

glennw commentedOct 27, 2017
•
edited by larsbergstrom
This applies two optimizations to outset box shadows:
of the box shadow, and mirror that across the primitive.
rect and stretch that across the primitive.
There are several remaining box shadow / clip related optimizations
to come, but this provides some large immediate wins on large
outset box shadows.
Fixes #1571.
This change is