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] remove most temporary allocation during polyline generation. #52131

Merged
merged 9 commits into from
Apr 16, 2024

Conversation

jonahwilliams
Copy link
Member

@jonahwilliams jonahwilliams commented Apr 15, 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.


void VertexWriter::Write(Point point) {
points_.emplace_back(point);
if (uv_transform_.has_value()) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a bit wonky, but I have a plan to remove all CPU computation of uvs for path drawing: #52106

PathBuilder{}.AddRect(Rect::MakeLTRB(0, 0, 10, 10)).TakePath(), points,
indices, 1.0);

std::vector<Point> expected = {{10, 0}, {10, 10}, {0, 10}, {0, 0}};
Copy link
Member Author

Choose a reason for hiding this comment

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

There order of these changes because we hit the "first" point in the contour on close now.

@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 #52131 at sha 1b05f64

@jonahwilliams
Copy link
Member Author

The only golden is a minor trivial diff:

image

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 16, 2024
@auto-submit auto-submit bot merged commit 03b08d7 into flutter:main Apr 16, 2024
32 checks passed
@jonahwilliams jonahwilliams deleted the remove_polyline_allocation branch April 16, 2024 18:48
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 16, 2024
@jonahwilliams
Copy link
Member Author

reason for revert: breaking flutter logo rendering

image

@jonahwilliams jonahwilliams added the revert Label used to revert changes in a closed and merged pull request. label Apr 16, 2024
auto-submit bot pushed a commit that referenced this pull request Apr 16, 2024
@auto-submit auto-submit bot removed the revert Label used to revert changes in a closed and merged pull request. label Apr 16, 2024
auto-submit bot added a commit that referenced this pull request Apr 16, 2024
…generation. (#52131)" (#52177)

Reverts: #52131
Initiated by: jonahwilliams
Reason for reverting: breaking flutter logo rendering

![image](https://github.com/flutter/engine/assets/8975114/90a6d70f-db22-4684-80f9-1cea3dc21ac5)

Original PR Author: jonahwilliams

Reviewed By: {chinmaygarde}

This change reverts the following previous change:
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.
@jonahwilliams
Copy link
Member Author

This was probably relying on us closing paths? or pehaps this is messing up unclosed paths that are implicitly closed. At any rate this is a good example to go off of.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 16, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 17, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Apr 17, 2024
…146857)

flutter/engine@4d69c0c...e7d8c62

2024-04-16 [email protected] Migrate FlutterChannelKeyResponder and FlutterSpellCheckPlugin to ARC (flutter/engine#52148)
2024-04-16 [email protected] Roll Skia from b83b6bf7174f to e335a0a11aa0 (1 revision) (flutter/engine#52175)
2024-04-16 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[Impeller] remove most temporary allocation during polyline generation. (#52131)" (flutter/engine#52177)
2024-04-16 [email protected] Roll Skia from d506a3d526f7 to b83b6bf7174f (2 revisions) (flutter/engine#52173)
2024-04-16 [email protected] Migrate FlutterUIPressProxy, ios_context*, rendering_api_selection, and a few other files to ARC (flutter/engine#51633)
2024-04-16 [email protected] Roll Skia from 98dbba281a84 to d506a3d526f7 (2 revisions) (flutter/engine#52170)
2024-04-16 [email protected] Roll Dart SDK from f2464b2892a1 to 57d7cba5bc3d (1 revision) (flutter/engine#52168)
2024-04-16 [email protected] Roll Skia from 300741074b41 to 98dbba281a84 (11 revisions) (flutter/engine#52167)
2024-04-16 [email protected] [Impeller] removes advanced plus blending (flutter/engine#52163)
2024-04-16 [email protected] [Impeller] remove most temporary allocation during polyline generation. (flutter/engine#52131)
2024-04-16 [email protected] Roll reclient, libpng, and zlib (flutter/engine#52072)

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

flutter/engine@4d69c0c...e7d8c62

2024-04-16 [email protected] Migrate FlutterChannelKeyResponder and FlutterSpellCheckPlugin to ARC (flutter/engine#52148)
2024-04-16 [email protected] Roll Skia from b83b6bf7174f to e335a0a11aa0 (1 revision) (flutter/engine#52175)
2024-04-16 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[Impeller] remove most temporary allocation during polyline generation. (flutter#52131)" (flutter/engine#52177)
2024-04-16 [email protected] Roll Skia from d506a3d526f7 to b83b6bf7174f (2 revisions) (flutter/engine#52173)
2024-04-16 [email protected] Migrate FlutterUIPressProxy, ios_context*, rendering_api_selection, and a few other files to ARC (flutter/engine#51633)
2024-04-16 [email protected] Roll Skia from 98dbba281a84 to d506a3d526f7 (2 revisions) (flutter/engine#52170)
2024-04-16 [email protected] Roll Dart SDK from f2464b2892a1 to 57d7cba5bc3d (1 revision) (flutter/engine#52168)
2024-04-16 [email protected] Roll Skia from 300741074b41 to 98dbba281a84 (11 revisions) (flutter/engine#52167)
2024-04-16 [email protected] [Impeller] removes advanced plus blending (flutter/engine#52163)
2024-04-16 [email protected] [Impeller] remove most temporary allocation during polyline generation. (flutter/engine#52131)
2024-04-16 [email protected] Roll reclient, libpng, and zlib (flutter/engine#52072)

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
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.
2 participants