From 2e2f3e35cd39a72859a2bba0b507a286b22b1647 Mon Sep 17 00:00:00 2001 From: Kaylee Lubick Date: Mon, 24 Jun 2024 07:39:16 -0400 Subject: [PATCH] Update uses of GrVkBackendContext and other deprecated type names (flutter/engine#53491) As of [this CL](https://skia-review.googlesource.com/c/skia/+/859125), `GrVkBackendContext` is an alias for `skgpu::VulkanBackendContext`, so this updates Flutter to use the GPU-backend agnostic version. See . ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I added new tests to check the change I am making or feature I am adding, or the PR is [test-exempt]. See [testing the engine] for instructions on writing and running engine tests. - [ ] I updated/added relevant documentation (doc comments with `///`). - [x] I signed the [CLA]. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style [testing the engine]: https://github.com/flutter/flutter/wiki/Testing-the-engine [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat --- engine/src/flutter/flutter_vma/flutter_skia_vma.h | 3 ++- .../flutter/shell/common/shell_test_platform_view_vulkan.cc | 4 ++-- .../flutter/shell/common/shell_test_platform_view_vulkan.h | 5 ++++- .../shell/platform/embedder/embedder_surface_vulkan.cc | 4 ++-- .../platform/fuchsia/flutter/vulkan_surface_producer.cc | 4 ++-- engine/src/flutter/testing/test_vulkan_context.cc | 3 ++- engine/src/flutter/vulkan/vulkan_device.cc | 1 - engine/src/flutter/vulkan/vulkan_native_surface_android.cc | 2 -- engine/src/flutter/vulkan/vulkan_skia_proc_table.cc | 3 ++- engine/src/flutter/vulkan/vulkan_skia_proc_table.h | 5 +++-- engine/src/flutter/vulkan/vulkan_window.cc | 4 ++-- engine/src/flutter/vulkan/vulkan_window.h | 4 ++-- 12 files changed, 23 insertions(+), 19 deletions(-) diff --git a/engine/src/flutter/flutter_vma/flutter_skia_vma.h b/engine/src/flutter/flutter_vma/flutter_skia_vma.h index 4a9bdaf9c6..a539a15b9f 100644 --- a/engine/src/flutter/flutter_vma/flutter_skia_vma.h +++ b/engine/src/flutter/flutter_vma/flutter_skia_vma.h @@ -9,7 +9,8 @@ #include "flutter/fml/memory/ref_ptr.h" #include "flutter/vulkan/procs/vulkan_proc_table.h" -#include "third_party/skia/include/gpu/vk/GrVkBackendContext.h" +#include "third_party/skia/include/gpu/vk/VulkanMemoryAllocator.h" +#include "third_party/skia/include/gpu/vk/VulkanTypes.h" namespace flutter { diff --git a/engine/src/flutter/shell/common/shell_test_platform_view_vulkan.cc b/engine/src/flutter/shell/common/shell_test_platform_view_vulkan.cc index 006cef0394..c148702b76 100644 --- a/engine/src/flutter/shell/common/shell_test_platform_view_vulkan.cc +++ b/engine/src/flutter/shell/common/shell_test_platform_view_vulkan.cc @@ -128,7 +128,7 @@ ShellTestPlatformViewVulkan::OffScreenSurface::OffScreenSurface( } bool ShellTestPlatformViewVulkan::OffScreenSurface::CreateSkiaGrContext() { - GrVkBackendContext backend_context; + skgpu::VulkanBackendContext backend_context; skgpu::VulkanExtensions no_extensions; // For now, Skia crashes if fDeviceFeatures is set but fVkExtensions is not. backend_context.fVkExtensions = &no_extensions; @@ -161,7 +161,7 @@ bool ShellTestPlatformViewVulkan::OffScreenSurface::CreateSkiaGrContext() { } bool ShellTestPlatformViewVulkan::OffScreenSurface::CreateSkiaBackendContext( - GrVkBackendContext* context, + skgpu::VulkanBackendContext* context, VkPhysicalDeviceFeatures* features) { FML_CHECK(context); FML_CHECK(features); diff --git a/engine/src/flutter/shell/common/shell_test_platform_view_vulkan.h b/engine/src/flutter/shell/common/shell_test_platform_view_vulkan.h index 02ef50d36d..7ee3f3ed04 100644 --- a/engine/src/flutter/shell/common/shell_test_platform_view_vulkan.h +++ b/engine/src/flutter/shell/common/shell_test_platform_view_vulkan.h @@ -11,6 +11,9 @@ #include "flutter/vulkan/vulkan_application.h" #include "flutter/vulkan/vulkan_device.h" #include "flutter/vulkan/vulkan_skia_proc_table.h" +#include "third_party/skia/include/gpu/vk/VulkanBackendContext.h" +#include "third_party/skia/include/gpu/vk/VulkanMemoryAllocator.h" +#include "third_party/skia/include/gpu/vk/VulkanTypes.h" namespace flutter { namespace testing { @@ -60,7 +63,7 @@ class ShellTestPlatformViewVulkan : public ShellTestPlatformView { sk_sp context_; bool CreateSkiaGrContext(); - bool CreateSkiaBackendContext(GrVkBackendContext*, + bool CreateSkiaBackendContext(skgpu::VulkanBackendContext*, VkPhysicalDeviceFeatures*); FML_DISALLOW_COPY_AND_ASSIGN(OffScreenSurface); diff --git a/engine/src/flutter/shell/platform/embedder/embedder_surface_vulkan.cc b/engine/src/flutter/shell/platform/embedder/embedder_surface_vulkan.cc index 39ef90a83c..7b8e4ac511 100644 --- a/engine/src/flutter/shell/platform/embedder/embedder_surface_vulkan.cc +++ b/engine/src/flutter/shell/platform/embedder/embedder_surface_vulkan.cc @@ -12,7 +12,7 @@ #include "flutter/shell/gpu/gpu_surface_vulkan_delegate.h" #include "flutter/vulkan/vulkan_skia_proc_table.h" #include "include/gpu/GrDirectContext.h" -#include "include/gpu/vk/GrVkBackendContext.h" +#include "include/gpu/vk/VulkanBackendContext.h" #include "include/gpu/vk/VulkanExtensions.h" #include "third_party/skia/include/gpu/ganesh/vk/GrVkDirectContext.h" @@ -143,7 +143,7 @@ sk_sp EmbedderSurfaceVulkan::CreateGrContext( skgpu::VulkanExtensions extensions; - GrVkBackendContext backend_context = {}; + skgpu::VulkanBackendContext backend_context = {}; backend_context.fInstance = instance; backend_context.fPhysicalDevice = device_.GetPhysicalDeviceHandle(); backend_context.fDevice = device_.GetHandle(); diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface_producer.cc b/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface_producer.cc index 17cc7e0adf..88f62c936f 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface_producer.cc +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface_producer.cc @@ -21,8 +21,8 @@ #include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h" #include "third_party/skia/include/gpu/ganesh/vk/GrVkBackendSurface.h" #include "third_party/skia/include/gpu/ganesh/vk/GrVkDirectContext.h" -#include "third_party/skia/include/gpu/vk/GrVkBackendContext.h" #include "third_party/skia/include/gpu/vk/GrVkTypes.h" +#include "third_party/skia/include/gpu/vk/VulkanBackendContext.h" #include "third_party/skia/include/gpu/vk/VulkanExtensions.h" namespace flutter_runner { @@ -125,7 +125,7 @@ bool VulkanSurfaceProducer::Initialize() { logical_device_->GetPhysicalDeviceHandle(), logical_device_->GetHandle(), vk_, true); - GrVkBackendContext backend_context; + skgpu::VulkanBackendContext backend_context; backend_context.fInstance = application_->GetInstance(); backend_context.fPhysicalDevice = logical_device_->GetPhysicalDeviceHandle(); backend_context.fDevice = logical_device_->GetHandle(); diff --git a/engine/src/flutter/testing/test_vulkan_context.cc b/engine/src/flutter/testing/test_vulkan_context.cc index 726e550f95..3d6b81fb8c 100644 --- a/engine/src/flutter/testing/test_vulkan_context.cc +++ b/engine/src/flutter/testing/test_vulkan_context.cc @@ -18,6 +18,7 @@ #include "third_party/skia/include/core/SkSurface.h" #include "third_party/skia/include/gpu/GrDirectContext.h" #include "third_party/skia/include/gpu/ganesh/vk/GrVkDirectContext.h" +#include "third_party/skia/include/gpu/vk/VulkanBackendContext.h" #include "third_party/skia/include/gpu/vk/VulkanExtensions.h" #include "vulkan/vulkan_core.h" @@ -90,7 +91,7 @@ TestVulkanContext::TestVulkanContext() { skgpu::VulkanExtensions extensions; - GrVkBackendContext backend_context = {}; + skgpu::VulkanBackendContext backend_context = {}; backend_context.fInstance = application_->GetInstance(); backend_context.fPhysicalDevice = device_->GetPhysicalDeviceHandle(); backend_context.fDevice = device_->GetHandle(); diff --git a/engine/src/flutter/vulkan/vulkan_device.cc b/engine/src/flutter/vulkan/vulkan_device.cc index 6a92071e32..d350438fdf 100644 --- a/engine/src/flutter/vulkan/vulkan_device.cc +++ b/engine/src/flutter/vulkan/vulkan_device.cc @@ -9,7 +9,6 @@ #include #include "flutter/vulkan/procs/vulkan_proc_table.h" -#include "third_party/skia/include/gpu/vk/GrVkBackendContext.h" #include "vulkan_surface.h" #include "vulkan_utilities.h" diff --git a/engine/src/flutter/vulkan/vulkan_native_surface_android.cc b/engine/src/flutter/vulkan/vulkan_native_surface_android.cc index 6f27b6eb19..4791644905 100644 --- a/engine/src/flutter/vulkan/vulkan_native_surface_android.cc +++ b/engine/src/flutter/vulkan/vulkan_native_surface_android.cc @@ -6,8 +6,6 @@ #include -#include "third_party/skia/include/gpu/vk/GrVkBackendContext.h" - namespace vulkan { VulkanNativeSurfaceAndroid::VulkanNativeSurfaceAndroid( diff --git a/engine/src/flutter/vulkan/vulkan_skia_proc_table.cc b/engine/src/flutter/vulkan/vulkan_skia_proc_table.cc index 71977fd269..c0f5ae37ab 100644 --- a/engine/src/flutter/vulkan/vulkan_skia_proc_table.cc +++ b/engine/src/flutter/vulkan/vulkan_skia_proc_table.cc @@ -6,7 +6,8 @@ namespace vulkan { -GrVkGetProc CreateSkiaGetProc(const fml::RefPtr& vk) { +skgpu::VulkanGetProc CreateSkiaGetProc( + const fml::RefPtr& vk) { if (!vk || !vk->IsValid()) { return nullptr; } diff --git a/engine/src/flutter/vulkan/vulkan_skia_proc_table.h b/engine/src/flutter/vulkan/vulkan_skia_proc_table.h index ca7a8e3314..02b0c821a1 100644 --- a/engine/src/flutter/vulkan/vulkan_skia_proc_table.h +++ b/engine/src/flutter/vulkan/vulkan_skia_proc_table.h @@ -7,11 +7,12 @@ #include "flutter/vulkan/procs/vulkan_proc_table.h" -#include "third_party/skia/include/gpu/vk/GrVkBackendContext.h" +#include "third_party/skia/include/gpu/vk/VulkanTypes.h" namespace vulkan { -GrVkGetProc CreateSkiaGetProc(const fml::RefPtr& vk); +skgpu::VulkanGetProc CreateSkiaGetProc( + const fml::RefPtr& vk); } // namespace vulkan diff --git a/engine/src/flutter/vulkan/vulkan_window.cc b/engine/src/flutter/vulkan/vulkan_window.cc index 1227b1d5f8..afd42e55b4 100644 --- a/engine/src/flutter/vulkan/vulkan_window.cc +++ b/engine/src/flutter/vulkan/vulkan_window.cc @@ -122,7 +122,7 @@ GrDirectContext* VulkanWindow::GetSkiaGrContext() { bool VulkanWindow::CreateSkiaGrContext() { #ifdef SK_VULKAN - GrVkBackendContext backend_context; + skgpu::VulkanBackendContext backend_context; VkPhysicalDeviceFeatures features; skgpu::VulkanExtensions extensions; @@ -151,7 +151,7 @@ bool VulkanWindow::CreateSkiaGrContext() { } bool VulkanWindow::CreateSkiaBackendContext( - GrVkBackendContext* context, + skgpu::VulkanBackendContext* context, VkPhysicalDeviceFeatures* features, skgpu::VulkanExtensions* extensions) { #ifdef SK_VULKAN diff --git a/engine/src/flutter/vulkan/vulkan_window.h b/engine/src/flutter/vulkan/vulkan_window.h index 22bf1ccc54..7495af323d 100644 --- a/engine/src/flutter/vulkan/vulkan_window.h +++ b/engine/src/flutter/vulkan/vulkan_window.h @@ -17,7 +17,7 @@ #include "third_party/skia/include/core/SkSize.h" #include "third_party/skia/include/core/SkSurface.h" #include "third_party/skia/include/gpu/GrDirectContext.h" -#include "third_party/skia/include/gpu/vk/GrVkBackendContext.h" +#include "third_party/skia/include/gpu/vk/VulkanBackendContext.h" namespace vulkan { @@ -68,7 +68,7 @@ class VulkanWindow { bool CreateSkiaGrContext(); - bool CreateSkiaBackendContext(GrVkBackendContext*, + bool CreateSkiaBackendContext(skgpu::VulkanBackendContext*, VkPhysicalDeviceFeatures*, skgpu::VulkanExtensions*);