From 88e33b2032d3ee08c942119fde05eea333047aba Mon Sep 17 00:00:00 2001 From: K Lubick Date: Tue, 19 Mar 2024 22:13:22 +0000 Subject: [PATCH] Migrate use of deprecated GrDirectContext::MakeMetal --- shell/gpu/gpu_surface_metal_delegate.h | 2 +- shell/gpu/gpu_surface_metal_impeller.h | 2 +- shell/platform/darwin/ios/ios_surface_metal_skia.h | 2 +- testing/test_metal_context.mm | 8 +++++++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/shell/gpu/gpu_surface_metal_delegate.h b/shell/gpu/gpu_surface_metal_delegate.h index a5dadedd9a429..f20b0507231c9 100644 --- a/shell/gpu/gpu_surface_metal_delegate.h +++ b/shell/gpu/gpu_surface_metal_delegate.h @@ -10,7 +10,7 @@ #include "flutter/fml/macros.h" #include "third_party/skia/include/core/SkSize.h" #include "third_party/skia/include/core/SkSurface.h" -#include "third_party/skia/include/gpu/mtl/GrMtlTypes.h" +#include "third_party/skia/include/gpu/ganesh/mtl/GrMtlTypes.h" namespace flutter { diff --git a/shell/gpu/gpu_surface_metal_impeller.h b/shell/gpu/gpu_surface_metal_impeller.h index 74dd752570098..ef0c1e955cd48 100644 --- a/shell/gpu/gpu_surface_metal_impeller.h +++ b/shell/gpu/gpu_surface_metal_impeller.h @@ -14,7 +14,7 @@ #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 "third_party/skia/include/gpu/mtl/GrMtlTypes.h" +#include "third_party/skia/include/gpu/ganesh/mtl/GrMtlTypes.h" namespace flutter { diff --git a/shell/platform/darwin/ios/ios_surface_metal_skia.h b/shell/platform/darwin/ios/ios_surface_metal_skia.h index efd174b07e09d..ed2468654abfc 100644 --- a/shell/platform/darwin/ios/ios_surface_metal_skia.h +++ b/shell/platform/darwin/ios/ios_surface_metal_skia.h @@ -8,7 +8,7 @@ #include "flutter/fml/macros.h" #include "flutter/shell/gpu/gpu_surface_metal_delegate.h" #import "flutter/shell/platform/darwin/ios/ios_surface.h" -#include "third_party/skia/include/gpu/mtl/GrMtlTypes.h" +#include "third_party/skia/include/gpu/ganesh/mtl/GrMtlTypes.h" @class CAMetalLayer; diff --git a/testing/test_metal_context.mm b/testing/test_metal_context.mm index dca0a34f7df28..7f869cb44bd79 100644 --- a/testing/test_metal_context.mm +++ b/testing/test_metal_context.mm @@ -10,6 +10,9 @@ #include "flutter/fml/logging.h" #include "flutter/fml/platform/darwin/scoped_nsobject.h" #include "third_party/skia/include/core/SkSurface.h" +#include "third_party/skia/include/gpu/GrDirectContext.h" +#include "third_party/skia/include/gpu/ganesh/mtl/GrMtlBackendContext.h" +#include "third_party/skia/include/gpu/ganesh/mtl/GrMtlDirectContext.h" namespace flutter { @@ -28,9 +31,12 @@ [command_queue.get() setLabel:@"Flutter Test Queue"]; + GrMtlBackendContext backendContext = {}; // Skia expect arguments to `MakeMetal` transfer ownership of the reference in for release later // when the GrDirectContext is collected. - skia_context_ = GrDirectContext::MakeMetal([device.get() retain], [command_queue.get() retain]); + backendContext.fDevice.reset([device.get() retain]); + backendContext.fQueue.reset([command_queue.get() retain]); + skia_context_ = GrDirectContexts::MakeMetal(backendContext); if (!skia_context_) { FML_LOG(ERROR) << "Could not create the GrDirectContext from the Metal Device " "and command queue.";