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 upMake stacking context clipping explicit #2600
Conversation
06a6964
to
667b368
|
The Gecko try job for this change is here: https://treeherder.mozilla.org/#/jobs?repo=try&revision=653eda9276eb3ecaede897f2f98e6263a69ca4b5&selectedJob=171426186 Looks like there are some intermittent failures and one newly passing test. |
667b368
to
8e98097
|
Reviewed 24 of 24 files at r1. webrender/src/batch.rs, line 680 at r1 (raw file):
This change will mean the catch-all _ at the bottom of this match executes if a bug occurs and we get here without a composite mode. Is there a specific reason to remove the expect here? webrender/src/display_list_flattener.rs, line 1201 at r1 (raw file):
We should perhaps test here (well, later probably) if the clipping node actually applies any useful clips? This would avoid doing redundant render work if the client supplies a clip node that has no effect. If we did something like that, we'd probably check during the picture prepare each frame if the clip node applies to this Picture, and select at that point whether to use an intermediate surface. We can do that as a follow up optimization later though - this will definitely let us do some testing in Gecko and make sure it works as we want the API to. webrender/src/picture.rs, line 204 at r1 (raw file):
Should this bool check just be added to the can_draw_directly_to_parent_surface method? webrender/src/picture.rs, line 373 at r1 (raw file):
nit: space webrender/src/prim_store.rs, line 1050 at r1 (raw file):
Should we just push this through the new_image method rather than making it a mut variable here and setting it? wrench/reftests/filters/blend-clipped.png, line 0 at r1 (raw file): Comments from Reviewable |
|
Generally this looks great! I added some comments in reviewable. |
|
|
|
Thanks for the review! I've answered you comments below and updated the PR. Review status: all files reviewed at latest revision, 6 unresolved discussions, some commit checks failed. webrender/src/batch.rs, line 680 at r1 (raw file): Previously, glennw (Glenn Watson) wrote…
The issue is that now even Pictures without a composition mode might have a surface assigned. This code was expecting that to never happen. Unless there is a better way to handle this, I can maintain the runtime check is by adding an assertion like: assert!(
picture.composite_mode.is_some() ||
picture.force_intermediate_surface
);
webrender/src/display_list_flattener.rs, line 1201 at r1 (raw file): Previously, glennw (Glenn Watson) wrote…
That's correct. Right now the clips are applied twice, which in our rendering model could even affect the output. Eventually I think we will need to append the two clip chains on all items in the stacking context (while perhaps removing duplicate clips). In the end, this should remove the need to force the use of an intermediate surface. This may require us to revisit how clips are applied in WebRender, in general. webrender/src/picture.rs, line 204 at r1 (raw file): Previously, glennw (Glenn Watson) wrote…
Yes, this made the code quite a bit simpler! webrender/src/picture.rs, line 373 at r1 (raw file): Previously, glennw (Glenn Watson) wrote…
This should be fixed with the previous change, webrender/src/prim_store.rs, line 1050 at r1 (raw file): Previously, glennw (Glenn Watson) wrote…
Done. wrench/reftests/filters/blend-clipped.png, line at r1 (raw file): Previously, glennw (Glenn Watson) wrote…
The content was affected here as well. Comments from Reviewable |
8e98097
to
7cd5b93
|
Review status: 20 of 24 files reviewed at latest revision, 2 unresolved discussions. webrender/src/batch.rs, line 680 at r1 (raw file): Previously, mrobinson (Martin Robinson) wrote…
Ah, I see. I inverted that logic a bit in 6b63b20, which is merging now. That will unfortunately conflict with your change, but perhaps the logic there might work a bit better with your change now (it inverts the composite mode / surface check). Or does that complicate things further? webrender/src/display_list_flattener.rs, line 1201 at r1 (raw file): Previously, mrobinson (Martin Robinson) wrote…
In theory, it's possible to avoid having clips applied twice, by having a different clip chain applied to the stacking context from the one that is set on primitives within the stacking context, isn't it? I thought the idea was that the caller could then choose whether to specify a clip-chain for the stacking context AND/OR the primitive as they want to. Or is my conceptual model of how this works not right? Comments from Reviewable |
|
|
|
r=me btw, once rebased and the questions above are covered. |
7cd5b93
to
762d6a9
|
|
762d6a9
to
8f35949
Instead of relying on the combination of a stacking contexts which render to intermediate surfaces and the PushStackingContext's clip node, add an explicit clipping node parameter for stacking contexts. This is necessary, because currently stacking context clipping is done by always rendering to an intermediate surface. Once we support merging stacking context and contained item clip chains we can remove this and the extra parameter.
8f35949
to
5e42243
|
Review status: 17 of 24 files reviewed at latest revision, 2 unresolved discussions. webrender/src/batch.rs, line 680 at r1 (raw file): Previously, glennw (Glenn Watson) wrote…
I think it works a bit better with your change from 6b63b20. Hopefully we can remove this completely in the future webrender/src/display_list_flattener.rs, line 1201 at r1 (raw file): Previously, glennw (Glenn Watson) wrote…
Oh I definitely want to preserve the functionality where when the stacking context and primitives are assigned different clip chains they both clip the primitive. This is how things work after this change. What I mean by avoiding double clipping is to handle the situation where, for instance, the stacking context clip chain is a subset of the primitive clip chain. In this example, the stacking context clip chain would be ignored completely. It would be great to have this de-duplication done on a per-clip basis while processing primitive runs. Comments from Reviewable |
|
@bors-servo r=glennw |
|
|
…=glennw Make stacking context clipping explicit Instead of relying on the combination of a stacking contexts which render to intermediate surfaces and the PushStackingContext's clip node, add an explicit clipping node parameter for stacking contexts. This is necessary, because currently stacking context clipping is done by always rendering to an intermediate surface. Once we support merging stacking context and contained item clip chains we can remove this and the extra parameter. <!-- 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/2600) <!-- Reviewable:end -->
|
|
|
@staktrace Heads up for public API change. Passing |
servo#2600 made it possible to correctly express this. I had to make the test a bit fuzzy since the reference uses floating point color, while the test uses integer color. They're visually indistinguishable, though.
This was made possible by servo#2600. I had to make the test a bit fuzzy since the reference uses floating point color, while the test uses integer color. They're visually indistinguishable, though.
add reftest for mask clips on stacking contexts, closes #1957 This was made possible by #2600. I had to make the test a bit fuzzy since the reference uses floating point color, while the test uses integer color. They're visually indistinguishable, though. <!-- 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/2646) <!-- Reviewable:end -->
mrobinson commentedApr 2, 2018
•
edited by larsbergstrom
Instead of relying on the combination of a stacking contexts which
render to intermediate surfaces and the PushStackingContext's clip node,
add an explicit clipping node parameter for stacking contexts. This is
necessary, because currently stacking context clipping is done by always
rendering to an intermediate surface. Once we support merging stacking
context and contained item clip chains we can remove this and the extra
parameter.
This change is