Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
GrMtlTextureRenderTarget Class Reference

#include <GrMtlTextureRenderTarget.h>

Inheritance diagram for GrMtlTextureRenderTarget:
GrMtlTexture GrMtlRenderTarget GrTexture GrRenderTarget GrSurface GrSurface GrGpuResource GrGpuResource GrIORef< GrGpuResource > GrIORef< GrGpuResource > SkNoncopyable SkNoncopyable

Public Member Functions

GrBackendFormat backendFormat () const override
 
- Public Member Functions inherited from GrMtlTexture
 ~GrMtlTexture () override
 
GrMtlAttachmentattachment () const
 
id< MTLTexture > mtlTexture () const
 
GrBackendTexture getBackendTexture () const override
 
GrBackendFormat backendFormat () const override
 
void textureParamsModified () override
 
bool reallocForMipmap (GrMtlGpu *gpu, uint32_t mipLevels)
 
- Public Member Functions inherited from GrTexture
GrTextureasTexture () override
 
const GrTextureasTexture () const override
 
virtual GrBackendTexture getBackendTexture () const =0
 
virtual void textureParamsModified ()=0
 
GrTextureType textureType () const
 
bool hasRestrictedSampling () const
 
void markMipmapsDirty ()
 
void markMipmapsClean ()
 
skgpu::Mipmapped mipmapped () const
 
bool mipmapsAreDirty () const
 
GrMipmapStatus mipmapStatus () const
 
int maxMipmapLevel () const
 
- Public Member Functions inherited from GrSurface
SkISize dimensions () const
 
int width () const
 
int height () const
 
SkRect getBoundsRect () const
 
virtual GrBackendFormat backendFormat () const =0
 
void setRelease (sk_sp< skgpu::RefCntedCallback > releaseHelper)
 
void setRelease (ReleaseProc proc, ReleaseCtx ctx)
 
virtual GrTextureasTexture ()
 
virtual const GrTextureasTexture () const
 
virtual GrRenderTargetasRenderTarget ()
 
virtual const GrRenderTargetasRenderTarget () const
 
GrInternalSurfaceFlags flags () const
 
bool readOnly () const
 
bool framebufferOnly () const
 
bool isProtected () const
 
void setFramebufferOnly ()
 
- Public Member Functions inherited from GrGpuResource
bool wasDestroyed () const
 
const GrDirectContextgetContext () const
 
GrDirectContextgetContext ()
 
size_t gpuMemorySize () const
 
UniqueID uniqueID () const
 
const skgpu::UniqueKeygetUniqueKey () const
 
std::string getLabel () const
 
void setLabel (std::string_view label)
 
CacheAccess cacheAccess ()
 
const CacheAccess cacheAccess () const
 
ProxyAccess proxyAccess ()
 
ResourcePriv resourcePriv ()
 
const ResourcePriv resourcePriv () const
 
virtual void dumpMemoryStatistics (SkTraceMemoryDump *traceMemoryDump) const
 
virtual const char * getResourceType () const =0
 
- Public Member Functions inherited from GrIORef< GrGpuResource >
bool unique () const
 
void ref () const
 
void unref () const
 
void refCommandBuffer () const
 
void unrefCommandBuffer () const
 
- Public Member Functions inherited from SkNoncopyable
 SkNoncopyable ()=default
 
 SkNoncopyable (SkNoncopyable &&)=default
 
SkNoncopyableoperator= (SkNoncopyable &&)=default
 
- Public Member Functions inherited from GrMtlRenderTarget
 ~GrMtlRenderTarget () override
 
bool canAttemptStencilAttachment (bool useMSAASurface) const override
 
GrMtlAttachmentcolorAttachment () const
 
id< MTLTexture > colorMTLTexture () const
 
GrMtlAttachmentresolveAttachment () const
 
id< MTLTexture > resolveMTLTexture () const
 
GrMtlAttachmentnonMSAAAttachment () const
 
GrBackendRenderTarget getBackendRenderTarget () const override
 
GrBackendFormat backendFormat () const override
 
const GrMtlFramebuffergetFramebuffer (bool withResolve, bool withStencil)
 
- Public Member Functions inherited from GrRenderTarget
virtual bool alwaysClearStencil () const
 
GrRenderTargetasRenderTarget () override
 
const GrRenderTargetasRenderTarget () const override
 
int numSamples () const
 
virtual GrBackendRenderTarget getBackendRenderTarget () const =0
 
GrAttachmentgetStencilAttachment (bool useMSAASurface) const
 
GrAttachmentgetStencilAttachment () const
 
virtual bool canAttemptStencilAttachment (bool useMSAASurface) const =0
 
void attachStencilAttachment (sk_sp< GrAttachment > stencil, bool useMSAASurface)
 
int numStencilBits (bool useMSAASurface) const
 
int getSamplePatternKey ()
 
const skia_private::TArray< SkPoint > & getSampleLocations ()
 
void setRequiresManualMSAAResolve ()
 
bool requiresManualMSAAResolve () const
 

Static Public Member Functions

static sk_sp< GrMtlTextureRenderTargetMakeNewTextureRenderTarget (GrMtlGpu *, skgpu::Budgeted, SkISize, int sampleCnt, MTLPixelFormat, uint32_t mipLevels, GrMipmapStatus, std::string_view label)
 
static sk_sp< GrMtlTextureRenderTargetMakeWrappedTextureRenderTarget (GrMtlGpu *, SkISize, int sampleCnt, id< MTLTexture >, GrWrapCacheable)
 
- Static Public Member Functions inherited from GrMtlTexture
static sk_sp< GrMtlTextureMakeNewTexture (GrMtlGpu *, skgpu::Budgeted budgeted, SkISize dimensions, MTLPixelFormat format, uint32_t mipLevels, GrMipmapStatus, std::string_view label)
 
static sk_sp< GrMtlTextureMakeWrappedTexture (GrMtlGpu *, SkISize, id< MTLTexture >, GrWrapCacheable, GrIOType)
 
- Static Public Member Functions inherited from GrTexture
static bool StealBackendTexture (sk_sp< GrTexture >, GrBackendTexture *, SkImages::BackendTextureReleaseProc *)
 
static void ComputeScratchKey (const GrCaps &caps, const GrBackendFormat &format, SkISize dimensions, GrRenderable, int sampleCnt, skgpu::Mipmapped, GrProtected, skgpu::ScratchKey *key)
 
- Static Public Member Functions inherited from GrSurface
static size_t ComputeSize (const GrBackendFormat &, SkISize dimensions, int colorSamplesPerPixel, skgpu::Mipmapped, bool binSize=false)
 
- Static Public Member Functions inherited from GrGpuResource
static uint32_t CreateUniqueID ()
 
- Static Public Member Functions inherited from GrMtlRenderTarget
static sk_sp< GrMtlRenderTargetMakeWrappedRenderTarget (GrMtlGpu *, SkISize, int sampleCnt, id< MTLTexture >)
 

Protected Member Functions

void onAbandon () override
 
void onRelease () override
 
- Protected Member Functions inherited from GrMtlTexture
 GrMtlTexture (GrMtlGpu *, SkISize, sk_sp< GrMtlAttachment >, GrMipmapStatus, std::string_view label)
 
GrMtlGpugetMtlGpu () const
 
void onAbandon () override
 
void onRelease () override
 
bool onStealBackendTexture (GrBackendTexture *, SkImages::BackendTextureReleaseProc *) override
 
void onSetLabel () override
 
- Protected Member Functions inherited from GrTexture
 GrTexture (GrGpu *, const SkISize &, GrProtected, GrTextureType, GrMipmapStatus, std::string_view label)
 
virtual bool onStealBackendTexture (GrBackendTexture *, SkImages::BackendTextureReleaseProc *)=0
 
void computeScratchKey (skgpu::ScratchKey *) const override
 
- Protected Member Functions inherited from GrSurface
void setGLRTFBOIDIs0 ()
 
bool glRTFBOIDis0 () const
 
void setRequiresManualMSAAResolve ()
 
bool requiresManualMSAAResolve () const
 
void setReadOnly ()
 
void setVkRTSupportsInputAttachment ()
 
 GrSurface (GrGpu *gpu, const SkISize &dimensions, skgpu::Protected isProtected, std::string_view label)
 
 ~GrSurface () override
 
void onRelease () override
 
void onAbandon () override
 
- Protected Member Functions inherited from GrGpuResource
void registerWithCache (skgpu::Budgeted)
 
void registerWithCacheWrapped (GrWrapCacheable)
 
 GrGpuResource (GrGpu *, std::string_view label)
 
virtual ~GrGpuResource ()
 
GrGpugetGpu () const
 
virtual void onRelease ()
 
virtual void onAbandon ()
 
virtual void setMemoryBacking (SkTraceMemoryDump *, const SkString &) const
 
SkString getResourceName () const
 
void dumpMemoryStatisticsPriv (SkTraceMemoryDump *traceMemoryDump, const SkString &resourceName, const char *type, size_t size) const
 
- Protected Member Functions inherited from GrIORef< GrGpuResource >
 GrIORef ()
 
bool internalHasRef () const
 
bool internalHasNoCommandBufferUsages () const
 
void addInitialRef () const
 
- Protected Member Functions inherited from GrMtlRenderTarget
 GrMtlRenderTarget (GrMtlGpu *gpu, SkISize, sk_sp< GrMtlAttachment > colorAttachment, sk_sp< GrMtlAttachment > resolveAttachment, std::string_view label)
 
GrMtlGpugetMtlGpu () const
 
void onAbandon () override
 
void onRelease () override
 
size_t onGpuMemorySize () const override
 
void onSetLabel () override
 
- Protected Member Functions inherited from GrRenderTarget
 GrRenderTarget (GrGpu *, const SkISize &, int sampleCount, GrProtected, std::string_view label, sk_sp< GrAttachment > stenicl=nullptr)
 
 ~GrRenderTarget () override
 
void onAbandon () override
 
void onRelease () override
 

Additional Inherited Members

- Public Types inherited from GrSurface
typedef void * ReleaseCtx
 
typedef void(* ReleaseProc) (ReleaseCtx)
 
- Public Types inherited from GrIORef< GrGpuResource >
enum  LastRemovedRef
 
- Protected Attributes inherited from GrMtlRenderTarget
sk_sp< GrMtlAttachmentfColorAttachment
 
sk_sp< GrMtlAttachmentfResolveAttachment
 

Detailed Description

Definition at line 14 of file GrMtlTextureRenderTarget.h.

Member Function Documentation

◆ backendFormat()

GrBackendFormat GrMtlTextureRenderTarget::backendFormat ( ) const
inlineoverridevirtual

Reimplemented from GrMtlRenderTarget.

Definition at line 30 of file GrMtlTextureRenderTarget.h.

30 {
32 }
GrBackendFormat backendFormat() const override

◆ MakeNewTextureRenderTarget()

sk_sp< GrMtlTextureRenderTarget > GrMtlTextureRenderTarget::MakeNewTextureRenderTarget ( GrMtlGpu gpu,
skgpu::Budgeted  budgeted,
SkISize  dimensions,
int  sampleCnt,
MTLPixelFormat  format,
uint32_t  mipLevels,
GrMipmapStatus  mipmapStatus,
std::string_view  label 
)
static

Definition at line 74 of file GrMtlTextureRenderTarget.mm.

82 {
83 sk_sp<GrMtlAttachment> textureAttachment =
85 /*numSamples=*/1, budgeted);
86 if (!textureAttachment) {
87 return nullptr;
88 }
89 if (@available(macOS 10.11, iOS 9.0, tvOS 9.0, *)) {
90 SkASSERT((MTLTextureUsageShaderRead | MTLTextureUsageRenderTarget) &
91 textureAttachment->mtlTexture().usage);
92 }
93
96 if (!create_rt_attachments(gpu, dimensions, format, sampleCnt, textureAttachment,
98 return nullptr;
99 }
101 SkASSERT(sampleCnt == 1 || resolveAttachment);
102
104 gpu, budgeted, dimensions, std::move(textureAttachment), std::move(colorAttachment),
105 std::move(resolveAttachment), mipmapStatus, label));
106}
bool create_rt_attachments(GrMtlGpu *gpu, SkISize dimensions, MTLPixelFormat format, int sampleCnt, sk_sp< GrMtlAttachment > texture, sk_sp< GrMtlAttachment > *colorAttachment, sk_sp< GrMtlAttachment > *resolveAttachment)
#define SkASSERT(cond)
Definition: SkAssert.h:116
static sk_sp< GrMtlAttachment > MakeTexture(GrMtlGpu *gpu, SkISize dimensions, MTLPixelFormat format, uint32_t mipLevels, GrRenderable renderable, int numSamples, skgpu::Budgeted budgeted)
id< MTLTexture > mtlTexture() const
GrMtlAttachment * colorAttachment() const
GrMtlAttachment * resolveAttachment() const
SkISize dimensions() const
Definition: GrSurface.h:27
GrMipmapStatus mipmapStatus() const
Definition: GrTexture.h:66
uint32_t uint32_t * format

◆ MakeWrappedTextureRenderTarget()

sk_sp< GrMtlTextureRenderTarget > GrMtlTextureRenderTarget::MakeWrappedTextureRenderTarget ( GrMtlGpu gpu,
SkISize  dimensions,
int  sampleCnt,
id< MTLTexture >  texture,
GrWrapCacheable  cacheable 
)
static

Definition at line 108 of file GrMtlTextureRenderTarget.mm.

113 {
114 SkASSERT(nil != texture);
115 if (@available(macOS 10.11, iOS 9.0, tvOS 9.0, *)) {
116 SkASSERT((MTLTextureUsageShaderRead | MTLTextureUsageRenderTarget) & texture.usage);
117 }
118 GrMipmapStatus mipmapStatus = texture.mipmapLevelCount > 1
123 sk_sp<GrMtlAttachment> textureAttachment =
124 GrMtlAttachment::MakeWrapped(gpu, dimensions, texture, textureUsageFlags, cacheable,
125 /*label=*/"MtlAttachment_TextureAttachment");
126 if (!textureAttachment) {
127 return nullptr;
128 }
129
132 if (!create_rt_attachments(gpu, dimensions, texture.pixelFormat, sampleCnt, textureAttachment,
134 return nullptr;
135 }
137 SkASSERT(sampleCnt == 1 || resolveAttachment);
138
140 gpu, dimensions, std::move(textureAttachment), std::move(colorAttachment),
141 std::move(resolveAttachment), mipmapStatus, cacheable,
142 /*label=*/"MtlWrappedTextureRenderTarget"));
143}
GrMipmapStatus
Definition: GrTypesPriv.h:523
static sk_sp< GrMtlAttachment > MakeWrapped(GrMtlGpu *gpu, SkISize dimensions, id< MTLTexture >, UsageFlags attachmentUsages, GrWrapCacheable, std::string_view label)
FlTexture * texture

◆ onAbandon()

void GrMtlTextureRenderTarget::onAbandon ( )
inlineoverrideprotectedvirtual

Overridden to abandon any internal handles, ptrs, etc to backend API resources. This may be called when the underlying 3D context is no longer valid and so no backend API calls should be made.

Reimplemented from GrMtlRenderTarget.

Definition at line 35 of file GrMtlTextureRenderTarget.h.

35 {
38 }
void onAbandon() override
void onAbandon() override
Definition: GrMtlTexture.h:56

◆ onRelease()

void GrMtlTextureRenderTarget::onRelease ( )
inlineoverrideprotectedvirtual

Overridden to free GPU resources in the backend API.

Reimplemented from GrMtlRenderTarget.

Definition at line 40 of file GrMtlTextureRenderTarget.h.

40 {
43 }
void onRelease() override
void onRelease() override
Definition: GrMtlTexture.h:60

The documentation for this class was generated from the following files: