Skip to content

Commit

Permalink
Eliminate Android-specific Vulkan support (#28239)
Browse files Browse the repository at this point in the history
This eliminates Vulkan support for Android. As of #27980
(c2f2291) we are no longer running Android-Vulkan builds. This
eliminates the --enable-vulkan flag from tools/gn and any code that is
only reachable when that flag is enabled.

Note that after this patch, `shell_enable_vulkan` is always false,
however the //flutter/shell/gpu:gpu_surface_vulkan target and source
files remain since they are still used when `test_enable_vulkan` is
true, which is the case when `is_fuchsia` is true. Note that these files
are *not* built as part of a regular fuchsia build (see the
`shell_gpu_configuration` in //shell/platform/fuchsia/flutter/BUILD.gn),
but may be enabled once the Fuchsia embedder is migrated to the Embedder
API.

Also updates TODOs to dworsham, who is the committer who'll be
transitioning the Fuchsia embedder to the embedding API.
  • Loading branch information
cbracken authored Aug 23, 2021
1 parent 22af55c commit 926ce0d
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 202 deletions.
2 changes: 0 additions & 2 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -778,8 +778,6 @@ FILE: ../../../flutter/shell/platform/android/android_surface_gl.cc
FILE: ../../../flutter/shell/platform/android/android_surface_gl.h
FILE: ../../../flutter/shell/platform/android/android_surface_software.cc
FILE: ../../../flutter/shell/platform/android/android_surface_software.h
FILE: ../../../flutter/shell/platform/android/android_surface_vulkan.cc
FILE: ../../../flutter/shell/platform/android/android_surface_vulkan.h
FILE: ../../../flutter/shell/platform/android/apk_asset_provider.cc
FILE: ../../../flutter/shell/platform/android/apk_asset_provider.h
FILE: ../../../flutter/shell/platform/android/context/android_context.cc
Expand Down
2 changes: 1 addition & 1 deletion shell/config.gni
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ declare_args() {
shell_enable_gl = !is_fuchsia
shell_enable_metal = false

# TODO(gw280): Enable once Fuchsia supports Vulkan through the embedder
# TODO(dworsham): Enable once Fuchsia supports Vulkan through the embedder.
shell_enable_vulkan = false
shell_enable_software = true
}
Expand Down
13 changes: 1 addition & 12 deletions shell/platform/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import("//flutter/shell/version/version.gni")

shell_gpu_configuration("android_gpu_configuration") {
enable_software = true
enable_vulkan = shell_enable_vulkan
enable_gl = true
enable_vulkan = false
enable_metal = false
}

Expand Down Expand Up @@ -95,17 +95,6 @@ shared_library("flutter_shell_native") {

defines = []

if (shell_enable_vulkan) {
sources += [
"android_surface_vulkan.cc",
"android_surface_vulkan.h",
]

deps += [ "//flutter/vulkan" ]

defines += [ "SHELL_ENABLE_VULKAN" ]
}

libs = [
"android",
"EGL",
Expand Down
99 changes: 0 additions & 99 deletions shell/platform/android/android_surface_vulkan.cc

This file was deleted.

62 changes: 0 additions & 62 deletions shell/platform/android/android_surface_vulkan.h

This file was deleted.

1 change: 0 additions & 1 deletion shell/platform/android/context/android_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ namespace flutter {
enum class AndroidRenderingAPI {
kSoftware,
kOpenGLES,
kVulkan,
};

//------------------------------------------------------------------------------
Expand Down
13 changes: 0 additions & 13 deletions shell/platform/android/platform_view_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
#include "flutter/shell/platform/android/surface/android_surface.h"
#include "flutter/shell/platform/android/surface/snapshot_surface_producer.h"

#if SHELL_ENABLE_VULKAN
#include "flutter/shell/platform/android/android_surface_vulkan.h"
#endif // SHELL_ENABLE_VULKAN

#include "flutter/shell/platform/android/context/android_context.h"
#include "flutter/shell/platform/android/jni/platform_view_android_jni.h"
#include "flutter/shell/platform/android/platform_message_response_android.h"
Expand All @@ -43,11 +39,6 @@ std::unique_ptr<AndroidSurface> AndroidSurfaceFactoryImpl::CreateSurface() {
jni_facade_);
case AndroidRenderingAPI::kOpenGLES:
return std::make_unique<AndroidSurfaceGL>(android_context_, jni_facade_);
case AndroidRenderingAPI::kVulkan:
#if SHELL_ENABLE_VULKAN
return std::make_unique<AndroidSurfaceVulkan>(android_context_,
jni_facade_);
#endif // SHELL_ENABLE_VULKAN
default:
FML_DCHECK(false);
return nullptr;
Expand All @@ -63,13 +54,9 @@ static std::shared_ptr<flutter::AndroidContext> CreateAndroidContext(
if (use_software_rendering) {
return std::make_shared<AndroidContext>(AndroidRenderingAPI::kSoftware);
}
#if SHELL_ENABLE_VULKAN
return std::make_shared<AndroidContext>(AndroidRenderingAPI::kVulkan);
#else // SHELL_ENABLE_VULKAN
return std::make_unique<AndroidContextGL>(
AndroidRenderingAPI::kOpenGLES,
fml::MakeRefCounted<AndroidEnvironmentGL>());
#endif // SHELL_ENABLE_VULKAN
}

PlatformViewAndroid::PlatformViewAndroid(
Expand Down
2 changes: 2 additions & 0 deletions shell/platform/fuchsia/flutter/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import("//flutter/vulkan/config.gni")
shell_gpu_configuration("fuchsia_gpu_configuration") {
enable_software = false
enable_gl = false

# TODO(dworsham): Enable once Fuchsia supports Vulkan through the embedder.
enable_vulkan = false
enable_metal = false
}
Expand Down
12 changes: 0 additions & 12 deletions tools/gn
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ def get_out_dir(args):
if args.target_os == 'fuchsia' and args.fuchsia_cpu is not None:
target_dir.append(args.fuchsia_cpu)

if args.enable_vulkan:
target_dir.append('vulkan')

# This exists for backwards compatibility of tests that are being run
# on LUCI. This can be removed in coordination with a LUCI change:
# https://github.com/flutter/flutter/issues/76547
Expand Down Expand Up @@ -123,9 +120,6 @@ def to_gn_args(args):
if args.target_os == 'android':
raise Exception('--simulator is not supported on Android')

if args.target_os != 'android' and args.enable_vulkan:
raise Exception('--enable-vulkan is only supported on Android')

runtime_mode = args.runtime_mode

gn_args = {}
Expand Down Expand Up @@ -309,12 +303,6 @@ def to_gn_args(args):
gn_args['skia_use_metal'] = True
gn_args['shell_enable_metal'] = True

if args.enable_vulkan:
# Enable vulkan in the Flutter shell.
gn_args['shell_enable_vulkan'] = True
# Configure Skia for Vulkan support.
gn_args['skia_use_vulkan'] = True

if sys.platform.startswith(('cygwin', 'win')):
# The buildroot currently isn't set up to support Vulkan in the
# Windows ANGLE build, so disable it regardless of enable_vulkan's value.
Expand Down

0 comments on commit 926ce0d

Please sign in to comment.