这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@flar
Copy link
Contributor

@flar flar commented Apr 8, 2025

Currently Impeller asks incoming paths to convert themselves into the impeller::Path class before tessellating their outlines. This wastes conversion time when the path is only needed to iterate the path segments. We now tessellate them directly from a path segment dispatcher saving the conversion cost.

@flar flar requested review from gaaclarke and jonahwilliams and removed request for gaaclarke April 8, 2025 16:01
@github-actions github-actions bot added engine flutter/engine related. See also e: labels. e: impeller Impeller rendering backend issues and features requests labels Apr 8, 2025
@flar flar requested a review from gaaclarke April 8, 2025 16:01
@flar
Copy link
Contributor Author

flar commented Apr 8, 2025

This PR currently only does the filling side of things, but will eventually address stroking. I haven't checked clipping yet, but if it doesn't use FillGeometry directly, it can be converted easily as well.

One planned side benefit for this work is that we should tessellate stroked paths directly from the PathReceiver to the widened tessellation without first generating a polygonalized version of the path, thus saving the intermediate allocation time and storage for the unwidened polygon.

There is some incidental de-skiafication work here that was originally started because I was trying to minimize the footprint of the DlPath code, but I eventually went with a new impeller::PathReceiver interface class that avoids most of Impeller's internal implementation code of needing to know about DlPath in the first place. I left it in because it is a good step forward, but it wasn't truly necessary to switch from path conversion to path iteration.

Copy link
Contributor

@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.

Approach LGTM, with some nits

We should monitor the path tessellation benchmarks to see if we get an improvement there (as we'd previously just moved the work around between ui/raster, now it should drop off)

.SetBounds(rse.GetBounds())
.TakePath();
DrawPath(path, paint);
DrawPath(flutter::DlPath(path), paint);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this end up converting back to a Skia path (here and above)?

That is probably ok as a first step, but if we're going to end up converting a draw to a path we should do so while recording.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can iterate directly from either SkPath or impeller::Path. The only code that would force a conversion would be DlPath::GetPath() or DlPath::GetSkPath(). Skia will use GetSkPath() until we stop using Skia, but impeller can switch from GetPath to iterators to avoid any conversions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I'm done with this work I may be able to delete DlPath::GetPath() -> impeller::Path.

@github-actions github-actions bot added the platform-fuchsia Fuchsia code specifically label Apr 8, 2025
@flar
Copy link
Contributor Author

flar commented Apr 8, 2025

None of this work had been done on UI I don't think. DL dispatch should have always been happening on raster thread. It's a question of removing conversion of the path description in favor of just interpreting the original description.

I think for fills it should be pretty close, but there is the potential that I've introduced more layers of vtable dispatch somewhere.

For strokes we can eliminate the intermediate un-widened polygonal storage, but again at the cost of more work being done on the fly inside virtual methods.

@flar
Copy link
Contributor Author

flar commented Apr 8, 2025

I double-checked. ClipPath uses FillPathGeometry which is converted so we are using the new paradigm for both filled and clipped paths.

@flar flar marked this pull request as ready for review April 8, 2025 19:27
@flar
Copy link
Contributor Author

flar commented Apr 8, 2025

Marked it ready for review, but I'm still planning to add some more specific unit tests for the new code.

@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.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #166759 at sha 02fab07

@flutter-dashboard flutter-dashboard bot added the will affect goldens Changes to golden files label Apr 8, 2025
@flar
Copy link
Contributor Author

flar commented Apr 8, 2025

The one golden diff is a mystery. I don't think I changed the way in which we tessellate the curves by this change so I'm not sure why we'd see "edge fuzziness" on the curves in that one test...

@jonahwilliams
Copy link
Contributor

Seems like a pretty harmless diff

@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Changes reported for pull request #166759 at sha 86a6510

@flar
Copy link
Contributor Author

flar commented Apr 9, 2025

Any last looks? I triaged the golden diff and the unit tests are in now...

@jonahwilliams
Copy link
Contributor

I took another quick look ... LGTM!

Ship itttttt

@flar flar added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 9, 2025
romanejaquez pushed a commit to romanejaquez/flutter that referenced this pull request Aug 14, 2025
Currently Impeller asks incoming paths to convert themselves into the
impeller::Path class before tessellating their outlines. This wastes
conversion time when the path is only needed to iterate the path
segments. We now tessellate them directly from a path segment dispatcher
saving the conversion cost.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e: impeller Impeller rendering backend issues and features requests engine flutter/engine related. See also e: labels. platform-fuchsia Fuchsia code specifically will affect goldens Changes to golden files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants