Migrate use of deprecated GrDirectContext::MakeMetal (flutter/engine#51537)

This was deprecated in https://skia-review.googlesource.com/c/skia/+/826397. Furthermore, some metal files were relocated, so this changes those also.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
K Lubick
2024-03-20 14:07:33 -04:00
committed by GitHub
parent 5669c466b2
commit 95d17af1aa
4 changed files with 10 additions and 4 deletions

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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 @@ TestMetalContext::TestMetalContext() {
[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.";