5#import "flutter/shell/platform/darwin/ios/ios_surface_metal_impeller.h"
7#include "flutter/impeller/renderer/backend/metal/formats_mtl.h"
8#include "flutter/impeller/renderer/context.h"
9#include "flutter/shell/gpu/gpu_surface_metal_impeller.h"
16 const std::shared_ptr<IOSContext>& context)
20 impeller_context_(context ? context->GetImpellerContext() : nullptr) {
21 if (!impeller_context_) {
31bool IOSSurfaceMetalImpeller::IsValid()
const {
36void IOSSurfaceMetalImpeller::UpdateStorageSizeIfNecessary() {
41std::unique_ptr<Surface> IOSSurfaceMetalImpeller::CreateGPUSurface(
GrDirectContext*) {
42 impeller_context_->UpdateOffscreenLayerPixelFormat(
44 return std::make_unique<GPUSurfaceMetalImpeller>(
this,
51 CAMetalLayer* layer = layer_.
get();
52 const auto drawable_size = CGSizeMake(frame_info.
width(), frame_info.
height());
53 if (!CGSizeEqualToSize(drawable_size, layer.drawableSize)) {
54 layer.drawableSize = drawable_size;
59 layer.framebufferOnly = NO;
67 layer.presentsWithTransaction = [[NSThread currentThread] isMainThread];
73bool IOSSurfaceMetalImpeller::PresentDrawable(
GrMTLHandle drawable)
const {
79GPUMTLTextureInfo IOSSurfaceMetalImpeller::GetMTLTexture(
const SkISize& frame_info)
const {
81 return GPUMTLTextureInfo{
88bool IOSSurfaceMetalImpeller::PresentTexture(GPUMTLTextureInfo
texture)
const {
94bool IOSSurfaceMetalImpeller::AllowsDrawingWhenGpuDisabled()
const {
T get() const __attribute((ns_returns_not_retained))
#define FML_CHECK(condition)
#define FML_DCHECK(condition)
void * GPUCAMetalLayerHandle
constexpr PixelFormat FromMTLPixelFormat(MTLPixelFormat format)
constexpr int32_t width() const
constexpr int32_t height() const