-
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
[Impeller] Make conical gradient work as expected #42567
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.
Nice find! The graphite code is so much easier to migrate. I spent so much time reading the math papers (which I swear are wrong) and reading through the skia code.
The code looks good. Just needs a comment linking the source of the code also I need confirmation that it's fine to opt out of IsOpaque since we could implement it if we want.
/// circles defined by (c0, r0) and (c1, r1). The returned vec2 encapsulates 't' | ||
/// as its x component and validity status as its y component, with positive y | ||
/// indicating a valid result. | ||
vec2 IPComputeConicalT(vec2 c0, float r0, vec2 c1, float r1, vec2 pos) { |
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.
You should add a comment that points to the graphite implementation. If there are upstream bugfixes we'll want to know where to grab them.
@@ -51,18 +51,6 @@ void ConicalGradientContents::SetFocus(std::optional<Point> focus, | |||
focus_radius_ = radius; | |||
} | |||
|
|||
bool ConicalGradientContents::IsOpaque() const { |
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.
Was this removed for the cases where the gradient doesn't occupy the full square? That wasn't the crux of the reported issue, right? I'm not sure if it's worth detecting those scenarios for IsOpaque.
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.
@bdero are you fine with us opting out of IsOpaque? I think we could calculate this by expanding on what we previously had if it's worth it.
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.
Yeah this is just used to optimize the blend mode for HSR and prevent unnecessary overdraw, so it's safe to just remove for now if it's wrong.
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. |
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 comment linking skia code.
…128341) flutter/engine@722aad8...b6d37f8 2023-06-06 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from tCxDcZ3yi0rnKGVHt... to atrYtfHWi2cmV9B_C... (flutter/engine#42589) 2023-06-06 zhangzhijian.123@bytedance.com [Impeller] Make conical gradient work as expected (flutter/engine#42567) Also rolling transitive DEPS: fuchsia/sdk/core/mac-amd64 from tCxDcZ3yi0rn to atrYtfHWi2cm If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC jacksongardner@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
fix flutter/flutter#128012
In many instances (flutter/flutter#128012 (comment)), the current implementation of conical gradient in impeller produces incorrect results. This pull request proposes to migrate the conical gradient algorithm from skia to impeller.
Please see https://github.com/google/skia/blob/ddf987d2ab3314ee0e80ac1ae7dbffb44a87d394/src/sksl/sksl_graphite_frag.sksl#L541-L666
Test result
Pre-launch Checklist
///
).