Skip to content
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] Reland: remove most temporary allocation during polyline generation. #52180

Merged
merged 21 commits into from
Apr 18, 2024

Conversation

jonahwilliams
Copy link
Member

@jonahwilliams jonahwilliams commented Apr 16, 2024

Part of flutter/flutter#143077

Only allocate into reused arenas instead of allocating a new vector of data. Fixes flutter/flutter#133348

Also moves tessellation logic into the c/tessellator and out of the impeller tessellator. This was necessary to fix a compilation error. introduced by including host_buffer -> allocator -> fml mapping -> window.h include which has a function definition that conflicts with the c tessellator definition.

Fixes missing points in case a filled path is not explicitly closed.

@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 #52180 at sha 235d02f

@jonahwilliams
Copy link
Member Author

One of these goldens looks wrong and the other didn't show up, investigating.

@jonahwilliams
Copy link
Member Author

jonahwilliams commented Apr 17, 2024

Should be fixed. THe stroke path issue was different than I thought so I pulled that change out of this PR.


// Note: the origin point is repeated but not referenced in the indices
// below
std::vector<Point> expected = {{0, 0}, {10, 0}, {10, 10}, {0, 10}, {0, 0}};
Copy link
Member Author

@jonahwilliams jonahwilliams Apr 17, 2024

Choose a reason for hiding this comment

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

The change here is that the first point is repeated if a contour is closed, where as it isn't repeated if it isn't closed. But we don't reference the first point multiple times (in the index buffer) so the triangles are the same.

This is because we need to make sure that a filled shape without an explicit close includes the first point.

@flutter-dashboard
Copy link

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

Changes reported for pull request #52180 at sha cdbb63e

@jonahwilliams
Copy link
Member Author

PTAL @chinmaygarde

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 18, 2024
@auto-submit auto-submit bot merged commit 46ff024 into flutter:main Apr 18, 2024
32 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 18, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Apr 18, 2024
…147005)

flutter/engine@6abfa56...46ff024

2024-04-18 [email protected] [Impeller] Reland: remove most temporary allocation during polyline generation. (flutter/engine#52180)

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
jonahwilliams added a commit to jonahwilliams/engine that referenced this pull request Apr 22, 2024
gilnobrega pushed a commit to gilnobrega/flutter that referenced this pull request Apr 22, 2024
…lutter#147005)

flutter/engine@6abfa56...46ff024

2024-04-18 [email protected] [Impeller] Reland: remove most temporary allocation during polyline generation. (flutter/engine#52180)

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
@jason-simmons
Copy link
Member

Noticed an issue in the benchmark results related to this PR before it was reverted.

The index_buffer_->clear() and point_buffer_->clear() calls in Tessellator::TessellateConvexInternal should instead use the index_buffer and point_buffer parameters.

If this is relanded, then Tessellator::TessellateConvexInternal should be made a static method with that patch applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App e: impeller will affect goldens
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Impeller] FillPointsForPolyLine and TessellateConvex have too much allocation.
3 participants