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 upBetter ClipChain optimization #2104
Conversation
There are a lot of situations where we can omit redundant clips or combine a series of clips into a single empty mask (which has the effect of clipping the primitive in screen space). Briefly, some of the optimizations this change includes: 1. When the inner rect of a clip completely encloses the outer rect of a parent, we can ignore it. 2. When the outer rectangle of a clip is completely enclosed by the inner rectangle of a parent, we can start a new ClipChan and ignore the parents. 3. If the combined inner rectangle of a ClipChain completely encloses the intersection of a primitive and the current clips, we can stop applying clips from that chain. 4. If a clip's inner rect completely encloses the intersection of a primitive and the current clips, we can ignore it.
|
This is one half of #2062. |
|
Awesome! I'll look at this first thing in the morning if no-one else gets to it first. The sooner we can get this part merged the better :) |
|
Reviewed 7 of 7 files at r1. Comments from Reviewable |
|
Looks good to me! I've done a try push that was green yesterday: I don't think this patch has changed since then. @bors-servo r+ |
|
|
Better ClipChain optimization Better ClipChain optimization There are a lot of situations where we can omit redundant clips or combine a series of clips into a single empty mask (which has the effect of clipping the primitive in screen space). Briefly, some of the optimizations this change includes: 1. When the inner rect of a clip completely encloses the outer rect of a parent, we can ignore it. 2. When the outer rectangle of a clip is completely enclosed by the inner rectangle of a parent, we can start a new ClipChan and ignore the parents. 3. If the combined inner rectangle of a ClipChain completely encloses the intersection of a primitive and the current clips, we can stop applying clips from that chain. 4. If a clip's inner rect completely encloses the intersection of a primitive and the current clips, we can ignore it. <!-- 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/2104) <!-- Reviewable:end -->
|
@kvark @jrmuizel @staktrace Once this lands, it's probably worth getting it into a Gecko update as soon as possible - it should improve the clip mask profiling on a lot of real world sites (and a few benchmarks too). |
|
|
|
@kvark @jrmuizel @staktrace Hmm, actually I'm seeing some strange behavior with extra large clip masks that seem redundant - it's probably unrelated to this - but might want to hold off on updating Gecko until I investigate them further. |
|
OK, there is a PR #2115 which fixes those issues (pending green try run of course). |
mrobinson commentedNov 27, 2017
•
edited by larsbergstrom
Better ClipChain optimization
There are a lot of situations where we can omit redundant clips or
combine a series of clips into a single empty mask (which has the
effect of clipping the primitive in screen space). Briefly, some of the
optimizations this change includes:
of a parent, we can ignore it.
inner rectangle of a parent, we can start a new ClipChan and
ignore the parents.
encloses the intersection of a primitive and the current clips,
we can stop applying clips from that chain.
of a primitive and the current clips, we can ignore it.
This change is