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

[Impeller] Respect max supported texture size when allocating glyph atlas texture. #45992

Merged
merged 1 commit into from
Sep 18, 2023

Conversation

chinmaygarde
Copy link
Member

The earlier limit of 4096u was pessimistically small on some backends and too big on others (like older versions of OpenGL ES). The former would stop glpyhs from rendering when they got sufficiently large or numerous. The latter would cause errors on texture allocation.

The full fix is tracked in flutter/flutter#133092

…tlas texture.

The earlier limit of 4096u was pessimistically small on some backends
and too big on others (like older versions of OpenGL ES). The former
would stop glpyhs from rendering when they got sufficiently large or
numerous. The latter would cause errors on texture allocation.

The full fix is tracked in flutter/flutter#133092
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie or stuartmorgan on the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@chinmaygarde
Copy link
Member Author

Drive-by workaround for flutter/flutter#134292

Copy link
Member

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

  1. Can we have a test for this? i.e. something in typopgrapher that creates glyphs of a known size closer to the max texture limit or something?

Or a test that adds glyphs until it fails and checks that the size is the max texture limit?

  1. Did you verify this fixes the linked issue? This will definitely improve things but I'm not sure if we also need to do @bdero 's fix for multiple atlas textures.

@chinmaygarde
Copy link
Member Author

Yeah, this improves things but I am more worried about the OpenGL backend where the min size is lower. Instead of not rendering more glyphs, I believe not being able to allocate the texture will lead to rasterizer teardown. Just wanted to get ahead of this badness.

@bdero fix is definitely necessary. This just prevents the teardown on OpenGL ES and improves things on Metal. We can add the testing there as this will interact with typography and capabilities and will be reworked soon hopefully.

@chinmaygarde chinmaygarde self-assigned this Sep 18, 2023
Copy link
Member

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

Change LGTM.

We could probably capture this in a Metal golden by trying to render a bunch of big emojis on Metal -- that'd trip a validation failure past the 4096 limit when is this change isn't present. That being said, that would be a somewhat lousy test due to the environment dependence. We'd really need a fake/mock context to bake this behavior down into a reliable test.

Maybe the fact that our existing text goldens continue not breaking is OK for now.

glyph_positions, //
atlas_context, //
type, //
context.GetResourceAllocator()->GetMaxTextureSizeSupported() //
Copy link
Member

Choose a reason for hiding this comment

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

Oh nice, I didn't realize we had this yet.

} while (current_size.width <= kMaxAtlasSize &&
current_size.height <= kMaxAtlasSize);
} while (current_size.width <= max_texture_size.width &&
current_size.height <= max_texture_size.height);
Copy link
Member

Choose a reason for hiding this comment

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

Can you also add this change to the STB backend? It's similarly pinned to an arbitrary texture size.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, my bad. Didn't notice this call to action. Filing a followup.

Copy link
Member Author

Choose a reason for hiding this comment

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

Filed #46010

@chinmaygarde chinmaygarde added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 18, 2023
@auto-submit auto-submit bot merged commit 386320b into flutter:main Sep 18, 2023
@chinmaygarde chinmaygarde deleted the atsize branch September 18, 2023 22:39
chinmaygarde added a commit to chinmaygarde/flutter_engine that referenced this pull request Sep 18, 2023
Gets rid of the hardcoded 2048 px size.

Followup from review comment left unaddressed in flutter#45992.

Missing this will be less easy after flutter/flutter#133029.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 19, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 19, 2023
auto-submit bot pushed a commit that referenced this pull request Sep 19, 2023
Gets rid of the hardcoded 2048 px size.

Followup from review comment left unaddressed in #45992.

Missing this will be less easy after flutter/flutter#133029.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 19, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 19, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Sep 19, 2023
…134998)

flutter/engine@e1c784e...589bde9

2023-09-19 [email protected] Roll Skia from 4122791099ce to 744807d740c7 (1 revision) (flutter/engine#46019)
2023-09-19 [email protected] [Android] Add support for setting thread affinity based on core speed. (flutter/engine#45673)
2023-09-19 [email protected] [Impeller] Fix STB backend to account for max texture sizes. (flutter/engine#46010)
2023-09-19 [email protected] [Impeller] Hold the CommandPoolVK at a higher scope. (flutter/engine#46013)
2023-09-19 [email protected] Roll Skia from 0c990ab9e097 to 4122791099ce (19 revisions) (flutter/engine#46016)
2023-09-18 [email protected] Add missing include of SkPath (flutter/engine#45996)
2023-09-18 [email protected] [Impeller] Respect max supported texture size when allocating glyph atlas texture. (flutter/engine#45992)
2023-09-18 [email protected] Roll Fuchsia Mac SDK from 3_Lh8otTpmVuf-Zwb... to qy5FU4y6sx1FscCpd... (flutter/engine#45998)
2023-09-18 [email protected] Revert "[Windows] Update vsync on raster thread (#45310)" (flutter/engine#46000)
2023-09-18 [email protected] Provide a default `--target-variant` for `clang_tidy`. (flutter/engine#45909)
2023-09-18 [email protected] Revert "[ios] use python script to generate extension safe frameworks and code sign them" (flutter/engine#46004)
2023-09-18 [email protected] Disable HardwareBuffer backed Platform Views temporarily (flutter/engine#45986)
2023-09-18 [email protected] Tighten up ImageReaderPlatformViewRenderTarget code (flutter/engine#45889)
2023-09-18 [email protected] [ios] use python script to generate extension safe frameworks and code sign them (flutter/engine#45781)
2023-09-18 [email protected] Bump impeller-cmake to HEAD. (flutter/engine#45953)
2023-09-18 [email protected] [iOS] Remove selectionDidChange call in UndoManager (flutter/engine#45657)

Also rolling transitive DEPS:
  fuchsia/sdk/core/mac-amd64 from 3_Lh8otTpmVu to qy5FU4y6sx1F

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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Mairramer pushed a commit to Mairramer/flutter that referenced this pull request Oct 10, 2023
…lutter#134998)

flutter/engine@e1c784e...589bde9

2023-09-19 [email protected] Roll Skia from 4122791099ce to 744807d740c7 (1 revision) (flutter/engine#46019)
2023-09-19 [email protected] [Android] Add support for setting thread affinity based on core speed. (flutter/engine#45673)
2023-09-19 [email protected] [Impeller] Fix STB backend to account for max texture sizes. (flutter/engine#46010)
2023-09-19 [email protected] [Impeller] Hold the CommandPoolVK at a higher scope. (flutter/engine#46013)
2023-09-19 [email protected] Roll Skia from 0c990ab9e097 to 4122791099ce (19 revisions) (flutter/engine#46016)
2023-09-18 [email protected] Add missing include of SkPath (flutter/engine#45996)
2023-09-18 [email protected] [Impeller] Respect max supported texture size when allocating glyph atlas texture. (flutter/engine#45992)
2023-09-18 [email protected] Roll Fuchsia Mac SDK from 3_Lh8otTpmVuf-Zwb... to qy5FU4y6sx1FscCpd... (flutter/engine#45998)
2023-09-18 [email protected] Revert "[Windows] Update vsync on raster thread (flutter#45310)" (flutter/engine#46000)
2023-09-18 [email protected] Provide a default `--target-variant` for `clang_tidy`. (flutter/engine#45909)
2023-09-18 [email protected] Revert "[ios] use python script to generate extension safe frameworks and code sign them" (flutter/engine#46004)
2023-09-18 [email protected] Disable HardwareBuffer backed Platform Views temporarily (flutter/engine#45986)
2023-09-18 [email protected] Tighten up ImageReaderPlatformViewRenderTarget code (flutter/engine#45889)
2023-09-18 [email protected] [ios] use python script to generate extension safe frameworks and code sign them (flutter/engine#45781)
2023-09-18 [email protected] Bump impeller-cmake to HEAD. (flutter/engine#45953)
2023-09-18 [email protected] [iOS] Remove selectionDidChange call in UndoManager (flutter/engine#45657)

Also rolling transitive DEPS:
  fuchsia/sdk/core/mac-amd64 from 3_Lh8otTpmVu to qy5FU4y6sx1F

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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
@emesterhazy
Copy link

Has this made it into a stable release of Flutter yet? I am trying to determine if the issue I'm seeing in Fintasys/emoji_picker_flutter#159 may be mitigated by this change, or if there is still an issue.

Can we count on context.GetResourceAllocator()->GetMaxTextureSizeSupported() to return the correct size, or does this need to be manually overridden to an acceptable size on iOS?

harryterkelsen pushed a commit that referenced this pull request Oct 23, 2023
…tlas texture. (#45992)

The earlier limit of 4096u was pessimistically small on some backends and too big on others (like older versions of OpenGL ES). The former would stop glpyhs from rendering when they got sufficiently large or numerous. The latter would cause errors on texture allocation.

The full fix is tracked in flutter/flutter#133092
harryterkelsen pushed a commit that referenced this pull request Oct 23, 2023
Gets rid of the hardcoded 2048 px size.

Followup from review comment left unaddressed in #45992.

Missing this will be less easy after flutter/flutter#133029.
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.

4 participants