-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Make gradients work as expected #36140
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. |
| ); | ||
| float t = dot / (len * len); | ||
| frag_color = IPSampleWithTileMode( | ||
| if ((t < 0.0 || t >= 1.0) && gradient_info.tile_mode == kTileModeDecal) { |
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.
is this an issue we should fix in IPSampleWithTileMode?
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.
if not, I think we should still probably pull this functionality into a helper in texture.glsl so that we don't need to repeat it for all 3 gradient types
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 is specifically a problem for linear sampling, so maybe we should have IPSampleLinear and IPSampleLinearWithTileMode, which is basically the same as the non-linear variants but with an extra half_texel param? We need to make this fix almost any time we do linear sampling (as @flar pointed out a couple of weeks back), so these utilities will probably get a good amount of use.
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. IPSampleLinear and IPSampleLinearWithTileMode have been added.
jonahwilliams
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
…111696) * 06fe761f6 [Impeller] Make gradients work as expected (flutter/engine#36140) * f18d17ba8 Roll Skia from 962fd1f9abfc to 6e0e0a9f6cbf (3 revisions) (flutter/engine#36174) * 5e6b0d813 Enable dart null-safety (flutter/engine#36154) * ccba311e2 Fix typo (flutter/engine#36167) * b828d3079 [lint] Enforce kCamelCase for global constants (flutter/engine#36175) * 9a6caba29 Roll Skia from 6e0e0a9f6cbf to 7c2dc625d01e (2 revisions) (flutter/engine#36178)
fix flutter/flutter#111534
The value of coods x should range from the center of the first texel to the center of the last texel. However, the current implementation goes from the left of the first texel to the right of the last texel.
For example, if the gradient only has start color and end color, the value range of coods x is from 0.25 to 0.75.
cc @jonahwilliams @bdero @dnfield
It is base on the flowing image

without patch
with patch
Pre-launch Checklist
writing and running engine tests.
///).