From 431bc70afecbb00bbafcb4a7de7e44f7f5fe0a66 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 29 Jul 2024 13:36:23 -0700 Subject: [PATCH 1/5] Rename //flutter/shell/gpu to //flutter/shell/surface. This component only contains surface subclasses of the abstract surface in flow. It used to be more related to other GPU related configuration but that is now no longer the case. --- BUILD.gn | 2 +- shell/common/BUILD.gn | 2 +- shell/common/shell_test_platform_view_gl.cc | 2 +- shell/common/shell_test_platform_view_gl.h | 2 +- shell/common/shell_test_platform_view_metal.h | 4 +- .../common/shell_test_platform_view_metal.mm | 12 ++-- .../common/shell_test_platform_view_vulkan.h | 2 +- shell/platform/android/BUILD.gn | 2 +- .../android/android_surface_gl_impeller.cc | 4 +- .../android/android_surface_gl_impeller.h | 4 +- .../android/android_surface_gl_skia.cc | 13 ++-- .../android/android_surface_gl_skia.h | 4 +- .../android/android_surface_software.cc | 3 +- .../android/android_surface_software.h | 4 +- .../android/android_surface_vk_impeller.cc | 8 +-- .../android/android_surface_vk_impeller.h | 4 +- .../android/external_view_embedder/BUILD.gn | 2 +- .../platform/android/platform_view_android.cc | 4 +- shell/platform/android/surface/BUILD.gn | 2 +- .../android/surface/android_surface_mock.h | 4 +- shell/platform/darwin/ios/BUILD.gn | 2 +- .../darwin/ios/ios_surface_metal_impeller.h | 2 +- .../darwin/ios/ios_surface_metal_impeller.mm | 2 +- .../darwin/ios/ios_surface_metal_skia.h | 2 +- .../darwin/ios/ios_surface_metal_skia.mm | 4 +- .../darwin/ios/ios_surface_software.h | 2 +- shell/platform/darwin/macos/BUILD.gn | 2 +- shell/platform/embedder/BUILD.gn | 2 +- .../embedder/embedder_surface_gl_impeller.h | 2 +- .../embedder/embedder_surface_gl_skia.h | 2 +- .../embedder_surface_metal_impeller.h | 6 +- .../embedder_surface_metal_impeller.mm | 8 +-- .../embedder/embedder_surface_metal_skia.h | 6 +- .../embedder/embedder_surface_metal_skia.mm | 6 +- .../embedder/embedder_surface_software.cc | 2 +- .../embedder/embedder_surface_software.h | 4 +- .../embedder/embedder_surface_vulkan.cc | 8 +-- .../embedder/embedder_surface_vulkan.h | 4 +- shell/platform/fuchsia/flutter/BUILD.gn | 2 +- shell/{gpu => surface}/BUILD.gn | 70 +++++++++---------- shell/surface/README.md | 3 + shell/{gpu/gpu.gni => surface/surface.gni} | 8 +-- .../surface_gl_delegate.cc} | 26 ++++--- .../surface_gl_delegate.h} | 10 +-- .../surface_gl_impeller.cc} | 30 ++++---- .../surface_gl_impeller.h} | 24 +++---- .../surface_gl_skia.cc} | 45 ++++++------ .../surface_gl_skia.h} | 28 ++++---- .../surface_metal_delegate.cc} | 10 +-- .../surface_metal_delegate.h} | 12 ++-- .../surface_metal_impeller.h} | 23 +++--- .../surface_metal_impeller.mm} | 32 ++++----- .../surface_metal_impeller_unittests.mm} | 20 +++--- .../surface_metal_skia.h} | 22 +++--- .../surface_metal_skia.mm} | 30 ++++---- .../surface_software.cc} | 16 ++--- .../surface_software.h} | 21 +++--- .../surface_software_delegate.cc} | 4 +- .../surface_software_delegate.h} | 10 +-- .../surface_vulkan.cc} | 22 +++--- .../surface_vulkan.h} | 26 +++---- .../surface_vulkan_delegate.cc} | 4 +- .../surface_vulkan_delegate.h} | 10 +-- .../surface_vulkan_impeller.cc} | 22 +++--- .../surface_vulkan_impeller.h} | 16 ++--- shell/testing/BUILD.gn | 4 +- shell/testing/tester_main.cc | 15 ++-- 67 files changed, 355 insertions(+), 360 deletions(-) rename shell/{gpu => surface}/BUILD.gn (52%) create mode 100644 shell/surface/README.md rename shell/{gpu/gpu.gni => surface/surface.gni} (82%) rename shell/{gpu/gpu_surface_gl_delegate.cc => surface/surface_gl_delegate.cc} (80%) rename shell/{gpu/gpu_surface_gl_delegate.h => surface/surface_gl_delegate.h} (94%) rename shell/{gpu/gpu_surface_gl_impeller.cc => surface/surface_gl_impeller.cc} (86%) rename shell/{gpu/gpu_surface_gl_impeller.h => surface/surface_gl_impeller.h} (67%) rename shell/{gpu/gpu_surface_gl_skia.cc => surface/surface_gl_skia.cc} (88%) rename shell/{gpu/gpu_surface_gl_skia.h => surface/surface_gl_skia.h} (74%) rename shell/{gpu/gpu_surface_metal_delegate.cc => surface/surface_metal_delegate.cc} (53%) rename shell/{gpu/gpu_surface_metal_delegate.h => surface/surface_metal_delegate.h} (92%) rename shell/{gpu/gpu_surface_metal_impeller.h => surface/surface_metal_impeller.h} (77%) rename shell/{gpu/gpu_surface_metal_impeller.mm => surface/surface_metal_impeller.mm} (93%) rename shell/{gpu/gpu_surface_metal_impeller_unittests.mm => surface/surface_metal_impeller_unittests.mm} (86%) rename shell/{gpu/gpu_surface_metal_skia.h => surface/surface_metal_skia.h} (74%) rename shell/{gpu/gpu_surface_metal_skia.mm => surface/surface_metal_skia.mm} (90%) rename shell/{gpu/gpu_surface_software.cc => surface/surface_software.cc} (84%) rename shell/{gpu/gpu_surface_software.h => surface/surface_software.h} (61%) rename shell/{gpu/gpu_surface_vulkan_delegate.cc => surface/surface_software_delegate.cc} (63%) rename shell/{gpu/gpu_surface_software_delegate.h => surface/surface_software_delegate.h} (89%) rename shell/{gpu/gpu_surface_vulkan.cc => surface/surface_vulkan.cc} (87%) rename shell/{gpu/gpu_surface_vulkan.h => surface/surface_vulkan.h} (72%) rename shell/{gpu/gpu_surface_software_delegate.cc => surface/surface_vulkan_delegate.cc} (61%) rename shell/{gpu/gpu_surface_vulkan_delegate.h => surface/surface_vulkan_delegate.h} (87%) rename shell/{gpu/gpu_surface_vulkan_impeller.cc => surface/surface_vulkan_impeller.cc} (88%) rename shell/{gpu/gpu_surface_vulkan_impeller.h => surface/surface_vulkan_impeller.h} (72%) diff --git a/BUILD.gn b/BUILD.gn index ac8d81872d19a..147701784501c 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -216,9 +216,9 @@ group("unittests") { if (is_mac) { public_deps += [ "//flutter/impeller/golden_tests:impeller_golden_tests", - "//flutter/shell/gpu:gpu_surface_metal_unittests", "//flutter/shell/platform/darwin/common:availability_version_check_unittests", "//flutter/shell/platform/darwin/common:framework_common_unittests", + "//flutter/shell/surface:metal_unittests", "//flutter/third_party/spring_animation:spring_animation_unittests", ] } diff --git a/shell/common/BUILD.gn b/shell/common/BUILD.gn index 8e2d9f2174b3a..9094481db3258 100644 --- a/shell/common/BUILD.gn +++ b/shell/common/BUILD.gn @@ -4,7 +4,7 @@ import("//flutter/common/config.gni") import("//flutter/impeller/tools/impeller.gni") -import("//flutter/shell/gpu/gpu.gni") +import("//flutter/shell/surface/surface.gni") import("//flutter/testing/testing.gni") if (is_fuchsia) { diff --git a/shell/common/shell_test_platform_view_gl.cc b/shell/common/shell_test_platform_view_gl.cc index 3a52772d0a0f7..9cf88265b4683 100644 --- a/shell/common/shell_test_platform_view_gl.cc +++ b/shell/common/shell_test_platform_view_gl.cc @@ -8,7 +8,7 @@ #include -#include "flutter/shell/gpu/gpu_surface_gl_skia.h" +#include "flutter/shell/surface/surface_gl_skia.h" #include "impeller/entity/gles/entity_shaders_gles.h" #if IMPELLER_ENABLE_3D diff --git a/shell/common/shell_test_platform_view_gl.h b/shell/common/shell_test_platform_view_gl.h index 12aa92d7f9674..3ca9412f53741 100644 --- a/shell/common/shell_test_platform_view_gl.h +++ b/shell/common/shell_test_platform_view_gl.h @@ -7,7 +7,7 @@ #include "flutter/shell/common/shell_test_external_view_embedder.h" #include "flutter/shell/common/shell_test_platform_view.h" -#include "flutter/shell/gpu/gpu_surface_gl_delegate.h" +#include "flutter/shell/surface/surface_gl_delegate.h" #include "flutter/testing/test_gl_surface.h" #include "impeller/renderer/backend/gles/context_gles.h" diff --git a/shell/common/shell_test_platform_view_metal.h b/shell/common/shell_test_platform_view_metal.h index c5c0a8d454d04..76aabdbdfb518 100644 --- a/shell/common/shell_test_platform_view_metal.h +++ b/shell/common/shell_test_platform_view_metal.h @@ -7,7 +7,7 @@ #include "flutter/fml/macros.h" #include "flutter/shell/common/shell_test_platform_view.h" -#include "flutter/shell/gpu/gpu_surface_metal_delegate.h" +#include "flutter/shell/surface/surface_metal_delegate.h" namespace flutter { namespace testing { @@ -15,7 +15,7 @@ namespace testing { class DarwinContextMetal; class ShellTestPlatformViewMetal final : public ShellTestPlatformView, - public GPUSurfaceMetalDelegate { + public SurfaceMetalDelegate { public: ShellTestPlatformViewMetal(PlatformView::Delegate& delegate, const TaskRunners& task_runners, diff --git a/shell/common/shell_test_platform_view_metal.mm b/shell/common/shell_test_platform_view_metal.mm index 41322490f8252..9ef656134f568 100644 --- a/shell/common/shell_test_platform_view_metal.mm +++ b/shell/common/shell_test_platform_view_metal.mm @@ -9,10 +9,10 @@ #include #include "flutter/fml/platform/darwin/scoped_nsobject.h" -#include "flutter/shell/gpu/gpu_surface_metal_impeller.h" -#include "flutter/shell/gpu/gpu_surface_metal_skia.h" #include "flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.h" #include "flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalSkia.h" +#include "flutter/shell/surface/surface_metal_impeller.h" +#include "flutter/shell/surface/surface_metal_skia.h" namespace flutter { namespace testing { @@ -74,7 +74,7 @@ GPUMTLTextureInfo offscreen_texture_info() const { std::shared_ptr shell_test_external_view_embedder, const std::shared_ptr& is_gpu_disabled_sync_switch) : ShellTestPlatformView(delegate, task_runners), - GPUSurfaceMetalDelegate(MTLRenderTargetType::kMTLTexture), + SurfaceMetalDelegate(MTLRenderTargetType::kMTLTexture), metal_context_(std::make_unique(GetSettings().enable_impeller, is_gpu_disabled_sync_switch)), create_vsync_waiter_(std::move(create_vsync_waiter)), @@ -113,10 +113,10 @@ GPUMTLTextureInfo offscreen_texture_info() const { // |PlatformView| std::unique_ptr ShellTestPlatformViewMetal::CreateRenderingSurface() { if (GetSettings().enable_impeller) { - return std::make_unique(this, - [metal_context_->impeller_context() context]); + return std::make_unique(this, + [metal_context_->impeller_context() context]); } - return std::make_unique(this, [metal_context_->context() mainContext]); + return std::make_unique(this, [metal_context_->context() mainContext]); } // |PlatformView| diff --git a/shell/common/shell_test_platform_view_vulkan.h b/shell/common/shell_test_platform_view_vulkan.h index 7ee3f3ed0420d..7e4314973d00e 100644 --- a/shell/common/shell_test_platform_view_vulkan.h +++ b/shell/common/shell_test_platform_view_vulkan.h @@ -7,7 +7,7 @@ #include "flutter/shell/common/shell_test_external_view_embedder.h" #include "flutter/shell/common/shell_test_platform_view.h" -#include "flutter/shell/gpu/gpu_surface_vulkan_delegate.h" +#include "flutter/shell/surface/surface_vulkan_delegate.h" #include "flutter/vulkan/vulkan_application.h" #include "flutter/vulkan/vulkan_device.h" #include "flutter/vulkan/vulkan_skia_proc_table.h" diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index 433af900f8cbf..c56ae3dffa8da 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -9,7 +9,7 @@ import("//flutter/build/zip_bundle.gni") import("//flutter/common/config.gni") import("//flutter/impeller/tools/impeller.gni") import("//flutter/shell/config.gni") -import("//flutter/shell/gpu/gpu.gni") +import("//flutter/shell/surface/surface.gni") import("//flutter/shell/version/version.gni") import("//flutter/vulkan/config.gni") diff --git a/shell/platform/android/android_surface_gl_impeller.cc b/shell/platform/android/android_surface_gl_impeller.cc index b2d0b69d9a9cf..bc58793551887 100644 --- a/shell/platform/android/android_surface_gl_impeller.cc +++ b/shell/platform/android/android_surface_gl_impeller.cc @@ -6,7 +6,7 @@ #include "flutter/fml/logging.h" #include "flutter/impeller/toolkit/egl/surface.h" -#include "flutter/shell/gpu/gpu_surface_gl_impeller.h" +#include "flutter/shell/surface/surface_gl_impeller.h" namespace flutter { @@ -35,7 +35,7 @@ bool AndroidSurfaceGLImpeller::IsValid() const { // |AndroidSurface| std::unique_ptr AndroidSurfaceGLImpeller::CreateGPUSurface( GrDirectContext* gr_context) { - auto surface = std::make_unique( + auto surface = std::make_unique( this, // delegate android_context_->GetImpellerContext(), // context true // render to surface diff --git a/shell/platform/android/android_surface_gl_impeller.h b/shell/platform/android/android_surface_gl_impeller.h index 3066a8552ee25..48bd941d2e3a4 100644 --- a/shell/platform/android/android_surface_gl_impeller.h +++ b/shell/platform/android/android_surface_gl_impeller.h @@ -7,14 +7,14 @@ #include "flutter/fml/macros.h" #include "flutter/impeller/renderer/context.h" -#include "flutter/shell/gpu/gpu_surface_gl_delegate.h" #include "flutter/shell/platform/android/android_context_gl_impeller.h" #include "flutter/shell/platform/android/surface/android_native_window.h" #include "flutter/shell/platform/android/surface/android_surface.h" +#include "flutter/shell/surface/surface_gl_delegate.h" namespace flutter { -class AndroidSurfaceGLImpeller final : public GPUSurfaceGLDelegate, +class AndroidSurfaceGLImpeller final : public SurfaceGLDelegate, public AndroidSurface { public: explicit AndroidSurfaceGLImpeller( diff --git a/shell/platform/android/android_surface_gl_skia.cc b/shell/platform/android/android_surface_gl_skia.cc index 6a5dda8a06082..d8ead5842592f 100644 --- a/shell/platform/android/android_surface_gl_skia.cc +++ b/shell/platform/android/android_surface_gl_skia.cc @@ -50,16 +50,15 @@ bool AndroidSurfaceGLSkia::IsValid() const { std::unique_ptr AndroidSurfaceGLSkia::CreateGPUSurface( GrDirectContext* gr_context) { if (gr_context) { - return std::make_unique(sk_ref_sp(gr_context), this, - true); + return std::make_unique(sk_ref_sp(gr_context), this, true); } else { sk_sp main_skia_context = android_context_->GetMainSkiaContext(); if (!main_skia_context) { - main_skia_context = GPUSurfaceGLSkia::MakeGLContext(this); + main_skia_context = SurfaceGLSkia::MakeGLContext(this); android_context_->SetMainSkiaContext(main_skia_context); } - return std::make_unique(main_skia_context, this, true); + return std::make_unique(main_skia_context, this, true); } } @@ -200,7 +199,7 @@ sk_sp AndroidSurfaceGLSkia::GetGLInterface() const { } } - return GPUSurfaceGLDelegate::GetGLInterface(); + return SurfaceGLDelegate::GetGLInterface(); } std::unique_ptr AndroidSurfaceGLSkia::CreateSnapshotSurface() { @@ -210,11 +209,11 @@ std::unique_ptr AndroidSurfaceGLSkia::CreateSnapshotSurface() { sk_sp main_skia_context = android_context_->GetMainSkiaContext(); if (!main_skia_context) { - main_skia_context = GPUSurfaceGLSkia::MakeGLContext(this); + main_skia_context = SurfaceGLSkia::MakeGLContext(this); android_context_->SetMainSkiaContext(main_skia_context); } - return std::make_unique(main_skia_context, this, true); + return std::make_unique(main_skia_context, this, true); } } // namespace flutter diff --git a/shell/platform/android/android_surface_gl_skia.h b/shell/platform/android/android_surface_gl_skia.h index 1c35692dc3a0e..92a27b7e3c56e 100644 --- a/shell/platform/android/android_surface_gl_skia.h +++ b/shell/platform/android/android_surface_gl_skia.h @@ -10,15 +10,15 @@ #include #include "flutter/fml/macros.h" -#include "flutter/shell/gpu/gpu_surface_gl_skia.h" #include "flutter/shell/platform/android/android_context_gl_skia.h" #include "flutter/shell/platform/android/android_environment_gl.h" #include "flutter/shell/platform/android/jni/platform_view_android_jni.h" #include "flutter/shell/platform/android/surface/android_surface.h" +#include "flutter/shell/surface/surface_gl_skia.h" namespace flutter { -class AndroidSurfaceGLSkia final : public GPUSurfaceGLDelegate, +class AndroidSurfaceGLSkia final : public SurfaceGLDelegate, public AndroidSurface { public: explicit AndroidSurfaceGLSkia( diff --git a/shell/platform/android/android_surface_software.cc b/shell/platform/android/android_surface_software.cc index db5881c684b88..48a052b38b07e 100644 --- a/shell/platform/android/android_surface_software.cc +++ b/shell/platform/android/android_surface_software.cc @@ -13,7 +13,6 @@ #include "flutter/fml/trace_event.h" #include "flutter/shell/platform/android/android_shell_holder.h" #include "flutter/shell/platform/android/jni/platform_view_android_jni.h" - #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkSurface.h" @@ -69,7 +68,7 @@ std::unique_ptr AndroidSurfaceSoftware::CreateGPUSurface( } auto surface = - std::make_unique(this, true /* render to surface */); + std::make_unique(this, true /* render to surface */); if (!surface->IsValid()) { return nullptr; diff --git a/shell/platform/android/android_surface_software.h b/shell/platform/android/android_surface_software.h index 1b7083aa7dda1..fbd4cc054415d 100644 --- a/shell/platform/android/android_surface_software.h +++ b/shell/platform/android/android_surface_software.h @@ -8,16 +8,16 @@ #include "flutter/fml/macros.h" #include "flutter/fml/platform/android/jni_weak_ref.h" #include "flutter/fml/platform/android/scoped_java_ref.h" -#include "flutter/shell/gpu/gpu_surface_software.h" #include "flutter/shell/platform/android/jni/platform_view_android_jni.h" #include "flutter/shell/platform/android/surface/android_surface.h" +#include "flutter/shell/surface/surface_software.h" #include "third_party/skia/include/core/SkSurface.h" namespace flutter { class AndroidSurfaceSoftware final : public AndroidSurface, - public GPUSurfaceSoftwareDelegate { + public SurfaceSoftwareDelegate { public: AndroidSurfaceSoftware(); diff --git a/shell/platform/android/android_surface_vk_impeller.cc b/shell/platform/android/android_surface_vk_impeller.cc index 8dc12a78ac479..22b5c95444c65 100644 --- a/shell/platform/android/android_surface_vk_impeller.cc +++ b/shell/platform/android/android_surface_vk_impeller.cc @@ -12,7 +12,7 @@ #include "flutter/fml/memory/ref_ptr.h" #include "flutter/impeller/renderer/backend/vulkan/context_vk.h" #include "flutter/impeller/renderer/backend/vulkan/swapchain/swapchain_vk.h" -#include "flutter/shell/gpu/gpu_surface_vulkan_impeller.h" +#include "flutter/shell/surface/surface_vulkan_impeller.h" #include "flutter/vulkan/vulkan_native_surface_android.h" namespace flutter { @@ -25,7 +25,7 @@ AndroidSurfaceVKImpeller::AndroidSurfaceVKImpeller( impeller::ContextVK::Cast(*android_context->GetImpellerContext()); surface_context_vk_ = context_vk.CreateSurfaceContext(); eager_gpu_surface_ = - std::make_unique(surface_context_vk_); + std::make_unique(surface_context_vk_); } AndroidSurfaceVKImpeller::~AndroidSurfaceVKImpeller() = default; @@ -56,8 +56,8 @@ std::unique_ptr AndroidSurfaceVKImpeller::CreateGPUSurface( return gpu_surface; } - std::unique_ptr gpu_surface = - std::make_unique(surface_context_vk_); + std::unique_ptr gpu_surface = + std::make_unique(surface_context_vk_); if (!gpu_surface->IsValid()) { return nullptr; diff --git a/shell/platform/android/android_surface_vk_impeller.h b/shell/platform/android/android_surface_vk_impeller.h index 01dde0844020b..ea2937cf57a7f 100644 --- a/shell/platform/android/android_surface_vk_impeller.h +++ b/shell/platform/android/android_surface_vk_impeller.h @@ -11,7 +11,7 @@ #include "flutter/shell/platform/android/android_context_vk_impeller.h" #include "flutter/shell/platform/android/surface/android_native_window.h" #include "flutter/shell/platform/android/surface/android_surface.h" -#include "shell/gpu/gpu_surface_vulkan_impeller.h" +#include "flutter/shell/surface/surface_vulkan_impeller.h" namespace flutter { @@ -53,7 +53,7 @@ class AndroidSurfaceVKImpeller : public AndroidSurface { // The first GPU Surface is initialized as soon as the // AndroidSurfaceVulkanImpeller is created. This ensures that the pipelines // are bootstrapped as early as possible. - std::unique_ptr eager_gpu_surface_; + std::unique_ptr eager_gpu_surface_; bool is_valid_ = false; diff --git a/shell/platform/android/external_view_embedder/BUILD.gn b/shell/platform/android/external_view_embedder/BUILD.gn index 44ae1106df182..620dc2b99d962 100644 --- a/shell/platform/android/external_view_embedder/BUILD.gn +++ b/shell/platform/android/external_view_embedder/BUILD.gn @@ -42,10 +42,10 @@ executable("android_external_view_embedder_unittests") { ":external_view_embedder", ":external_view_embedder_fixtures", "//flutter/flow", - "//flutter/shell/gpu:gpu_surface_gl", "//flutter/shell/platform/android/jni:jni_mock", "//flutter/shell/platform/android/surface", "//flutter/shell/platform/android/surface:surface_mock", + "//flutter/shell/surface:gl", "//flutter/testing", "//flutter/testing:dart", "//flutter/testing:skia", diff --git a/shell/platform/android/platform_view_android.cc b/shell/platform/android/platform_view_android.cc index 926c99928b694..469133454c071 100644 --- a/shell/platform/android/platform_view_android.cc +++ b/shell/platform/android/platform_view_android.cc @@ -11,7 +11,6 @@ #include "flutter/common/graphics/texture.h" #include "flutter/fml/synchronization/waitable_event.h" #include "flutter/shell/common/shell_io_manager.h" -#include "flutter/shell/gpu/gpu_surface_gl_delegate.h" #include "flutter/shell/platform/android/android_context_gl_impeller.h" #include "flutter/shell/platform/android/android_context_gl_skia.h" #include "flutter/shell/platform/android/android_context_vk_impeller.h" @@ -23,6 +22,7 @@ #include "flutter/shell/platform/android/surface_texture_external_texture_gl_impeller.h" #include "flutter/shell/platform/android/surface_texture_external_texture_gl_skia.h" #include "flutter/shell/platform/android/surface_texture_external_texture_vk_impeller.h" +#include "flutter/shell/surface/surface_gl_delegate.h" #include "fml/logging.h" #if IMPELLER_ENABLE_VULKAN // b/258506856 for why this is behind an if #include "flutter/shell/platform/android/android_surface_vk_impeller.h" @@ -384,7 +384,7 @@ sk_sp PlatformViewAndroid::CreateResourceContext() const { // this changes, this assumption breaks. Handle the same. resource_context = ShellIOManager::CreateCompatibleResourceLoadingContext( GrBackendApi::kOpenGL, - GPUSurfaceGLDelegate::GetDefaultPlatformGLInterface()); + SurfaceGLDelegate::GetDefaultPlatformGLInterface()); } else { FML_DLOG(ERROR) << "Could not make the resource context current."; } diff --git a/shell/platform/android/surface/BUILD.gn b/shell/platform/android/surface/BUILD.gn index ecc46d1145f6e..78d7d810bbaa7 100644 --- a/shell/platform/android/surface/BUILD.gn +++ b/shell/platform/android/surface/BUILD.gn @@ -52,7 +52,7 @@ source_set("surface_mock") { deps = [ ":surface", "//flutter/flow", - "//flutter/shell/gpu:gpu_surface_gl", + "//flutter/shell/surface:gl", "//flutter/third_party/googletest:gmock", "//flutter/third_party/googletest:gtest", ] diff --git a/shell/platform/android/surface/android_surface_mock.h b/shell/platform/android/surface/android_surface_mock.h index 6bb1628e7dd85..fcabc721997eb 100644 --- a/shell/platform/android/surface/android_surface_mock.h +++ b/shell/platform/android/surface/android_surface_mock.h @@ -5,8 +5,8 @@ #ifndef FLUTTER_SHELL_PLATFORM_ANDROID_SURFACE_ANDROID_SURFACE_MOCK_H_ #define FLUTTER_SHELL_PLATFORM_ANDROID_SURFACE_ANDROID_SURFACE_MOCK_H_ -#include "flutter/shell/gpu/gpu_surface_gl_skia.h" #include "flutter/shell/platform/android/surface/android_surface.h" +#include "flutter/shell/surface/surface_gl_skia.h" #include "gmock/gmock.h" namespace flutter { @@ -15,7 +15,7 @@ namespace flutter { /// Mock for |AndroidSurface|. This implementation can be used in unit /// tests without requiring the Android toolchain. /// -class AndroidSurfaceMock final : public GPUSurfaceGLDelegate, +class AndroidSurfaceMock final : public SurfaceGLDelegate, public AndroidSurface { public: MOCK_METHOD(bool, IsValid, (), (const, override)); diff --git a/shell/platform/darwin/ios/BUILD.gn b/shell/platform/darwin/ios/BUILD.gn index f3e3389a3df2f..5edeef5fdf547 100644 --- a/shell/platform/darwin/ios/BUILD.gn +++ b/shell/platform/darwin/ios/BUILD.gn @@ -9,8 +9,8 @@ import("//build/toolchain/clang.gni") import("//build/toolchain/toolchain.gni") import("//flutter/common/config.gni") import("//flutter/shell/config.gni") -import("//flutter/shell/gpu/gpu.gni") import("//flutter/shell/platform/darwin/common/framework_common.gni") +import("//flutter/shell/surface/surface.gni") import("//flutter/testing/testing.gni") _flutter_framework_dir = "$root_out_dir/Flutter.framework" diff --git a/shell/platform/darwin/ios/ios_surface_metal_impeller.h b/shell/platform/darwin/ios/ios_surface_metal_impeller.h index 888f3935355e3..7bce1275cfbe1 100644 --- a/shell/platform/darwin/ios/ios_surface_metal_impeller.h +++ b/shell/platform/darwin/ios/ios_surface_metal_impeller.h @@ -6,8 +6,8 @@ #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_IOS_SURFACE_METAL_IMPELLER_H_ #include "flutter/fml/macros.h" -#include "flutter/shell/gpu/gpu_surface_metal_delegate.h" #include "flutter/shell/platform/darwin/ios/ios_surface.h" +#include "flutter/shell/surface/surface_metal_delegate.h" @class CAMetalLayer; diff --git a/shell/platform/darwin/ios/ios_surface_metal_impeller.mm b/shell/platform/darwin/ios/ios_surface_metal_impeller.mm index edf0e6c886192..82002b4f295a4 100644 --- a/shell/platform/darwin/ios/ios_surface_metal_impeller.mm +++ b/shell/platform/darwin/ios/ios_surface_metal_impeller.mm @@ -6,7 +6,7 @@ #include "flutter/impeller/renderer/backend/metal/formats_mtl.h" #include "flutter/impeller/renderer/context.h" -#include "flutter/shell/gpu/gpu_surface_metal_impeller.h" +#include "flutter/shell/surface/surface_metal_impeller.h" FLUTTER_ASSERT_ARC diff --git a/shell/platform/darwin/ios/ios_surface_metal_skia.h b/shell/platform/darwin/ios/ios_surface_metal_skia.h index 65549762c4949..2ef1cc97a6433 100644 --- a/shell/platform/darwin/ios/ios_surface_metal_skia.h +++ b/shell/platform/darwin/ios/ios_surface_metal_skia.h @@ -8,8 +8,8 @@ #if !SLIMPELLER #include "flutter/fml/macros.h" -#include "flutter/shell/gpu/gpu_surface_metal_delegate.h" #import "flutter/shell/platform/darwin/ios/ios_surface.h" +#include "flutter/shell/surface/surface_metal_delegate.h" #include "third_party/skia/include/gpu/ganesh/mtl/GrMtlTypes.h" @class CAMetalLayer; diff --git a/shell/platform/darwin/ios/ios_surface_metal_skia.mm b/shell/platform/darwin/ios/ios_surface_metal_skia.mm index 32465e2153201..a93ff91cbe136 100644 --- a/shell/platform/darwin/ios/ios_surface_metal_skia.mm +++ b/shell/platform/darwin/ios/ios_surface_metal_skia.mm @@ -6,9 +6,9 @@ #import "flutter/shell/platform/darwin/ios/ios_surface_metal_skia.h" -#include "flutter/shell/gpu/gpu_surface_metal_delegate.h" -#include "flutter/shell/gpu/gpu_surface_metal_skia.h" #include "flutter/shell/platform/darwin/ios/ios_context_metal_skia.h" +#include "flutter/shell/surface/surface_metal_delegate.h" +#include "flutter/shell/surface/surface_metal_skia.h" FLUTTER_ASSERT_ARC diff --git a/shell/platform/darwin/ios/ios_surface_software.h b/shell/platform/darwin/ios/ios_surface_software.h index e1ed6b69518c0..15a75b162d721 100644 --- a/shell/platform/darwin/ios/ios_surface_software.h +++ b/shell/platform/darwin/ios/ios_surface_software.h @@ -8,9 +8,9 @@ #include "flutter/flow/embedded_views.h" #include "flutter/fml/macros.h" #include "flutter/fml/platform/darwin/scoped_nsobject.h" -#include "flutter/shell/gpu/gpu_surface_software.h" #import "flutter/shell/platform/darwin/ios/ios_context.h" #import "flutter/shell/platform/darwin/ios/ios_surface.h" +#include "flutter/shell/surface/surface_software.h" #include "third_party/skia/include/core/SkSurface.h" diff --git a/shell/platform/darwin/macos/BUILD.gn b/shell/platform/darwin/macos/BUILD.gn index 401b63bc0b8b6..558160cbae19c 100644 --- a/shell/platform/darwin/macos/BUILD.gn +++ b/shell/platform/darwin/macos/BUILD.gn @@ -6,9 +6,9 @@ assert(is_mac) import("//build/config/mac/mac_sdk.gni") import("//flutter/build/zip_bundle.gni") -import("//flutter/shell/gpu/gpu.gni") import("//flutter/shell/platform/darwin/common/framework_common.gni") import("//flutter/shell/platform/glfw/config.gni") +import("//flutter/shell/surface/surface.gni") import("//flutter/testing/testing.gni") shell_gpu_configuration("macos_gpu_configuration") { diff --git a/shell/platform/embedder/BUILD.gn b/shell/platform/embedder/BUILD.gn index 39ca8dc757ae7..6f5458c3210f5 100644 --- a/shell/platform/embedder/BUILD.gn +++ b/shell/platform/embedder/BUILD.gn @@ -6,8 +6,8 @@ import("//build/toolchain/clang.gni") import("//flutter/build/zip_bundle.gni") import("//flutter/common/config.gni") import("//flutter/impeller/tools/impeller.gni") -import("//flutter/shell/gpu/gpu.gni") import("//flutter/shell/platform/embedder/embedder.gni") +import("//flutter/shell/surface/surface.gni") import("//flutter/testing/testing.gni") declare_args() { diff --git a/shell/platform/embedder/embedder_surface_gl_impeller.h b/shell/platform/embedder/embedder_surface_gl_impeller.h index bc4d80e759e2d..45f14e5714a51 100644 --- a/shell/platform/embedder/embedder_surface_gl_impeller.h +++ b/shell/platform/embedder/embedder_surface_gl_impeller.h @@ -6,10 +6,10 @@ #define FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SURFACE_GL_IMPELLER_H_ #include "flutter/fml/macros.h" -#include "flutter/shell/gpu/gpu_surface_gl_impeller.h" #include "flutter/shell/platform/embedder/embedder_external_view_embedder.h" #include "flutter/shell/platform/embedder/embedder_surface.h" #include "flutter/shell/platform/embedder/embedder_surface_gl_skia.h" +#include "flutter/shell/surface/surface_gl_impeller.h" namespace impeller { class ContextGLES; diff --git a/shell/platform/embedder/embedder_surface_gl_skia.h b/shell/platform/embedder/embedder_surface_gl_skia.h index 0fb39828d972c..c303a00761119 100644 --- a/shell/platform/embedder/embedder_surface_gl_skia.h +++ b/shell/platform/embedder/embedder_surface_gl_skia.h @@ -6,9 +6,9 @@ #define FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SURFACE_GL_SKIA_H_ #include "flutter/fml/macros.h" -#include "flutter/shell/gpu/gpu_surface_gl_skia.h" #include "flutter/shell/platform/embedder/embedder_external_view_embedder.h" #include "flutter/shell/platform/embedder/embedder_surface.h" +#include "flutter/shell/surface/surface_gl_skia.h" namespace flutter { diff --git a/shell/platform/embedder/embedder_surface_metal_impeller.h b/shell/platform/embedder/embedder_surface_metal_impeller.h index 109870aa6f129..1997580e10393 100644 --- a/shell/platform/embedder/embedder_surface_metal_impeller.h +++ b/shell/platform/embedder/embedder_surface_metal_impeller.h @@ -7,10 +7,10 @@ #include #include "flutter/fml/macros.h" -#include "flutter/shell/gpu/gpu_surface_metal_delegate.h" -#include "flutter/shell/gpu/gpu_surface_metal_skia.h" #include "flutter/shell/platform/embedder/embedder_external_view_embedder.h" #include "flutter/shell/platform/embedder/embedder_surface.h" +#include "flutter/shell/surface/surface_metal_delegate.h" +#include "flutter/shell/surface/surface_metal_skia.h" #include "fml/concurrent_message_loop.h" namespace impeller { @@ -20,7 +20,7 @@ class Context; namespace flutter { class EmbedderSurfaceMetalImpeller final : public EmbedderSurface, - public GPUSurfaceMetalDelegate { + public SurfaceMetalDelegate { public: struct MetalDispatchTable { std::function present; // required diff --git a/shell/platform/embedder/embedder_surface_metal_impeller.mm b/shell/platform/embedder/embedder_surface_metal_impeller.mm index c36199a2a3fc0..96af46723bcab 100644 --- a/shell/platform/embedder/embedder_surface_metal_impeller.mm +++ b/shell/platform/embedder/embedder_surface_metal_impeller.mm @@ -9,9 +9,9 @@ #include "flutter/fml/logging.h" #include "flutter/fml/synchronization/sync_switch.h" -#include "flutter/shell/gpu/gpu_surface_metal_delegate.h" -#include "flutter/shell/gpu/gpu_surface_metal_impeller.h" #import "flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.h" +#include "flutter/shell/surface/surface_metal_delegate.h" +#include "flutter/shell/surface/surface_metal_impeller.h" #include "impeller/entity/mtl/entity_shaders.h" #include "impeller/entity/mtl/framebuffer_blend_shaders.h" #include "impeller/entity/mtl/modern_shaders.h" @@ -30,7 +30,7 @@ GPUMTLCommandQueueHandle command_queue, MetalDispatchTable metal_dispatch_table, std::shared_ptr external_view_embedder) - : GPUSurfaceMetalDelegate(MTLRenderTargetType::kMTLTexture), + : SurfaceMetalDelegate(MTLRenderTargetType::kMTLTexture), metal_dispatch_table_(std::move(metal_dispatch_table)), external_view_embedder_(std::move(external_view_embedder)) { std::vector> shader_mappings = { @@ -70,7 +70,7 @@ } const bool render_to_surface = !external_view_embedder_; - auto surface = std::make_unique(this, context_, render_to_surface); + auto surface = std::make_unique(this, context_, render_to_surface); if (!surface->IsValid()) { return nullptr; diff --git a/shell/platform/embedder/embedder_surface_metal_skia.h b/shell/platform/embedder/embedder_surface_metal_skia.h index b03a17c6e6f67..1dcd179aa2026 100644 --- a/shell/platform/embedder/embedder_surface_metal_skia.h +++ b/shell/platform/embedder/embedder_surface_metal_skia.h @@ -8,10 +8,10 @@ #if !SLIMPELLER #include "flutter/fml/macros.h" -#include "flutter/shell/gpu/gpu_surface_metal_delegate.h" -#include "flutter/shell/gpu/gpu_surface_metal_skia.h" #include "flutter/shell/platform/embedder/embedder_external_view_embedder.h" #include "flutter/shell/platform/embedder/embedder_surface.h" +#include "flutter/shell/surface/surface_metal_delegate.h" +#include "flutter/shell/surface/surface_metal_skia.h" #include "third_party/skia/include/core/SkSurface.h" @@ -21,7 +21,7 @@ namespace flutter { // specifically for Impeller called EmbedderSurfaceMetalImpeller. Rename this to // EmbedderSurfaceMetalSkia to avoid confusion. class EmbedderSurfaceMetalSkia final : public EmbedderSurface, - public GPUSurfaceMetalDelegate { + public SurfaceMetalDelegate { public: struct MetalDispatchTable { std::function present; // required diff --git a/shell/platform/embedder/embedder_surface_metal_skia.mm b/shell/platform/embedder/embedder_surface_metal_skia.mm index 244dcb05da5d2..b7063647d81aa 100644 --- a/shell/platform/embedder/embedder_surface_metal_skia.mm +++ b/shell/platform/embedder/embedder_surface_metal_skia.mm @@ -9,8 +9,8 @@ #include "flutter/shell/platform/embedder/embedder_surface_metal_skia.h" #include "flutter/fml/logging.h" -#include "flutter/shell/gpu/gpu_surface_metal_delegate.h" #include "flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalSkia.h" +#include "flutter/shell/surface/surface_metal_delegate.h" #include "third_party/skia/include/gpu/GrDirectContext.h" FLUTTER_ASSERT_NOT_ARC @@ -21,7 +21,7 @@ GPUMTLCommandQueueHandle command_queue, MetalDispatchTable metal_dispatch_table, std::shared_ptr external_view_embedder) - : GPUSurfaceMetalDelegate(MTLRenderTargetType::kMTLTexture), + : SurfaceMetalDelegate(MTLRenderTargetType::kMTLTexture), metal_dispatch_table_(std::move(metal_dispatch_table)), external_view_embedder_(std::move(external_view_embedder)) { main_context_ = @@ -49,7 +49,7 @@ } const bool render_to_surface = !external_view_embedder_; - auto surface = std::make_unique(this, main_context_, render_to_surface); + auto surface = std::make_unique(this, main_context_, render_to_surface); if (!surface->IsValid()) { return nullptr; diff --git a/shell/platform/embedder/embedder_surface_software.cc b/shell/platform/embedder/embedder_surface_software.cc index 7f6d445aa054c..b0a8d5d14f8f6 100644 --- a/shell/platform/embedder/embedder_surface_software.cc +++ b/shell/platform/embedder/embedder_surface_software.cc @@ -39,7 +39,7 @@ std::unique_ptr EmbedderSurfaceSoftware::CreateGPUSurface() { return nullptr; } const bool render_to_surface = !external_view_embedder_; - auto surface = std::make_unique(this, render_to_surface); + auto surface = std::make_unique(this, render_to_surface); if (!surface->IsValid()) { return nullptr; diff --git a/shell/platform/embedder/embedder_surface_software.h b/shell/platform/embedder/embedder_surface_software.h index 5d52e63d76528..42c7226e357f4 100644 --- a/shell/platform/embedder/embedder_surface_software.h +++ b/shell/platform/embedder/embedder_surface_software.h @@ -6,16 +6,16 @@ #define FLUTTER_SHELL_PLATFORM_EMBEDDER_EMBEDDER_SURFACE_SOFTWARE_H_ #include "flutter/fml/macros.h" -#include "flutter/shell/gpu/gpu_surface_software.h" #include "flutter/shell/platform/embedder/embedder_external_view_embedder.h" #include "flutter/shell/platform/embedder/embedder_surface.h" +#include "flutter/shell/surface/surface_software.h" #include "third_party/skia/include/core/SkSurface.h" namespace flutter { class EmbedderSurfaceSoftware final : public EmbedderSurface, - public GPUSurfaceSoftwareDelegate { + public SurfaceSoftwareDelegate { public: struct SoftwareDispatchTable { std::function diff --git a/shell/platform/embedder/embedder_surface_vulkan.cc b/shell/platform/embedder/embedder_surface_vulkan.cc index 7b8e4ac511b67..2830276b1766f 100644 --- a/shell/platform/embedder/embedder_surface_vulkan.cc +++ b/shell/platform/embedder/embedder_surface_vulkan.cc @@ -8,8 +8,8 @@ #include "flutter/flutter_vma/flutter_skia_vma.h" #include "flutter/shell/common/shell_io_manager.h" -#include "flutter/shell/gpu/gpu_surface_vulkan.h" -#include "flutter/shell/gpu/gpu_surface_vulkan_delegate.h" +#include "flutter/shell/surface/surface_vulkan.h" +#include "flutter/shell/surface/surface_vulkan_delegate.h" #include "flutter/vulkan/vulkan_skia_proc_table.h" #include "include/gpu/GrDirectContext.h" #include "include/gpu/vk/VulkanBackendContext.h" @@ -111,8 +111,8 @@ bool EmbedderSurfaceVulkan::IsValid() const { // |EmbedderSurface| std::unique_ptr EmbedderSurfaceVulkan::CreateGPUSurface() { const bool render_to_surface = !external_view_embedder_; - return std::make_unique(this, main_context_, - render_to_surface); + return std::make_unique(this, main_context_, + render_to_surface); } // |EmbedderSurface| diff --git a/shell/platform/embedder/embedder_surface_vulkan.h b/shell/platform/embedder/embedder_surface_vulkan.h index 0e972d3723b74..1851ad547cac9 100644 --- a/shell/platform/embedder/embedder_surface_vulkan.h +++ b/shell/platform/embedder/embedder_surface_vulkan.h @@ -7,11 +7,11 @@ #include "flutter/fml/macros.h" #include "flutter/shell/common/context_options.h" -#include "flutter/shell/gpu/gpu_surface_vulkan.h" -#include "flutter/shell/gpu/gpu_surface_vulkan_delegate.h" #include "flutter/shell/platform/embedder/embedder.h" #include "flutter/shell/platform/embedder/embedder_external_view_embedder.h" #include "flutter/shell/platform/embedder/embedder_surface.h" +#include "flutter/shell/surface/surface_vulkan.h" +#include "flutter/shell/surface/surface_vulkan_delegate.h" #include "flutter/vulkan/procs/vulkan_proc_table.h" namespace flutter { diff --git a/shell/platform/fuchsia/flutter/BUILD.gn b/shell/platform/fuchsia/flutter/BUILD.gn index ad4e3426a1c80..33383d9700039 100644 --- a/shell/platform/fuchsia/flutter/BUILD.gn +++ b/shell/platform/fuchsia/flutter/BUILD.gn @@ -6,7 +6,7 @@ assert(is_fuchsia) import("//flutter/common/config.gni") import("//flutter/shell/config.gni") -import("//flutter/shell/gpu/gpu.gni") +import("//flutter/shell/surface/surface.gni") import("//flutter/testing/testing.gni") import("//flutter/tools/fuchsia/dart.gni") import("//flutter/tools/fuchsia/fuchsia_archive.gni") diff --git a/shell/gpu/BUILD.gn b/shell/surface/BUILD.gn similarity index 52% rename from shell/gpu/BUILD.gn rename to shell/surface/BUILD.gn index 0e7e68670551f..5e0858e097507 100644 --- a/shell/gpu/BUILD.gn +++ b/shell/surface/BUILD.gn @@ -6,7 +6,7 @@ import("//flutter/common/config.gni") import("//flutter/impeller/tools/impeller.gni") import("//flutter/shell/config.gni") -gpu_common_deps = [ +common_deps = [ "//flutter/common", "//flutter/common/graphics", "//flutter/flow", @@ -15,45 +15,45 @@ gpu_common_deps = [ "//flutter/skia", ] -source_set("gpu_surface_software") { +source_set("software") { sources = [ - "gpu_surface_software.cc", - "gpu_surface_software.h", - "gpu_surface_software_delegate.cc", - "gpu_surface_software_delegate.h", + "surface_software.cc", + "surface_software.h", + "surface_software_delegate.cc", + "surface_software_delegate.h", ] - public_deps = gpu_common_deps + public_deps = common_deps } -source_set("gpu_surface_gl") { +source_set("gl") { sources = [ - "gpu_surface_gl_delegate.cc", - "gpu_surface_gl_delegate.h", - "gpu_surface_gl_skia.cc", - "gpu_surface_gl_skia.h", + "surface_gl_delegate.cc", + "surface_gl_delegate.h", + "surface_gl_skia.cc", + "surface_gl_skia.h", ] - public_deps = gpu_common_deps + public_deps = common_deps if (impeller_enable_opengles) { sources += [ - "gpu_surface_gl_impeller.cc", - "gpu_surface_gl_impeller.h", + "surface_gl_impeller.cc", + "surface_gl_impeller.h", ] public_deps += [ "//flutter/impeller" ] } } -source_set("gpu_surface_vulkan") { +source_set("vulkan") { sources = [ - "gpu_surface_vulkan.cc", - "gpu_surface_vulkan.h", - "gpu_surface_vulkan_delegate.cc", - "gpu_surface_vulkan_delegate.h", + "surface_vulkan.cc", + "surface_vulkan.h", + "surface_vulkan_delegate.cc", + "surface_vulkan_delegate.h", ] - public_deps = gpu_common_deps + [ + public_deps = common_deps + [ "//flutter/shell/platform/embedder:embedder_headers", "//flutter/vulkan", "//flutter/vulkan/procs", @@ -61,28 +61,28 @@ source_set("gpu_surface_vulkan") { if (impeller_enable_vulkan) { sources += [ - "gpu_surface_vulkan_impeller.cc", - "gpu_surface_vulkan_impeller.h", + "surface_vulkan_impeller.cc", + "surface_vulkan_impeller.h", ] public_deps += [ "//flutter/impeller" ] } } -source_set("gpu_surface_metal") { +source_set("metal") { sources = [ - "gpu_surface_metal_delegate.cc", - "gpu_surface_metal_delegate.h", - "gpu_surface_metal_skia.h", - "gpu_surface_metal_skia.mm", + "surface_metal_delegate.cc", + "surface_metal_delegate.h", + "surface_metal_skia.h", + "surface_metal_skia.mm", ] - public_deps = gpu_common_deps + public_deps = common_deps if (impeller_enable_metal) { sources += [ - "gpu_surface_metal_impeller.h", - "gpu_surface_metal_impeller.mm", + "surface_metal_impeller.h", + "surface_metal_impeller.mm", ] public_deps += [ "//flutter/impeller" ] @@ -90,10 +90,10 @@ source_set("gpu_surface_metal") { } if (is_mac) { - impeller_component("gpu_surface_metal_unittests") { + impeller_component("metal_unittests") { testonly = true target_type = "executable" - sources = [ "gpu_surface_metal_impeller_unittests.mm" ] + sources = [ "surface_metal_impeller_unittests.mm" ] frameworks = [ "AppKit.framework", @@ -102,12 +102,12 @@ if (is_mac) { deps = [ "//flutter/testing", - ":gpu_surface_metal", + ":metal", "//flutter/impeller/fixtures", "//flutter/fml", "//flutter/runtime", "//flutter/runtime:libdart", "//flutter/testing", - ] + gpu_common_deps + ] + common_deps } } diff --git a/shell/surface/README.md b/shell/surface/README.md new file mode 100644 index 0000000000000..46946b1907200 --- /dev/null +++ b/shell/surface/README.md @@ -0,0 +1,3 @@ +# Surface + +Concrete implementations of the flow Surfaces used to wrap platform specific render targets to render to. diff --git a/shell/gpu/gpu.gni b/shell/surface/surface.gni similarity index 82% rename from shell/gpu/gpu.gni rename to shell/surface/surface.gni index 8e09b4f465783..f7b7ef2b9fd3b 100644 --- a/shell/gpu/gpu.gni +++ b/shell/surface/surface.gni @@ -18,19 +18,19 @@ template("shell_gpu_configuration") { public_deps = [] if (invoker.enable_software) { - public_deps += [ "//flutter/shell/gpu:gpu_surface_software" ] + public_deps += [ "//flutter/shell/surface:software" ] } if (invoker.enable_gl) { - public_deps += [ "//flutter/shell/gpu:gpu_surface_gl" ] + public_deps += [ "//flutter/shell/surface:gl" ] } if (invoker.enable_vulkan) { - public_deps += [ "//flutter/shell/gpu:gpu_surface_vulkan" ] + public_deps += [ "//flutter/shell/surface:vulkan" ] } if (invoker.enable_metal) { - public_deps += [ "//flutter/shell/gpu:gpu_surface_metal" ] + public_deps += [ "//flutter/shell/surface:metal" ] } } diff --git a/shell/gpu/gpu_surface_gl_delegate.cc b/shell/surface/surface_gl_delegate.cc similarity index 80% rename from shell/gpu/gpu_surface_gl_delegate.cc rename to shell/surface/surface_gl_delegate.cc index 61631b028fc0f..840cf95c0494e 100644 --- a/shell/gpu/gpu_surface_gl_delegate.cc +++ b/shell/surface/surface_gl_delegate.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "flutter/shell/gpu/gpu_surface_gl_delegate.h" +#include "flutter/shell/surface/surface_gl_delegate.h" #include "flutter/fml/build_config.h" @@ -29,32 +29,31 @@ namespace flutter { -GPUSurfaceGLDelegate::~GPUSurfaceGLDelegate() = default; +SurfaceGLDelegate::~SurfaceGLDelegate() = default; -bool GPUSurfaceGLDelegate::GLContextFBOResetAfterPresent() const { +bool SurfaceGLDelegate::GLContextFBOResetAfterPresent() const { return false; } -SurfaceFrame::FramebufferInfo GPUSurfaceGLDelegate::GLContextFramebufferInfo() +SurfaceFrame::FramebufferInfo SurfaceGLDelegate::GLContextFramebufferInfo() const { SurfaceFrame::FramebufferInfo res; res.supports_readback = true; return res; } -SkMatrix GPUSurfaceGLDelegate::GLContextSurfaceTransformation() const { +SkMatrix SurfaceGLDelegate::GLContextSurfaceTransformation() const { SkMatrix matrix; matrix.setIdentity(); return matrix; } -GPUSurfaceGLDelegate::GLProcResolver GPUSurfaceGLDelegate::GetGLProcResolver() - const { +SurfaceGLDelegate::GLProcResolver SurfaceGLDelegate::GetGLProcResolver() const { return nullptr; } static bool IsProcResolverOpenGLES( - const GPUSurfaceGLDelegate::GLProcResolver& proc_resolver) { + const SurfaceGLDelegate::GLProcResolver& proc_resolver) { // Version string prefix that identifies an OpenGL ES implementation. #define GPU_GL_VERSION 0x1F02 constexpr char kGLESVersionPrefix[] = "OpenGL ES"; @@ -81,7 +80,7 @@ static bool IsProcResolverOpenGLES( } static sk_sp CreateGLInterface( - const GPUSurfaceGLDelegate::GLProcResolver& proc_resolver) { + const SurfaceGLDelegate::GLProcResolver& proc_resolver) { if (proc_resolver == nullptr) { #if defined(FML_OS_ANDROID) return GrGLInterfaces::MakeEGL(); @@ -104,7 +103,7 @@ static sk_sp CreateGLInterface( } struct ProcResolverContext { - GPUSurfaceGLDelegate::GLProcResolver resolver; + SurfaceGLDelegate::GLProcResolver resolver; }; ProcResolverContext context = {proc_resolver}; @@ -131,16 +130,15 @@ static sk_sp CreateGLInterface( return nullptr; } -sk_sp GPUSurfaceGLDelegate::GetGLInterface() const { +sk_sp SurfaceGLDelegate::GetGLInterface() const { return CreateGLInterface(GetGLProcResolver()); } -sk_sp -GPUSurfaceGLDelegate::GetDefaultPlatformGLInterface() { +sk_sp SurfaceGLDelegate::GetDefaultPlatformGLInterface() { return CreateGLInterface(nullptr); } -bool GPUSurfaceGLDelegate::AllowsDrawingWhenGpuDisabled() const { +bool SurfaceGLDelegate::AllowsDrawingWhenGpuDisabled() const { return true; } diff --git a/shell/gpu/gpu_surface_gl_delegate.h b/shell/surface/surface_gl_delegate.h similarity index 94% rename from shell/gpu/gpu_surface_gl_delegate.h rename to shell/surface/surface_gl_delegate.h index 39a58e6a708a6..edde31799e324 100644 --- a/shell/gpu/gpu_surface_gl_delegate.h +++ b/shell/surface/surface_gl_delegate.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef FLUTTER_SHELL_GPU_GPU_SURFACE_GL_DELEGATE_H_ -#define FLUTTER_SHELL_GPU_GPU_SURFACE_GL_DELEGATE_H_ +#ifndef FLUTTER_SHELL_SURFACE_SURFACE_GL_DELEGATE_H_ +#define FLUTTER_SHELL_SURFACE_SURFACE_GL_DELEGATE_H_ #include @@ -48,9 +48,9 @@ struct GLPresentInfo { const std::optional& buffer_damage; }; -class GPUSurfaceGLDelegate { +class SurfaceGLDelegate { public: - ~GPUSurfaceGLDelegate(); + ~SurfaceGLDelegate(); // Called to make the main GL context current on the current thread. virtual std::unique_ptr GLContextMakeCurrent() = 0; @@ -108,4 +108,4 @@ class GPUSurfaceGLDelegate { } // namespace flutter -#endif // FLUTTER_SHELL_GPU_GPU_SURFACE_GL_DELEGATE_H_ +#endif // FLUTTER_SHELL_SURFACE_SURFACE_GL_DELEGATE_H_ diff --git a/shell/gpu/gpu_surface_gl_impeller.cc b/shell/surface/surface_gl_impeller.cc similarity index 86% rename from shell/gpu/gpu_surface_gl_impeller.cc rename to shell/surface/surface_gl_impeller.cc index ca2c90da8f4a9..76afb478c00d7 100644 --- a/shell/gpu/gpu_surface_gl_impeller.cc +++ b/shell/surface/surface_gl_impeller.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "flutter/shell/gpu/gpu_surface_gl_impeller.h" +#include "flutter/shell/surface/surface_gl_impeller.h" #include "flutter/fml/make_copyable.h" #include "impeller/display_list/dl_dispatcher.h" @@ -12,10 +12,9 @@ namespace flutter { -GPUSurfaceGLImpeller::GPUSurfaceGLImpeller( - GPUSurfaceGLDelegate* delegate, - std::shared_ptr context, - bool render_to_surface) +SurfaceGLImpeller::SurfaceGLImpeller(SurfaceGLDelegate* delegate, + std::shared_ptr context, + bool render_to_surface) : weak_factory_(this) { if (delegate == nullptr) { return; @@ -46,15 +45,15 @@ GPUSurfaceGLImpeller::GPUSurfaceGLImpeller( } // |Surface| -GPUSurfaceGLImpeller::~GPUSurfaceGLImpeller() = default; +SurfaceGLImpeller::~SurfaceGLImpeller() = default; // |Surface| -bool GPUSurfaceGLImpeller::IsValid() { +bool SurfaceGLImpeller::IsValid() { return is_valid_; } // |Surface| -std::unique_ptr GPUSurfaceGLImpeller::AcquireFrame( +std::unique_ptr SurfaceGLImpeller::AcquireFrame( const SkISize& size) { if (!IsValid()) { FML_LOG(ERROR) << "OpenGL surface was invalid."; @@ -151,40 +150,39 @@ std::unique_ptr GPUSurfaceGLImpeller::AcquireFrame( } // |Surface| -SkMatrix GPUSurfaceGLImpeller::GetRootTransformation() const { +SkMatrix SurfaceGLImpeller::GetRootTransformation() const { // This backend does not currently support root surface transformations. Just // return identity. return {}; } // |Surface| -GrDirectContext* GPUSurfaceGLImpeller::GetContext() { +GrDirectContext* SurfaceGLImpeller::GetContext() { // Impeller != Skia. return nullptr; } // |Surface| -std::unique_ptr -GPUSurfaceGLImpeller::MakeRenderContextCurrent() { +std::unique_ptr SurfaceGLImpeller::MakeRenderContextCurrent() { return delegate_->GLContextMakeCurrent(); } // |Surface| -bool GPUSurfaceGLImpeller::ClearRenderContext() { +bool SurfaceGLImpeller::ClearRenderContext() { return delegate_->GLContextClearCurrent(); } -bool GPUSurfaceGLImpeller::AllowsDrawingWhenGpuDisabled() const { +bool SurfaceGLImpeller::AllowsDrawingWhenGpuDisabled() const { return delegate_->AllowsDrawingWhenGpuDisabled(); } // |Surface| -bool GPUSurfaceGLImpeller::EnableRasterCache() const { +bool SurfaceGLImpeller::EnableRasterCache() const { return false; } // |Surface| -std::shared_ptr GPUSurfaceGLImpeller::GetAiksContext() +std::shared_ptr SurfaceGLImpeller::GetAiksContext() const { return aiks_context_; } diff --git a/shell/gpu/gpu_surface_gl_impeller.h b/shell/surface/surface_gl_impeller.h similarity index 67% rename from shell/gpu/gpu_surface_gl_impeller.h rename to shell/surface/surface_gl_impeller.h index d35dd14e962f5..926b58809798d 100644 --- a/shell/gpu/gpu_surface_gl_impeller.h +++ b/shell/surface/surface_gl_impeller.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef FLUTTER_SHELL_GPU_GPU_SURFACE_GL_IMPELLER_H_ -#define FLUTTER_SHELL_GPU_GPU_SURFACE_GL_IMPELLER_H_ +#ifndef FLUTTER_SHELL_SURFACE_SURFACE_GL_IMPELLER_H_ +#define FLUTTER_SHELL_SURFACE_SURFACE_GL_IMPELLER_H_ #include "flutter/common/graphics/gl_context_switch.h" #include "flutter/flow/surface.h" @@ -11,31 +11,31 @@ #include "flutter/fml/memory/weak_ptr.h" #include "flutter/impeller/aiks/aiks_context.h" #include "flutter/impeller/renderer/context.h" -#include "flutter/shell/gpu/gpu_surface_gl_delegate.h" +#include "flutter/shell/surface/surface_gl_delegate.h" #include "impeller/renderer/renderer.h" namespace flutter { -class GPUSurfaceGLImpeller final : public Surface { +class SurfaceGLImpeller final : public Surface { public: - explicit GPUSurfaceGLImpeller(GPUSurfaceGLDelegate* delegate, - std::shared_ptr context, - bool render_to_surface); + explicit SurfaceGLImpeller(SurfaceGLDelegate* delegate, + std::shared_ptr context, + bool render_to_surface); // |Surface| - ~GPUSurfaceGLImpeller() override; + ~SurfaceGLImpeller() override; // |Surface| bool IsValid() override; private: - GPUSurfaceGLDelegate* delegate_ = nullptr; + SurfaceGLDelegate* delegate_ = nullptr; std::shared_ptr impeller_context_; bool render_to_surface_ = true; std::shared_ptr impeller_renderer_; std::shared_ptr aiks_context_; bool is_valid_ = false; - fml::TaskRunnerAffineWeakPtrFactory weak_factory_; + fml::TaskRunnerAffineWeakPtrFactory weak_factory_; // |Surface| std::unique_ptr AcquireFrame(const SkISize& size) override; @@ -61,9 +61,9 @@ class GPUSurfaceGLImpeller final : public Surface { // |Surface| std::shared_ptr GetAiksContext() const override; - FML_DISALLOW_COPY_AND_ASSIGN(GPUSurfaceGLImpeller); + FML_DISALLOW_COPY_AND_ASSIGN(SurfaceGLImpeller); }; } // namespace flutter -#endif // FLUTTER_SHELL_GPU_GPU_SURFACE_GL_IMPELLER_H_ +#endif // FLUTTER_SHELL_SURFACE_SURFACE_GL_IMPELLER_H_ diff --git a/shell/gpu/gpu_surface_gl_skia.cc b/shell/surface/surface_gl_skia.cc similarity index 88% rename from shell/gpu/gpu_surface_gl_skia.cc rename to shell/surface/surface_gl_skia.cc index 04c708808e0a9..0484ebf014d4a 100644 --- a/shell/gpu/gpu_surface_gl_skia.cc +++ b/shell/surface/surface_gl_skia.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "flutter/shell/gpu/gpu_surface_gl_skia.h" +#include "flutter/shell/surface/surface_gl_skia.h" #include "flutter/common/graphics/persistent_cache.h" #include "flutter/fml/base32.h" @@ -10,7 +10,7 @@ #include "flutter/fml/size.h" #include "flutter/fml/trace_event.h" #include "flutter/shell/common/context_options.h" -#include "flutter/shell/gpu/gpu_surface_gl_delegate.h" +#include "flutter/shell/surface/surface_gl_delegate.h" #include "third_party/skia/include/core/SkAlphaType.h" #include "third_party/skia/include/core/SkColorFilter.h" #include "third_party/skia/include/core/SkColorSpace.h" @@ -40,8 +40,8 @@ namespace flutter { // system channel. static const size_t kGrCacheMaxByteSize = 24 * (1 << 20); -sk_sp GPUSurfaceGLSkia::MakeGLContext( - GPUSurfaceGLDelegate* delegate) { +sk_sp SurfaceGLSkia::MakeGLContext( + SurfaceGLDelegate* delegate) { auto context_switch = delegate->GLContextMakeCurrent(); if (!context_switch->GetResult()) { FML_LOG(ERROR) @@ -66,15 +66,15 @@ sk_sp GPUSurfaceGLSkia::MakeGLContext( return context; } -GPUSurfaceGLSkia::GPUSurfaceGLSkia(GPUSurfaceGLDelegate* delegate, - bool render_to_surface) - : GPUSurfaceGLSkia(MakeGLContext(delegate), delegate, render_to_surface) { +SurfaceGLSkia::SurfaceGLSkia(SurfaceGLDelegate* delegate, + bool render_to_surface) + : SurfaceGLSkia(MakeGLContext(delegate), delegate, render_to_surface) { context_owner_ = true; } -GPUSurfaceGLSkia::GPUSurfaceGLSkia(const sk_sp& gr_context, - GPUSurfaceGLDelegate* delegate, - bool render_to_surface) +SurfaceGLSkia::SurfaceGLSkia(const sk_sp& gr_context, + SurfaceGLDelegate* delegate, + bool render_to_surface) : delegate_(delegate), context_(gr_context), @@ -92,7 +92,7 @@ GPUSurfaceGLSkia::GPUSurfaceGLSkia(const sk_sp& gr_context, valid_ = gr_context != nullptr; } -GPUSurfaceGLSkia::~GPUSurfaceGLSkia() { +SurfaceGLSkia::~SurfaceGLSkia() { if (!valid_) { return; } @@ -114,7 +114,7 @@ GPUSurfaceGLSkia::~GPUSurfaceGLSkia() { } // |Surface| -bool GPUSurfaceGLSkia::IsValid() { +bool SurfaceGLSkia::IsValid() { return valid_; } @@ -162,7 +162,7 @@ static sk_sp WrapOnscreenSurface(GrDirectContext* context, ); } -bool GPUSurfaceGLSkia::CreateOrUpdateSurfaces(const SkISize& size) { +bool SurfaceGLSkia::CreateOrUpdateSurfaces(const SkISize& size) { if (onscreen_surface_ != nullptr && size == SkISize::Make(onscreen_surface_->width(), onscreen_surface_->height())) { @@ -207,13 +207,12 @@ bool GPUSurfaceGLSkia::CreateOrUpdateSurfaces(const SkISize& size) { } // |Surface| -SkMatrix GPUSurfaceGLSkia::GetRootTransformation() const { +SkMatrix SurfaceGLSkia::GetRootTransformation() const { return delegate_->GLContextSurfaceTransformation(); } // |Surface| -std::unique_ptr GPUSurfaceGLSkia::AcquireFrame( - const SkISize& size) { +std::unique_ptr SurfaceGLSkia::AcquireFrame(const SkISize& size) { if (delegate_ == nullptr) { return nullptr; } @@ -263,8 +262,8 @@ std::unique_ptr GPUSurfaceGLSkia::AcquireFrame( std::move(context_switch)); } -bool GPUSurfaceGLSkia::PresentSurface(const SurfaceFrame& frame, - DlCanvas* canvas) { +bool SurfaceGLSkia::PresentSurface(const SurfaceFrame& frame, + DlCanvas* canvas) { if (delegate_ == nullptr || canvas == nullptr || context_ == nullptr) { return false; } @@ -314,7 +313,7 @@ bool GPUSurfaceGLSkia::PresentSurface(const SurfaceFrame& frame, return true; } -sk_sp GPUSurfaceGLSkia::AcquireRenderSurface( +sk_sp SurfaceGLSkia::AcquireRenderSurface( const SkISize& untransformed_size, const SkMatrix& root_surface_transformation) { const auto transformed_rect = root_surface_transformation.mapRect( @@ -331,22 +330,22 @@ sk_sp GPUSurfaceGLSkia::AcquireRenderSurface( } // |Surface| -GrDirectContext* GPUSurfaceGLSkia::GetContext() { +GrDirectContext* SurfaceGLSkia::GetContext() { return context_.get(); } // |Surface| -std::unique_ptr GPUSurfaceGLSkia::MakeRenderContextCurrent() { +std::unique_ptr SurfaceGLSkia::MakeRenderContextCurrent() { return delegate_->GLContextMakeCurrent(); } // |Surface| -bool GPUSurfaceGLSkia::ClearRenderContext() { +bool SurfaceGLSkia::ClearRenderContext() { return delegate_->GLContextClearCurrent(); } // |Surface| -bool GPUSurfaceGLSkia::AllowsDrawingWhenGpuDisabled() const { +bool SurfaceGLSkia::AllowsDrawingWhenGpuDisabled() const { return delegate_->AllowsDrawingWhenGpuDisabled(); } diff --git a/shell/gpu/gpu_surface_gl_skia.h b/shell/surface/surface_gl_skia.h similarity index 74% rename from shell/gpu/gpu_surface_gl_skia.h rename to shell/surface/surface_gl_skia.h index ae6cdaf52d13f..5875204787c2b 100644 --- a/shell/gpu/gpu_surface_gl_skia.h +++ b/shell/surface/surface_gl_skia.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef FLUTTER_SHELL_GPU_GPU_SURFACE_GL_SKIA_H_ -#define FLUTTER_SHELL_GPU_GPU_SURFACE_GL_SKIA_H_ +#ifndef FLUTTER_SHELL_SURFACE_SURFACE_GL_SKIA_H_ +#define FLUTTER_SHELL_SURFACE_SURFACE_GL_SKIA_H_ #include #include @@ -13,26 +13,26 @@ #include "flutter/flow/surface.h" #include "flutter/fml/macros.h" #include "flutter/fml/memory/weak_ptr.h" -#include "flutter/shell/gpu/gpu_surface_gl_delegate.h" +#include "flutter/shell/surface/surface_gl_delegate.h" #include "third_party/skia/include/core/SkSurface.h" #include "third_party/skia/include/gpu/GrDirectContext.h" namespace flutter { -class GPUSurfaceGLSkia : public Surface { +class SurfaceGLSkia : public Surface { public: - static sk_sp MakeGLContext(GPUSurfaceGLDelegate* delegate); + static sk_sp MakeGLContext(SurfaceGLDelegate* delegate); - GPUSurfaceGLSkia(GPUSurfaceGLDelegate* delegate, bool render_to_surface); + SurfaceGLSkia(SurfaceGLDelegate* delegate, bool render_to_surface); // Creates a new GL surface reusing an existing GrDirectContext. - GPUSurfaceGLSkia(const sk_sp& gr_context, - GPUSurfaceGLDelegate* delegate, - bool render_to_surface); + SurfaceGLSkia(const sk_sp& gr_context, + SurfaceGLDelegate* delegate, + bool render_to_surface); // |Surface| - ~GPUSurfaceGLSkia() override; + ~SurfaceGLSkia() override; // |Surface| bool IsValid() override; @@ -64,7 +64,7 @@ class GPUSurfaceGLSkia : public Surface { bool PresentSurface(const SurfaceFrame& frame, DlCanvas* canvas); - GPUSurfaceGLDelegate* delegate_; + SurfaceGLDelegate* delegate_; sk_sp context_; sk_sp onscreen_surface_; /// FBO backing the current `onscreen_surface_`. @@ -82,10 +82,10 @@ class GPUSurfaceGLSkia : public Surface { bool valid_ = false; // WeakPtrFactory must be the last member. - fml::TaskRunnerAffineWeakPtrFactory weak_factory_; - FML_DISALLOW_COPY_AND_ASSIGN(GPUSurfaceGLSkia); + fml::TaskRunnerAffineWeakPtrFactory weak_factory_; + FML_DISALLOW_COPY_AND_ASSIGN(SurfaceGLSkia); }; } // namespace flutter -#endif // FLUTTER_SHELL_GPU_GPU_SURFACE_GL_SKIA_H_ +#endif // FLUTTER_SHELL_SURFACE_SURFACE_GL_SKIA_H_ diff --git a/shell/gpu/gpu_surface_metal_delegate.cc b/shell/surface/surface_metal_delegate.cc similarity index 53% rename from shell/gpu/gpu_surface_metal_delegate.cc rename to shell/surface/surface_metal_delegate.cc index 7a22d8de88a89..6db21547500c8 100644 --- a/shell/gpu/gpu_surface_metal_delegate.cc +++ b/shell/surface/surface_metal_delegate.cc @@ -2,21 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "flutter/shell/gpu/gpu_surface_metal_delegate.h" +#include "flutter/shell/surface/surface_metal_delegate.h" namespace flutter { -GPUSurfaceMetalDelegate::GPUSurfaceMetalDelegate( +SurfaceMetalDelegate::SurfaceMetalDelegate( MTLRenderTargetType render_target_type) : render_target_type_(render_target_type) {} -GPUSurfaceMetalDelegate::~GPUSurfaceMetalDelegate() = default; +SurfaceMetalDelegate::~SurfaceMetalDelegate() = default; -MTLRenderTargetType GPUSurfaceMetalDelegate::GetRenderTargetType() { +MTLRenderTargetType SurfaceMetalDelegate::GetRenderTargetType() { return render_target_type_; } -bool GPUSurfaceMetalDelegate::AllowsDrawingWhenGpuDisabled() const { +bool SurfaceMetalDelegate::AllowsDrawingWhenGpuDisabled() const { return true; } diff --git a/shell/gpu/gpu_surface_metal_delegate.h b/shell/surface/surface_metal_delegate.h similarity index 92% rename from shell/gpu/gpu_surface_metal_delegate.h rename to shell/surface/surface_metal_delegate.h index f20b0507231c9..9f6b1ecb817e0 100644 --- a/shell/gpu/gpu_surface_metal_delegate.h +++ b/shell/surface/surface_metal_delegate.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef FLUTTER_SHELL_GPU_GPU_SURFACE_METAL_DELEGATE_H_ -#define FLUTTER_SHELL_GPU_GPU_SURFACE_METAL_DELEGATE_H_ +#ifndef FLUTTER_SHELL_SURFACE_SURFACE_METAL_DELEGATE_H_ +#define FLUTTER_SHELL_SURFACE_SURFACE_METAL_DELEGATE_H_ #include @@ -49,7 +49,7 @@ enum class MTLRenderTargetType { kMTLTexture, kCAMetalLayer }; /// /// @see |IOSurfaceMetal| and |EmbedderSurfaceMetal|. /// -class GPUSurfaceMetalDelegate { +class SurfaceMetalDelegate { public: //------------------------------------------------------------------------------ /// @brief Construct a new GPUSurfaceMetalDelegate object with the specified @@ -57,9 +57,9 @@ class GPUSurfaceMetalDelegate { /// /// @see |MTLRenderTargetType| /// - explicit GPUSurfaceMetalDelegate(MTLRenderTargetType render_target); + explicit SurfaceMetalDelegate(MTLRenderTargetType render_target); - virtual ~GPUSurfaceMetalDelegate(); + virtual ~SurfaceMetalDelegate(); //------------------------------------------------------------------------------ /// @brief Returns the handle to the CAMetalLayer to render to. This is only @@ -106,4 +106,4 @@ class GPUSurfaceMetalDelegate { } // namespace flutter -#endif // FLUTTER_SHELL_GPU_GPU_SURFACE_METAL_DELEGATE_H_ +#endif // FLUTTER_SHELL_SURFACE_SURFACE_METAL_DELEGATE_H_ diff --git a/shell/gpu/gpu_surface_metal_impeller.h b/shell/surface/surface_metal_impeller.h similarity index 77% rename from shell/gpu/gpu_surface_metal_impeller.h rename to shell/surface/surface_metal_impeller.h index ef0c1e955cd48..5952bc5068afb 100644 --- a/shell/gpu/gpu_surface_metal_impeller.h +++ b/shell/surface/surface_metal_impeller.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef FLUTTER_SHELL_GPU_GPU_SURFACE_METAL_IMPELLER_H_ -#define FLUTTER_SHELL_GPU_GPU_SURFACE_METAL_IMPELLER_H_ +#ifndef FLUTTER_SHELL_SURFACE_SURFACE_METAL_IMPELLER_H_ +#define FLUTTER_SHELL_SURFACE_SURFACE_METAL_IMPELLER_H_ #include @@ -13,20 +13,19 @@ #include "flutter/impeller/aiks/aiks_context.h" #include "flutter/impeller/renderer/backend/metal/context_mtl.h" #include "flutter/impeller/renderer/renderer.h" -#include "flutter/shell/gpu/gpu_surface_metal_delegate.h" +#include "flutter/shell/surface/surface_metal_delegate.h" #include "third_party/skia/include/gpu/ganesh/mtl/GrMtlTypes.h" namespace flutter { -class IMPELLER_CA_METAL_LAYER_AVAILABLE GPUSurfaceMetalImpeller - : public Surface { +class IMPELLER_CA_METAL_LAYER_AVAILABLE SurfaceMetalImpeller : public Surface { public: - GPUSurfaceMetalImpeller(GPUSurfaceMetalDelegate* delegate, - const std::shared_ptr& context, - bool render_to_surface = true); + SurfaceMetalImpeller(SurfaceMetalDelegate* delegate, + const std::shared_ptr& context, + bool render_to_surface = true); // |Surface| - ~GPUSurfaceMetalImpeller(); + ~SurfaceMetalImpeller(); // |Surface| bool IsValid() override; @@ -34,7 +33,7 @@ class IMPELLER_CA_METAL_LAYER_AVAILABLE GPUSurfaceMetalImpeller virtual Surface::SurfaceData GetSurfaceData() const override; private: - const GPUSurfaceMetalDelegate* delegate_; + const SurfaceMetalDelegate* delegate_; const MTLRenderTargetType render_target_type_; std::shared_ptr impeller_renderer_; std::shared_ptr aiks_context_; @@ -78,9 +77,9 @@ class IMPELLER_CA_METAL_LAYER_AVAILABLE GPUSurfaceMetalImpeller // |Surface| std::shared_ptr GetAiksContext() const override; - FML_DISALLOW_COPY_AND_ASSIGN(GPUSurfaceMetalImpeller); + FML_DISALLOW_COPY_AND_ASSIGN(SurfaceMetalImpeller); }; } // namespace flutter -#endif // FLUTTER_SHELL_GPU_GPU_SURFACE_METAL_IMPELLER_H_ +#endif // FLUTTER_SHELL_SURFACE_SURFACE_METAL_IMPELLER_H_ diff --git a/shell/gpu/gpu_surface_metal_impeller.mm b/shell/surface/surface_metal_impeller.mm similarity index 93% rename from shell/gpu/gpu_surface_metal_impeller.mm rename to shell/surface/surface_metal_impeller.mm index e14ac5c4a224b..037aaab1e7014 100644 --- a/shell/gpu/gpu_surface_metal_impeller.mm +++ b/shell/surface/surface_metal_impeller.mm @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "flutter/shell/gpu/gpu_surface_metal_impeller.h" +#include "flutter/shell/surface/surface_metal_impeller.h" #import #import @@ -29,9 +29,9 @@ return renderer; } -GPUSurfaceMetalImpeller::GPUSurfaceMetalImpeller(GPUSurfaceMetalDelegate* delegate, - const std::shared_ptr& context, - bool render_to_surface) +SurfaceMetalImpeller::SurfaceMetalImpeller(SurfaceMetalDelegate* delegate, + const std::shared_ptr& context, + bool render_to_surface) : delegate_(delegate), render_target_type_(delegate->GetRenderTargetType()), impeller_renderer_(CreateImpellerRenderer(context)), @@ -47,15 +47,15 @@ } } -GPUSurfaceMetalImpeller::~GPUSurfaceMetalImpeller() = default; +SurfaceMetalImpeller::~SurfaceMetalImpeller() = default; // |Surface| -bool GPUSurfaceMetalImpeller::IsValid() { +bool SurfaceMetalImpeller::IsValid() { return !!aiks_context_ && aiks_context_->IsValid(); } // |Surface| -std::unique_ptr GPUSurfaceMetalImpeller::AcquireFrame(const SkISize& frame_size) { +std::unique_ptr SurfaceMetalImpeller::AcquireFrame(const SkISize& frame_size) { TRACE_EVENT0("impeller", "GPUSurfaceMetalImpeller::AcquireFrame"); if (!IsValid()) { @@ -86,7 +86,7 @@ return nullptr; } -std::unique_ptr GPUSurfaceMetalImpeller::AcquireFrameFromCAMetalLayer( +std::unique_ptr SurfaceMetalImpeller::AcquireFrameFromCAMetalLayer( const SkISize& frame_size) { auto layer = delegate_->GetCAMetalLayer(frame_size); @@ -224,7 +224,7 @@ ); } -std::unique_ptr GPUSurfaceMetalImpeller::AcquireFrameFromMTLTexture( +std::unique_ptr SurfaceMetalImpeller::AcquireFrameFromMTLTexture( const SkISize& frame_size) { GPUMTLTextureInfo texture_info = delegate_->GetMTLTexture(frame_size); id mtl_texture = (id)(texture_info.texture); @@ -355,38 +355,38 @@ } // |Surface| -SkMatrix GPUSurfaceMetalImpeller::GetRootTransformation() const { +SkMatrix SurfaceMetalImpeller::GetRootTransformation() const { // This backend does not currently support root surface transformations. Just // return identity. return {}; } // |Surface| -GrDirectContext* GPUSurfaceMetalImpeller::GetContext() { +GrDirectContext* SurfaceMetalImpeller::GetContext() { return nullptr; } // |Surface| -std::unique_ptr GPUSurfaceMetalImpeller::MakeRenderContextCurrent() { +std::unique_ptr SurfaceMetalImpeller::MakeRenderContextCurrent() { // This backend has no such concept. return std::make_unique(true); } -bool GPUSurfaceMetalImpeller::AllowsDrawingWhenGpuDisabled() const { +bool SurfaceMetalImpeller::AllowsDrawingWhenGpuDisabled() const { return delegate_->AllowsDrawingWhenGpuDisabled(); } // |Surface| -bool GPUSurfaceMetalImpeller::EnableRasterCache() const { +bool SurfaceMetalImpeller::EnableRasterCache() const { return false; } // |Surface| -std::shared_ptr GPUSurfaceMetalImpeller::GetAiksContext() const { +std::shared_ptr SurfaceMetalImpeller::GetAiksContext() const { return aiks_context_; } -Surface::SurfaceData GPUSurfaceMetalImpeller::GetSurfaceData() const { +Surface::SurfaceData SurfaceMetalImpeller::GetSurfaceData() const { if (!(last_texture_ && [last_texture_ conformsToProtocol:@protocol(MTLTexture)])) { return {}; } diff --git a/shell/gpu/gpu_surface_metal_impeller_unittests.mm b/shell/surface/surface_metal_impeller_unittests.mm similarity index 86% rename from shell/gpu/gpu_surface_metal_impeller_unittests.mm rename to shell/surface/surface_metal_impeller_unittests.mm index a5927ff035783..4f87d78e4c3bf 100644 --- a/shell/gpu/gpu_surface_metal_impeller_unittests.mm +++ b/shell/surface/surface_metal_impeller_unittests.mm @@ -5,7 +5,7 @@ #include #include -#include "flutter/shell/gpu/gpu_surface_metal_impeller.h" +#include "flutter/shell/surface/surface_metal_impeller.h" #include "gtest/gtest.h" #include "impeller/entity/mtl/entity_shaders.h" #include "impeller/entity/mtl/framebuffer_blend_shaders.h" @@ -15,9 +15,9 @@ namespace flutter { namespace testing { -class TestGPUSurfaceMetalDelegate : public GPUSurfaceMetalDelegate { +class TestGPUSurfaceMetalDelegate : public SurfaceMetalDelegate { public: - TestGPUSurfaceMetalDelegate() : GPUSurfaceMetalDelegate(MTLRenderTargetType::kCAMetalLayer) { + TestGPUSurfaceMetalDelegate() : SurfaceMetalDelegate(MTLRenderTargetType::kCAMetalLayer) { layer_ = [[CAMetalLayer alloc] init]; } @@ -57,14 +57,14 @@ GPUCAMetalLayerHandle GetCAMetalLayer(const SkISize& frame_info) const override TEST(GPUSurfaceMetalImpeller, InvalidImpellerContextCreatesCausesSurfaceToBeInvalid) { auto delegate = std::make_shared(); - auto surface = std::make_shared(delegate.get(), nullptr); + auto surface = std::make_shared(delegate.get(), nullptr); ASSERT_FALSE(surface->IsValid()); } TEST(GPUSurfaceMetalImpeller, CanCreateValidSurface) { auto delegate = std::make_shared(); - auto surface = std::make_shared(delegate.get(), CreateImpellerContext()); + auto surface = std::make_shared(delegate.get(), CreateImpellerContext()); ASSERT_TRUE(surface->IsValid()); } @@ -72,7 +72,7 @@ GPUCAMetalLayerHandle GetCAMetalLayer(const SkISize& frame_info) const override TEST(GPUSurfaceMetalImpeller, AcquireFrameFromCAMetalLayerNullChecksDrawable) { auto delegate = std::make_shared(); std::shared_ptr surface = - std::make_shared(delegate.get(), CreateImpellerContext()); + std::make_shared(delegate.get(), CreateImpellerContext()); ASSERT_TRUE(surface->IsValid()); @@ -84,7 +84,7 @@ GPUCAMetalLayerHandle GetCAMetalLayer(const SkISize& frame_info) const override auto delegate = std::make_shared(); delegate->SetDevice(); std::unique_ptr surface = - std::make_unique(delegate.get(), CreateImpellerContext()); + std::make_unique(delegate.get(), CreateImpellerContext()); ASSERT_TRUE(surface->IsValid()); @@ -103,7 +103,7 @@ GPUCAMetalLayerHandle GetCAMetalLayer(const SkISize& frame_info) const override auto context = CreateImpellerContext(); std::unique_ptr surface = - std::make_unique(delegate.get(), context); + std::make_unique(delegate.get(), context); ASSERT_TRUE(surface->IsValid()); @@ -134,14 +134,14 @@ GPUCAMetalLayerHandle GetCAMetalLayer(const SkISize& frame_info) const override EXPECT_FALSE(context->GetCaptureManager()->CaptureScopeActive()); std::unique_ptr surface = - std::make_unique(delegate.get(), context); + std::make_unique(delegate.get(), context); auto frame_1 = surface->AcquireFrame(SkISize::Make(100, 100)); frame_1->set_submit_info({.frame_boundary = false}); EXPECT_TRUE(context->GetCaptureManager()->CaptureScopeActive()); std::unique_ptr surface_2 = - std::make_unique(delegate.get(), context); + std::make_unique(delegate.get(), context); auto frame_2 = surface->AcquireFrame(SkISize::Make(100, 100)); frame_2->set_submit_info({.frame_boundary = true}); diff --git a/shell/gpu/gpu_surface_metal_skia.h b/shell/surface/surface_metal_skia.h similarity index 74% rename from shell/gpu/gpu_surface_metal_skia.h rename to shell/surface/surface_metal_skia.h index ab7ec9512fe70..2dd962b181002 100644 --- a/shell/gpu/gpu_surface_metal_skia.h +++ b/shell/surface/surface_metal_skia.h @@ -2,32 +2,32 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef FLUTTER_SHELL_GPU_GPU_SURFACE_METAL_SKIA_H_ -#define FLUTTER_SHELL_GPU_GPU_SURFACE_METAL_SKIA_H_ +#ifndef FLUTTER_SHELL_SURFACE_SURFACE_METAL_SKIA_H_ +#define FLUTTER_SHELL_SURFACE_SURFACE_METAL_SKIA_H_ #if !SLIMPELLER #include "flutter/flow/surface.h" #include "flutter/fml/macros.h" -#include "flutter/shell/gpu/gpu_surface_metal_delegate.h" +#include "flutter/shell/surface/surface_metal_delegate.h" #include "third_party/skia/include/gpu/GrDirectContext.h" namespace flutter { -class SK_API_AVAILABLE_CA_METAL_LAYER GPUSurfaceMetalSkia : public Surface { +class SK_API_AVAILABLE_CA_METAL_LAYER SurfaceMetalSkia : public Surface { public: - GPUSurfaceMetalSkia(GPUSurfaceMetalDelegate* delegate, - sk_sp context, - bool render_to_surface = true); + SurfaceMetalSkia(SurfaceMetalDelegate* delegate, + sk_sp context, + bool render_to_surface = true); // |Surface| - ~GPUSurfaceMetalSkia(); + ~SurfaceMetalSkia(); // |Surface| bool IsValid() override; private: - const GPUSurfaceMetalDelegate* delegate_; + const SurfaceMetalDelegate* delegate_; const MTLRenderTargetType render_target_type_; sk_sp context_; GrDirectContext* precompiled_sksl_context_ = nullptr; @@ -65,11 +65,11 @@ class SK_API_AVAILABLE_CA_METAL_LAYER GPUSurfaceMetalSkia : public Surface { void PrecompileKnownSkSLsIfNecessary(); - FML_DISALLOW_COPY_AND_ASSIGN(GPUSurfaceMetalSkia); + FML_DISALLOW_COPY_AND_ASSIGN(SurfaceMetalSkia); }; } // namespace flutter #endif // !SLIMPELLER -#endif // FLUTTER_SHELL_GPU_GPU_SURFACE_METAL_SKIA_H_ +#endif // FLUTTER_SHELL_SURFACE_SURFACE_METAL_SKIA_H_ diff --git a/shell/gpu/gpu_surface_metal_skia.mm b/shell/surface/surface_metal_skia.mm similarity index 90% rename from shell/gpu/gpu_surface_metal_skia.mm rename to shell/surface/surface_metal_skia.mm index c945c8894a70c..7a301bc920545 100644 --- a/shell/gpu/gpu_surface_metal_skia.mm +++ b/shell/surface/surface_metal_skia.mm @@ -4,7 +4,7 @@ #if !SLIMPELLER -#include "flutter/shell/gpu/gpu_surface_metal_skia.h" +#include "flutter/shell/surface/surface_metal_skia.h" #import #import @@ -16,7 +16,7 @@ #include "flutter/fml/platform/darwin/cf_utils.h" #include "flutter/fml/platform/darwin/scoped_nsobject.h" #include "flutter/fml/trace_event.h" -#include "flutter/shell/gpu/gpu_surface_metal_delegate.h" +#include "flutter/shell/surface/surface_metal_delegate.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkColorSpace.h" #include "third_party/skia/include/core/SkColorType.h" @@ -56,9 +56,9 @@ } } // namespace -GPUSurfaceMetalSkia::GPUSurfaceMetalSkia(GPUSurfaceMetalDelegate* delegate, - sk_sp context, - bool render_to_surface) +SurfaceMetalSkia::SurfaceMetalSkia(SurfaceMetalDelegate* delegate, + sk_sp context, + bool render_to_surface) : delegate_(delegate), render_target_type_(delegate->GetRenderTargetType()), context_(std::move(context)), @@ -71,14 +71,14 @@ } } -GPUSurfaceMetalSkia::~GPUSurfaceMetalSkia() = default; +SurfaceMetalSkia::~SurfaceMetalSkia() = default; // |Surface| -bool GPUSurfaceMetalSkia::IsValid() { +bool SurfaceMetalSkia::IsValid() { return context_ != nullptr; } -void GPUSurfaceMetalSkia::PrecompileKnownSkSLsIfNecessary() { +void SurfaceMetalSkia::PrecompileKnownSkSLsIfNecessary() { auto* current_context = GetContext(); if (current_context == precompiled_sksl_context_) { // Known SkSLs have already been prepared in this context. @@ -89,7 +89,7 @@ } // |Surface| -std::unique_ptr GPUSurfaceMetalSkia::AcquireFrame(const SkISize& frame_size) { +std::unique_ptr SurfaceMetalSkia::AcquireFrame(const SkISize& frame_size) { if (!IsValid()) { FML_LOG(ERROR) << "Metal surface was invalid."; return nullptr; @@ -120,7 +120,7 @@ return nullptr; } -std::unique_ptr GPUSurfaceMetalSkia::AcquireFrameFromCAMetalLayer( +std::unique_ptr SurfaceMetalSkia::AcquireFrameFromCAMetalLayer( const SkISize& frame_info) { auto layer = delegate_->GetCAMetalLayer(frame_info); if (!layer) { @@ -200,7 +200,7 @@ frame_info); } -std::unique_ptr GPUSurfaceMetalSkia::AcquireFrameFromMTLTexture( +std::unique_ptr SurfaceMetalSkia::AcquireFrameFromMTLTexture( const SkISize& frame_info) { GPUMTLTextureInfo texture = delegate_->GetMTLTexture(frame_info); id mtl_texture = (id)(texture.texture); @@ -244,19 +244,19 @@ } // |Surface| -SkMatrix GPUSurfaceMetalSkia::GetRootTransformation() const { +SkMatrix SurfaceMetalSkia::GetRootTransformation() const { // This backend does not currently support root surface transformations. Just // return identity. return {}; } // |Surface| -GrDirectContext* GPUSurfaceMetalSkia::GetContext() { +GrDirectContext* SurfaceMetalSkia::GetContext() { return context_.get(); } // |Surface| -std::unique_ptr GPUSurfaceMetalSkia::MakeRenderContextCurrent() { +std::unique_ptr SurfaceMetalSkia::MakeRenderContextCurrent() { // A context may either be necessary to render to the surface or to snapshot an offscreen // surface. Either way, SkSL precompilation must be attempted. PrecompileKnownSkSLsIfNecessary(); @@ -265,7 +265,7 @@ return std::make_unique(true); } -bool GPUSurfaceMetalSkia::AllowsDrawingWhenGpuDisabled() const { +bool SurfaceMetalSkia::AllowsDrawingWhenGpuDisabled() const { return delegate_->AllowsDrawingWhenGpuDisabled(); } diff --git a/shell/gpu/gpu_surface_software.cc b/shell/surface/surface_software.cc similarity index 84% rename from shell/gpu/gpu_surface_software.cc rename to shell/surface/surface_software.cc index efb905ba24ecb..a976d058ab655 100644 --- a/shell/gpu/gpu_surface_software.cc +++ b/shell/surface/surface_software.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "flutter/shell/gpu/gpu_surface_software.h" +#include "flutter/shell/surface/surface_software.h" #include @@ -12,21 +12,21 @@ namespace flutter { -GPUSurfaceSoftware::GPUSurfaceSoftware(GPUSurfaceSoftwareDelegate* delegate, - bool render_to_surface) +SurfaceSoftware::SurfaceSoftware(SurfaceSoftwareDelegate* delegate, + bool render_to_surface) : delegate_(delegate), render_to_surface_(render_to_surface), weak_factory_(this) {} -GPUSurfaceSoftware::~GPUSurfaceSoftware() = default; +SurfaceSoftware::~SurfaceSoftware() = default; // |Surface| -bool GPUSurfaceSoftware::IsValid() { +bool SurfaceSoftware::IsValid() { return delegate_ != nullptr; } // |Surface| -std::unique_ptr GPUSurfaceSoftware::AcquireFrame( +std::unique_ptr SurfaceSoftware::AcquireFrame( const SkISize& logical_size) { SurfaceFrame::FramebufferInfo framebuffer_info; framebuffer_info.supports_readback = true; @@ -82,7 +82,7 @@ std::unique_ptr GPUSurfaceSoftware::AcquireFrame( } // |Surface| -SkMatrix GPUSurfaceSoftware::GetRootTransformation() const { +SkMatrix SurfaceSoftware::GetRootTransformation() const { // This backend does not currently support root surface transformations. Just // return identity. SkMatrix matrix; @@ -91,7 +91,7 @@ SkMatrix GPUSurfaceSoftware::GetRootTransformation() const { } // |Surface| -GrDirectContext* GPUSurfaceSoftware::GetContext() { +GrDirectContext* SurfaceSoftware::GetContext() { // There is no GrContext associated with a software surface. return nullptr; } diff --git a/shell/gpu/gpu_surface_software.h b/shell/surface/surface_software.h similarity index 61% rename from shell/gpu/gpu_surface_software.h rename to shell/surface/surface_software.h index 18bc8d5b41446..dd62468b882c1 100644 --- a/shell/gpu/gpu_surface_software.h +++ b/shell/surface/surface_software.h @@ -2,22 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef FLUTTER_SHELL_GPU_GPU_SURFACE_SOFTWARE_H_ -#define FLUTTER_SHELL_GPU_GPU_SURFACE_SOFTWARE_H_ +#ifndef FLUTTER_SHELL_SURFACE_SURFACE_SOFTWARE_H_ +#define FLUTTER_SHELL_SURFACE_SURFACE_SOFTWARE_H_ #include "flutter/flow/surface.h" #include "flutter/fml/macros.h" #include "flutter/fml/memory/weak_ptr.h" -#include "flutter/shell/gpu/gpu_surface_software_delegate.h" +#include "flutter/shell/surface/surface_software_delegate.h" namespace flutter { -class GPUSurfaceSoftware : public Surface { +class SurfaceSoftware : public Surface { public: - GPUSurfaceSoftware(GPUSurfaceSoftwareDelegate* delegate, - bool render_to_surface); + SurfaceSoftware(SurfaceSoftwareDelegate* delegate, bool render_to_surface); - ~GPUSurfaceSoftware() override; + ~SurfaceSoftware() override; // |Surface| bool IsValid() override; @@ -32,16 +31,16 @@ class GPUSurfaceSoftware : public Surface { GrDirectContext* GetContext() override; private: - GPUSurfaceSoftwareDelegate* delegate_; + SurfaceSoftwareDelegate* delegate_; // TODO(38466): Refactor GPU surface APIs take into account the fact that an // external view embedder may want to render to the root surface. This is a // hack to make avoid allocating resources for the root surface when an // external view embedder is present. const bool render_to_surface_; - fml::TaskRunnerAffineWeakPtrFactory weak_factory_; - FML_DISALLOW_COPY_AND_ASSIGN(GPUSurfaceSoftware); + fml::TaskRunnerAffineWeakPtrFactory weak_factory_; + FML_DISALLOW_COPY_AND_ASSIGN(SurfaceSoftware); }; } // namespace flutter -#endif // FLUTTER_SHELL_GPU_GPU_SURFACE_SOFTWARE_H_ +#endif // FLUTTER_SHELL_SURFACE_SURFACE_SOFTWARE_H_ diff --git a/shell/gpu/gpu_surface_vulkan_delegate.cc b/shell/surface/surface_software_delegate.cc similarity index 63% rename from shell/gpu/gpu_surface_vulkan_delegate.cc rename to shell/surface/surface_software_delegate.cc index 3e64ad702279c..2827fa5060e3f 100644 --- a/shell/gpu/gpu_surface_vulkan_delegate.cc +++ b/shell/surface/surface_software_delegate.cc @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "flutter/shell/gpu/gpu_surface_vulkan_delegate.h" +#include "flutter/shell/surface/surface_software_delegate.h" namespace flutter { -GPUSurfaceVulkanDelegate::~GPUSurfaceVulkanDelegate() = default; +SurfaceSoftwareDelegate::~SurfaceSoftwareDelegate() = default; } // namespace flutter diff --git a/shell/gpu/gpu_surface_software_delegate.h b/shell/surface/surface_software_delegate.h similarity index 89% rename from shell/gpu/gpu_surface_software_delegate.h rename to shell/surface/surface_software_delegate.h index e46f4ec0f1f13..d0c468e8d6ce2 100644 --- a/shell/gpu/gpu_surface_software_delegate.h +++ b/shell/surface/surface_software_delegate.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef FLUTTER_SHELL_GPU_GPU_SURFACE_SOFTWARE_DELEGATE_H_ -#define FLUTTER_SHELL_GPU_GPU_SURFACE_SOFTWARE_DELEGATE_H_ +#ifndef FLUTTER_SHELL_SURFACE_SURFACE_SOFTWARE_DELEGATE_H_ +#define FLUTTER_SHELL_SURFACE_SURFACE_SOFTWARE_DELEGATE_H_ #include "flutter/flow/embedded_views.h" #include "flutter/fml/macros.h" @@ -24,9 +24,9 @@ namespace flutter { /// @see |IOSSurfaceSoftware|, |AndroidSurfaceSoftware|, /// |EmbedderSurfaceSoftware|. /// -class GPUSurfaceSoftwareDelegate { +class SurfaceSoftwareDelegate { public: - ~GPUSurfaceSoftwareDelegate(); + ~SurfaceSoftwareDelegate(); //---------------------------------------------------------------------------- /// @brief Called when the GPU surface needs a new buffer to render a new @@ -52,4 +52,4 @@ class GPUSurfaceSoftwareDelegate { } // namespace flutter -#endif // FLUTTER_SHELL_GPU_GPU_SURFACE_SOFTWARE_DELEGATE_H_ +#endif // FLUTTER_SHELL_SURFACE_SURFACE_SOFTWARE_DELEGATE_H_ diff --git a/shell/gpu/gpu_surface_vulkan.cc b/shell/surface/surface_vulkan.cc similarity index 87% rename from shell/gpu/gpu_surface_vulkan.cc rename to shell/surface/surface_vulkan.cc index 63f1359722c17..6608129cf551f 100644 --- a/shell/gpu/gpu_surface_vulkan.cc +++ b/shell/surface/surface_vulkan.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "flutter/shell/gpu/gpu_surface_vulkan.h" +#include "flutter/shell/surface/surface_vulkan.h" #include "flutter/fml/logging.h" #include "flutter/fml/trace_event.h" @@ -18,21 +18,21 @@ namespace flutter { -GPUSurfaceVulkan::GPUSurfaceVulkan(GPUSurfaceVulkanDelegate* delegate, - const sk_sp& skia_context, - bool render_to_surface) +SurfaceVulkan::SurfaceVulkan(SurfaceVulkanDelegate* delegate, + const sk_sp& skia_context, + bool render_to_surface) : delegate_(delegate), skia_context_(skia_context), render_to_surface_(render_to_surface), weak_factory_(this) {} -GPUSurfaceVulkan::~GPUSurfaceVulkan() = default; +SurfaceVulkan::~SurfaceVulkan() = default; -bool GPUSurfaceVulkan::IsValid() { +bool SurfaceVulkan::IsValid() { return skia_context_ != nullptr; } -std::unique_ptr GPUSurfaceVulkan::AcquireFrame( +std::unique_ptr SurfaceVulkan::AcquireFrame( const SkISize& frame_size) { if (!IsValid()) { FML_LOG(ERROR) << "Vulkan surface was invalid."; @@ -88,7 +88,7 @@ std::unique_ptr GPUSurfaceVulkan::AcquireFrame( std::move(callback), frame_size); } -SkMatrix GPUSurfaceVulkan::GetRootTransformation() const { +SkMatrix SurfaceVulkan::GetRootTransformation() const { // This backend does not support delegating to the underlying platform to // query for root surface transformations. Just return identity. SkMatrix matrix; @@ -96,11 +96,11 @@ SkMatrix GPUSurfaceVulkan::GetRootTransformation() const { return matrix; } -GrDirectContext* GPUSurfaceVulkan::GetContext() { +GrDirectContext* SurfaceVulkan::GetContext() { return skia_context_.get(); } -sk_sp GPUSurfaceVulkan::CreateSurfaceFromVulkanImage( +sk_sp SurfaceVulkan::CreateSurfaceFromVulkanImage( const VkImage image, const VkFormat format, const SkISize& size) { @@ -136,7 +136,7 @@ sk_sp GPUSurfaceVulkan::CreateSurfaceFromVulkanImage( #endif // SK_VULKAN } -SkColorType GPUSurfaceVulkan::ColorTypeFromFormat(const VkFormat format) { +SkColorType SurfaceVulkan::ColorTypeFromFormat(const VkFormat format) { switch (format) { case VK_FORMAT_R8G8B8A8_UNORM: case VK_FORMAT_R8G8B8A8_SRGB: diff --git a/shell/gpu/gpu_surface_vulkan.h b/shell/surface/surface_vulkan.h similarity index 72% rename from shell/gpu/gpu_surface_vulkan.h rename to shell/surface/surface_vulkan.h index 69da9500393d1..142c1803dd36c 100644 --- a/shell/gpu/gpu_surface_vulkan.h +++ b/shell/surface/surface_vulkan.h @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef FLUTTER_SHELL_GPU_GPU_SURFACE_VULKAN_H_ -#define FLUTTER_SHELL_GPU_GPU_SURFACE_VULKAN_H_ +#ifndef FLUTTER_SHELL_SURFACE_SURFACE_VULKAN_H_ +#define FLUTTER_SHELL_SURFACE_SURFACE_VULKAN_H_ #include #include "flutter/flow/surface.h" #include "flutter/fml/macros.h" #include "flutter/fml/memory/weak_ptr.h" -#include "flutter/shell/gpu/gpu_surface_vulkan_delegate.h" +#include "flutter/shell/surface/surface_vulkan_delegate.h" #include "flutter/vulkan/vulkan_backbuffer.h" #include "flutter/vulkan/vulkan_native_surface.h" #include "flutter/vulkan/vulkan_window.h" @@ -24,17 +24,19 @@ namespace flutter { /// @brief A GPU surface backed by VkImages provided by a /// GPUSurfaceVulkanDelegate. /// -class GPUSurfaceVulkan : public Surface { +/// A user of this implementation is the embedder. +/// +class SurfaceVulkan : public Surface { public: //------------------------------------------------------------------------------ /// @brief Create a GPUSurfaceVulkan while letting it reuse an existing /// GrDirectContext. /// - GPUSurfaceVulkan(GPUSurfaceVulkanDelegate* delegate, - const sk_sp& context, - bool render_to_surface); + SurfaceVulkan(SurfaceVulkanDelegate* delegate, + const sk_sp& context, + bool render_to_surface); - ~GPUSurfaceVulkan() override; + ~SurfaceVulkan() override; // |Surface| bool IsValid() override; @@ -51,19 +53,19 @@ class GPUSurfaceVulkan : public Surface { static SkColorType ColorTypeFromFormat(const VkFormat format); private: - GPUSurfaceVulkanDelegate* delegate_; + SurfaceVulkanDelegate* delegate_; sk_sp skia_context_; bool render_to_surface_; - fml::WeakPtrFactory weak_factory_; + fml::WeakPtrFactory weak_factory_; sk_sp CreateSurfaceFromVulkanImage(const VkImage image, const VkFormat format, const SkISize& size); - FML_DISALLOW_COPY_AND_ASSIGN(GPUSurfaceVulkan); + FML_DISALLOW_COPY_AND_ASSIGN(SurfaceVulkan); }; } // namespace flutter -#endif // FLUTTER_SHELL_GPU_GPU_SURFACE_VULKAN_H_ +#endif // FLUTTER_SHELL_SURFACE_SURFACE_VULKAN_H_ diff --git a/shell/gpu/gpu_surface_software_delegate.cc b/shell/surface/surface_vulkan_delegate.cc similarity index 61% rename from shell/gpu/gpu_surface_software_delegate.cc rename to shell/surface/surface_vulkan_delegate.cc index 9bc6d8b98fea7..423547c88d3c2 100644 --- a/shell/gpu/gpu_surface_software_delegate.cc +++ b/shell/surface/surface_vulkan_delegate.cc @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "flutter/shell/gpu/gpu_surface_software_delegate.h" +#include "flutter/shell/surface/surface_vulkan_delegate.h" namespace flutter { -GPUSurfaceSoftwareDelegate::~GPUSurfaceSoftwareDelegate() = default; +SurfaceVulkanDelegate::~SurfaceVulkanDelegate() = default; } // namespace flutter diff --git a/shell/gpu/gpu_surface_vulkan_delegate.h b/shell/surface/surface_vulkan_delegate.h similarity index 87% rename from shell/gpu/gpu_surface_vulkan_delegate.h rename to shell/surface/surface_vulkan_delegate.h index 2a95f0a613b51..8fa667896d4b8 100644 --- a/shell/gpu/gpu_surface_vulkan_delegate.h +++ b/shell/surface/surface_vulkan_delegate.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef FLUTTER_SHELL_GPU_GPU_SURFACE_VULKAN_DELEGATE_H_ -#define FLUTTER_SHELL_GPU_GPU_SURFACE_VULKAN_DELEGATE_H_ +#ifndef FLUTTER_SHELL_SURFACE_SURFACE_VULKAN_DELEGATE_H_ +#define FLUTTER_SHELL_SURFACE_SURFACE_VULKAN_DELEGATE_H_ #include "flutter/fml/memory/ref_ptr.h" #include "flutter/shell/platform/embedder/embedder.h" @@ -26,9 +26,9 @@ namespace flutter { /// /// @see |EmbedderSurfaceVulkan|. /// -class GPUSurfaceVulkanDelegate { +class SurfaceVulkanDelegate { public: - virtual ~GPUSurfaceVulkanDelegate(); + virtual ~SurfaceVulkanDelegate(); /// @brief Obtain a reference to the Vulkan implementation's proc table. /// @@ -47,4 +47,4 @@ class GPUSurfaceVulkanDelegate { } // namespace flutter -#endif // FLUTTER_SHELL_GPU_GPU_SURFACE_VULKAN_DELEGATE_H_ +#endif // FLUTTER_SHELL_SURFACE_SURFACE_VULKAN_DELEGATE_H_ diff --git a/shell/gpu/gpu_surface_vulkan_impeller.cc b/shell/surface/surface_vulkan_impeller.cc similarity index 88% rename from shell/gpu/gpu_surface_vulkan_impeller.cc rename to shell/surface/surface_vulkan_impeller.cc index d32cef7e6ea4c..fc23f2bb3f57e 100644 --- a/shell/gpu/gpu_surface_vulkan_impeller.cc +++ b/shell/surface/surface_vulkan_impeller.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "flutter/shell/gpu/gpu_surface_vulkan_impeller.h" +#include "flutter/shell/surface/surface_vulkan_impeller.h" #include "flutter/fml/make_copyable.h" #include "impeller/display_list/dl_dispatcher.h" @@ -13,7 +13,7 @@ namespace flutter { -GPUSurfaceVulkanImpeller::GPUSurfaceVulkanImpeller( +SurfaceVulkanImpeller::SurfaceVulkanImpeller( std::shared_ptr context) { if (!context || !context->IsValid()) { return; @@ -37,15 +37,15 @@ GPUSurfaceVulkanImpeller::GPUSurfaceVulkanImpeller( } // |Surface| -GPUSurfaceVulkanImpeller::~GPUSurfaceVulkanImpeller() = default; +SurfaceVulkanImpeller::~SurfaceVulkanImpeller() = default; // |Surface| -bool GPUSurfaceVulkanImpeller::IsValid() { +bool SurfaceVulkanImpeller::IsValid() { return is_valid_; } // |Surface| -std::unique_ptr GPUSurfaceVulkanImpeller::AcquireFrame( +std::unique_ptr SurfaceVulkanImpeller::AcquireFrame( const SkISize& size) { if (!IsValid()) { FML_LOG(ERROR) << "Vulkan surface was invalid."; @@ -134,33 +134,33 @@ std::unique_ptr GPUSurfaceVulkanImpeller::AcquireFrame( } // |Surface| -SkMatrix GPUSurfaceVulkanImpeller::GetRootTransformation() const { +SkMatrix SurfaceVulkanImpeller::GetRootTransformation() const { // This backend does not currently support root surface transformations. Just // return identity. return {}; } // |Surface| -GrDirectContext* GPUSurfaceVulkanImpeller::GetContext() { +GrDirectContext* SurfaceVulkanImpeller::GetContext() { // Impeller != Skia. return nullptr; } // |Surface| std::unique_ptr -GPUSurfaceVulkanImpeller::MakeRenderContextCurrent() { +SurfaceVulkanImpeller::MakeRenderContextCurrent() { // This backend has no such concept. return std::make_unique(true); } // |Surface| -bool GPUSurfaceVulkanImpeller::EnableRasterCache() const { +bool SurfaceVulkanImpeller::EnableRasterCache() const { return false; } // |Surface| -std::shared_ptr -GPUSurfaceVulkanImpeller::GetAiksContext() const { +std::shared_ptr SurfaceVulkanImpeller::GetAiksContext() + const { return aiks_context_; } diff --git a/shell/gpu/gpu_surface_vulkan_impeller.h b/shell/surface/surface_vulkan_impeller.h similarity index 72% rename from shell/gpu/gpu_surface_vulkan_impeller.h rename to shell/surface/surface_vulkan_impeller.h index fb761329ee95a..0ada6beda830e 100644 --- a/shell/gpu/gpu_surface_vulkan_impeller.h +++ b/shell/surface/surface_vulkan_impeller.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef FLUTTER_SHELL_GPU_GPU_SURFACE_VULKAN_IMPELLER_H_ -#define FLUTTER_SHELL_GPU_GPU_SURFACE_VULKAN_IMPELLER_H_ +#ifndef FLUTTER_SHELL_SURFACE_SURFACE_VULKAN_IMPELLER_H_ +#define FLUTTER_SHELL_SURFACE_SURFACE_VULKAN_IMPELLER_H_ #include "flutter/common/graphics/gl_context_switch.h" #include "flutter/flow/surface.h" @@ -11,17 +11,17 @@ #include "flutter/fml/memory/weak_ptr.h" #include "flutter/impeller/aiks/aiks_context.h" #include "flutter/impeller/renderer/context.h" -#include "flutter/shell/gpu/gpu_surface_vulkan_delegate.h" +#include "flutter/shell/surface/surface_vulkan_delegate.h" #include "impeller/renderer/renderer.h" namespace flutter { -class GPUSurfaceVulkanImpeller final : public Surface { +class SurfaceVulkanImpeller final : public Surface { public: - explicit GPUSurfaceVulkanImpeller(std::shared_ptr context); + explicit SurfaceVulkanImpeller(std::shared_ptr context); // |Surface| - ~GPUSurfaceVulkanImpeller() override; + ~SurfaceVulkanImpeller() override; // |Surface| bool IsValid() override; @@ -50,9 +50,9 @@ class GPUSurfaceVulkanImpeller final : public Surface { // |Surface| std::shared_ptr GetAiksContext() const override; - FML_DISALLOW_COPY_AND_ASSIGN(GPUSurfaceVulkanImpeller); + FML_DISALLOW_COPY_AND_ASSIGN(SurfaceVulkanImpeller); }; } // namespace flutter -#endif // FLUTTER_SHELL_GPU_GPU_SURFACE_VULKAN_IMPELLER_H_ +#endif // FLUTTER_SHELL_SURFACE_SURFACE_VULKAN_IMPELLER_H_ diff --git a/shell/testing/BUILD.gn b/shell/testing/BUILD.gn index 28a19c75d1bb9..f7301eaa3e53c 100644 --- a/shell/testing/BUILD.gn +++ b/shell/testing/BUILD.gn @@ -3,7 +3,7 @@ # found in the LICENSE file. import("//flutter/impeller/tools/impeller.gni") -import("//flutter/shell/gpu/gpu.gni") +import("//flutter/shell/surface/surface.gni") if (is_fuchsia) { import("//flutter/tools/fuchsia/gn-sdk/src/gn_configs.gni") @@ -44,7 +44,7 @@ executable("testing") { "//flutter/fml", "//flutter/lib/snapshot", "//flutter/shell/common", - "//flutter/shell/gpu:gpu_surface_software", + "//flutter/shell/surface:software", "//flutter/skia", "//flutter/third_party/abseil-cpp/absl/base:no_destructor", "//flutter/third_party/tonic", diff --git a/shell/testing/tester_main.cc b/shell/testing/tester_main.cc index b9a8b19b88840..fc8e2f1365c8b 100644 --- a/shell/testing/tester_main.cc +++ b/shell/testing/tester_main.cc @@ -23,7 +23,7 @@ #include "flutter/shell/common/shell.h" #include "flutter/shell/common/switches.h" #include "flutter/shell/common/thread_host.h" -#include "flutter/shell/gpu/gpu_surface_software.h" +#include "flutter/shell/surface/surface_software.h" #include "flutter/third_party/abseil-cpp/absl/base/no_destructor.h" #include "third_party/dart/runtime/include/bin/dart_io_api.h" @@ -35,6 +35,7 @@ #if ALLOW_IMPELLER #include // nogncheck +#include "flutter/shell/surface/surface_vulkan_impeller.h" // nogncheck #include "impeller/entity/vk/entity_shaders_vk.h" // nogncheck #include "impeller/entity/vk/framebuffer_blend_shaders_vk.h" // nogncheck #include "impeller/entity/vk/modern_shaders_vk.h" // nogncheck @@ -42,7 +43,6 @@ #include "impeller/renderer/backend/vulkan/surface_context_vk.h" // nogncheck #include "impeller/renderer/context.h" // nogncheck #include "impeller/renderer/vk/compute_shaders_vk.h" // nogncheck -#include "shell/gpu/gpu_surface_vulkan_impeller.h" // nogncheck #if IMPELLER_ENABLE_3D #include "impeller/scene/shaders/vk/scene_shaders_vk.h" // nogncheck #endif // IMPELLER_ENABLE_3D @@ -176,17 +176,16 @@ class TesterExternalViewEmbedder : public ExternalViewEmbedder { DisplayListBuilder builder_; }; -class TesterGPUSurfaceSoftware : public GPUSurfaceSoftware { +class TesterGPUSurfaceSoftware : public SurfaceSoftware { public: - TesterGPUSurfaceSoftware(GPUSurfaceSoftwareDelegate* delegate, + TesterGPUSurfaceSoftware(SurfaceSoftwareDelegate* delegate, bool render_to_surface) - : GPUSurfaceSoftware(delegate, render_to_surface) {} + : SurfaceSoftware(delegate, render_to_surface) {} bool EnableRasterCache() const override { return false; } }; -class TesterPlatformView : public PlatformView, - public GPUSurfaceSoftwareDelegate { +class TesterPlatformView : public PlatformView, public SurfaceSoftwareDelegate { public: TesterPlatformView(Delegate& delegate, const TaskRunners& task_runners, @@ -217,7 +216,7 @@ class TesterPlatformView : public PlatformView, #if ALLOW_IMPELLER if (delegate_.OnPlatformViewGetSettings().enable_impeller) { FML_DCHECK(impeller_context_holder_.context); - auto surface = std::make_unique( + auto surface = std::make_unique( impeller_context_holder_.surface_context); FML_DCHECK(surface->IsValid()); return surface; From bf685f96c4186a3a391dc3daedb3448d6a92bef1 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 29 Jul 2024 15:32:31 -0700 Subject: [PATCH 2/5] Licenses. --- ci/licenses_golden/excluded_files | 3 +- ci/licenses_golden/licenses_flutter | 88 ++++++++++++++--------------- 2 files changed, 46 insertions(+), 45 deletions(-) diff --git a/ci/licenses_golden/excluded_files b/ci/licenses_golden/excluded_files index 254e3a7041540..9c1b97656b704 100644 --- a/ci/licenses_golden/excluded_files +++ b/ci/licenses_golden/excluded_files @@ -287,7 +287,6 @@ ../../../flutter/shell/common/switches_unittests.cc ../../../flutter/shell/common/variable_refresh_rate_display_unittests.cc ../../../flutter/shell/common/vsync_waiter_unittests.cc -../../../flutter/shell/gpu/gpu_surface_metal_impeller_unittests.mm ../../../flutter/shell/platform/android/.gitignore ../../../flutter/shell/platform/android/README.md ../../../flutter/shell/platform/android/android_context_gl_impeller_unittests.cc @@ -421,6 +420,8 @@ ../../../flutter/shell/platform/windows/window_unittests.cc ../../../flutter/shell/platform/windows/windows_lifecycle_manager_unittests.cc ../../../flutter/shell/profiling/sampling_profiler_unittest.cc +../../../flutter/shell/surface/README.md +../../../flutter/shell/surface/surface_metal_impeller_unittests.mm ../../../flutter/shell/testing ../../../flutter/shell/vmservice/.dart_tool ../../../flutter/shell/vmservice/pubspec.lock diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index 9ac21f7cfaf8c..d5570d363281b 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -43265,28 +43265,6 @@ ORIGIN: ../../../flutter/shell/common/vsync_waiter_fallback.cc + ../../../flutte ORIGIN: ../../../flutter/shell/common/vsync_waiter_fallback.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/common/vsync_waiters_test.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/common/vsync_waiters_test.h + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/gpu/gpu_surface_gl_delegate.cc + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/gpu/gpu_surface_gl_delegate.h + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/gpu/gpu_surface_gl_impeller.cc + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/gpu/gpu_surface_gl_impeller.h + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/gpu/gpu_surface_gl_skia.cc + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/gpu/gpu_surface_gl_skia.h + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/gpu/gpu_surface_metal_delegate.cc + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/gpu/gpu_surface_metal_delegate.h + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/gpu/gpu_surface_metal_impeller.h + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/gpu/gpu_surface_metal_impeller.mm + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/gpu/gpu_surface_metal_skia.h + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/gpu/gpu_surface_metal_skia.mm + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/gpu/gpu_surface_software.cc + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/gpu/gpu_surface_software.h + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/gpu/gpu_surface_software_delegate.cc + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/gpu/gpu_surface_software_delegate.h + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/gpu/gpu_surface_vulkan.cc + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/gpu/gpu_surface_vulkan.h + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/gpu/gpu_surface_vulkan_delegate.cc + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/gpu/gpu_surface_vulkan_delegate.h + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/gpu/gpu_surface_vulkan_impeller.cc + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/shell/gpu/gpu_surface_vulkan_impeller.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/android/AndroidManifest.xml + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/android/android_context_gl_impeller.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/platform/android/android_context_gl_impeller.h + ../../../flutter/LICENSE @@ -44318,6 +44296,28 @@ ORIGIN: ../../../flutter/shell/platform/windows/windows_proc_table.h + ../../../ ORIGIN: ../../../flutter/shell/platform/windows/windowsx_shim.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/profiling/sampling_profiler.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/profiling/sampling_profiler.h + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/surface/surface_gl_delegate.cc + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/surface/surface_gl_delegate.h + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/surface/surface_gl_impeller.cc + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/surface/surface_gl_impeller.h + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/surface/surface_gl_skia.cc + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/surface/surface_gl_skia.h + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/surface/surface_metal_delegate.cc + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/surface/surface_metal_delegate.h + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/surface/surface_metal_impeller.h + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/surface/surface_metal_impeller.mm + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/surface/surface_metal_skia.h + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/surface/surface_metal_skia.mm + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/surface/surface_software.cc + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/surface/surface_software.h + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/surface/surface_software_delegate.cc + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/surface/surface_software_delegate.h + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/surface/surface_vulkan.cc + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/surface/surface_vulkan.h + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/surface/surface_vulkan_delegate.cc + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/surface/surface_vulkan_delegate.h + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/surface/surface_vulkan_impeller.cc + ../../../flutter/LICENSE +ORIGIN: ../../../flutter/shell/surface/surface_vulkan_impeller.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/version/version.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/version/version.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/shell/vmservice/empty.dart + ../../../flutter/LICENSE @@ -46155,28 +46155,6 @@ FILE: ../../../flutter/shell/common/vsync_waiter_fallback.cc FILE: ../../../flutter/shell/common/vsync_waiter_fallback.h FILE: ../../../flutter/shell/common/vsync_waiters_test.cc FILE: ../../../flutter/shell/common/vsync_waiters_test.h -FILE: ../../../flutter/shell/gpu/gpu_surface_gl_delegate.cc -FILE: ../../../flutter/shell/gpu/gpu_surface_gl_delegate.h -FILE: ../../../flutter/shell/gpu/gpu_surface_gl_impeller.cc -FILE: ../../../flutter/shell/gpu/gpu_surface_gl_impeller.h -FILE: ../../../flutter/shell/gpu/gpu_surface_gl_skia.cc -FILE: ../../../flutter/shell/gpu/gpu_surface_gl_skia.h -FILE: ../../../flutter/shell/gpu/gpu_surface_metal_delegate.cc -FILE: ../../../flutter/shell/gpu/gpu_surface_metal_delegate.h -FILE: ../../../flutter/shell/gpu/gpu_surface_metal_impeller.h -FILE: ../../../flutter/shell/gpu/gpu_surface_metal_impeller.mm -FILE: ../../../flutter/shell/gpu/gpu_surface_metal_skia.h -FILE: ../../../flutter/shell/gpu/gpu_surface_metal_skia.mm -FILE: ../../../flutter/shell/gpu/gpu_surface_software.cc -FILE: ../../../flutter/shell/gpu/gpu_surface_software.h -FILE: ../../../flutter/shell/gpu/gpu_surface_software_delegate.cc -FILE: ../../../flutter/shell/gpu/gpu_surface_software_delegate.h -FILE: ../../../flutter/shell/gpu/gpu_surface_vulkan.cc -FILE: ../../../flutter/shell/gpu/gpu_surface_vulkan.h -FILE: ../../../flutter/shell/gpu/gpu_surface_vulkan_delegate.cc -FILE: ../../../flutter/shell/gpu/gpu_surface_vulkan_delegate.h -FILE: ../../../flutter/shell/gpu/gpu_surface_vulkan_impeller.cc -FILE: ../../../flutter/shell/gpu/gpu_surface_vulkan_impeller.h FILE: ../../../flutter/shell/platform/android/AndroidManifest.xml FILE: ../../../flutter/shell/platform/android/android_context_gl_impeller.cc FILE: ../../../flutter/shell/platform/android/android_context_gl_impeller.h @@ -47233,6 +47211,28 @@ FILE: ../../../flutter/shell/platform/windows/windows_proc_table.h FILE: ../../../flutter/shell/platform/windows/windowsx_shim.h FILE: ../../../flutter/shell/profiling/sampling_profiler.cc FILE: ../../../flutter/shell/profiling/sampling_profiler.h +FILE: ../../../flutter/shell/surface/surface_gl_delegate.cc +FILE: ../../../flutter/shell/surface/surface_gl_delegate.h +FILE: ../../../flutter/shell/surface/surface_gl_impeller.cc +FILE: ../../../flutter/shell/surface/surface_gl_impeller.h +FILE: ../../../flutter/shell/surface/surface_gl_skia.cc +FILE: ../../../flutter/shell/surface/surface_gl_skia.h +FILE: ../../../flutter/shell/surface/surface_metal_delegate.cc +FILE: ../../../flutter/shell/surface/surface_metal_delegate.h +FILE: ../../../flutter/shell/surface/surface_metal_impeller.h +FILE: ../../../flutter/shell/surface/surface_metal_impeller.mm +FILE: ../../../flutter/shell/surface/surface_metal_skia.h +FILE: ../../../flutter/shell/surface/surface_metal_skia.mm +FILE: ../../../flutter/shell/surface/surface_software.cc +FILE: ../../../flutter/shell/surface/surface_software.h +FILE: ../../../flutter/shell/surface/surface_software_delegate.cc +FILE: ../../../flutter/shell/surface/surface_software_delegate.h +FILE: ../../../flutter/shell/surface/surface_vulkan.cc +FILE: ../../../flutter/shell/surface/surface_vulkan.h +FILE: ../../../flutter/shell/surface/surface_vulkan_delegate.cc +FILE: ../../../flutter/shell/surface/surface_vulkan_delegate.h +FILE: ../../../flutter/shell/surface/surface_vulkan_impeller.cc +FILE: ../../../flutter/shell/surface/surface_vulkan_impeller.h FILE: ../../../flutter/shell/version/version.cc FILE: ../../../flutter/shell/version/version.h FILE: ../../../flutter/shell/vmservice/empty.dart From 477968ad44e5257d45edee382a1430d327af0ca0 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 29 Jul 2024 22:33:24 +0000 Subject: [PATCH 3/5] Fix Linux. --- shell/common/shell_test_platform_view_gl.cc | 4 ++-- shell/common/shell_test_platform_view_gl.h | 2 +- shell/platform/embedder/embedder.cc | 4 ++-- shell/platform/embedder/embedder_surface_gl_impeller.cc | 2 +- shell/platform/embedder/embedder_surface_gl_impeller.h | 2 +- shell/platform/embedder/embedder_surface_gl_skia.cc | 2 +- shell/platform/embedder/embedder_surface_gl_skia.h | 2 +- shell/platform/embedder/embedder_surface_vulkan.h | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/shell/common/shell_test_platform_view_gl.cc b/shell/common/shell_test_platform_view_gl.cc index 9cf88265b4683..628465f3a5213 100644 --- a/shell/common/shell_test_platform_view_gl.cc +++ b/shell/common/shell_test_platform_view_gl.cc @@ -73,7 +73,7 @@ void ShellTestPlatformViewGL::SimulateVSync() { // |PlatformView| std::unique_ptr ShellTestPlatformViewGL::CreateRenderingSurface() { - return std::make_unique(this, true); + return std::make_unique(this, true); } // |PlatformView| @@ -114,7 +114,7 @@ GLFBOInfo ShellTestPlatformViewGL::GLContextFBO(GLFrameInfo frame_info) const { } // |GPUSurfaceGLDelegate| -GPUSurfaceGLDelegate::GLProcResolver +SurfaceGLDelegate::GLProcResolver ShellTestPlatformViewGL::GetGLProcResolver() const { return [surface = &gl_surface_](const char* name) -> void* { return surface->GetProcAddress(name); diff --git a/shell/common/shell_test_platform_view_gl.h b/shell/common/shell_test_platform_view_gl.h index 3ca9412f53741..1b6b8e8ade0d2 100644 --- a/shell/common/shell_test_platform_view_gl.h +++ b/shell/common/shell_test_platform_view_gl.h @@ -15,7 +15,7 @@ namespace flutter { namespace testing { class ShellTestPlatformViewGL : public ShellTestPlatformView, - public GPUSurfaceGLDelegate { + public SurfaceGLDelegate { public: ShellTestPlatformViewGL(PlatformView::Delegate& delegate, const TaskRunners& task_runners, diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index 6631c2582c9a1..73eebc8a73881 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -433,7 +433,7 @@ InferOpenGLPlatformViewCreationCallback( } } - flutter::GPUSurfaceGLDelegate::GLProcResolver gl_proc_resolver = nullptr; + flutter::SurfaceGLDelegate::GLProcResolver gl_proc_resolver = nullptr; if (SAFE_ACCESS(open_gl_config, gl_proc_resolver, nullptr) != nullptr) { gl_proc_resolver = [ptr = config->open_gl.gl_proc_resolver, user_data](const char* gl_proc_name) { @@ -1132,7 +1132,7 @@ static sk_sp MakeSkSurfaceFromBackingStore( backend_texture, // back-end texture kTopLeft_GrSurfaceOrigin, // surface origin 1, // sample count - flutter::GPUSurfaceVulkan::ColorTypeFromFormat( + flutter::SurfaceVulkan::ColorTypeFromFormat( static_cast(vulkan->image->format)), // color type SkColorSpace::MakeSRGB(), // color space &surface_properties, // surface properties diff --git a/shell/platform/embedder/embedder_surface_gl_impeller.cc b/shell/platform/embedder/embedder_surface_gl_impeller.cc index cc5b62c8efa33..0c5824c3e6f12 100644 --- a/shell/platform/embedder/embedder_surface_gl_impeller.cc +++ b/shell/platform/embedder/embedder_surface_gl_impeller.cc @@ -183,7 +183,7 @@ std::unique_ptr EmbedderSurfaceGLImpeller::CreateGPUSurface() { // current thread needs to be able to execute reactor operations. GLContextMakeCurrent(); - return std::make_unique( + return std::make_unique( this, // GPU surface GL delegate impeller_context_, // Impeller context !external_view_embedder_ // render to surface diff --git a/shell/platform/embedder/embedder_surface_gl_impeller.h b/shell/platform/embedder/embedder_surface_gl_impeller.h index 45f14e5714a51..07807b3589174 100644 --- a/shell/platform/embedder/embedder_surface_gl_impeller.h +++ b/shell/platform/embedder/embedder_surface_gl_impeller.h @@ -20,7 +20,7 @@ namespace flutter { class ReactorWorker; class EmbedderSurfaceGLImpeller final : public EmbedderSurface, - public GPUSurfaceGLDelegate { + public SurfaceGLDelegate { public: EmbedderSurfaceGLImpeller( EmbedderSurfaceGLSkia::GLDispatchTable gl_dispatch_table, diff --git a/shell/platform/embedder/embedder_surface_gl_skia.cc b/shell/platform/embedder/embedder_surface_gl_skia.cc index 05ea4c5a057b8..7b19e39504e90 100644 --- a/shell/platform/embedder/embedder_surface_gl_skia.cc +++ b/shell/platform/embedder/embedder_surface_gl_skia.cc @@ -98,7 +98,7 @@ SurfaceFrame::FramebufferInfo EmbedderSurfaceGLSkia::GLContextFramebufferInfo() // |EmbedderSurface| std::unique_ptr EmbedderSurfaceGLSkia::CreateGPUSurface() { const bool render_to_surface = !external_view_embedder_; - return std::make_unique( + return std::make_unique( this, // GPU surface GL delegate render_to_surface // render to surface ); diff --git a/shell/platform/embedder/embedder_surface_gl_skia.h b/shell/platform/embedder/embedder_surface_gl_skia.h index c303a00761119..a5216a5238429 100644 --- a/shell/platform/embedder/embedder_surface_gl_skia.h +++ b/shell/platform/embedder/embedder_surface_gl_skia.h @@ -13,7 +13,7 @@ namespace flutter { class EmbedderSurfaceGLSkia final : public EmbedderSurface, - public GPUSurfaceGLDelegate { + public SurfaceGLDelegate { public: struct GLDispatchTable { std::function gl_make_current_callback; // required diff --git a/shell/platform/embedder/embedder_surface_vulkan.h b/shell/platform/embedder/embedder_surface_vulkan.h index 1851ad547cac9..8b8ccb8466009 100644 --- a/shell/platform/embedder/embedder_surface_vulkan.h +++ b/shell/platform/embedder/embedder_surface_vulkan.h @@ -17,7 +17,7 @@ namespace flutter { class EmbedderSurfaceVulkan final : public EmbedderSurface, - public GPUSurfaceVulkanDelegate { + public SurfaceVulkanDelegate { public: struct VulkanDispatchTable { PFN_vkGetInstanceProcAddr get_instance_proc_address; // required From 8735ad473bcf507fa128a8095cc03362796a1509 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 29 Jul 2024 15:35:35 -0700 Subject: [PATCH 4/5] Format. --- shell/common/shell_test_platform_view_gl.cc | 4 ++-- shell/platform/embedder/embedder_surface_gl_skia.cc | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/shell/common/shell_test_platform_view_gl.cc b/shell/common/shell_test_platform_view_gl.cc index 628465f3a5213..37e98bab74f2a 100644 --- a/shell/common/shell_test_platform_view_gl.cc +++ b/shell/common/shell_test_platform_view_gl.cc @@ -114,8 +114,8 @@ GLFBOInfo ShellTestPlatformViewGL::GLContextFBO(GLFrameInfo frame_info) const { } // |GPUSurfaceGLDelegate| -SurfaceGLDelegate::GLProcResolver -ShellTestPlatformViewGL::GetGLProcResolver() const { +SurfaceGLDelegate::GLProcResolver ShellTestPlatformViewGL::GetGLProcResolver() + const { return [surface = &gl_surface_](const char* name) -> void* { return surface->GetProcAddress(name); }; diff --git a/shell/platform/embedder/embedder_surface_gl_skia.cc b/shell/platform/embedder/embedder_surface_gl_skia.cc index 7b19e39504e90..3a0bcab528a20 100644 --- a/shell/platform/embedder/embedder_surface_gl_skia.cc +++ b/shell/platform/embedder/embedder_surface_gl_skia.cc @@ -98,9 +98,8 @@ SurfaceFrame::FramebufferInfo EmbedderSurfaceGLSkia::GLContextFramebufferInfo() // |EmbedderSurface| std::unique_ptr EmbedderSurfaceGLSkia::CreateGPUSurface() { const bool render_to_surface = !external_view_embedder_; - return std::make_unique( - this, // GPU surface GL delegate - render_to_surface // render to surface + return std::make_unique(this, // GPU surface GL delegate + render_to_surface // render to surface ); } From 12e3c991e93c78461eead03f305a43ba17dcf0e0 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 29 Jul 2024 15:52:18 -0700 Subject: [PATCH 5/5] PR --- shell/platform/darwin/ios/ios_surface_metal_impeller.h | 5 ++--- shell/platform/darwin/ios/ios_surface_metal_impeller.mm | 6 +++--- shell/platform/darwin/ios/ios_surface_metal_skia.h | 2 +- shell/platform/darwin/ios/ios_surface_metal_skia.mm | 6 +++--- shell/platform/darwin/ios/ios_surface_software.h | 2 +- shell/platform/darwin/ios/ios_surface_software.mm | 2 +- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/shell/platform/darwin/ios/ios_surface_metal_impeller.h b/shell/platform/darwin/ios/ios_surface_metal_impeller.h index 7bce1275cfbe1..d9c111ac3bafb 100644 --- a/shell/platform/darwin/ios/ios_surface_metal_impeller.h +++ b/shell/platform/darwin/ios/ios_surface_metal_impeller.h @@ -17,9 +17,8 @@ class Context; namespace flutter { -class SK_API_AVAILABLE_CA_METAL_LAYER IOSSurfaceMetalImpeller final - : public IOSSurface, - public GPUSurfaceMetalDelegate { +class SK_API_AVAILABLE_CA_METAL_LAYER IOSSurfaceMetalImpeller final : public IOSSurface, + public SurfaceMetalDelegate { public: IOSSurfaceMetalImpeller(const fml::scoped_nsobject& layer, const std::shared_ptr& context); diff --git a/shell/platform/darwin/ios/ios_surface_metal_impeller.mm b/shell/platform/darwin/ios/ios_surface_metal_impeller.mm index 82002b4f295a4..81844b1889d9c 100644 --- a/shell/platform/darwin/ios/ios_surface_metal_impeller.mm +++ b/shell/platform/darwin/ios/ios_surface_metal_impeller.mm @@ -15,7 +15,7 @@ IOSSurfaceMetalImpeller::IOSSurfaceMetalImpeller(const fml::scoped_nsobject& layer, const std::shared_ptr& context) : IOSSurface(context), - GPUSurfaceMetalDelegate(MTLRenderTargetType::kCAMetalLayer), + SurfaceMetalDelegate(MTLRenderTargetType::kCAMetalLayer), layer_(layer), impeller_context_(context ? context->GetImpellerContext() : nullptr) { if (!impeller_context_) { @@ -41,8 +41,8 @@ std::unique_ptr IOSSurfaceMetalImpeller::CreateGPUSurface(GrDirectContext*) { impeller_context_->UpdateOffscreenLayerPixelFormat( impeller::FromMTLPixelFormat(layer_.get().pixelFormat)); - return std::make_unique(this, // - impeller_context_ // + return std::make_unique(this, // + impeller_context_ // ); } diff --git a/shell/platform/darwin/ios/ios_surface_metal_skia.h b/shell/platform/darwin/ios/ios_surface_metal_skia.h index 2ef1cc97a6433..2c48e554d9ef5 100644 --- a/shell/platform/darwin/ios/ios_surface_metal_skia.h +++ b/shell/platform/darwin/ios/ios_surface_metal_skia.h @@ -17,7 +17,7 @@ namespace flutter { class SK_API_AVAILABLE_CA_METAL_LAYER IOSSurfaceMetalSkia final : public IOSSurface, - public GPUSurfaceMetalDelegate { + public SurfaceMetalDelegate { public: IOSSurfaceMetalSkia(const fml::scoped_nsobject& layer, std::shared_ptr context); diff --git a/shell/platform/darwin/ios/ios_surface_metal_skia.mm b/shell/platform/darwin/ios/ios_surface_metal_skia.mm index a93ff91cbe136..dc10c467b9828 100644 --- a/shell/platform/darwin/ios/ios_surface_metal_skia.mm +++ b/shell/platform/darwin/ios/ios_surface_metal_skia.mm @@ -26,7 +26,7 @@ - (void)flutterPrepareForPresent:(nonnull id)commandBuffer; IOSSurfaceMetalSkia::IOSSurfaceMetalSkia(const fml::scoped_nsobject& layer, std::shared_ptr context) : IOSSurface(std::move(context)), - GPUSurfaceMetalDelegate(MTLRenderTargetType::kCAMetalLayer), + SurfaceMetalDelegate(MTLRenderTargetType::kCAMetalLayer), layer_(layer) { is_valid_ = layer_; auto metal_context = CastToMetalContext(GetContext()); @@ -51,8 +51,8 @@ - (void)flutterPrepareForPresent:(nonnull id)commandBuffer; // |IOSSurface| std::unique_ptr IOSSurfaceMetalSkia::CreateGPUSurface(GrDirectContext* context) { FML_DCHECK(context); - return std::make_unique(this, // delegate - sk_ref_sp(context) // context + return std::make_unique(this, // delegate + sk_ref_sp(context) // context ); } diff --git a/shell/platform/darwin/ios/ios_surface_software.h b/shell/platform/darwin/ios/ios_surface_software.h index 15a75b162d721..e9284f22b19aa 100644 --- a/shell/platform/darwin/ios/ios_surface_software.h +++ b/shell/platform/darwin/ios/ios_surface_software.h @@ -18,7 +18,7 @@ namespace flutter { -class IOSSurfaceSoftware final : public IOSSurface, public GPUSurfaceSoftwareDelegate { +class IOSSurfaceSoftware final : public IOSSurface, public SurfaceSoftwareDelegate { public: IOSSurfaceSoftware(const fml::scoped_nsobject& layer, std::shared_ptr context); diff --git a/shell/platform/darwin/ios/ios_surface_software.mm b/shell/platform/darwin/ios/ios_surface_software.mm index c67facb1931c2..21981737cc335 100644 --- a/shell/platform/darwin/ios/ios_surface_software.mm +++ b/shell/platform/darwin/ios/ios_surface_software.mm @@ -41,7 +41,7 @@ return nullptr; } - auto surface = std::make_unique(this, true /* render to surface */); + auto surface = std::make_unique(this, true /* render to surface */); if (!surface->IsValid()) { return nullptr;