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

[Impeller] basic outline of geometry classes + vertices#36649

Merged
auto-submit[bot] merged 7 commits intoflutter:mainfrom
jonahwilliams:geometry_start
Oct 7, 2022
Merged

[Impeller] basic outline of geometry classes + vertices#36649
auto-submit[bot] merged 7 commits intoflutter:mainfrom
jonahwilliams:geometry_start

Conversation

@jonahwilliams
Copy link
Contributor

I took an initial stab at some of the API in go/impeller-geometry. This only works for vertices so far. Some findings:

  • I'm not sure if we'll be able to get away with one fragment shader per color source. vertices supports per-vertex color blending with the given color source. Still, that's not a huge number.

I put the geometry implementation in a single TU in impeller/entity. renderer felt too low level, and geometry doesn't have the necessary dependencies.

The pipeline declarations are awkward since I'm jamming all of this functionality into vertices for now, but once we remove the vertices_contents and make the other color sources support it it should hopefully simplify a bit.

Punted on adding support for texture coordinates to vertices for now

return {};
}

GeometryVertexType VerticesGeometry::GetVertexType() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a bool in the design, but we'll need to figure out all of the vertices combinations to support first - the color sources might need to know about it.

For example, if we have texture coordinates and a tiled texture image source, blend mode, and a paint color, do we need to blend those together?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah geez, I knew I was forgetting something. I need to go through and check all these cases. If we end up needing to blend in the vertex colors for images and/or gradients, I think we can easily support it by finish up adding all the blends on the GPU and basically do 23 item switch statement -- although dynamic dispatch should be possible on some backends!

Copy link
Contributor

Choose a reason for hiding this comment

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

(In practice this would just look like a couple of extra uniforms and a call into a shader library function in each color source fragment shader.)

@jonahwilliams jonahwilliams marked this pull request as ready for review October 6, 2022 22:06
@jonahwilliams jonahwilliams self-assigned this Oct 6, 2022
Copy link
Contributor

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

Fantastic! LGTM!

void VerticesContents::SetGeometry(std::unique_ptr<Geometry> geometry) {
geometry_ = std::move(geometry);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Passing this into VerticesContents to start using it right away is a cool idea.

Copy link
Contributor

Choose a reason for hiding this comment

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

This and the GetCoverage seem like something that could eventually just be members of the base contents class, or perhaps of some base GeometryContents class?

Copy link
Contributor

Choose a reason for hiding this comment

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

This should go on the ColorSourceContents base class once we start upgrading the color sources. Some Contents (namely FilterContents) take other Contents as input as opposed to Geometry.

Copy link
Contributor

Choose a reason for hiding this comment

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

(VerticesContents should also go away and/or be renamed to ColorColorSourceContents in the end)

Copy link
Contributor Author

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

This breaks some stuff with drawVertices + colors, still looking at it

@jonahwilliams
Copy link
Contributor Author

forgot to break 🤦

@skia-gold
Copy link

Gold has detected about 2 new digest(s) on patchset 7.
View them at https://flutter-engine-gold.skia.org/cl/github/36649

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 7, 2022
@auto-submit auto-submit bot merged commit a36a34b into flutter:main Oct 7, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 7, 2022
@jonahwilliams jonahwilliams deleted the geometry_start branch October 7, 2022 06:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App e: impeller

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants