[Impeller] Ensure known geometry has simple bounds computation.#46623
[Impeller] Ensure known geometry has simple bounds computation.#46623auto-submit[bot] merged 3 commits intoflutter:mainfrom
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
| PathBuilder{} | ||
| .AddCircle(center, radius) | ||
| .SetConvexity(Convexity::kConvex) | ||
| .SetBounds(Rect::MakeLTRB(center.x - radius, center.y - radius, |
There was a problem hiding this comment.
Should this part also have a unit test?
| auto path = PathBuilder{} | ||
| .SetConvexity(Convexity::kConvex) | ||
| .AddRoundedRect(rect, corner_radius) | ||
| .SetBounds(rect) |
There was a problem hiding this comment.
So, the gist is that if you don't call SetBounds, it is getting calculated instead? What about rounded rects that have extreme corner radii? Does that become a shape whose bounds are different than the one specified in the draw call?
There was a problem hiding this comment.
Yes, normally we use the Skia computed bounds - but the Aiks API doesn't accomidated that. What are you thinking of for extreme corner radii?
There was a problem hiding this comment.
Running some tests:
for (auto i = - 100; i < 100; i += 10) {
SkRRect rrect = SkRRect::MakeRectXY(SkRect::MakeLTRB(0, 0, 100, 100), i, i);
SkPath path = SkPath().addRRect(rrect);
auto bds = path.getBounds();
FML_LOG(ERROR) << "Bounds for RRect with radius " << i << " -> " << bds.x() << "," << bds.y() << "m" << bds.width() << "," << bds.height();
}
Result:
[ERROR:flutter/impeller/display_list/dl_unittests.cc(1748)] Bounds for RRect with radius -100 -> 0,0m100,100
[ERROR:flutter/impeller/display_list/dl_unittests.cc(1748)] Bounds for RRect with radius -90 -> 0,0m100,100
[ERROR:flutter/impeller/display_list/dl_unittests.cc(1748)] Bounds for RRect with radius -80 -> 0,0m100,100
[ERROR:flutter/impeller/display_list/dl_unittests.cc(1748)] Bounds for RRect with radius -70 -> 0,0m100,100
[ERROR:flutter/impeller/display_list/dl_unittests.cc(1748)] Bounds for RRect with radius -60 -> 0,0m100,100
[ERROR:flutter/impeller/display_list/dl_unittests.cc(1748)] Bounds for RRect with radius -50 -> 0,0m100,100
[ERROR:flutter/impeller/display_list/dl_unittests.cc(1748)] Bounds for RRect with radius -40 -> 0,0m100,100
[ERROR:flutter/impeller/display_list/dl_unittests.cc(1748)] Bounds for RRect with radius -30 -> 0,0m100,100
[ERROR:flutter/impeller/display_list/dl_unittests.cc(1748)] Bounds for RRect with radius -20 -> 0,0m100,100
[ERROR:flutter/impeller/display_list/dl_unittests.cc(1748)] Bounds for RRect with radius -10 -> 0,0m100,100
[ERROR:flutter/impeller/display_list/dl_unittests.cc(1748)] Bounds for RRect with radius 0 -> 0,0m100,100
[ERROR:flutter/impeller/display_list/dl_unittests.cc(1748)] Bounds for RRect with radius 10 -> 0,0m100,100
[ERROR:flutter/impeller/display_list/dl_unittests.cc(1748)] Bounds for RRect with radius 20 -> 0,0m100,100
[ERROR:flutter/impeller/display_list/dl_unittests.cc(1748)] Bounds for RRect with radius 30 -> 0,0m100,100
[ERROR:flutter/impeller/display_list/dl_unittests.cc(1748)] Bounds for RRect with radius 40 -> 0,0m100,100
[ERROR:flutter/impeller/display_list/dl_unittests.cc(1748)] Bounds for RRect with radius 50 -> 0,0m100,100
[ERROR:flutter/impeller/display_list/dl_unittests.cc(1748)] Bounds for RRect with radius 60 -> 0,0m100,100
[ERROR:flutter/impeller/display_list/dl_unittests.cc(1748)] Bounds for RRect with radius 70 -> 0,0m100,100
[ERROR:flutter/impeller/display_list/dl_unittests.cc(1748)] Bounds for RRect with radius 80 -> 0,0m100,100
[ERROR:flutter/impeller/display_list/dl_unittests.cc(1748)] Bounds for RRect with radius 90 -> 0,0m100,100
There was a problem hiding this comment.
I was wondering if when the corner radius was high would it start looking more like a circle that was inset in the rect. LGTM.
There was a problem hiding this comment.
Did you try this with reversed rects? RRects is one of the areas where Skia was doing "auto-sorting" of the corners of the rects...
flutter/engine@1bb228d...eb5d5c6 2023-10-06 [email protected] [Impeller] Ensure known geometry has simple bounds computation. (flutter/engine#46623) 2023-10-06 [email protected] [Impeller] Refactor CapabilitiesGLES into a Capabilties. (flutter/engine#46621) 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://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
…6094) flutter/engine@1bb228d...eb5d5c6 2023-10-06 [email protected] [Impeller] Ensure known geometry has simple bounds computation. (flutter/engine#46623) 2023-10-06 [email protected] [Impeller] Refactor CapabilitiesGLES into a Capabilties. (flutter/engine#46621) 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://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
Computing the bounds of an RRect can be really slow if you don't actually know that it is an RRect, and shows up in the traces for flutter gallery on wembly. This change should be semantically equivalent and is only an optimization to avoid recomputing the same value we already know.
Computing the bounds of an RRect can be really slow if you don't actually know that it is an RRect, and shows up in the traces for flutter gallery on wembly. This change should be semantically equivalent and is only an optimization to avoid recomputing the same value we already know.