-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Make porter duff blended atlas calls faster. #44059
[Impeller] Make porter duff blended atlas calls faster. #44059
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. |
| "filename": "flutter/impeller/entity/gles/porter_duff_blend.frag.gles", | ||
| "has_side_effects": false, | ||
| "has_uniform_computation": true, | ||
| "has_uniform_computation": false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These moved to the vert.
|
Golden file changes are available for triage from new commit, Click here to view. |
…gine into make_draw_vertices_fast
|
Friendly ping 😄 |
chinmaygarde
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bdero said he would take a look yesterday but he may be preoccupied. I took a stab instead and LGTM. If he has further comments, we can handle it in a later pass. Thanks!
| "filename": "flutter/impeller/entity/gles/porter_duff_blend.frag.gles", | ||
| "has_side_effects": false, | ||
| "has_uniform_computation": true, | ||
| "has_uniform_computation": false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These moved to the vert.
bdero
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but can we add a golden that uses AtlasContents?
Summary of my understanding:
- The
porter_duff_blendis reworked to distribute the tiles while performing the blend at the same time. - The blend shader needs to be reversed because the blended colors are actually the destination: https://api.flutter.dev/flutter/dart-ui/Canvas/drawAtlas.html
In an engine sync you mentioned that the blend isn't behaving correctly, but I wasn't able to spot a potential problem.
I might have mispoke, I didn't mean with this patch but at ToT. In general there is a problem with some of the blending with the current implementation. Those issues are linked in the above issue but in particular: flutter/flutter#118914 So I'm trying to move us closer to what Skia is doing without adding more shaders. |
|
Oh! I notice that issue is from January. We discovered some tricky alpha management issues while comprehensively covering the blends with goldens & comparing with Skia -- maybe it's already fixed by #43283? BTW, if you're planning to employ a trick like this to make the advanced blends faster in DrawAtlas and/or DrawVertices, I think that would also be a great way to resolve the mask tracking issue I was worried about. Although in the case of DrawAtlas/DrawVertices, the issue is confined to edges looking a bit discolored rather than the whole blended square getting colored in for some blend modes. |
|
Oh nice, that's right you fixed that. I'll need to recheck. |
|
Are we landing this? |
|
Waiting on benchmarks |
|
Benchmarks have landed, will monitor and ensure those are running and then land later this week. |
flutter/engine@22f03ff...a9da721 2023-08-15 skia-flutter-autoroll@skia.org Roll Skia from c7c9e85a8657 to b07a6964a1cf (2 revisions) (flutter/engine#44733) 2023-08-15 jonahwilliams@google.com [Impeller] Make porter duff blended atlas calls faster. (flutter/engine#44059) 2023-08-15 skia-flutter-autoroll@skia.org Roll Skia from 4beb6fd05f4f to c7c9e85a8657 (7 revisions) (flutter/engine#44729) 2023-08-15 skia-flutter-autoroll@skia.org Roll Dart SDK from 19c87486f0a9 to b36934aae968 (1 revision) (flutter/engine#44728) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC jsimmons@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This implements part of flutter/flutter#131345 --- Makes all porter-duff draw atlas blending avoid subpass creation, by tweaking the existing porter duff shader to support per-vertex colors and output opacity. This requires a small trick: What the blend shaders and what (drawAtlas/drawVertices) consider the source and destination is reversed. That is a blend mode color filter treats the color as the source whereas drawVertices/drawAtlas treat their per-vertex colors as the destination. Therefore I cannot simply make all color inputs per vertex and use the exact same shaders :( However, for the porter duff blends we should just be able to reverse the blend mode (srcover -> dstOver, xor->xor) (I'm pretty sure I did this correctly) so that the blending is still correct. I don't think we can do this for the advanced blends, but supporting those is less important than the common atlas blending parameters like dstIn. This PR only updates drawAtlas.
This implements part of flutter/flutter#131345
Makes all porter-duff draw atlas blending avoid subpass creation, by tweaking the existing porter duff shader to support per-vertex colors and output opacity. This requires a small trick: What the blend shaders and what (drawAtlas/drawVertices) consider the source and destination is reversed. That is a blend mode color filter treats the color as the source whereas drawVertices/drawAtlas treat their per-vertex colors as the destination. Therefore I cannot simply make all color inputs per vertex and use the exact same shaders :(
However, for the porter duff blends we should just be able to reverse the blend mode (srcover -> dstOver, xor->xor) (I'm pretty sure I did this correctly) so that the blending is still correct. I don't think we can do this for the advanced blends, but supporting those is less important than the common atlas blending parameters like dstIn.
This PR only updates drawAtlas.