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 upInclude picture composite mode in primitive key for pictures. #3426
Conversation
We need to ensure that a display list that is otherwise the same except for a different compositing mode is detected by picture caching code as invalid. For example, if a picture has brightness(0.5) and then the next display list is exactly the same but with brightness(0.6). This patch adds a not particularly elegant key for picture composite modes that is stored in the interned primitive data for a picture, ensuring these cases are correctly detected.
|
Pending try since this affects non-picture caching path too: |
|
Try run looks good. |
|
Did you consider to only cache pre-composition results (which would not have this problem)? With this path, if there is an opacity animation, wouldn't we then invalidate the picture every frame? |
|
I do think it's something worth considering in the future as we make the caching support more granular. |
|
What is the motivation for caching the post-composition contents? |
|
The point of this change is so that a nested child picture inside a tile cache which had a composite mode is correctly detected as invalidating that tile when its parameters change. For example, imagine you have a picture / tile cache, and that has [image, opacity [image], rectangle] - we need to know that the opacity filter has changed to redraw that tile, just as we need to know if any primitive / clip has changed for that cached surface. |
|
@bors-servo r=kvark |
|
|
Include picture composite mode in primitive key for pictures. We need to ensure that a display list that is otherwise the same except for a different compositing mode is detected by picture caching code as invalid. For example, if a picture has brightness(0.5) and then the next display list is exactly the same but with brightness(0.6). This patch adds a not particularly elegant key for picture composite modes that is stored in the interned primitive data for a picture, ensuring these cases are correctly detected. <!-- 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/3426) <!-- Reviewable:end -->
|
|
| match mode { | ||
| Some(PictureCompositeMode::MixBlend(mode)) => { | ||
| match mode { | ||
| MixBlendMode::Normal => PictureCompositeKey::Identity, |
This comment has been minimized.
This comment has been minimized.
kvark
Dec 18, 2018
Member
why don't we include a variant like MixBlend(MixBlendMode) into PictureCompositeKey instead of duplicating the variants?
This comment has been minimized.
This comment has been minimized.
gw3583
Dec 18, 2018
Author
Collaborator
Duh, I should have done that! Will do next time I'm in this area.
| } | ||
| Some(PictureCompositeMode::Filter(op)) => { | ||
| match op { | ||
| FilterOp::Blur(value) => PictureCompositeKey::Blur(Au::from_f32_px(value)), |
This comment has been minimized.
This comment has been minimized.
kvark
Dec 18, 2018
Member
similarly, it looks like we should turn FilterOp<T> to be generic and just have a variant like Filter(FilterOp<Au>) in the composite key
This comment has been minimized.
This comment has been minimized.
gw3583
Dec 18, 2018
Author
Collaborator
I wasn't sure if that would break the public API / bindgen bindings, so I tried to leave the public API as is.
…8f0c07508e73 (WR PR #3426). r=kats servo/webrender#3426 Differential Revision: https://phabricator.services.mozilla.com/D14825 --HG-- extra : moz-landing-system : lando
…8f0c07508e73 (WR PR #3426). r=kats servo/webrender#3426 Differential Revision: https://phabricator.services.mozilla.com/D14825
…8f0c07508e73 (WR PR #3426). r=kats servo/webrender#3426 Differential Revision: https://phabricator.services.mozilla.com/D14825 UltraBlame original commit: 04a614f2fceb64430d2069050f343e50e13e236b
…8f0c07508e73 (WR PR #3426). r=kats servo/webrender#3426 Differential Revision: https://phabricator.services.mozilla.com/D14825 UltraBlame original commit: 04a614f2fceb64430d2069050f343e50e13e236b
…8f0c07508e73 (WR PR #3426). r=kats servo/webrender#3426 Differential Revision: https://phabricator.services.mozilla.com/D14825 UltraBlame original commit: 04a614f2fceb64430d2069050f343e50e13e236b
gw3583 commentedDec 17, 2018
•
edited by larsbergstrom
We need to ensure that a display list that is otherwise the same
except for a different compositing mode is detected by picture
caching code as invalid.
For example, if a picture has brightness(0.5) and then the next
display list is exactly the same but with brightness(0.6).
This patch adds a not particularly elegant key for picture
composite modes that is stored in the interned primitive data
for a picture, ensuring these cases are correctly detected.
This change is