Skip to content

Commit f6c2b10

Browse files
authored
[Impeller] Plumb through the impeller-force-gl flag. (#123828)
[Impeller] Plumb through the impeller-force-gl flag.
1 parent d940f60 commit f6c2b10

File tree

5 files changed

+24
-0
lines changed

5 files changed

+24
-0
lines changed

packages/flutter_tools/lib/src/android/android_device.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,8 @@ class AndroidDevice extends Device {
662662
...<String>['--ez', 'enable-impeller', 'false'],
663663
if (debuggingOptions.enableVulkanValidation)
664664
...<String>['--ez', 'enable-vulkan-validation', 'true'],
665+
if (debuggingOptions.impellerForceGL)
666+
...<String>['--ez', 'impeller-force-gl', 'true'],
665667
if (debuggingOptions.debuggingEnabled) ...<String>[
666668
if (debuggingOptions.buildInfo.isDebug) ...<String>[
667669
...<String>['--ez', 'enable-checked-mode', 'true'],

packages/flutter_tools/lib/src/commands/run.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
184184
usesFatalWarningsOption(verboseHelp: verboseHelp);
185185
addEnableImpellerFlag(verboseHelp: verboseHelp);
186186
addEnableVulkanValidationFlag(verboseHelp: verboseHelp);
187+
addImpellerForceGLFlag(verboseHelp: verboseHelp);
187188
addEnableEmbedderApiFlag(verboseHelp: verboseHelp);
188189
}
189190

@@ -198,6 +199,7 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
198199
bool get trackWidgetCreation => boolArg('track-widget-creation');
199200
ImpellerStatus get enableImpeller => ImpellerStatus.fromBool(argResults!['enable-impeller'] as bool?);
200201
bool get enableVulkanValidation => boolArg('enable-vulkan-validation');
202+
bool get impellerForceGL => boolArg('impeller-force-gl');
201203
bool get uninstallFirst => boolArg('uninstall-first');
202204
bool get enableEmbedderApi => boolArg('enable-embedder-api');
203205

@@ -240,6 +242,7 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
240242
webBrowserFlags: webBrowserFlags,
241243
enableImpeller: enableImpeller,
242244
enableVulkanValidation: enableVulkanValidation,
245+
impellerForceGL: impellerForceGL,
243246
uninstallFirst: uninstallFirst,
244247
enableDartProfiling: enableDartProfiling,
245248
enableEmbedderApi: enableEmbedderApi,
@@ -289,6 +292,7 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
289292
nativeNullAssertions: boolArg('native-null-assertions'),
290293
enableImpeller: enableImpeller,
291294
enableVulkanValidation: enableVulkanValidation,
295+
impellerForceGL: impellerForceGL,
292296
uninstallFirst: uninstallFirst,
293297
serveObservatory: boolArg('serve-observatory'),
294298
enableDartProfiling: enableDartProfiling,

packages/flutter_tools/lib/src/device.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,7 @@ class DebuggingOptions {
966966
this.nativeNullAssertions = false,
967967
this.enableImpeller = ImpellerStatus.platformDefault,
968968
this.enableVulkanValidation = false,
969+
this.impellerForceGL = false,
969970
this.uninstallFirst = false,
970971
this.serveObservatory = false,
971972
this.enableDartProfiling = true,
@@ -988,6 +989,7 @@ class DebuggingOptions {
988989
this.traceAllowlist,
989990
this.enableImpeller = ImpellerStatus.platformDefault,
990991
this.enableVulkanValidation = false,
992+
this.impellerForceGL = false,
991993
this.uninstallFirst = false,
992994
this.enableDartProfiling = true,
993995
this.enableEmbedderApi = false,
@@ -1062,6 +1064,7 @@ class DebuggingOptions {
10621064
required this.nativeNullAssertions,
10631065
required this.enableImpeller,
10641066
required this.enableVulkanValidation,
1067+
required this.impellerForceGL,
10651068
required this.uninstallFirst,
10661069
required this.serveObservatory,
10671070
required this.enableDartProfiling,
@@ -1102,6 +1105,7 @@ class DebuggingOptions {
11021105
final bool webUseSseForInjectedClient;
11031106
final ImpellerStatus enableImpeller;
11041107
final bool enableVulkanValidation;
1108+
final bool impellerForceGL;
11051109
final bool serveObservatory;
11061110
final bool enableDartProfiling;
11071111
final bool enableEmbedderApi;
@@ -1235,6 +1239,7 @@ class DebuggingOptions {
12351239
'nativeNullAssertions': nativeNullAssertions,
12361240
'enableImpeller': enableImpeller.asBool,
12371241
'enableVulkanValidation': enableVulkanValidation,
1242+
'impellerForceGL': impellerForceGL,
12381243
'serveObservatory': serveObservatory,
12391244
'enableDartProfiling': enableDartProfiling,
12401245
'enableEmbedderApi': enableEmbedderApi,
@@ -1284,6 +1289,7 @@ class DebuggingOptions {
12841289
nativeNullAssertions: json['nativeNullAssertions']! as bool,
12851290
enableImpeller: ImpellerStatus.fromBool(json['enableImpeller'] as bool?),
12861291
enableVulkanValidation: (json['enableVulkanValidation'] as bool?) ?? false,
1292+
impellerForceGL: (json['impellerForceGL'] as bool?) ?? false,
12871293
uninstallFirst: (json['uninstallFirst'] as bool?) ?? false,
12881294
serveObservatory: (json['serveObservatory'] as bool?) ?? false,
12891295
enableDartProfiling: (json['enableDartProfiling'] as bool?) ?? true,

packages/flutter_tools/lib/src/runner/flutter_command.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,16 @@ abstract class FlutterCommand extends Command<void> {
10691069
);
10701070
}
10711071

1072+
void addImpellerForceGLFlag({required bool verboseHelp}) {
1073+
argParser.addFlag('impeller-force-gl',
1074+
hide: !verboseHelp,
1075+
help: 'On platforms that support OpenGL Rendering using Impeller, force '
1076+
'rendering using OpenGL over other APIs. If Impeller is not '
1077+
'enabled or the platform does not support OpenGL ES, this flag '
1078+
'does nothing.',
1079+
);
1080+
}
1081+
10721082
void addEnableEmbedderApiFlag({required bool verboseHelp}) {
10731083
argParser.addFlag('enable-embedder-api',
10741084
hide: !verboseHelp,

packages/flutter_tools/test/commands.shard/hermetic/run_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,7 @@ void main() {
10511051
'--native-null-assertions',
10521052
'--enable-impeller',
10531053
'--enable-vulkan-validation',
1054+
'--impeller-force-gl',
10541055
'--trace-systrace',
10551056
'--enable-software-rendering',
10561057
'--skia-deterministic-rendering',
@@ -1070,6 +1071,7 @@ void main() {
10701071
expect(options.traceSystrace, true);
10711072
expect(options.enableImpeller, ImpellerStatus.enabled);
10721073
expect(options.enableVulkanValidation, true);
1074+
expect(options.impellerForceGL, true);
10731075
expect(options.enableSoftwareRendering, true);
10741076
expect(options.skiaDeterministicRendering, true);
10751077
}, overrides: <Type, Generator>{

0 commit comments

Comments
 (0)