-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] rectangle packer actually packs. #52781
Conversation
| ASSERT_EQ(packer->PercentFull(), 0); | ||
| } | ||
|
|
||
| TEST_P(TypographerTest, GlyphAtlasTextureIsRecycledWhenContentsAreRecreated) { |
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.
This test really depends on the exact atlas sizing and how efficient the packing is, making it unstable. I'm removing it for now.
|
|
||
| #include <algorithm> | ||
| #include <vector> | ||
| #include "fml/logging.h" |
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.
Nit: flutter/fml/logging.h
| bool AddRect(int w, int h, IPoint16* loc) final; | ||
|
|
||
| Scalar PercentFull() const final { | ||
| float PercentFull() const final { |
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.
Scalars are floats already.
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.
Fixed
| // 'y' with the y-location at which it fits (the x location is pulled from | ||
| // 'skylineIndex's segment. | ||
| bool rectangleFits(int skylineIndex, int width, int height, int* y) const; | ||
| bool rectangleFits(size_t skylineIndex, int width, int height, int* y) const; |
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.
Here and elsewhere, use the PascalCase per the style guide?
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.
Fixed
| for (int i = skylineIndex + 1; i < (int)skyline_.size(); ++i) { | ||
| // The new segment subsumes all or part of skyline_[i] | ||
| for (auto i = skylineIndex + 1; i < skyline_.size(); ++i) { | ||
| // The new segment subsumes all or part of fSkyline[i] |
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.
If fSkyline referring to the right ivar?
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.
oops, I had re-ported this from skia and missed some renames.
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.
Fixed
| for (auto i = 0u; i < skyline_.size(); ++i) { | ||
| int y; | ||
| if (this->rectangleFits(i, width, height, &y)) { | ||
| if (this->RectangleFits(i, width, height, &y)) { |
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.
this-> is redundant.
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.
Done
| if (skyline_[i].y_ == skyline_[i + 1].y_) { | ||
| skyline_[i].width_ += skyline_[i + 1].width_; | ||
| skyline_.erase(std::next(skyline_.begin(), i)); | ||
| skyline_.erase(skyline_.begin() + i + 1); |
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 always have a tough time reading the stuff that returns an iterator you must use to modify the container.
But, this is an off by one error right? That is std::next(begin(), i) + 1 would have been the same thing?
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.
Yeah, looking at the diff I think this was the bug.
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.
Thanks. I was wondering what was different.
…148274) flutter/engine@7dcbd93...13a561c 2024-05-13 [email protected] [Impeller] rectangle packer actually packs. (flutter/engine#52781) 2024-05-13 [email protected] Roll Skia from 75b3286ecaac to 400c6fbeace8 (6 revisions) (flutter/engine#52783) 2024-05-13 [email protected] ios_external_view_embedder to ARC (flutter/engine#52782) 2024-05-13 [email protected] Roll Dart SDK from a0a940f07d56 to 7c7767ecc3d7 (2 revisions) (flutter/engine#52777) 2024-05-13 [email protected] Remove outdated comment. (flutter/engine#52778) 2024-05-13 [email protected] [Impeller] Prepare a SkiaGPU-less iOS build. (flutter/engine#52748) 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] 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
Fixes flutter/flutter#148251
Work towards flutter/flutter#138798
The rectangle packer was only filling up the top and right edge of each rectangle, making the atlas super inefficient.