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

Conversation

@flar
Copy link
Contributor

@flar flar commented Feb 22, 2024

The stroking code was performing texture coordinate conversion on each created vertex. Since there were often very few calculations needed for each vertex, interspersing a coordinate transform with each vertex append was clogging up the code.

This change will defer the calculation of the texture coordinates until the end of the stroking process so that the polyline widening code can do its job efficiently and then later the coordinate conversion code can do its job also efficiently in a tight loop. This change also opened up the opportunity to optimize a common case (no effect transform) even more than before.

@flar
Copy link
Contributor Author

flar commented Feb 22, 2024

Here is an example of the expected improvements in performance on the stroke..._uv benchmarks:

Performance of aggressive vs lazy UV computations

effect_transform_(effect_transform) {}

const std::vector<TextureFillVertexShader::PerVertexData>& GetData() const {
const std::vector<TextureFillVertexShader::PerVertexData>& GetData() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that I removed the "const" qualifier here so that the code could lazily update the data_ array. The corresponding method in the regular PositionWriter is still declared "const" because it has no such lazy work to do and these 2 classes are "related" but do not inherit from each other.

I was waffling on whether both should be consistent in whether they are declared "const", for symmetry, or not...

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that is probably fine

@flar flar requested a review from jonahwilliams February 22, 2024 21:28
Copy link
Contributor

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

LGTM

@flar flar added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 23, 2024
@auto-submit auto-submit bot merged commit 5d1c0d4 into flutter:main Feb 23, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 23, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Feb 23, 2024
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

None yet

Development

Successfully merging this pull request may close these issues.

2 participants