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 upUse constant color blend for subpx text without clips. #1998
Conversation
|
r? @kvark |
|
LGTM, minus one small concern. |
| pub fn set_blend_mode_subpixel_opaque(&self, color: ColorF) { | ||
| self.gl.blend_color(color.r, color.g, color.b, color.a); | ||
| self.gl | ||
| .blend_func(gl::CONSTANT_COLOR, gl::ONE_MINUS_SRC_COLOR); |
This comment has been minimized.
This comment has been minimized.
kvark
Nov 7, 2017
Member
we should be setting the blend equation here as well as in set_blend_mode_subpixel_passX
This comment has been minimized.
This comment has been minimized.
|
I think this method can be extended in a fairly straightforward way to cover non-opaque text as well (as long as the alpha is constant):
Then the resulting equation is
|
Actually, if the color passed to |
The current subpx rendering mode that supports clip masks is a two pass technique. With the current batcher implementation, this can result in a lot of batches on sites where text bounding rects are a bit loose, and are detected as potentially overlapping. This most often occurs on sites that use a lot of small text. As an interim solution, only use the clip mask supporting method when a clip mask (or translucent text) is active. Otherwise, use the old color blending method. In the near(ish) future, we'll start using the dual source blending extension for subpixel rendering on hardware that supports it. This extension gives the best of both worlds - supporting clip masks and being a single pass technique. It's supported on the vast majority of our target hardware (perhaps even all of it). On hardware that doesn't support dual source blending, using the modes here which invoke a different technique depending on need for alpha masking is a very reasonable tradeoff. Additionally, future improvements to batching will improve this fallback solution by being a bit smarter about clumping together non-overlapping batches. Fixes #1984.
|
thanks, |
|
|
Use constant color blend for subpx text without clips. The current subpx rendering mode that supports clip masks is a two pass technique. With the current batcher implementation, this can result in a lot of batches on sites where text bounding rects are a bit loose, and are detected as potentially overlapping. This most often occurs on sites that use a lot of small text. As an interim solution, only use the clip mask supporting method when a clip mask (or translucent text) is active. Otherwise, use the old color blending method. In the near(ish) future, we'll start using the dual source blending extension for subpixel rendering on hardware that supports it. This extension gives the best of both worlds - supporting clip masks and being a single pass technique. It's supported on the vast majority of our target hardware (perhaps even all of it). On hardware that doesn't support dual source blending, using the modes here which invoke a different technique depending on need for alpha masking is a very reasonable tradeoff. Additionally, future improvements to batching will improve this fallback solution by being a bit smarter about clumping together non-overlapping batches. Fixes #1984. <!-- 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/1998) <!-- Reviewable:end -->
|
|
glennw commentedNov 6, 2017
•
edited by larsbergstrom
The current subpx rendering mode that supports clip masks is a
two pass technique. With the current batcher implementation,
this can result in a lot of batches on sites where text
bounding rects are a bit loose, and are detected as potentially
overlapping. This most often occurs on sites that use a lot
of small text.
As an interim solution, only use the clip mask supporting method
when a clip mask (or translucent text) is active. Otherwise, use
the old color blending method.
In the near(ish) future, we'll start using the dual source blending
extension for subpixel rendering on hardware that supports it. This
extension gives the best of both worlds - supporting clip masks and
being a single pass technique. It's supported on the vast majority
of our target hardware (perhaps even all of it).
On hardware that doesn't support dual source blending, using the
modes here which invoke a different technique depending on need
for alpha masking is a very reasonable tradeoff.
Additionally, future improvements to batching will improve this
fallback solution by being a bit smarter about clumping together
non-overlapping batches.
Fixes #1984.
This change is