-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] reduce advanced blend subpass count for single input with foreground color #40886
[Impeller] reduce advanced blend subpass count for single input with foreground color #40886
Conversation
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!
Entity entity; | ||
entity.SetTransformation(Matrix::MakeTranslation(coverage.origin)); | ||
entity.SetContents(std::move(contents)); | ||
return entity; |
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.
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.
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.
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.
…nput with foreground color (flutter/engine#40886)
…nput with foreground color (flutter/engine#40886)
…nput with foreground color (flutter/engine#40886)
…nput with foreground color (flutter/engine#40886)
…nput with foreground color (flutter/engine#40886)
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
After