New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unify text-shadows with the blur filter. #2556
Conversation
This PR also includes #2552. It may be easier to review this PR after that lands. The try run has several orange items, but I think they are all OK:
@staktrace, does that look correct to you? r? @mrobinson or @kvark |
@glennw I agree with your try push assessment, I think this is fine to land. |
Surprise! The unexpected-pass results are all actually from turning off mipmaps, not from this PR. https://treeherder.mozilla.org/#/jobs?repo=try&revision=b114b7b9e9565b2f03470931c6574040e354aa10 |
@staktrace I thought that might actually be the case here :) |
e89ed9b
to
5b8a81e
Compare
I've rebased this on top of master, now down to one commit with +269 / -410 lines :) |
Reviewed 12 of 12 files at r1. webrender/src/display_list_flattener.rs, line 179 at r1 (raw file):
🎉 webrender/src/display_list_flattener.rs, line 941 at r1 (raw file):
I don't recall us handling local clip sources around here before, why now? webrender/src/display_list_flattener.rs, line 957 at r1 (raw file):
Hmm, is it actually possible for a primitive to be in a non-visible container while the shadow isn't? (is a shadow ever in a different container from its contents?) PrimitiveContainers are a new notion to me so idk what they represent (kvark says they're the new Picture, but I still see Pictures are alive and well?) Is it accurate to say they're just temporary metadata used during flattening? so e.g. the fact that we do tons of non-recycled calls to create_shadow is "fine"? If so I'd prefer to call create_shadow something that indicates it's uh, softer, than it sounds. with_shadow? webrender/src/display_list_flattener.rs, line 1419 at r1 (raw file):
do -> to webrender/src/display_list_flattener.rs, line 1449 at r1 (raw file):
😭 webrender/src/picture.rs, line 193 at r1 (raw file):
Why is FilterOp::Blur handling deferred to prepare_prim_for_render, but not e.g. DropShadow? webrender/src/tiling.rs, line 409 at r1 (raw file):
Why isn't this just wrench/reftests/text/blurred-shadow-local-clip-rect-ref.png, line 0 at r1 (raw file): wrench/reftests/text/shadow-clip.yaml, line 15 at r1 (raw file):
why was this necessary? Comments from Reviewable |
r=me with comments addressed (mostly just questions to make sure I understand what this does) |
Review status: all files reviewed at latest revision, 8 unresolved discussions. webrender/src/display_list_flattener.rs, line 941 at r1 (raw file): Previously, Gankro (Alexis Beingessner) wrote…
Because we now draw text decorations as a clip source - this has only landed recently. webrender/src/display_list_flattener.rs, line 957 at r1 (raw file): Previously, Gankro (Alexis Beingessner) wrote…
A PrimitiveContainer is just an enum used to handle pushing all of the primitive types. In this case, the is_visible just checks if alpha > 0, which is what we used to do manually in the add_text and add_line functions. webrender/src/display_list_flattener.rs, line 1419 at r1 (raw file): Previously, Gankro (Alexis Beingessner) wrote…
Done. webrender/src/display_list_flattener.rs, line 1449 at r1 (raw file): Previously, Gankro (Alexis Beingessner) wrote…
Is that a good reaction, or an issue? webrender/src/picture.rs, line 193 at r1 (raw file): Previously, Gankro (Alexis Beingessner) wrote…
Because the DropShadow code is much broken. I'm working on fixing the drop shadow code as a follow up patch. webrender/src/tiling.rs, line 409 at r1 (raw file): Previously, Gankro (Alexis Beingessner) wrote…
I got a rustc compile error, since there's just the one PictureKind now (I'm intending to remove that enum as a follow up, but left it here for now to avoid a heap of indentation changes). wrench/reftests/text/blurred-shadow-local-clip-rect-ref.png, line at r1 (raw file): Previously, Gankro (Alexis Beingessner) wrote…
I didn't look into that diff too closely, since the try run passed. I can try to find the exact cause though, if you like? wrench/reftests/text/shadow-clip.yaml, line 15 at r1 (raw file): Previously, Gankro (Alexis Beingessner) wrote…
A blur radius of 1 was producing a fractional offset in the primitive, due to the halving of the blur radius, and then scaling by 3 for the blur range. This was producing pixel perfect results on all the hardware I tested, but OSMesa seemed to be rounding it incorrectly, causing the test to fail. Since it only affected OSMesa, and the blur radius being 2 doesn't affect what this test is checking, I used a whole number to work around that for now. Comments from Reviewable |
5b8a81e
to
3f20fa6
Compare
Review status: 11 of 12 files reviewed at latest revision, 3 unresolved discussions. webrender/src/display_list_flattener.rs, line 1449 at r1 (raw file): Previously, glennw (Glenn Watson) wrote…
tears of joy! webrender/src/tiling.rs, line 409 at r1 (raw file): Previously, glennw (Glenn Watson) wrote…
Yes that's why I moved the wrench/reftests/text/blurred-shadow-local-clip-rect-ref.png, line at r1 (raw file): Previously, glennw (Glenn Watson) wrote…
It's also possible github is just being dumb here. But wait, how did you get a passing try and a diff? Comments from Reviewable |
This removes any special code for text shadows. A text shadow is now simply a Picture with text runs and/or line decorations that has a blur filter applied to it. This is possible due to the recent work related to removing the line decoration and cached text run primitives. This greatly simplifies the shadow code, and a lot of the functionality of the text shadows (e.g. fast path shadows) just fall out of the existing Picture functionality for blur filters. Next step is to expand the primitive types that can run through the shadow paths, which will then allow us to unify the drop-shadow filter to be a simple shadow + blur filter. NOTE: The PictureKind enum now has only a single kind (Image). I could have removed that in this PR, and added the fields to Picture directly. However, that will result in a lot of indentation changes. So I'll do that as a follow up PR to make this one easier to review.
3f20fa6
to
e36c071
Compare
Review status: 10 of 12 files reviewed at latest revision, 2 unresolved discussions. webrender/src/tiling.rs, line 409 at r1 (raw file): Previously, Gankro (Alexis Beingessner) wrote…
Ah, I misread your comment. Fixed now. wrench/reftests/text/blurred-shadow-local-clip-rect-ref.png, line at r1 (raw file): Previously, Gankro (Alexis Beingessner) wrote…
Oh, I meant I hadn't looked too closely at the wrench reference image difference, since the gecko try had passed. I can take a closer look at this difference before we merge though, if you prefer, to see if it's actually a bug with the previous image or the new one? Comments from Reviewable |
Review status: 10 of 12 files reviewed at latest revision, 1 unresolved discussion. wrench/reftests/text/blurred-shadow-local-clip-rect-ref.png, line at r1 (raw file): Previously, glennw (Glenn Watson) wrote…
I'd appreciate it, but not a blocker if you think you have better stuff to do. Comments from Reviewable |
I'll take a look today, and see what causes the difference. r=you if it turns out to be expected? (otherwise if there's a bug I'll put up an extra commit + gecko try). |
yep, r=me with the image investigated |
@gankro You're quite right - that reference image was incorrectly clipped. I guess we don't have Gecko test coverage for that. Pushed a commit that restores the local rect inflate for blurs, will kick off a gecko try shortly. |
Try run here https://treeherder.mozilla.org/#/jobs?repo=try&revision=e5cabd0b6e5a2c58b75f4fd20d55a0c782166b97 has one new PASS and one new FAIL. I'll investigate the failure today. |
Hmmm, seems to not reproduce locally so far 😞 |
It's needed when the contents of the blur are clipped. Also update the reference images with minor differences.
9bd1296
to
2afe3d0
Compare
Latest try run (not quite complete yet): https://treeherder.mozilla.org/#/jobs?repo=try&revision=a51d30f477a9adbf31ba1e3053275b5177a0e06e There is a new PASS in R7. The other orange results look unrelated, so I think this is ready to merge now. |
Try run looks good now. @bors-servo r=Gankro 🚀 |
📌 Commit 2afe3d0 has been approved by |
Unify text-shadows with the blur filter. This removes any special code for text shadows. A text shadow is now simply a Picture with text runs and/or line decorations that has a blur filter applied to it. This is possible due to the recent work related to removing the line decoration and cached text run primitives. This greatly simplifies the shadow code, and a lot of the functionality of the text shadows (e.g. fast path shadows) just fall out of the existing Picture functionality for blur filters. Next step is to expand the primitive types that can run through the shadow paths, which will then allow us to unify the drop-shadow filter to be a simple shadow + blur filter. NOTE: The PictureKind enum now has only a single kind (Image). I could have removed that in this PR, and added the fields to Picture directly. However, that will result in a lot of indentation changes. So I'll do that as a follow up PR to make this one easier to review. <!-- 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/2556) <!-- Reviewable:end -->
☀️ Test successful - status-appveyor, status-taskcluster |
This removes any special code for text shadows. A text shadow is
now simply a Picture with text runs and/or line decorations that
has a blur filter applied to it.
This is possible due to the recent work related to removing the line
decoration and cached text run primitives.
This greatly simplifies the shadow code, and a lot of the functionality
of the text shadows (e.g. fast path shadows) just fall out of the
existing Picture functionality for blur filters.
Next step is to expand the primitive types that can run through the
shadow paths, which will then allow us to unify the drop-shadow
filter to be a simple shadow + blur filter.
NOTE: The PictureKind enum now has only a single kind (Image). I could
have removed that in this PR, and added the fields to Picture
directly. However, that will result in a lot of indentation
changes. So I'll do that as a follow up PR to make this one
easier to review.
This change is