Flutter GPU has a permanent, project-level opt-in on every platform except Linux and Windows. iOS and macOS use FLTEnableFlutterGPU in Info.plist, Android uses the io.flutter.embedding.android.EnableFlutterGPU manifest key. On Linux and Windows the only way to set it is the --enable-flutter-gpu engine switch.
Release desktop builds ignore engine switches from the environment. GetSwitchesFromEnvironment in shell/platform/common/engine_switches.cc is wrapped in #ifndef FLUTTER_RELEASE, so the switch reaches the engine only under flutter run. A packaged release app on Linux or Windows therefore has no way to turn Flutter GPU on.
Steps to reproduce
- Create an app that calls into package:flutter_gpu.
- flutter run -d windows --enable-flutter-gpu (or -d linux) and confirm it works.
- flutter build windows --release (or linux) and launch the packaged executable directly.
Expected results
Some supported way to enable Flutter GPU for the release build, matching the other platforms.
Actual results
The first Flutter GPU call throws.
Exception: Flutter GPU must be enabled via the Flutter GPU manifest setting. This can be done
either via command line argument --enable-flutter-gpu or by adding the FLTEnableFlutterGPU key
set to true on iOS or io.flutter.embedding.android.EnableFlutterGPU metadata key to true on
Android.
The message lists no desktop option, because none existed.
Notes
Related to #167734, which is the Windows half of this reported as a sample failure. The most recent comment there describes the same packaging problem.
Fixed on master by #190684, which adds fl_dart_project_set_enable_flutter_gpu on Linux and DartProject::set_enable_flutter_gpu on Windows.
Flutter GPU has a permanent, project-level opt-in on every platform except Linux and Windows. iOS and macOS use FLTEnableFlutterGPU in Info.plist, Android uses the io.flutter.embedding.android.EnableFlutterGPU manifest key. On Linux and Windows the only way to set it is the --enable-flutter-gpu engine switch.
Release desktop builds ignore engine switches from the environment. GetSwitchesFromEnvironment in shell/platform/common/engine_switches.cc is wrapped in #ifndef FLUTTER_RELEASE, so the switch reaches the engine only under flutter run. A packaged release app on Linux or Windows therefore has no way to turn Flutter GPU on.
Steps to reproduce
Expected results
Some supported way to enable Flutter GPU for the release build, matching the other platforms.
Actual results
The first Flutter GPU call throws.
The message lists no desktop option, because none existed.
Notes
Related to #167734, which is the Windows half of this reported as a sample failure. The most recent comment there describes the same packaging problem.
Fixed on master by #190684, which adds fl_dart_project_set_enable_flutter_gpu on Linux and DartProject::set_enable_flutter_gpu on Windows.