From 9a5e38db18a5c9bc8fbd0c29d7b126350d4931d8 Mon Sep 17 00:00:00 2001 From: Aaron Clarke Date: Thu, 31 Aug 2023 14:49:58 -0700 Subject: [PATCH 1/2] [Impeller] turned on validations for all debug builds --- shell/platform/android/BUILD.gn | 4 +++- .../flutter/embedding/engine/loader/FlutterLoader.java | 10 +++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index 18562b0ae24c4..6ebed9f200336 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -490,7 +490,9 @@ action("android_jar") { ":pom_libflutter", ] - if (enable_vulkan_validation_layers) { + if (enable_vulkan_validation_layers || + (impeller_enable_vulkan && current_cpu == "arm64" && + flutter_runtime_mode == "debug")) { assert(impeller_enable_vulkan) deps += [ "//third_party/vulkan_validation_layers" ] args += [ diff --git a/shell/platform/android/io/flutter/embedding/engine/loader/FlutterLoader.java b/shell/platform/android/io/flutter/embedding/engine/loader/FlutterLoader.java index 8265cd46a8858..01f940b95b7c3 100644 --- a/shell/platform/android/io/flutter/embedding/engine/loader/FlutterLoader.java +++ b/shell/platform/android/io/flutter/embedding/engine/loader/FlutterLoader.java @@ -214,6 +214,13 @@ public InitResult call() { } } + private static boolean areValidationLayersOnByDefault() { + if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + return Build.SUPPORTED_ABIS[0].equals("arm64-v8a"); + } + return false; + } + /** * Blocks until initialization of the native system has completed. * @@ -324,7 +331,8 @@ public void ensureInitializationComplete( if (metaData.getBoolean(ENABLE_IMPELLER_META_DATA_KEY, false)) { shellArgs.add("--enable-impeller"); } - if (metaData.getBoolean(ENABLE_VULKAN_VALIDATION_META_DATA_KEY, false)) { + if (metaData.getBoolean( + ENABLE_VULKAN_VALIDATION_META_DATA_KEY, areValidationLayersOnByDefault())) { shellArgs.add("--enable-vulkan-validation"); } String backend = metaData.getString(IMPELLER_BACKEND_META_DATA_KEY); From 91c9a911f7e5d2615c97db936a188805bc94bfd5 Mon Sep 17 00:00:00 2001 From: Zach Anderson Date: Fri, 1 Sep 2023 14:21:32 -0700 Subject: [PATCH 2/2] Build vulkan validation layers with api level 26, and bundle --- DEPS | 2 +- shell/platform/android/BUILD.gn | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/DEPS b/DEPS index 6e43f2c3d43b3..01c63ccc0fea7 100644 --- a/DEPS +++ b/DEPS @@ -261,7 +261,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + '6b0243e97d94836767ea8b94a477d7d15ee3bb91', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + 'b615dd6af4c2e95a388060151c7fd1e429e34d61', # Fuchsia compatibility # diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index 6ebed9f200336..ec965a4c0a53f 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -494,12 +494,15 @@ action("android_jar") { (impeller_enable_vulkan && current_cpu == "arm64" && flutter_runtime_mode == "debug")) { assert(impeller_enable_vulkan) - deps += [ "//third_party/vulkan_validation_layers" ] + apilevel26_toolchain = "//build/toolchain/android:clang_arm64_apilevel26" + validation_layer_target = + "//third_party/vulkan_validation_layers($apilevel26_toolchain)" + validation_layer_out_dir = + get_label_info(validation_layer_target, "root_out_dir") + deps += [ validation_layer_target ] args += [ "--native_lib", - rebase_path("libVkLayer_khronos_validation.so", - root_build_dir, - root_build_dir), + rebase_path("$validation_layer_out_dir/libVkLayer_khronos_validation.so"), ] if (current_cpu == "arm64") { args += [