diff --git a/engine/src/flutter/shell/gpu/BUILD.gn b/engine/src/flutter/shell/gpu/BUILD.gn deleted file mode 100644 index cd093e1238..0000000000 --- a/engine/src/flutter/shell/gpu/BUILD.gn +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 2016 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import("$flutter_root/shell/config.gni") - -source_set("gpu") { - sources = [ - "gpu_surface_software.cc", - "gpu_surface_software.h", - ] - - if (!is_fuchsia) { - sources += [ - "gpu_surface_gl.cc", - "gpu_surface_gl.h", - ] - } - - if (shell_enable_vulkan) { - sources += [ - "gpu_surface_vulkan.cc", - "gpu_surface_vulkan.h", - ] - } - - deps = [ - "$flutter_root/common", - "$flutter_root/flow", - "$flutter_root/fml", - "$flutter_root/glue", - "$flutter_root/shell/common", - "$flutter_root/synchronization", - "//garnet/public/lib/fxl", - "//third_party/skia", - "//third_party/skia:gpu", - ] - - public_configs = [ "$flutter_root:config" ] - - if (shell_enable_vulkan) { - deps += [ "$flutter_root/vulkan" ] - } -} diff --git a/engine/src/flutter/shell/gpu/gpu.gni b/engine/src/flutter/shell/gpu/gpu.gni new file mode 100644 index 0000000000..7ec2553c36 --- /dev/null +++ b/engine/src/flutter/shell/gpu/gpu.gni @@ -0,0 +1,64 @@ +# Copyright 2016 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("$flutter_root/shell/config.gni") + +template("shell_gpu_configuration") { + assert(defined(invoker.enable_software), + "Caller must declare if the Software backend must be enabled.") + assert(defined(invoker.enable_vulkan), + "Caller must declare if the Vulkan backend must be enabled.") + assert(defined(invoker.enable_gl), + "Caller must declare if the Open GL backend must be enabled.") + + source_set(target_name) { + # vulkan_backend_enabled = shell_enable_vulkan + # gl_backend_enabled = !is_fuchsia + # software_backend_enabled = true + + sources = [] + + gpu_dir = "$flutter_root/shell/gpu" + + if (invoker.enable_software) { + sources += [ + "$gpu_dir/gpu_surface_software.cc", + "$gpu_dir/gpu_surface_software.h", + ] + } + + if (invoker.enable_gl) { + sources += [ + "$gpu_dir/gpu_surface_gl.cc", + "$gpu_dir/gpu_surface_gl.h", + ] + } + + if (invoker.enable_vulkan) { + sources += [ + "$gpu_dir/gpu_surface_vulkan.cc", + "$gpu_dir/gpu_surface_vulkan.h", + ] + } + + deps = [ + "$flutter_root/common", + "$flutter_root/flow", + "$flutter_root/fml", + "$flutter_root/glue", + "$flutter_root/shell/common", + "$flutter_root/synchronization", + "//garnet/public/lib/fxl", + "//third_party/skia", + ] + + if (invoker.enable_vulkan || invoker.enable_gl) { + deps += [ "//third_party/skia:gpu" ] + } + + if (invoker.enable_vulkan) { + deps += [ "$flutter_root/vulkan" ] + } + } +} diff --git a/engine/src/flutter/shell/platform/android/BUILD.gn b/engine/src/flutter/shell/platform/android/BUILD.gn index 129c877fae..1a35925546 100644 --- a/engine/src/flutter/shell/platform/android/BUILD.gn +++ b/engine/src/flutter/shell/platform/android/BUILD.gn @@ -6,6 +6,13 @@ import("$flutter_root/common/config.gni") import("$flutter_root/shell/config.gni") import("//build/config/android/config.gni") import("//build/config/android/rules.gni") +import("$flutter_root/shell/gpu/gpu.gni") + +shell_gpu_configuration("android_gpu_configuration") { + enable_software = true + enable_vulkan = shell_enable_vulkan + enable_gl = true +} shared_library("flutter_shell_native") { visibility = [ ":*" ] @@ -45,6 +52,7 @@ shared_library("flutter_shell_native") { ] deps = [ + ":android_gpu_configuration", "$flutter_root/assets", "$flutter_root/common", "$flutter_root/flow", @@ -52,7 +60,6 @@ shared_library("flutter_shell_native") { "$flutter_root/lib/ui", "$flutter_root/runtime", "$flutter_root/shell/common", - "$flutter_root/shell/gpu", "//garnet/public/lib/fxl", "//third_party/skia", "//third_party/skia:gpu", diff --git a/engine/src/flutter/shell/platform/darwin/BUILD.gn b/engine/src/flutter/shell/platform/darwin/BUILD.gn index 721733b964..2e3798ec01 100644 --- a/engine/src/flutter/shell/platform/darwin/BUILD.gn +++ b/engine/src/flutter/shell/platform/darwin/BUILD.gn @@ -41,7 +41,6 @@ source_set("flutter_channels") { "$flutter_root/fml", "$flutter_root/runtime", "$flutter_root/shell/common", - "$flutter_root/shell/gpu", "//garnet/public/lib/fxl", "//third_party/skia", ] diff --git a/engine/src/flutter/shell/platform/darwin/common/BUILD.gn b/engine/src/flutter/shell/platform/darwin/common/BUILD.gn index 338b0479de..beef771ab3 100644 --- a/engine/src/flutter/shell/platform/darwin/common/BUILD.gn +++ b/engine/src/flutter/shell/platform/darwin/common/BUILD.gn @@ -20,7 +20,6 @@ source_set("common") { "$flutter_root/fml", "$flutter_root/runtime", "$flutter_root/shell/common", - "$flutter_root/shell/gpu", "//garnet/public/lib/fxl", "//third_party/dart/runtime:dart_api", "//third_party/skia", diff --git a/engine/src/flutter/shell/platform/darwin/desktop/BUILD.gn b/engine/src/flutter/shell/platform/darwin/desktop/BUILD.gn index ddc54b67e9..b66ddc1dbc 100644 --- a/engine/src/flutter/shell/platform/darwin/desktop/BUILD.gn +++ b/engine/src/flutter/shell/platform/darwin/desktop/BUILD.gn @@ -4,6 +4,14 @@ assert(is_mac) +import("$flutter_root/shell/gpu/gpu.gni") + +shell_gpu_configuration("darwin_desktop_gpu_configuration") { + enable_software = false + enable_vulkan = false + enable_gl = true +} + source_set("mac_desktop_platform") { visibility = [ ":*" ] @@ -20,11 +28,11 @@ source_set("mac_desktop_platform") { ] deps = [ + ":darwin_desktop_gpu_configuration", "$flutter_root/common", "$flutter_root/fml", "$flutter_root/lib/snapshot", "$flutter_root/shell/common", - "$flutter_root/shell/gpu", "$flutter_root/shell/platform/darwin/common", "$flutter_root/synchronization", "//garnet/public/lib/fxl", diff --git a/engine/src/flutter/shell/platform/darwin/ios/BUILD.gn b/engine/src/flutter/shell/platform/darwin/ios/BUILD.gn index 19d2486a69..c4c4acea8b 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/BUILD.gn +++ b/engine/src/flutter/shell/platform/darwin/ios/BUILD.gn @@ -6,9 +6,16 @@ assert(is_ios) import("$flutter_root/common/config.gni") import("//build/config/ios/ios_sdk.gni") +import("$flutter_root/shell/gpu/gpu.gni") _flutter_framework_dir = "$root_out_dir/Flutter.framework" +shell_gpu_configuration("ios_gpu_configuration") { + enable_software = true + enable_gl = true + enable_vulkan = false +} + # The headers that will be copied to the Flutter.framework and be accessed # from outside the Flutter engine source root. _flutter_framework_headers = [ @@ -81,6 +88,7 @@ shared_library("create_flutter_framework_dylib") { sources += _flutter_framework_headers deps = [ + ":ios_gpu_configuration", "$flutter_root/common", "$flutter_root/flow", "$flutter_root/fml", @@ -88,7 +96,6 @@ shared_library("create_flutter_framework_dylib") { "$flutter_root/lib/ui", "$flutter_root/runtime", "$flutter_root/shell/common", - "$flutter_root/shell/gpu", "$flutter_root/shell/platform/darwin/common", "//garnet/public/lib/fxl", "//third_party/skia", diff --git a/engine/src/flutter/shell/platform/embedder/BUILD.gn b/engine/src/flutter/shell/platform/embedder/BUILD.gn index 91d86f3c8f..6761892bca 100644 --- a/engine/src/flutter/shell/platform/embedder/BUILD.gn +++ b/engine/src/flutter/shell/platform/embedder/BUILD.gn @@ -3,6 +3,13 @@ # found in the LICENSE file. import("$flutter_root/testing/testing.gni") +import("$flutter_root/shell/gpu/gpu.gni") + +shell_gpu_configuration("embedder_gpu_configuration") { + enable_software = false + enable_vulkan = false + enable_gl = true +} source_set("embedder") { sources = [ @@ -16,12 +23,12 @@ source_set("embedder") { ] deps = [ + ":embedder_gpu_configuration", "$flutter_root/assets", "$flutter_root/common", "$flutter_root/fml", "$flutter_root/lib/snapshot", "$flutter_root/shell/common", - "$flutter_root/shell/gpu", "//garnet/public/lib/fxl", "//third_party/dart/runtime:libdart_jit", "//third_party/dart/runtime/bin:embedded_dart_io",