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 upOptimization: draw solid, single color borders as rect + clip. #2626
Conversation
Due to various recent optimizations and features added for the segment logic, it's now feasible to start drawing borders as a solid rect + clip mask. For now, we start with only the simplest and most common case, borders with style: solid and a single color. This optimization applies in a couple of ways: * Fewer shader switches and better batching. Specifically, we can often batch these simple borders into an existing solid rect batch. Additionally, the edge segments of borders are typically considered opaque segments, which are more efficient to batch, and help with early z-reject of other fragments. * Once we start to cache clip masks between elements, and also across frames / display lists, we'll automatically get some wins here by only rendering a border corner mask once where applicable. Many real world sites use a common border radius on all buttons, for example, so this can be a significant optimization in these cases.
|
Rebased on master so there is just the one commit now. |
I have a strong dejavu feeling about this :) Reviewed 11 of 11 files at r1. Comments from Reviewable |
|
@bors-servo r+ |
|
|
bors-servo
added a commit
that referenced
this pull request
Apr 6, 2018
Optimization: draw solid, single color borders as rect + clip. Due to various recent optimizations and features added for the segment logic, it's now feasible to start drawing borders as a solid rect + clip mask. For now, we start with only the simplest and most common case, borders with style: solid and a single color. This optimization applies in a couple of ways: * Fewer shader switches and better batching. Specifically, we can often batch these simple borders into an existing solid rect batch. Additionally, the edge segments of borders are typically considered opaque segments, which are more efficient to batch, and help with early z-reject of other fragments. * Once we start to cache clip masks between elements, and also across frames / display lists, we'll automatically get some wins here by only rendering a border corner mask once where applicable. Many real world sites use a common border radius on all buttons, for example, so this can be a significant optimization in these cases. <!-- 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/2626) <!-- Reviewable:end -->
|
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
glennw commentedApr 6, 2018
•
edited by larsbergstrom
Due to various recent optimizations and features added for the
segment logic, it's now feasible to start drawing borders as
a solid rect + clip mask.
For now, we start with only the simplest and most common case,
borders with style: solid and a single color.
This optimization applies in a couple of ways:
Fewer shader switches and better batching. Specifically, we
can often batch these simple borders into an existing solid
rect batch. Additionally, the edge segments of borders are
typically considered opaque segments, which are more efficient
to batch, and help with early z-reject of other fragments.
Once we start to cache clip masks between elements, and also
across frames / display lists, we'll automatically get some
wins here by only rendering a border corner mask once where
applicable. Many real world sites use a common border radius
on all buttons, for example, so this can be a significant
optimization in these cases.
This change is