17#if !__has_feature(objc_arc)
18#error This file must be compiled with Arc. Use -fobjc-arc flag
29 std::string_view label)
32 , fColorAttachment(
std::move(colorAttachment))
33 , fResolveAttachment(
std::move(resolveAttachment)) {
42 std::string_view label)
45 , fColorAttachment(
std::move(colorAttachment))
46 , fResolveAttachment(
std::move(resolveAttachment)) {
55 if (@available(macOS 10.11, iOS 9.0, tvOS 9.0, *)) {
63 "MtlAttachment_TextureAttachment");
67 if ([
texture sampleCount] == 1) {
79 if (!msaaAttachment) {
86 kWrapped,
"MakeWrappedRenderTargetWithOneTextureSampleCount");
92 "MakeWrappedRenderTargetWithManySampleCount");
97 "MakeWrappedRenderTargetWithOneOrLessSampleCount");
109 GrMtlTextureInfo
info;
133 SkASSERT(cacheIndex < GrMtlRenderTarget::kNumCachedFramebuffers);
135 if (fCachedFramebuffers[cacheIndex]) {
136 return fCachedFramebuffers[cacheIndex].
get();
146 fCachedFramebuffers[cacheIndex] =
148 return fCachedFramebuffers[cacheIndex].get();
168bool GrMtlRenderTarget::completeStencilAttachment(
GrAttachment* stencil,
bool useMSAASurface) {
176 NSString* labelStr = @(this->
getLabel().c_str());
179 [
@"_Skia_MSAA_" stringByAppendingString:labelStr];
181 [
@"_Skia_Resolve_" stringByAppendingString:labelStr];
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static int renderpass_features_to_index(bool hasResolve, bool hasStencil)
SK_ALWAYS_INLINE CF_RETURNS_RETAINED const void * GrRetainPtrFromId(id idObject)
@ kNo
Don't pre-clip the geometry before applying the (perspective) matrix.
GrResourceProvider * resourceProvider()
GrDirectContextPriv priv()
std::string getLabel() const
bool wasDestroyed() const
GrDirectContext * getContext()
MTLPixelFormat mtlFormat() const
static sk_sp< GrMtlAttachment > MakeWrapped(GrMtlGpu *gpu, SkISize dimensions, id< MTLTexture >, UsageFlags attachmentUsages, GrWrapCacheable, std::string_view label)
id< MTLTexture > mtlTexture() const
bool isFormatRenderable(const GrBackendFormat &format, int sampleCount) const override
static sk_sp< const GrMtlFramebuffer > Make(GrMtlAttachment *colorAttachment, GrMtlAttachment *resolveAttachment, GrMtlAttachment *stencilAttachment)
const GrMtlCaps & mtlCaps() const
~GrMtlRenderTarget() override
GrMtlAttachment * colorAttachment() const
GrMtlGpu * getMtlGpu() const
void onSetLabel() override
static sk_sp< GrMtlRenderTarget > MakeWrappedRenderTarget(GrMtlGpu *, SkISize, int sampleCnt, id< MTLTexture >)
sk_sp< GrMtlAttachment > fColorAttachment
sk_sp< GrMtlAttachment > fResolveAttachment
const GrMtlFramebuffer * getFramebuffer(bool withResolve, bool withStencil)
GrBackendFormat backendFormat() const override
GrBackendRenderTarget getBackendRenderTarget() const override
void onAbandon() override
GrMtlAttachment * resolveAttachment() const
GrMtlRenderTarget(GrMtlGpu *gpu, SkISize, sk_sp< GrMtlAttachment > colorAttachment, sk_sp< GrMtlAttachment > resolveAttachment, std::string_view label)
void onRelease() override
GrAttachment * getStencilAttachment() const
void onAbandon() override
void setRequiresManualMSAAResolve()
void onRelease() override
SkISize dimensions() const
EMSCRIPTEN_KEEPALIVE void empty()
uint32_t uint32_t * format
SK_API GrBackendRenderTarget MakeMtl(int width, int height, const GrMtlTextureInfo &mtlInfo)