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 upSupport clip masks for text runs. #1855
Conversation
|
r? @kvark (Passes servo/wrench tests OK, but I still need to do a gecko try with this). |
|
Gecko try is green on all configs. |
|
Code looks good. I haven't evaluated the performance impact yet though. Reviewed 16 of 16 files at r1. webrender/res/ps_text_run.glsl, line 88 at r1 (raw file):
I vaguely recall driver issues with output variables assigned in a switch webrender/src/device.rs, line 1466 at r1 (raw file):
I wonder if we can get any perf from caching those uniforms. Device pixel ratio and the mode don't change often. webrender/src/renderer.rs, line 900 at r1 (raw file):
would not harm to have a proper name for this type instead of Comments from Reviewable |
I guess there is no alternative atm :) Review status: all files reviewed at latest revision, 3 unresolved discussions. Comments from Reviewable |
|
|
|
Actually, Glenn is here soon, so I'll wait to let him address the nits. |
This switches our subpixel rendering over to a two pass method that supports normal alpha blending. There's some tradeoffs involved here: * +++ We get clip masks on subpixel text. * +++ CPU batching is much better (no batch breaks on text color change). * --- We draw the subpixel text pixels twice. On balance, this is likely to be a reasonable performance win, because: (a) We are typically CPU limited rather than GPU limited. (b) The time in text run FS is typically a small portion of GPU time. More importantly, this gives us correct clip masking on text, and also allows us to apply some optimizations in the future: * Take advantage of dual source blending where available. This is available on most recent hardware, and allows clip masking plus subpixel rendering in a single pass. * Consider using the old constant color blend method when there is no clip mask present, if the two pass method does show up as a significant cost.
|
Review status: 15 of 16 files reviewed at latest revision, 3 unresolved discussions. webrender/res/ps_text_run.glsl, line 88 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
I think that was only in a very specific case, not in any switch. Maybe merge and see if we encounter any issues? webrender/src/device.rs, line 1466 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
webrender/src/renderer.rs, line 900 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Done. Comments from Reviewable |
|
@kvark Thanks for the quick review! Comments addressed. |
I think we should make it an informal rule to have a single code path for all output writes. It makes drivers happy, and allows easier code navigation and reasoning. Anyhow, it's fine to follow-up with. Thanks for addressing my nits! |
|
|
|
Yea, that sounds like a good idea - perhaps we need a style guide for shader writing... |
Support clip masks for text runs. This switches our subpixel rendering over to a two pass method that supports normal alpha blending. There's some tradeoffs involved here: * +++ We get clip masks on subpixel text. * +++ CPU batching is much better (no batch breaks on text color change). * --- We draw the subpixel text pixels twice. On balance, this is likely to be a reasonable performance win, because: (a) We are typically CPU limited rather than GPU limited. (b) The time in text run FS is typically a small portion of GPU time. More importantly, this gives us correct clip masking on text, and also allows us to apply some optimizations in the future: * Take advantage of dual source blending where available. This is available on most recent hardware, and allows clip masking plus subpixel rendering in a single pass. * Consider using the old constant color blend method when there is no clip mask present, if the two pass method does show up as a significant cost. <!-- 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/1855) <!-- Reviewable:end -->
|
|
2e9eb03
into
servo:master
|
@glennw I believe this change is causing shader compilation failures on Windows: thread '' panicked at 'called Full regression range is in https://bugzilla.mozilla.org/show_bug.cgi?id=1407213#c10 but this PR is the one that touches uMode. |
|
@staktrace could you try with #1872 ? |
|
Thanks for the quick PR! Try push is in progress at https://treeherder.mozilla.org/#/jobs?repo=try&revision=911f826e93460538f7906168377958a3259b30af |
Switched uMode to be accessible to fragment shaders only Addresses #1855 (comment) <!-- 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/1872) <!-- Reviewable:end -->
|
I screwed up the reftest.list files in that try push so it didn't run the reftests. Here's another one (this includes #1873 as well): https://treeherder.mozilla.org/#/jobs?repo=try&revision=1f38daa67ff395256f26bc280b099a930dc26c38 |
|
Fix verified, thanks! |
glennw commentedOct 12, 2017
•
edited by larsbergstrom
This switches our subpixel rendering over to a two pass method
that supports normal alpha blending.
There's some tradeoffs involved here:
On balance, this is likely to be a reasonable performance win, because:
(a) We are typically CPU limited rather than GPU limited.
(b) The time in text run FS is typically a small portion of GPU time.
More importantly, this gives us correct clip masking on text, and also
allows us to apply some optimizations in the future:
available on most recent hardware, and allows clip masking plus
subpixel rendering in a single pass.
is no clip mask present, if the two pass method does show up
as a significant cost.
This change is