-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Compute UV coordinates lazily in PositionUVWriter #50879
[Impeller] Compute UV coordinates lazily in PositionUVWriter #50879
Conversation
| effect_transform_(effect_transform) {} | ||
|
|
||
| const std::vector<TextureFillVertexShader::PerVertexData>& GetData() const { | ||
| const std::vector<TextureFillVertexShader::PerVertexData>& GetData() { |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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
jonahwilliams
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…144049) flutter/engine@fbc9b88...5d1c0d4 2024-02-23 [email protected] [Impeller] Compute UV coordinates lazily in PositionUVWriter (flutter/engine#50879) 2024-02-23 [email protected] Roll Skia from 49dd7ed24bec to fde4d63c5e61 (3 revisions) (flutter/engine#50917) 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

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.