Fix sdfs being enabled for MacOS regardless of FLTEnableSDFs value#185565
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the FlutterEngine to conditionally add the --impeller-use-sdfs=true flag based on the _project.enableSDFs property. The review suggests simplifying the logic by removing the redundant std::find check, as the flag's presence can be managed directly through the boolean property.
| if (_project.enableSDFs || | ||
| std::find(switches.begin(), switches.end(), "--impeller-use-sdfs=true") != switches.end()) { | ||
| switches.push_back("--impeller-use-sdfs=true"); | ||
| } |
There was a problem hiding this comment.
While this pattern is used for other flags in this file, the std::find check is redundant. Since the engine's switch parser uses HasOption, it only checks for the presence of the flag, not its value. If the flag is already in switches, adding it again has no effect. If _project.enableSDFs is false, we should simply avoid adding the flag. Simplifying this logic adheres to the "Write what you need and no more" principle from the repository style guide.
if (_project.enableSDFs) {
switches.push_back("--impeller-use-sdfs=true");
}
|
This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
Benson and I chatted and we want to make this cherry-pickable so we'll be adding a test.
|
Added an integration test based on #185637 |
There was a problem hiding this comment.
Code Review
This pull request adds a macOS devicelab test to verify that the Impeller backend switches to MetalSDF when FLTEnableSDFs is set in Info.plist. It also updates the macOS engine to conditionally append the --impeller-use-sdfs=true flag. Feedback suggests simplifying the engine logic by removing a redundant check and extending the test to verify behavior when FLTEnableSDFs is explicitly set to false.
| if (_project.enableSDFs || | ||
| std::find(switches.begin(), switches.end(), "--impeller-use-sdfs=true") != switches.end()) { | ||
| switches.push_back("--impeller-use-sdfs=true"); | ||
| } |
There was a problem hiding this comment.
The std::find check is redundant here. If the flag is already present in switches, adding it again doesn't change the engine's behavior (since it only checks for the presence of the flag). If it's not present, it should only be added if _project.enableSDFs is true.
While I understand the desire for consistency with the surrounding code, simplifying this to only check _project.enableSDFs would be cleaner and more efficient.
if (_project.enableSDFs) {
switches.push_back("--impeller-use-sdfs=true");
}
| if (!sawSdfsMessage) { | ||
| res = TaskResult.failure( | ||
| 'Did not see "Using the Impeller rendering backend (MetalSDF)." in output', | ||
| ); | ||
| } |
There was a problem hiding this comment.
It would be beneficial to add a third step to this test that explicitly sets FLTEnableSDFs to false in the Info.plist. The PR description mentions that the issue was SDFs being enabled even when the flag was set to false (because the framework was passing --impeller-use-sdfs=false). Verifying that an explicit false in the plist now correctly results in standard Metal rendering (not MetalSDF) would ensure the fix covers this case.
|
auto label is removed for flutter/flutter/185565, Failed to enqueue flutter/flutter/185565 with HTTP 400: Pull request is already in the queue. |
…11595) Manual roll Flutter from 31001886cbe8 to 61fca76dd523 (53 revisions) Manual roll requested by tarrinneal@google.com flutter/flutter@3100188...61fca76 2026-04-27 30870216+gaaclarke@users.noreply.github.com Adds integration test for the FLTEnableSDFs flag for iOS (flutter/flutter#185637) 2026-04-27 97480502+b-luk@users.noreply.github.com Fix sdfs being enabled for MacOS regardless of FLTEnableSDFs value (flutter/flutter#185565) 2026-04-27 97480502+b-luk@users.noreply.github.com Don't use UberSDF for paint with incompatible blend modes (flutter/flutter#184889) 2026-04-27 engine-flutter-autoroll@skia.org Roll Dart SDK from de495e3de9a0 to 941ca325cfc9 (2 revisions) (flutter/flutter#185653) 2026-04-27 jhy03261997@gmail.com [a11y] Add CONTENT_CHANGE_TYPE_EXPANDED support on android. (flutter/flutter#185305) 2026-04-27 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#185641) 2026-04-27 1063596+reidbaker@users.noreply.github.com Modify analyze.dart to have flags to run only or exclude each verification step. (flutter/flutter#185618) 2026-04-27 meylis@divine.video Fix debugNeedsPaint/Layout/CompositedLayerUpdate crashing in release mode (flutter/flutter#184627) 2026-04-27 kallentu@google.com Enable `var_with_no_type_annotation` lint. (flutter/flutter#185215) 2026-04-27 53523825+JhonaCodes@users.noreply.github.com Fix SelectionArea handles overlapping context menu on Android (flutter/flutter#182663) 2026-04-27 30870216+gaaclarke@users.noreply.github.com Adds debugging information to compiled metal shaders (flutter/flutter#185629) 2026-04-27 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#185638) 2026-04-27 84978733+alejandro-all-win-software@users.noreply.github.com Use null-aware elements in dev/devicelab/lib/framework/browser.dart (flutter/flutter#184778) 2026-04-27 154381524+flutteractionsbot@users.noreply.github.com Sync CHANGELOG.md from stable (flutter/flutter#185633) 2026-04-27 31591868+zawhtetnaing10@users.noreply.github.com Added useOriginalColors flag which allows ImageIcon to bypass IconTheme colorization and use the original colors (flutter/flutter#180491) 2026-04-27 engine-flutter-autoroll@skia.org Roll Packages from 8400f71 to 23280da (2 revisions) (flutter/flutter#185619) 2026-04-27 engine-flutter-autoroll@skia.org Roll Skia from f1238e0f1022 to ce82d32b3e03 (1 revision) (flutter/flutter#185616) 2026-04-27 15619084+vashworth@users.noreply.github.com [SwiftPM] Enable package resolution on xcodebuild commands (flutter/flutter#185208) 2026-04-27 chris@bracken.jp [iOS] Refactor keyboard inset logic into FlutterKeyboardInsetManager (flutter/flutter#185535) 2026-04-27 matej.knopp@gmail.com [Win32] FlutterDesktopEngineGetGraphicsAdapter should use out parameter (flutter/flutter#185590) 2026-04-27 engine-flutter-autoroll@skia.org Roll Skia from d77e3356d526 to f1238e0f1022 (4 revisions) (flutter/flutter#185604) 2026-04-27 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from flsn8jC4LkTn6WECf... to i6d0NoDueUiXpePfX... (flutter/flutter#185601) 2026-04-26 engine-flutter-autoroll@skia.org Roll Dart SDK from a108dfe2d227 to de495e3de9a0 (1 revision) (flutter/flutter#185599) 2026-04-26 engine-flutter-autoroll@skia.org Roll Skia from ce9aa2231292 to d77e3356d526 (1 revision) (flutter/flutter#185596) 2026-04-26 engine-flutter-autoroll@skia.org Roll Skia from 622fff4c24d2 to ce9aa2231292 (1 revision) (flutter/flutter#185588) 2026-04-25 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 9fPnyEo9PaNdXtasl... to flsn8jC4LkTn6WECf... (flutter/flutter#185585) 2026-04-25 engine-flutter-autoroll@skia.org Roll Dart SDK from 605a8faf0dda to a108dfe2d227 (1 revision) (flutter/flutter#185584) 2026-04-25 engine-flutter-autoroll@skia.org Roll Dart SDK from 6b8c39765f17 to 605a8faf0dda (1 revision) (flutter/flutter#185578) 2026-04-25 engine-flutter-autoroll@skia.org Roll Skia from 185f6b57d64f to 622fff4c24d2 (1 revision) (flutter/flutter#185573) 2026-04-25 evanwall@buffalo.edu Implement square-like round superellipses with circular corners in the SDF uber shader (flutter/flutter#185370) 2026-04-25 victorsanniay@gmail.com Add @awaitNotRequired annotation to flutter sdk (flutter/flutter#181513) 2026-04-25 engine-flutter-autoroll@skia.org Roll Dart SDK from 01228cb7af42 to 6b8c39765f17 (2 revisions) (flutter/flutter#185569) 2026-04-25 flar@google.com Adapt the DisplayList benchmarks into a primitive rendering benchmark suite (flutter/flutter#185270) 2026-04-25 okorohelijah@google.com Enable SPM for GoogleMobileAds (flutter/flutter#185548) 2026-04-25 engine-flutter-autoroll@skia.org Roll Skia from 3f467a581942 to 185f6b57d64f (1 revision) (flutter/flutter#185564) 2026-04-25 victorsanniay@gmail.com Fix Table crash when a cell child paints below the row bottom (flutter/flutter#185323) 2026-04-24 ahmedsameha1@gmail.com Make sure that an Image doesn't crash in 0x0 environment (flutter/flutter#181154) 2026-04-24 engine-flutter-autoroll@skia.org Roll Skia from 300d432048b0 to 3f467a581942 (3 revisions) (flutter/flutter#185558) 2026-04-24 engine-flutter-autoroll@skia.org Roll Dart SDK from c26627715892 to 01228cb7af42 (4 revisions) (flutter/flutter#185559) 2026-04-24 jacksongardner@google.com Reland "[web] Fix LateInitializationError in CkSurface and SkwasmSurface (#185116)" (flutter/flutter#185553) 2026-04-24 41930132+hellohuanlin@users.noreply.github.com [github]fix git ls-file glob pattern in labeler.yml instruction (flutter/flutter#185495) 2026-04-24 41930132+hellohuanlin@users.noreply.github.com [ios]update ios-reviewers tags to include more files (flutter/flutter#185490) 2026-04-24 tomac@google.com Add initial support for Cross-Origin Storage (flutter/flutter#184149) 2026-04-24 30870216+gaaclarke@users.noreply.github.com tool: Skip cached engine artifacts with local engine (flutter/flutter#185546) ...
Fix naming in a couple places where an extra "macos" was added in flutter#185565 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
…lutter#11595) Manual roll Flutter from 31001886cbe8 to 61fca76dd523 (53 revisions) Manual roll requested by tarrinneal@google.com flutter/flutter@3100188...61fca76 2026-04-27 30870216+gaaclarke@users.noreply.github.com Adds integration test for the FLTEnableSDFs flag for iOS (flutter/flutter#185637) 2026-04-27 97480502+b-luk@users.noreply.github.com Fix sdfs being enabled for MacOS regardless of FLTEnableSDFs value (flutter/flutter#185565) 2026-04-27 97480502+b-luk@users.noreply.github.com Don't use UberSDF for paint with incompatible blend modes (flutter/flutter#184889) 2026-04-27 engine-flutter-autoroll@skia.org Roll Dart SDK from de495e3de9a0 to 941ca325cfc9 (2 revisions) (flutter/flutter#185653) 2026-04-27 jhy03261997@gmail.com [a11y] Add CONTENT_CHANGE_TYPE_EXPANDED support on android. (flutter/flutter#185305) 2026-04-27 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#185641) 2026-04-27 1063596+reidbaker@users.noreply.github.com Modify analyze.dart to have flags to run only or exclude each verification step. (flutter/flutter#185618) 2026-04-27 meylis@divine.video Fix debugNeedsPaint/Layout/CompositedLayerUpdate crashing in release mode (flutter/flutter#184627) 2026-04-27 kallentu@google.com Enable `var_with_no_type_annotation` lint. (flutter/flutter#185215) 2026-04-27 53523825+JhonaCodes@users.noreply.github.com Fix SelectionArea handles overlapping context menu on Android (flutter/flutter#182663) 2026-04-27 30870216+gaaclarke@users.noreply.github.com Adds debugging information to compiled metal shaders (flutter/flutter#185629) 2026-04-27 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#185638) 2026-04-27 84978733+alejandro-all-win-software@users.noreply.github.com Use null-aware elements in dev/devicelab/lib/framework/browser.dart (flutter/flutter#184778) 2026-04-27 154381524+flutteractionsbot@users.noreply.github.com Sync CHANGELOG.md from stable (flutter/flutter#185633) 2026-04-27 31591868+zawhtetnaing10@users.noreply.github.com Added useOriginalColors flag which allows ImageIcon to bypass IconTheme colorization and use the original colors (flutter/flutter#180491) 2026-04-27 engine-flutter-autoroll@skia.org Roll Packages from 8400f71 to 23280da (2 revisions) (flutter/flutter#185619) 2026-04-27 engine-flutter-autoroll@skia.org Roll Skia from f1238e0f1022 to ce82d32b3e03 (1 revision) (flutter/flutter#185616) 2026-04-27 15619084+vashworth@users.noreply.github.com [SwiftPM] Enable package resolution on xcodebuild commands (flutter/flutter#185208) 2026-04-27 chris@bracken.jp [iOS] Refactor keyboard inset logic into FlutterKeyboardInsetManager (flutter/flutter#185535) 2026-04-27 matej.knopp@gmail.com [Win32] FlutterDesktopEngineGetGraphicsAdapter should use out parameter (flutter/flutter#185590) 2026-04-27 engine-flutter-autoroll@skia.org Roll Skia from d77e3356d526 to f1238e0f1022 (4 revisions) (flutter/flutter#185604) 2026-04-27 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from flsn8jC4LkTn6WECf... to i6d0NoDueUiXpePfX... (flutter/flutter#185601) 2026-04-26 engine-flutter-autoroll@skia.org Roll Dart SDK from a108dfe2d227 to de495e3de9a0 (1 revision) (flutter/flutter#185599) 2026-04-26 engine-flutter-autoroll@skia.org Roll Skia from ce9aa2231292 to d77e3356d526 (1 revision) (flutter/flutter#185596) 2026-04-26 engine-flutter-autoroll@skia.org Roll Skia from 622fff4c24d2 to ce9aa2231292 (1 revision) (flutter/flutter#185588) 2026-04-25 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from 9fPnyEo9PaNdXtasl... to flsn8jC4LkTn6WECf... (flutter/flutter#185585) 2026-04-25 engine-flutter-autoroll@skia.org Roll Dart SDK from 605a8faf0dda to a108dfe2d227 (1 revision) (flutter/flutter#185584) 2026-04-25 engine-flutter-autoroll@skia.org Roll Dart SDK from 6b8c39765f17 to 605a8faf0dda (1 revision) (flutter/flutter#185578) 2026-04-25 engine-flutter-autoroll@skia.org Roll Skia from 185f6b57d64f to 622fff4c24d2 (1 revision) (flutter/flutter#185573) 2026-04-25 evanwall@buffalo.edu Implement square-like round superellipses with circular corners in the SDF uber shader (flutter/flutter#185370) 2026-04-25 victorsanniay@gmail.com Add @awaitNotRequired annotation to flutter sdk (flutter/flutter#181513) 2026-04-25 engine-flutter-autoroll@skia.org Roll Dart SDK from 01228cb7af42 to 6b8c39765f17 (2 revisions) (flutter/flutter#185569) 2026-04-25 flar@google.com Adapt the DisplayList benchmarks into a primitive rendering benchmark suite (flutter/flutter#185270) 2026-04-25 okorohelijah@google.com Enable SPM for GoogleMobileAds (flutter/flutter#185548) 2026-04-25 engine-flutter-autoroll@skia.org Roll Skia from 3f467a581942 to 185f6b57d64f (1 revision) (flutter/flutter#185564) 2026-04-25 victorsanniay@gmail.com Fix Table crash when a cell child paints below the row bottom (flutter/flutter#185323) 2026-04-24 ahmedsameha1@gmail.com Make sure that an Image doesn't crash in 0x0 environment (flutter/flutter#181154) 2026-04-24 engine-flutter-autoroll@skia.org Roll Skia from 300d432048b0 to 3f467a581942 (3 revisions) (flutter/flutter#185558) 2026-04-24 engine-flutter-autoroll@skia.org Roll Dart SDK from c26627715892 to 01228cb7af42 (4 revisions) (flutter/flutter#185559) 2026-04-24 jacksongardner@google.com Reland "[web] Fix LateInitializationError in CkSurface and SkwasmSurface (#185116)" (flutter/flutter#185553) 2026-04-24 41930132+hellohuanlin@users.noreply.github.com [github]fix git ls-file glob pattern in labeler.yml instruction (flutter/flutter#185495) 2026-04-24 41930132+hellohuanlin@users.noreply.github.com [ios]update ios-reviewers tags to include more files (flutter/flutter#185490) 2026-04-24 tomac@google.com Add initial support for Cross-Origin Storage (flutter/flutter#184149) 2026-04-24 30870216+gaaclarke@users.noreply.github.com tool: Skip cached engine artifacts with local engine (flutter/flutter#185546) ...
This changes the
_project.enableSDFscheck in the MacOS FlutterEngine.mm to be the same as the checks for_project.enableImpellerand_project.enableFlutterGPUnext to it.Instead of setting
--impeller-use-sdfs=trueor--impeller-use-sdfs=falsedepending on_project.enableSDFs, only set--impeller-use-sdfs=truefor true, and leave the flag out when it is false.The flag is checked by
flutter/engine/src/flutter/shell/common/switches.cc
Lines 553 to 560 in d3757da
which uses
command_line.HasOption(). This checks only for the existence of the flag. The value of the flag (true or false) is entirely ignored. So this would enable SDFs whether we passed in--impeller-use-sdfs=trueor--impeller-use-sdfs=false.If we actually wanted to check the value of the flag, we should use
CommandLine::GetOptionValue()orCommandLine::GetOptionValueWithDefault()instead. It's misleading to pass the flag with a true/false value that is ignored and make the switch get set to true for either one. For consistency with the other flag's I'm leaving this behavior as-is.Also for consistency with the other flags, I'm leaving the
|| std::find(switches.begin(), switches.end(), "--impeller-use-sdfs=true") != switches.end()check. But this check seems completely redundant/useless to me.Fixes #185562
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.