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

GLES for scenario_app tests using Impeller #51000

Merged
merged 3 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ public void onCreate(@Nullable Bundle arguments) {
String[] engineArguments = null;
if ("true".equals(arguments.getString("enable-impeller"))) {
// Set up the global settings object so that Impeller is enabled for all tests.
engineArguments = new String[] {"--enable-impeller=true"};
engineArguments =
new String[] {
"--enable-impeller=true",
"--impeller-backend=" + arguments.getString("impeller-backend", "vulkan")
};
}
// For consistency, just always initilaize FlutterJNI etc.
FlutterInjector.instance().flutterLoader().startInitialization(getTargetContext());
Expand Down
19 changes: 14 additions & 5 deletions testing/scenario_app/bin/run_android_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ Future<void> _run({

late Process logcatProcess;
late Future<int> logcatProcessExitCode;
bool seenImpeller = false;
_ImpellerBackend? actualImpellerBackend;

final IOSink logcat = File(logcatPath).openWrite();
try {
Expand All @@ -222,8 +222,16 @@ Future<void> _run({
logcatOutput.listen((String line) {
// Always write to the full log.
logcat.writeln(line);
if (enableImpeller && !seenImpeller) {
seenImpeller = line.contains('Using the Impeller rendering backend');
if (enableImpeller && actualImpellerBackend == null && line.contains('Using the Impeller rendering backend')) {
if (line.contains('OpenGLES')) {
actualImpellerBackend = _ImpellerBackend.opengles;
} else if (line.contains('Vulkan')) {
actualImpellerBackend = _ImpellerBackend.vulkan;
} else {
panic(<String>[
'Impeller was enabled, but $line did not contain "OpenGLES" or "Vulkan".',
]);
}
}

// Conditionally parse and write to stderr.
Expand Down Expand Up @@ -375,9 +383,10 @@ Future<void> _run({

if (enableImpeller) {
await step('Validating Impeller...', () async {
if (!seenImpeller) {
final _ImpellerBackend expectedImpellerBackend = impellerBackend ?? _ImpellerBackend.vulkan;
if (actualImpellerBackend != expectedImpellerBackend) {
panic(<String>[
'--enable-impeller was specified, but Impeller was not used.',
'--enable-impeller was specified and expected to find "${expectedImpellerBackend.name}", which did not match "${actualImpellerBackend?.name ?? '<impeller disabled>'}".',
]);
}
});
Expand Down