[Impeller] rectangle packer actually packs.#52781
[Impeller] rectangle packer actually packs.#52781auto-submit[bot] merged 3 commits intoflutter:mainfrom
Conversation
| ASSERT_EQ(packer->PercentFull(), 0); | ||
| } | ||
|
|
||
| TEST_P(TypographerTest, GlyphAtlasTextureIsRecycledWhenContentsAreRecreated) { |
There was a problem hiding this comment.
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.
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.
Scalars are floats already.
| // '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.
Here and elsewhere, use the PascalCase per the style guide?
| 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.
If fSkyline referring to the right ivar?
There was a problem hiding this comment.
oops, I had re-ported this from skia and missed some renames.
| for (auto i = 0u; i < skyline_.size(); ++i) { | ||
| int y; | ||
| if (this->rectangleFits(i, width, height, &y)) { | ||
| if (this->RectangleFits(i, width, height, &y)) { |
| 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.
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.
Yeah, looking at the diff I think this was the bug.
There was a problem hiding this comment.
Thanks. I was wondering what was different.
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.