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

[Impeller] turned on validations for all debug builds #45350

Merged
merged 5 commits into from
Sep 1, 2023
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
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down
11 changes: 7 additions & 4 deletions shell/platform/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -492,12 +492,15 @@ action("android_jar") {

if (enable_vulkan_validation_layers) {
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 += [
Expand Down
7 changes: 6 additions & 1 deletion shell/platform/android/android_context_vulkan_impeller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ static std::shared_ptr<impeller::Context> CreateImpellerContext(
settings.cache_directory = fml::paths::GetCachesDirectory();
settings.enable_validation = enable_vulkan_validation;

FML_LOG(ERROR) << "Using the Impeller rendering backend (Vulkan).";
if (settings.enable_validation) {
FML_LOG(ERROR) << "Using the Impeller rendering backend (Vulkan with "
"Validation Layers).";
} else {
FML_LOG(ERROR) << "Using the Impeller rendering backend (Vulkan).";
}

return impeller::ContextVK::Create(std::move(settings));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,13 @@ public InitResult call() {
}
}

private static boolean areValidationLayersOnByDefault() {
if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
return Build.SUPPORTED_ABIS[0].equals("arm64-v8a");
}
return false;
}

/**
* Blocks until initialization of the native system has completed.
*
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion tools/gn
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,9 @@ def to_gn_args(args):
if args.unoptimized and args.target_os == 'android' and args.android_cpu == 'arm64':
enable_vulkan_validation = True

if enable_vulkan_validation:
if enable_vulkan_validation or (args.enable_impeller_vulkan and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the changes to the GN build for the validation layers .so, does the API level for the whole build still need to be bumped up to 26 down on line 654?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, not necessary anymore. I can rip it out.

runtime_mode == 'debug' and
gn_args['target_cpu'] == 'arm64'):
gn_args['enable_vulkan_validation_layers'] = True
if args.target_os == 'android':
gn_args['android_api_level'] = 26
Expand Down