-
Notifications
You must be signed in to change notification settings - Fork 29.8k
[Impeller] let drawImage nine use porter duff optimization. #169611
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
[Impeller] let drawImage nine use porter duff optimization. #169611
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
gaaclarke
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.
Looking good, just needs cleaned up documentation.
| float16_t output_alpha; | ||
| float tmx; | ||
| float tmy; | ||
| vec4 ai_ao_tmx_tmy; |
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.
This needs a docstring.
| float tmx = frag_info.ai_ao_tmx_tmy.z; | ||
| float tmy = frag_info.ai_ao_tmx_tmy.w; |
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.
No abbreviations: https://google.github.io/styleguide/cppguide.html#General_Naming_Rules
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.
This isn't C++ :)
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.
Oh I forgot, the glsl style guide says abbreviate everything. Nevermind, change everything else then.
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.
LOL :P
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.
(do you get the joke, I used an abbreviation to respond to you)
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.
(also yes, I will change this :) )
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.
Sorry, I was actually talking about the tmx, tmy variables. The packed one was unfortunate but I figured the docstring would help.
- float tmx = frag_info.ai_ao_tmx_tmy.z;
- float tmy = frag_info.ai_ao_tmx_tmy.w;
+ vec2 tileMode = vec2(frag_info.ai_ao_tmx_tmy.z, frag_info.ai_ao_tmx_tmy.w);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.
done
engine/src/flutter/impeller/entity/shaders/blending/porter_duff_blend.frag
Show resolved
Hide resolved
|
|
||
| virtual bool ShouldInvertBlendMode() const { return true; } | ||
|
|
||
| virtual std::optional<Rect> GetStrictSrcRect() const { return std::nullopt; } |
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.
Docstring please, just add a "see also" that points to the definition of strict source rects.
| float tmx = frag_info.ai_ao_tmx_tmy.z; | ||
| float tmy = frag_info.ai_ao_tmx_tmy.w; |
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.
Sorry, I was actually talking about the tmx, tmy variables. The packed one was unfortunate but I figured the docstring would help.
- float tmx = frag_info.ai_ao_tmx_tmy.z;
- float tmy = frag_info.ai_ao_tmx_tmy.w;
+ vec2 tileMode = vec2(frag_info.ai_ao_tmx_tmy.z, frag_info.ai_ao_tmx_tmy.w);|
|
||
| virtual bool ShouldInvertBlendMode() const { return true; } | ||
|
|
||
| /// @brief the source rect of the draw if a strict source rect should |
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.
| /// @brief the source rect of the draw if a strict source rect should | |
| /// @brief The source rect of the draw if a strict source rect should |
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.
done
gaaclarke
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 modulo the tilemode abbreviation.
Fixes #169492
Currently we apply a color filter nine times for the drawImageNine calls, which is very expensive. We can do the same porterduff optimization we did for flame for drawImage nine by allowing the porter duff shader to specify a strict src rect.
Before
After