Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Impeller] reduce advanced blend subpass count for single input with foreground color #40886

Merged

Conversation

jonahwilliams
Copy link
Member

Work towards flutter/flutter#124025

This makes Advanced Blends applied via ColorFiltered take one fewer subpass, and Advanced Blends applied directly to contents (via Paint) take no extra subpasses at all.

To test this, I used the flutter codelabs nextgen UI app. Though this uses a ColorFiltered with a pipeline blend, I changed to using ColorDodge to experiment with the costs of the advanced blend filters. While this reduces the number of subpasses significantly, it only has a minor impact on overall performance.

Before

Screenshot 2023-04-03 at 9 56 15 AM

After

Screenshot 2023-04-03 at 9 52 07 AM

@jonahwilliams jonahwilliams marked this pull request as ready for review April 3, 2023 20:38
@jonahwilliams jonahwilliams requested review from dnfield and bdero April 3, 2023 22:23
Copy link
Member

@bdero bdero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Entity entity;
entity.SetTransformation(Matrix::MakeTranslation(coverage.origin));
entity.SetContents(std::move(contents));
return entity;
Copy link
Member

@bdero bdero Apr 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To prevent the need for adding new contents that don't really have a use outside of filters (and for just keeping all the logic local), you could also use Contents::MakeAnonymous() here, which I added to help make returning specialized contents easier when optimizing filters like this.
It just takes a render method and coverage, no questions asked. :)

Up to you if you want to do that refactor though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do intend to use this a bit more though, for some of the follow ups in flutter/flutter#124025 the bypass the color filter entirely.

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 3, 2023
@auto-submit auto-submit bot merged commit 5335c87 into flutter:main Apr 3, 2023
@jonahwilliams jonahwilliams deleted the reduce_advanced_blend_subpass branch April 3, 2023 23:36
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 4, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 4, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 4, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 4, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 4, 2023
jonahwilliams added a commit that referenced this pull request Apr 4, 2023
jonahwilliams added a commit that referenced this pull request Apr 4, 2023
…ut with foreground color" (#40914)

Reverts #40886

This renders incorrectly when applied directly to contents instead of as
a filter, essentially due to some transform mis handling.

The code only works when the snapshot has an identity transform, which
is only true as a subpass
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App e: impeller
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants