9#include "flutter/shell/platform/embedder/embedder_surface_metal_skia.h"
11#include "flutter/fml/logging.h"
12#include "flutter/shell/gpu/gpu_surface_metal_delegate.h"
13#include "flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalSkia.h"
23 std::shared_ptr<EmbedderExternalViewEmbedder> external_view_embedder)
25 metal_dispatch_table_(
std::move(metal_dispatch_table)),
26 external_view_embedder_(
std::move(external_view_embedder)) {
29 commandQueue:(id<MTLCommandQueue>)command_queue];
32 commandQueue:(id<MTLCommandQueue>)command_queue];
33 valid_ = main_context_ && resource_context_;
38bool EmbedderSurfaceMetalSkia::IsValid()
const {
42std::unique_ptr<Surface> EmbedderSurfaceMetalSkia::CreateGPUSurface()
API_AVAILABLE(
ios(13.0)) {
43 if (@available(iOS 13.0, *)) {
51 const bool render_to_surface = !external_view_embedder_;
52 auto surface = std::make_unique<GPUSurfaceMetalSkia>(
this, main_context_, render_to_surface);
62 return resource_context_;
66 FML_CHECK(
false) <<
"Only rendering to MTLTexture is supported.";
70bool EmbedderSurfaceMetalSkia::PresentDrawable(
GrMTLHandle drawable)
const {
71 FML_CHECK(
false) <<
"Only rendering to MTLTexture is supported.";
75GPUMTLTextureInfo EmbedderSurfaceMetalSkia::GetMTLTexture(
const SkISize& frame_info)
const {
76 return metal_dispatch_table_.
get_texture(frame_info);
79bool EmbedderSurfaceMetalSkia::PresentTexture(GPUMTLTextureInfo
texture)
const {
#define FLUTTER_ASSERT_NOT_ARC
#define FML_CHECK(condition)
SK_API sk_sp< SkSurface > ios(9.0)
void * GPUMTLDeviceHandle
void * GPUCAMetalLayerHandle
void * GPUMTLCommandQueueHandle
API_AVAILABLE(ios(14.0), macos(11.0)) static NSString *MTLCommandEncoderErrorStateToString(MTLCommandEncoderErrorState state)