From a6761a95ea394d5e98eb3012f5a9b5e9eccf8ac3 Mon Sep 17 00:00:00 2001 From: Kevin Lubick Date: Fri, 13 Oct 2023 10:41:25 -0400 Subject: [PATCH] Update to use GrDirectContexts::MakeVulkan (flutter/engine#46878) In http://review.skia.org/764516, Skia moved the way to make a Vulkan context. This updates Flutter to use that new way. ## 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]. - [ ] 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. - [x] 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 --- .../flutter/shell/common/shell_test_platform_view_vulkan.cc | 3 ++- .../flutter/shell/platform/embedder/embedder_surface_vulkan.cc | 3 ++- .../shell/platform/fuchsia/flutter/vulkan_surface_producer.cc | 3 ++- engine/src/flutter/testing/test_vulkan_context.cc | 3 ++- engine/src/flutter/vulkan/vulkan_window.cc | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) 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 d19e5cb2bca..d8ce19114f1 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 @@ -14,6 +14,7 @@ #include "third_party/skia/include/core/SkSurface.h" #include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h" +#include "third_party/skia/include/gpu/ganesh/vk/GrVkDirectContext.h" #if OS_FUCHSIA #define VULKAN_SO_PATH "libvulkan.so" @@ -138,7 +139,7 @@ bool ShellTestPlatformViewVulkan::OffScreenSurface::CreateSkiaGrContext() { MakeDefaultContextOptions(ContextType::kRender, GrBackendApi::kVulkan); sk_sp context = - GrDirectContext::MakeVulkan(backend_context, options); + GrDirectContexts::MakeVulkan(backend_context, options); if (context == nullptr) { FML_DLOG(ERROR) << "Failed to create GrDirectContext"; 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 d7191770025..1ab4ca92942 100644 --- a/engine/src/flutter/shell/platform/embedder/embedder_surface_vulkan.cc +++ b/engine/src/flutter/shell/platform/embedder/embedder_surface_vulkan.cc @@ -14,6 +14,7 @@ #include "include/gpu/GrDirectContext.h" #include "include/gpu/vk/GrVkBackendContext.h" #include "include/gpu/vk/GrVkExtensions.h" +#include "third_party/skia/include/gpu/ganesh/vk/GrVkDirectContext.h" namespace flutter { @@ -171,7 +172,7 @@ sk_sp EmbedderSurfaceVulkan::CreateGrContext( GrContextOptions options = MakeDefaultContextOptions(context_type, GrBackendApi::kVulkan); options.fReduceOpsTaskSplitting = GrContextOptions::Enable::kNo; - return GrDirectContext::MakeVulkan(backend_context, options); + return GrDirectContexts::MakeVulkan(backend_context, options); } } // namespace flutter 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 24394e4cfc0..f99c39a4d09 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 @@ -20,6 +20,7 @@ #include "third_party/skia/include/gpu/GrBackendSurface.h" #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/GrVkExtensions.h" #include "third_party/skia/include/gpu/vk/GrVkTypes.h" @@ -153,7 +154,7 @@ bool VulkanSurfaceProducer::Initialize() { GrContextOptions options; options.fReduceOpsTaskSplitting = GrContextOptions::Enable::kNo; - context_ = GrDirectContext::MakeVulkan(backend_context, options); + context_ = GrDirectContexts::MakeVulkan(backend_context, options); if (context_ == nullptr) { FML_LOG(ERROR) diff --git a/engine/src/flutter/testing/test_vulkan_context.cc b/engine/src/flutter/testing/test_vulkan_context.cc index 5652431a800..d7472303f11 100644 --- a/engine/src/flutter/testing/test_vulkan_context.cc +++ b/engine/src/flutter/testing/test_vulkan_context.cc @@ -17,6 +17,7 @@ #include "flutter/vulkan/swiftshader_path.h" #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/GrVkExtensions.h" #include "vulkan/vulkan_core.h" @@ -106,7 +107,7 @@ TestVulkanContext::TestVulkanContext() { GrContextOptions options = MakeDefaultContextOptions(ContextType::kRender, GrBackendApi::kVulkan); options.fReduceOpsTaskSplitting = GrContextOptions::Enable::kNo; - context_ = GrDirectContext::MakeVulkan(backend_context, options); + context_ = GrDirectContexts::MakeVulkan(backend_context, options); } TestVulkanContext::~TestVulkanContext() { diff --git a/engine/src/flutter/vulkan/vulkan_window.cc b/engine/src/flutter/vulkan/vulkan_window.cc index 345919b83d8..95bd227dde4 100644 --- a/engine/src/flutter/vulkan/vulkan_window.cc +++ b/engine/src/flutter/vulkan/vulkan_window.cc @@ -19,6 +19,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" namespace vulkan { @@ -128,7 +129,7 @@ bool VulkanWindow::CreateSkiaGrContext() { GrContextOptions options; options.fReduceOpsTaskSplitting = GrContextOptions::Enable::kNo; sk_sp context = - GrDirectContext::MakeVulkan(backend_context, options); + GrDirectContexts::MakeVulkan(backend_context, options); if (context == nullptr) { return false;