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

Conversation

jonahwilliams
Copy link
Contributor

@jonahwilliams jonahwilliams commented Nov 9, 2023

Work towards flutter/flutter#138004

@jonahwilliams jonahwilliams marked this pull request as ready for review November 9, 2023 15:33
@jonahwilliams jonahwilliams requested a review from bdero November 9, 2023 15:33
@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 #47845 at sha 28eed8a

@chinmaygarde chinmaygarde changed the title [Impeller] faster path for circle geometry, rename. [Impeller] Faster path for circle geometry, rename compute path geometry. Nov 9, 2023
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, just a couple of suggestions. Feel free to punt, of course.

points[offset++] = origin;
points[offset++] = pt2;
pt2 = center + angle_table[j + 3];
points[offset++] = pt2;
Copy link
Member

Choose a reason for hiding this comment

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

You could reduce the verts by 1/3 by making this a triangle strip

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh, I had a brain fart. The reason this wasn't working is that this code is also used for draw points, so I'd also need to insert padding to break the strip. I'd rather leave this as is for now.

auto elapsed_angle = radian_start;
std::vector<Point> angle_table(vertices_per_geom);
for (auto i = 0u; i < vertices_per_geom; i++) {
angle_table[i] = Point(cos(elapsed_angle), sin(elapsed_angle)) * radius;
Copy link
Member

Choose a reason for hiding this comment

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

Instead of generating a table for the whole circle, you could just generate points for the 0 to PI/2 range and reuse the table for all 4 quadrants.

@jonahwilliams
Copy link
Contributor Author

From offline discussion: this code can be simplified by using a Triangle strip.

@jonahwilliams
Copy link
Contributor Author

I think this looks right but I want to double check goldens.

@jonahwilliams
Copy link
Contributor Author

Testing BTW

@flutter-dashboard
Copy link

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

Changes reported for pull request #47845 at sha 674a1d0

@flutter-dashboard
Copy link

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

Changes reported for pull request #47845 at sha c696eb9

jonahwilliams added 3 commits November 9, 2023 20:15
This reverts commit c696eb9.
This reverts commit 674a1d0.
This reverts commit 4ecec73.
return {};
}

Scalar min_size = 1.0f / sqrt(std::abs(determinant));
Copy link
Contributor

Choose a reason for hiding this comment

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

min_size is appropriate for strokes (i.e. when this is created from DrawPoints), but not when we are filling an actual circle (i.e. when created from DrawCircle).

@flar
Copy link
Contributor

flar commented Nov 10, 2023

One general comment is that I think it might be more useful to split this into Circle and Point geometry classes, but have their common code shared either via global/static methods that tesselate a circle or through a parent "CircleTesselatingGeometry" mixin class to inherit from. While both DrawPoints and DrawCircle may end up tesselating a circle, they generate them from different kinds of data and have different options. For example, DrawPoints may not involve circles at all and even when it does generate circles it will need to filter the radius through the minimum scale before it invokes the tesselation. A couple of lines of code in the split Geometry classes can do this work and then delegate to a common tesselation mechanism.

auto-submit bot pushed a commit that referenced this pull request Nov 10, 2023
…7846)

Impeller implements the DrawLine primitive as DrawPath on a path containing a single line. Benchmarks show that this can cost 30% overhead on apps that use a lot of DrawLine primitives. This PR creates a more direct Entity that can tesselate the geometry of a line directly.

The reduced overhead should help with flutter/flutter#138004

The current code will back off to Path rendering for round caps. When the circle geometry work is finished (#47845) we can come back and implement round caps using the code refactored in that PR.
@jonahwilliams
Copy link
Contributor Author

Closing in favor of flutter/flutter#138254

@jonahwilliams
Copy link
Contributor Author

Oops i mean: flutter/flutter#138254

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants