Skip to content

Commit

Permalink
[Impeller] made a switch for turning on validation layers
Browse files Browse the repository at this point in the history
  • Loading branch information
gaaclarke committed Jun 7, 2023
1 parent 52b94e4 commit 0a19d83
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ allowed_hosts = [
]

deps = {
'src': 'https://github.com/flutter/buildroot.git' + '@' + '859e7ccc38f55f89dac8aea49367b7a4c1656490',
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'fabb92f0ada787444ad0be22638c80a6d5927a2c',

# Fuchsia compatibility
#
Expand Down
1 change: 1 addition & 0 deletions shell/config.gni
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ declare_args() {
shell_enable_vulkan = false

shell_enable_software = true
enable_vulkan_validation_layers = false
}

declare_args() {
Expand Down
10 changes: 10 additions & 0 deletions shell/platform/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,16 @@ action("android_jar") {
":pom_libflutter",
]

if (enable_vulkan_validation_layers) {
deps += [ "//third_party/vulkan_validation_layers" ]
args += [
"--native_lib",
rebase_path("libVkLayer_khronos_validation.so",
root_build_dir,
root_build_dir),
]
}

if (flutter_runtime_mode == "profile") {
deps += [ "//flutter/shell/vmservice:vmservice_snapshot" ]
args += [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public class FlutterLoader {
"io.flutter.embedding.android.EnableImpeller";
private static final String IMPELLER_BACKEND_META_DATA_KEY =
"io.flutter.embedding.android.ImpellerBackend";
private static final String ENABLE_VULKAN_VALIDATION_META_DATA_KEY =
"io.flutter.embedding.android.EnableVulkanValidation";

/**
* Set whether leave or clean up the VM after the last shell shuts down. It can be set from app's
Expand Down Expand Up @@ -324,6 +326,12 @@ public void ensureInitializationComplete(
}
String backend = metaData.getString(IMPELLER_BACKEND_META_DATA_KEY, "opengles");
shellArgs.add("--impeller-backend=" + backend);

Log.d(TAG, "foobar has metadata");
if (metaData.getBoolean(ENABLE_VULKAN_VALIDATION_META_DATA_KEY, false)) {
Log.d(TAG, "foobar has validation flag");
shellArgs.add("--enable-vulkan-validation");
}
}

final String leakVM = isLeakVM(metaData) ? "true" : "false";
Expand Down
2 changes: 1 addition & 1 deletion testing/scenario_app/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
org.gradle.jvmargs=-Xmx1536M
org.gradle.jvmargs=-Xmx2048M
android.useAndroidX=true
android.enableJetifier=true
android.builder.sdkDownload=false
9 changes: 4 additions & 5 deletions tools/gn
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ def to_command_line(gn_args):
def merge(key, value):
if isinstance(value, bool):
return '%s=%s' % (key, 'true' if value else 'false')
elif isinstance(value, int):
return '%s=%d' % (key, value)
return '%s="%s"' % (key, value)

return [merge(x, y) for x, y in gn_args.items()]
Expand Down Expand Up @@ -548,11 +550,8 @@ def to_gn_args(args):
gn_args['use_fstack_protector'] = True

if args.enable_vulkan_validation_layers:
if args.target_os != 'fuchsia':
print(
'Vulkan validation layers are currently only supported on Fuchsia targets.'
)
sys.exit(1)
if args.target_os == 'android':
gn_args['android_api_level'] = int(26)
gn_args['enable_vulkan_validation_layers'] = True

# Enable pointer compression on 64-bit mobile targets. iOS is excluded due to
Expand Down

0 comments on commit 0a19d83

Please sign in to comment.