Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Impeller] Direct tessellation of simple filled round rects #48919

Merged
merged 2 commits into from
Dec 12, 2023

Conversation

flar
Copy link
Contributor

@flar flar commented Dec 12, 2023

Simple round rects with the same width and height at each corner are tessellated directly for fill operations, but not yet for stroke operations.

@flutter-dashboard
Copy link

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.

Changes reported for pull request #48919 at sha 519583f

Copy link
Member

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with minor nit.

Have you benchmarked this compared to the current approach for RRects + Skia?

Comment on lines +494 to +496
} else {
return FilledEllipse(view_transform, bounds);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uber-nit

Suggested change
} else {
return FilledEllipse(view_transform, bounds);
}
}
return FilledEllipse(view_transform, bounds);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious what is the reasoning for the nit.

One advantage of using the else is that it makes sure that the "previous implementation code" did, in fact, return - otherwise the method would lack a return statement.

I just ran into a case of that within this PR where I forgot to return after "doing one version of the work" of a method and so ended up doing "both versions of the work" instead.

Copy link
Contributor Author

@flar flar Dec 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's basically a case of "do this OR do that".

Also, if it is "do 1 line of code or do 30 lines of code", readability might be improved by

  if (condition) {
    1 line;
    return
  };
  30 lines;

but in this case both blocks are small.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that is a fair point. Generally I would say that I prefer that we use as little nesting as possible. So if you think of this as an early return, then it makes sense to remove the nesting. As you point out, you could also think about this as being, return one of two options, so it makes sense to leave the else.

Some thoughts on the matter can be seen at https://engdoc.corp.google.com/eng/doc/tott/episodes/651.md?cl=head and https://engdoc.corp.google.com/eng/doc/tott/episodes/680.md?cl=head

I'd say taking either approach is fine, I tend to (overly simplistically probably) push for unnesting.

@flar
Copy link
Contributor Author

flar commented Dec 12, 2023

I didn't bother to graph them, but on a quick run of my primitive basher I saw:

Skia - 5ms/frame
Old code - 13ms/frame
New code - 7ms/frame

Copy link
Member

@bdero bdero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@flar flar added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 12, 2023
@auto-submit auto-submit bot merged commit dabf364 into flutter:main Dec 12, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Dec 13, 2023
…140084)

flutter/engine@9039ac7...fc32677

2023-12-13 [email protected] Revert Dart SDK back to 3.3.0-219.0.dev (flutter/engine#48990)
2023-12-13 [email protected] [Impeller] Use direct tessellation geometry for simple clip shapes (flutter/engine#48959)
2023-12-13 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[Android] Re-land "Add target to have linux_android_emulator_tests run on AVDs with Android 33 & 34"" (flutter/engine#48988)
2023-12-13 [email protected] Add a constructor for `GlyphInfo`. (flutter/engine#48971)
2023-12-13 [email protected] [Windows] Refactor surface manager mocking (flutter/engine#48953)
2023-12-13 [email protected] Roll Skia from 6e5bd9b1d91d to f3401c6186c1 (2 revisions) (flutter/engine#48981)
2023-12-13 [email protected] Roll Skia from 1e63c048ded7 to 6e5bd9b1d91d (1 revision) (flutter/engine#48973)
2023-12-13 [email protected] Roll Skia from 927f20598b11 to 1e63c048ded7 (1 revision) (flutter/engine#48968)
2023-12-13 [email protected] Roll Dart SDK from 17143c130ab3 to 114f2e8de3e5 (1 revision) (flutter/engine#48969)
2023-12-13 [email protected] Workarounds for clang-tidy warnings in the next roll of Clang (flutter/engine#48963)
2023-12-13 [email protected] Migrate `impeller/**.h` to header guards. (flutter/engine#48962)
2023-12-13 [email protected] Roll Dart SDK from 02f28120470f to 17143c130ab3 (1 revision) (flutter/engine#48961)
2023-12-13 [email protected] [Android] Re-land "Add target to have linux_android_emulator_tests run on AVDs with Android 33 & 34" (flutter/engine#48936)
2023-12-13 [email protected] Roll Skia from 49e32eb178a7 to 927f20598b11 (3 revisions) (flutter/engine#48956)
2023-12-13 [email protected] [web:multiview] Make CanvasKitRenderer listen for view creation/disposal events (flutter/engine#48812)
2023-12-12 [email protected] Move `third_party/swiftshader`, roll buildroot `DEPS`. (flutter/engine#48946)
2023-12-12 [email protected] [Impeller] Direct tessellation of simple filled round rects (flutter/engine#48919)
2023-12-12 [email protected] Roll Skia from 8e8d92ac1536 to 49e32eb178a7 (1 revision) (flutter/engine#48949)
2023-12-12 [email protected] Roll Dart SDK from a677378ae254 to 02f28120470f (1 revision) (flutter/engine#48945)
2023-12-12 [email protected] Roll Skia from 43a400456ab4 to 8e8d92ac1536 (1 revision) (flutter/engine#48941)
2023-12-12 [email protected] Roll Skia from 3678212a85b8 to 43a400456ab4 (2 revisions) (flutter/engine#48939)
2023-12-12 [email protected] Roll `buildroot` and delete `libxml`. (flutter/engine#48906)
2023-12-12 [email protected] Roll Skia from 16298087c277 to 3678212a85b8 (2 revisions) (flutter/engine#48934)
2023-12-12 [email protected] Manual roll of Dart SDK from 82c4571bb2de to a677378ae254 (flutter/engine#48933)
2023-12-12 [email protected] Roll Skia from 7685acfb6221 to 16298087c277 (1 revision) (flutter/engine#48931)
2023-12-12 [email protected] [web] Handle resizes at the view level (flutter/engine#48892)

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
const Matrix& view_transform,
const Rect& bounds,
const Size& radii) {
if (radii.width * 2 < bounds.GetSize().width &&
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be || not &&. Reverting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert wasn't clean so I fixed it instead: #49021

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App e: impeller will affect goldens
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants