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] geometry changes to support line/point style. #56340

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jonahwilliams
Copy link
Member

@jonahwilliams jonahwilliams commented Nov 2, 2024

Split off from #55230 . Adds getter that tracks if a Path is a single contour.

################################

flutter/flutter#152702

@@ -71,7 +71,8 @@ class StripVertexWriter : public VertexWriter {
class GLESVertexWriter : public VertexWriter {
public:
explicit GLESVertexWriter(std::vector<Point>& points,
std::vector<uint16_t>& indices);
std::vector<uint16_t>& indices,
bool line_strip = false);
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a docstring for what line_strip is? Maybe just link to tessellator's documentation.

/// @return A point vector containing the vertices in triangle strip format.
/// Matrix::GetMaxBasisLengthXY of the CTM applied to
/// the path for rendering.
/// @param[in] line_strip if true, generates line strip geometry instead of a
Copy link
Member

Choose a reason for hiding this comment

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

What is a "line strip"? A triangle strip that makes a line?

Copy link
Member Author

Choose a reason for hiding this comment

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

A line strip is a GL_LINE_STRIP geometry. How about a link to the primitive type?

Copy link
Member

Choose a reason for hiding this comment

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

I don't understand why a tessellator would be generating a line strip, tessellation means converting something to packed polygons (triangles in our case). I see, this is doing stuff like converting a bezier path to a line strip?

Yea, mentioning GL_LINE_STRIP would help to distinguish it from a line make with a triangle strip. Especially since a generating a GL_LINE_STRIP isn't technically tessellation.

The brief for this method also explicitly says it creates a triangle fan structure, that should be updated.

Now that I think of it. Don't you think this would be better off as it's own function instead of a bool parameter? Generally it's advised to make procedures do 1 thing. We can share the code in a helper function.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I agree with you, a separate method would be better in this case. I suppose since its a line primitive its not exactly tessellation but primitive generation :)

Comment on lines +57 to +58
point_buffer.GetBuffer()->Flush(point_buffer.GetRange());
index_buffer.GetBuffer()->Flush(index_buffer.GetRange());
Copy link
Member

Choose a reason for hiding this comment

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

Is there a test for these changes?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't have a test case for this, except for the fact that it may or may not work on swiftshader. I don't want to add a mock test for these, instead I think switching to the point arena like we did for strokes is probably better?

Copy link
Member

Choose a reason for hiding this comment

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

So, you're saying if this wasn't here the goldens would look wrong? Sounds good to me.

Copy link
Member Author

Choose a reason for hiding this comment

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

It would be racy :(

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

lgtm! thanks

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 7, 2024
Copy link
Contributor

auto-submit bot commented Nov 7, 2024

auto label is removed for flutter/engine/56340, due to - The status or check suite Mac mac_ios_engine has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 7, 2024

std::pair<size_t, size_t> GetVertexCount() const;

const std::vector<Point>& GetOveriszedBuffer() const;
Copy link
Contributor

Choose a reason for hiding this comment

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

typo Overiszed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants