25#import <Metal/Metal.h>
26#import <MetalKit/MetalKit.h>
27#import <QuartzCore/CAMetalLayer.h>
41 CAMetalLayer* metalLayer = (__bridge CAMetalLayer*)layer;
46 SkISize dims = {(
int)metalLayer.drawableSize.
width, (
int)metalLayer.drawableSize.height};
55 CAMetalLayer* metalLayer = (__bridge CAMetalLayer*)layer;
56 id<CAMetalDrawable> currentDrawable = [metalLayer nextDrawable];
60 if (metalLayer.framebufferOnly) {
62 mtlGpu,
desc.fDimensions,
desc.fSampleCnt, currentDrawable.texture);
68 currentDrawable.texture,
72 surface->setRequiresManualMSAAResolve();
75 *drawable = (__bridge_retained
GrMTLHandle)currentDrawable;
83 metalLayer.framebufferOnly ? nullptr : &texInfo,
93 std::move(colorSpace),
101 return sk_make_sp<SkSurface_Ganesh>(std::move(
device));
113 MTKView* mtkView = (__bridge MTKView*)view;
118 SkISize dims = {(
int)mtkView.drawableSize.
width, (
int)mtkView.drawableSize.height};
127 MTKView* mtkView = (__bridge MTKView*)view;
128 id<CAMetalDrawable> currentDrawable = [mtkView currentDrawable];
132 if (mtkView.framebufferOnly) {
134 mtlGpu,
desc.fDimensions,
desc.fSampleCnt, currentDrawable.texture);
140 currentDrawable.texture,
144 surface->setRequiresManualMSAAResolve();
154 mtkView.framebufferOnly ? nullptr : &texInfo,
164 std::move(colorSpace),
172 return sk_make_sp<SkSurface_Ganesh>(std::move(
device));
@ kRequiresManualMSAAResolve
static constexpr GrColorType SkColorTypeToGrColorType(SkColorType ct)
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static SkSurfaceProps SkSurfacePropsCopyOrDefault(const SkSurfaceProps *props)
static sk_sp< GrMtlRenderTarget > MakeWrappedRenderTarget(GrMtlGpu *, SkISize, int sampleCnt, id< MTLTexture >)
static sk_sp< GrMtlTextureRenderTarget > MakeWrappedTextureRenderTarget(GrMtlGpu *, SkISize, int sampleCnt, id< MTLTexture >, GrWrapCacheable)
sk_sp< GrRenderTargetProxy > createLazyRenderTargetProxy(LazyInstantiateCallback &&, const GrBackendFormat &, SkISize dimensions, int renderTargetSampleCnt, GrInternalSurfaceFlags, const TextureInfo *, GrMipmapStatus, SkBackingFit, skgpu::Budgeted, GrProtected, bool wrapsVkSecondaryCB, UseAllocator useAllocator)
GrProxyProvider * proxyProvider()
sk_sp< skgpu::ganesh::Device > createDevice(GrColorType, sk_sp< GrSurfaceProxy >, sk_sp< SkColorSpace >, GrSurfaceOrigin, const SkSurfaceProps &, skgpu::ganesh::Device::InitContents)
GrRecordingContextPriv priv()
GrResourceProviderPriv priv()
SK_API sk_sp< SkSurface > WrapCAMetalLayer(GrRecordingContext *context, GrMTLHandle layer, GrSurfaceOrigin origin, int sampleCnt, SkColorType colorType, sk_sp< SkColorSpace > colorSpace, const SkSurfaceProps *surfaceProps, GrMTLHandle *drawable) SK_API_AVAILABLE_CA_METAL_LAYER
SK_API sk_sp< SkSurface > WrapMTKView(GrRecordingContext *context, GrMTLHandle mtkView, GrSurfaceOrigin origin, int sampleCnt, SkColorType colorType, sk_sp< SkColorSpace > colorSpace, const SkSurfaceProps *surfaceProps) SK_API_AVAILABLE(macos(10.11)
GrTextureType fTextureType
skgpu::Mipmapped fMipmapped
constexpr int32_t width() const