Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion shell/gpu/gpu_surface_metal_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion shell/gpu/gpu_surface_metal_impeller.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion shell/platform/darwin/ios/ios_surface_metal_skia.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 7 additions & 1 deletion testing/test_metal_context.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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.";
Expand Down