Add dump-shader-skp flag to flutter tools (#29258)
This is the accompanying change for https://github.com/flutter/engine/pull/8148 and it needs the engine PR to land first.
For https://github.com/flutter/flutter/issues/813
diff --git a/packages/flutter_tools/lib/src/android/android_device.dart b/packages/flutter_tools/lib/src/android/android_device.dart
index 55e0f54..b1bc093 100644
--- a/packages/flutter_tools/lib/src/android/android_device.dart
+++ b/packages/flutter_tools/lib/src/android/android_device.dart
@@ -430,6 +430,8 @@
cmd.addAll(<String>['--ez', 'trace-skia', 'true']);
if (debuggingOptions.traceSystrace)
cmd.addAll(<String>['--ez', 'trace-systrace', 'true']);
+ if (debuggingOptions.dumpSkpOnShaderCompilation)
+ cmd.addAll(<String>['--ez', 'dump-skp-on-shader-compilation', 'true']);
if (debuggingOptions.debuggingEnabled) {
if (debuggingOptions.buildInfo.isDebug) {
cmd.addAll(<String>['--ez', 'enable-checked-mode', 'true']);
diff --git a/packages/flutter_tools/lib/src/commands/run.dart b/packages/flutter_tools/lib/src/commands/run.dart
index a00fae1..507ea45 100644
--- a/packages/flutter_tools/lib/src/commands/run.dart
+++ b/packages/flutter_tools/lib/src/commands/run.dart
@@ -99,6 +99,13 @@
help: 'Enable tracing to the system tracer. This is only useful on '
'platforms where such a tracer is available (Android and Fuchsia).',
)
+ ..addFlag('dump-skp-on-shader-compilation',
+ negatable: false,
+ help: 'Automatically dump the skp that triggers new shader compilations. '
+ 'This is useful for wrting custom ShaderWarmUp to reduce jank. '
+ 'By default, this is not enabled to reduce the overhead. '
+ 'This is only available in profile or debug build. ',
+ )
..addFlag('await-first-frame-when-tracing',
defaultsTo: true,
help: 'Whether to wait for the first frame when tracing startup ("--trace-startup"), '
@@ -259,6 +266,7 @@
skiaDeterministicRendering: argResults['skia-deterministic-rendering'],
traceSkia: argResults['trace-skia'],
traceSystrace: argResults['trace-systrace'],
+ dumpSkpOnShaderCompilation: argResults['dump-skp-on-shader-compilation'],
observatoryPort: observatoryPort,
verboseSystemLogs: argResults['verbose-system-logs'],
);
diff --git a/packages/flutter_tools/lib/src/device.dart b/packages/flutter_tools/lib/src/device.dart
index eb5ad6d..608a20f 100644
--- a/packages/flutter_tools/lib/src/device.dart
+++ b/packages/flutter_tools/lib/src/device.dart
@@ -371,6 +371,7 @@
this.skiaDeterministicRendering = false,
this.traceSkia = false,
this.traceSystrace = false,
+ this.dumpSkpOnShaderCompilation = false,
this.useTestFonts = false,
this.verboseSystemLogs = false,
this.observatoryPort,
@@ -384,6 +385,7 @@
skiaDeterministicRendering = false,
traceSkia = false,
traceSystrace = false,
+ dumpSkpOnShaderCompilation = false,
verboseSystemLogs = false,
observatoryPort = null;
@@ -395,6 +397,7 @@
final bool skiaDeterministicRendering;
final bool traceSkia;
final bool traceSystrace;
+ final bool dumpSkpOnShaderCompilation;
final bool useTestFonts;
final bool verboseSystemLogs;
final int observatoryPort;
diff --git a/packages/flutter_tools/lib/src/ios/devices.dart b/packages/flutter_tools/lib/src/ios/devices.dart
index cc39f13..4c6278e 100644
--- a/packages/flutter_tools/lib/src/ios/devices.dart
+++ b/packages/flutter_tools/lib/src/ios/devices.dart
@@ -297,6 +297,9 @@
if (debuggingOptions.traceSkia)
launchArguments.add('--trace-skia');
+ if (debuggingOptions.dumpSkpOnShaderCompilation)
+ launchArguments.add('--dump-skp-on-shader-compilation');
+
if (debuggingOptions.verboseSystemLogs) {
launchArguments.add('--verbose-logging');
}