-
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] Use Wang's formula for quad/cubic subdivision. #52079
[Impeller] Use Wang's formula for quad/cubic subdivision. #52079
Conversation
@@ -78,30 +78,6 @@ TEST(TessellatorTest, TessellatorBuilderReturnsCorrectResultStatus) { | |||
|
|||
ASSERT_EQ(result, Tessellator::Result::kInputError); | |||
} | |||
|
|||
// More than uint16 points, odd fill mode. | |||
{ |
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 testing a case that no longer matters since we don't use the tessellator. i suspect it broke because we're now generating fewer line segments, since our cubic division isn't as cranky.
As a follow up I plan to delete most of this code.
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.
Just a minor nit but otherwise LGTM. I don't think we should care about the segment count either. This is great.
impeller/geometry/wangs_formula.cc
Outdated
return std::sqrt(nn.x + nn.y); | ||
} | ||
|
||
static inline Point Max(Point a, Point b) { |
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.
Don't we already have Point::Max
and Point::GetLength
?
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.
Switched to Point::Max. The length measurement is different however.
None of the golden diffs are unexpected either. |
Golden file changes are available for triage from new commit, Click here to view. |
Part of flutter/flutter#143077 Results: About 5x faster cubics, 2-3x fast quads. |
…146790) flutter/engine@07ae93c...503e7e8 2024-04-15 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[Impeller] moved to bgra10_xr (#52019)" (flutter/engine#52140) 2024-04-15 [email protected] Roll Skia from d27e288efd54 to 0b5df0201734 (1 revision) (flutter/engine#52132) 2024-04-15 [email protected] Roll Skia from 0fe107da5a4e to d27e288efd54 (6 revisions) (flutter/engine#52130) 2024-04-15 [email protected] [Impeller] moved to bgra10_xr (flutter/engine#52019) 2024-04-15 [email protected] Roll Skia from 9e20a146c024 to 0fe107da5a4e (33 revisions) (flutter/engine#52129) 2024-04-15 [email protected] [Impeller] Use Wang's formula for quad/cubic subdivision. (flutter/engine#52079) 2024-04-15 [email protected] [Impeller] organize shaders a bit, make filter shaders use same vertex source. (flutter/engine#52113) 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 [email protected],[email protected],[email protected] 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://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…lutter#146790) flutter/engine@07ae93c...503e7e8 2024-04-15 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[Impeller] moved to bgra10_xr (flutter#52019)" (flutter/engine#52140) 2024-04-15 [email protected] Roll Skia from d27e288efd54 to 0b5df0201734 (1 revision) (flutter/engine#52132) 2024-04-15 [email protected] Roll Skia from 0fe107da5a4e to d27e288efd54 (6 revisions) (flutter/engine#52130) 2024-04-15 [email protected] [Impeller] moved to bgra10_xr (flutter/engine#52019) 2024-04-15 [email protected] Roll Skia from 9e20a146c024 to 0fe107da5a4e (33 revisions) (flutter/engine#52129) 2024-04-15 [email protected] [Impeller] Use Wang's formula for quad/cubic subdivision. (flutter/engine#52079) 2024-04-15 [email protected] [Impeller] organize shaders a bit, make filter shaders use same vertex source. (flutter/engine#52113) 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 [email protected],[email protected],[email protected] 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://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Use a faster method to compute the number of subdivisions of quadradic and cubic curves. Unlike the adaptive subdivison we use this may give us more line segments around straight-ish parts of a curve ... but who cares! the rasterizer can handle it. This is enough to lop off about 2ms from the animated tessellation benchmark (5.5 to 3.5 on a Pixel 7), and there are some additional savings we can book by removing some of the incidental allocations. This part will be done in a follow up (#52078).
Before
After
From looking at the proproptions I think this is in the 3x-5x faster range.
Code originally taken from https://github.com/google/skia/blob/main/src/gpu/tessellate/WangsFormula.h