-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Opacity peephole optimization #29775
Merged
fluttergithubbot
merged 13 commits into
flutter:main
from
flar:opacity-peephole-optimization
Dec 15, 2021
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ad1dfb3
pass opacity into display list layers that can render it directly
flar 1d78ae5
fix formatting
flar eef6412
simplify layer_supports_opacity mechanism and use it in many more cases
flar 57dbc16
save/restore extra_alpha and prevent test pictures from triggering op…
flar 597d610
switch from alpha to opacity, fix IOS overrides, fix FRACT handling i…
flar 77329a7
adjust alpha calculations in OpacityLayer tests
flar 85bba9a
update golden for slight difference in alpha calculations
flar 94cf4ca
prototype new tests and switching test surfaces to GL
flar b71d315
formatting
flar 23dc980
change group opacity test methods and mark hairline ops incompatible
flar 999499b
revert to SW shader for group opacity tests and allow 1 pixel difference
flar 8118fa2
remove code using TestGLSurface entirely to fix Fuchsia build problems
flar f11845d
review feedback - adding comments here and there
flar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@flar Hey, Could I ask you a question? How do i understand the
compatible
? and another methodadd_compatible_op()
. Thank youThere 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 methods (and variable names) are specific to group opacity compatibility. It's the only peephole optimization we make currently, but more should come.
These optimizations are cases where we can elide a saveLayer because the modification that would have been applied to the rendering inside the layer can instead be applied to each operation individually without any changes to the result. It is common to want to fade an entire UI component by surrounding it with a "saveLayer with alpha". But if the component is a single rendering operation or a few non-overlapping operations, then we can instead apply the alpha to each rendering operation. The code that deals with the group opacity compatibility is looking for such "single or non-overlapping rendering operations that can take an alpha to reduce their opacity" cases.