14#include "third_party/skia/include/gpu/ganesh/GrDirectContext.h"
24 std::shared_ptr<EmbedderExternalViewEmbedder> external_view_embedder)
26 metal_dispatch_table_(
std::move(metal_dispatch_table)),
27 external_view_embedder_(
std::move(external_view_embedder)) {
30 commandQueue:(__bridge id<MTLCommandQueue>)command_queue];
33 commandQueue:(__bridge id<MTLCommandQueue>)command_queue];
34 valid_ = main_context_ && resource_context_;
39bool EmbedderSurfaceMetalSkia::IsValid()
const {
43std::unique_ptr<Surface> EmbedderSurfaceMetalSkia::CreateGPUSurface()
API_AVAILABLE(ios(13.0)) {
48 const bool render_to_surface = !external_view_embedder_;
49 auto surface = std::make_unique<GPUSurfaceMetalSkia>(
this, main_context_, render_to_surface);
58sk_sp<GrDirectContext> EmbedderSurfaceMetalSkia::CreateResourceContext()
const {
59 return resource_context_;
63 FML_CHECK(
false) <<
"Only rendering to MTLTexture is supported.";
67bool EmbedderSurfaceMetalSkia::PresentDrawable(GrMTLHandle drawable)
const {
68 FML_CHECK(
false) <<
"Only rendering to MTLTexture is supported.";
72GPUMTLTextureInfo EmbedderSurfaceMetalSkia::GetMTLTexture(
const DlISize& frame_info)
const {
73 return metal_dispatch_table_.
get_texture(frame_info);
76bool EmbedderSurfaceMetalSkia::PresentTexture(GPUMTLTextureInfo
texture)
const {
#define FML_CHECK(condition)
void * GPUMTLDeviceHandle
impeller::ISize32 DlISize
void * GPUCAMetalLayerHandle
void * GPUMTLCommandQueueHandle
API_AVAILABLE(ios(14.0), macos(11.0)) static NSString *MTLCommandEncoderErrorStateToString(MTLCommandEncoderErrorState state)