Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
GrVkTextureRenderTarget Class Reference

#include <GrVkTextureRenderTarget.h>

Inheritance diagram for GrVkTextureRenderTarget:
GrVkTexture GrVkRenderTarget GrTexture GrRenderTarget GrSurface GrSurface GrGpuResource GrGpuResource GrIORef< GrGpuResource > GrIORef< GrGpuResource > SkNoncopyable SkNoncopyable

Public Member Functions

GrBackendFormat backendFormat () const override
 
- Public Member Functions inherited from GrVkTexture
 ~GrVkTexture () override
 
GrBackendTexture getBackendTexture () const override
 
void textureParamsModified () override
 
GrVkImagetextureImage () const
 
const GrVkImageViewtextureView ()
 
const GrVkDescriptorSetcachedSingleDescSet (GrSamplerState)
 
void addDescriptorSetToCache (const GrVkDescriptorSet *, GrSamplerState)
 
- Public Member Functions inherited from GrTexture
GrTextureasTexture () override
 
const GrTextureasTexture () const override
 
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
 
void setRelease (sk_sp< skgpu::RefCntedCallback > releaseHelper)
 
void setRelease (ReleaseProc proc, ReleaseCtx ctx)
 
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
 
- 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 GrVkRenderTarget
 ~GrVkRenderTarget () override
 
const GrVkFramebuffergetFramebuffer (bool withResolve, bool withStencil, SelfDependencyFlags selfDepFlags, LoadFromResolve)
 
const GrVkFramebuffergetFramebuffer (const GrVkRenderPass &renderPass)
 
GrVkImagecolorAttachment () const
 
const GrVkImageViewcolorAttachmentView () const
 
GrVkImageresolveAttachment () const
 
const GrVkImageViewresolveAttachmentView () const
 
GrVkImagenonMSAAAttachment () const
 
GrVkImageexternalAttachment () const
 
const GrVkRenderPassgetSimpleRenderPass (bool withResolve, bool withStencil, SelfDependencyFlags selfDepFlags, LoadFromResolve)
 
GrVkResourceProvider::CompatibleRPHandle compatibleRenderPassHandle (bool withResolve, bool withStencil, SelfDependencyFlags selfDepFlags, LoadFromResolve)
 
bool wrapsSecondaryCommandBuffer () const
 
sk_sp< GrVkFramebufferexternalFramebuffer () const
 
bool canAttemptStencilAttachment (bool useMSAASurface) const override
 
GrBackendRenderTarget getBackendRenderTarget () const override
 
bool getAttachmentsDescriptor (GrVkRenderPass::AttachmentsDescriptor *desc, GrVkRenderPass::AttachmentFlags *flags, bool withResolve, bool withStencil)
 
- Public Member Functions inherited from GrRenderTarget
virtual bool alwaysClearStencil () const
 
GrRenderTargetasRenderTarget () override
 
const GrRenderTargetasRenderTarget () const override
 
int numSamples () const
 
GrAttachmentgetStencilAttachment (bool useMSAASurface) const
 
GrAttachmentgetStencilAttachment () const
 
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< GrVkTextureRenderTargetMakeNewTextureRenderTarget (GrVkGpu *gpu, skgpu::Budgeted budgeted, SkISize dimensions, VkFormat format, uint32_t mipLevels, int sampleCnt, GrMipmapStatus mipmapStatus, GrProtected isProtected, std::string_view label)
 
static sk_sp< GrVkTextureRenderTargetMakeWrappedTextureRenderTarget (GrVkGpu *, SkISize dimensions, int sampleCnt, GrWrapOwnership, GrWrapCacheable, const GrVkImageInfo &, sk_sp< skgpu::MutableTextureState >)
 
- Static Public Member Functions inherited from GrVkTexture
static sk_sp< GrVkTextureMakeNewTexture (GrVkGpu *, skgpu::Budgeted budgeted, SkISize dimensions, VkFormat format, uint32_t mipLevels, GrProtected, GrMipmapStatus, std::string_view label)
 
static sk_sp< GrVkTextureMakeWrappedTexture (GrVkGpu *, SkISize dimensions, GrWrapOwnership, GrWrapCacheable, GrIOType, const GrVkImageInfo &, sk_sp< skgpu::MutableTextureState >)
 
- 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 GrVkRenderTarget
static sk_sp< GrVkRenderTargetMakeWrappedRenderTarget (GrVkGpu *, SkISize, int sampleCnt, const GrVkImageInfo &, sk_sp< skgpu::MutableTextureState >)
 
static sk_sp< GrVkRenderTargetMakeSecondaryCBRenderTarget (GrVkGpu *, SkISize, const GrVkDrawableInfo &vkInfo)
 
static void ReconstructAttachmentsDescriptor (const GrVkCaps &vkCaps, const GrProgramInfo &programInfo, GrVkRenderPass::AttachmentsDescriptor *desc, GrVkRenderPass::AttachmentFlags *flags)
 

Protected Member Functions

void onAbandon () override
 
void onRelease () override
 
- Protected Member Functions inherited from GrVkTexture
 GrVkTexture (GrVkGpu *, SkISize dimensions, sk_sp< GrVkImage > texture, GrMipmapStatus, std::string_view label)
 
GrVkGpugetVkGpu () const
 
bool onStealBackendTexture (GrBackendTexture *, SkImages::BackendTextureReleaseProc *) override
 
- Protected Member Functions inherited from GrTexture
 GrTexture (GrGpu *, const SkISize &, GrProtected, GrTextureType, GrMipmapStatus, std::string_view label)
 
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
 
- 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 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 GrVkRenderTarget
 GrVkRenderTarget (GrVkGpu *gpu, SkISize dimensions, sk_sp< GrVkImage > colorAttachment, sk_sp< GrVkImage > resolveImage, CreateType createType, std::string_view label)
 
- Protected Member Functions inherited from GrRenderTarget
 GrRenderTarget (GrGpu *, const SkISize &, int sampleCount, GrProtected, std::string_view label, sk_sp< GrAttachment > stenicl=nullptr)
 
 ~GrRenderTarget () override
 

Private Member Functions

size_t onGpuMemorySize () const override
 
void onSetLabel () override
 
void onSetRelease (sk_sp< RefCntedReleaseProc > releaseHelper) override
 

Additional Inherited Members

- Public Types inherited from GrSurface
typedef void * ReleaseCtx
 
typedef void(* ReleaseProc) (ReleaseCtx)
 
- Public Types inherited from GrIORef< GrGpuResource >
enum  LastRemovedRef
 
- Public Types inherited from GrVkRenderTarget
using SelfDependencyFlags = GrVkRenderPass::SelfDependencyFlags
 
using LoadFromResolve = GrVkRenderPass::LoadFromResolve
 
- Protected Types inherited from GrVkRenderTarget
enum class  CreateType { kDirectlyWrapped , kFromTextureRT }
 

Detailed Description

Definition at line 27 of file GrVkTextureRenderTarget.h.

Member Function Documentation

◆ backendFormat()

GrBackendFormat GrVkTextureRenderTarget::backendFormat ( ) const
inlineoverridevirtual

Reimplemented from GrVkTexture.

Definition at line 48 of file GrVkTextureRenderTarget.h.

GrBackendFormat backendFormat() const override
Definition GrVkTexture.h:46

◆ MakeNewTextureRenderTarget()

sk_sp< GrVkTextureRenderTarget > GrVkTextureRenderTarget::MakeNewTextureRenderTarget ( GrVkGpu gpu,
skgpu::Budgeted  budgeted,
SkISize  dimensions,
VkFormat  format,
uint32_t  mipLevels,
int  sampleCnt,
GrMipmapStatus  mipmapStatus,
GrProtected  isProtected,
std::string_view  label 
)
static

Definition at line 87 of file GrVkTextureRenderTarget.cpp.

96 {
99 format,
100 mipLevels,
101 GrRenderable::kYes,
102 /*numSamples=*/1,
103 budgeted,
105 if (!texture) {
106 return nullptr;
107 }
108
113 return nullptr;
114 }
116 SkASSERT(sampleCnt == 1 || resolveAttachment);
118 budgeted,
120 std::move(texture),
121 std::move(colorAttachment),
122 std::move(resolveAttachment),
124 label));
125}
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
SkISize dimensions() const
Definition GrSurface.h:27
bool isProtected() const
Definition GrSurface.h:87
GrMipmapStatus mipmapStatus() const
Definition GrTexture.h:66
static sk_sp< GrVkImage > MakeTexture(GrVkGpu *gpu, SkISize dimensions, VkFormat format, uint32_t mipLevels, GrRenderable renderable, int numSamples, skgpu::Budgeted budgeted, GrProtected isProtected)
Definition GrVkImage.cpp:65
GrVkImage * colorAttachment() const
GrVkImage * resolveAttachment() const
uint32_t uint32_t * format
FlTexture * texture

◆ MakeWrappedTextureRenderTarget()

sk_sp< GrVkTextureRenderTarget > GrVkTextureRenderTarget::MakeWrappedTextureRenderTarget ( GrVkGpu gpu,
SkISize  dimensions,
int  sampleCnt,
GrWrapOwnership  wrapOwnership,
GrWrapCacheable  cacheable,
const GrVkImageInfo info,
sk_sp< skgpu::MutableTextureState mutableState 
)
static

Definition at line 127 of file GrVkTextureRenderTarget.cpp.

134 {
135 // Adopted textures require both image and allocation because we're responsible for freeing
136 SkASSERT(VK_NULL_HANDLE != info.fImage &&
137 (kBorrow_GrWrapOwnership == wrapOwnership || VK_NULL_HANDLE != info.fAlloc.fMemory));
138
140 if (info.fImageUsageFlags & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) {
142 }
143
146 info,
147 std::move(mutableState),
148 textureUsageFlags,
149 wrapOwnership,
150 cacheable,
151 "VkImage_MakeWrappedTextureRenderTarget");
152 if (!texture) {
153 return nullptr;
154 }
155
158 if (!create_rt_attachments(gpu, dimensions, info.fFormat, sampleCnt, info.fProtected, texture,
160 return nullptr;
161 }
163 SkASSERT(sampleCnt == 1 || resolveAttachment);
164
167
171 std::move(texture),
172 std::move(colorAttachment),
173 std::move(resolveAttachment),
175 cacheable,
176 /*label=*/"Vk_MakeWrappedTextureRenderTarget"));
177}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
GrMipmapStatus
@ kBorrow_GrWrapOwnership
Definition GrTypesPriv.h:78
static sk_sp< GrVkImage > MakeWrapped(GrVkGpu *gpu, SkISize dimensions, const GrVkImageInfo &, sk_sp< skgpu::MutableTextureState >, UsageFlags attachmentUsages, GrWrapOwnership, GrWrapCacheable, std::string_view label, bool forSecondaryCB=false)
@ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
#define VK_NULL_HANDLE
Definition vulkan_core.h:46

◆ onAbandon()

void GrVkTextureRenderTarget::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 GrVkTexture.

Definition at line 51 of file GrVkTextureRenderTarget.h.

51 {
52 // In order to correctly handle calling texture idle procs, GrVkTexture must go first.
55 }
void onAbandon() override
void onAbandon() override

◆ onGpuMemorySize()

size_t GrVkTextureRenderTarget::onGpuMemorySize ( ) const
overrideprivatevirtual

Reimplemented from GrTexture.

Definition at line 179 of file GrVkTextureRenderTarget.cpp.

179 {
180 // The GrTexture[RenderTarget] is built up by a bunch of attachments each of which are their
181 // own GrGpuResource. Ideally the GrRenderTarget would not be a GrGpuResource and the GrTexture
182 // would just merge with the new GrSurface/Attachment world. Then we could just depend on each
183 // attachment to give its own size since we don't have GrGpuResources owning other
184 // GrGpuResources. Until we get to that point we need to live in some hybrid world. We will let
185 // the msaa and stencil attachments track their own size because they do get cached separately.
186 // For all GrTexture* based things we will continue to to use the GrTexture* to report size and
187 // the owned attachments will have no size and be uncached.
188#ifdef SK_DEBUG
189 // The nonMSAA attachment (either color or resolve depending on numSamples should have size of
190 // zero since it is a texture attachment.
192 if (this->numSamples() > 1) {
193 // Msaa attachment should have a valid size
196 this->dimensions(),
197 this->numSamples(),
198 skgpu::Mipmapped::kNo));
199 }
200#endif
201 return GrSurface::ComputeSize(this->backendFormat(), this->dimensions(),
202 1 /*colorSamplesPerPixel*/, this->mipmapped());
203}
size_t gpuMemorySize() const
int numSamples() const
static size_t ComputeSize(const GrBackendFormat &, SkISize dimensions, int colorSamplesPerPixel, skgpu::Mipmapped, bool binSize=false)
Definition GrSurface.cpp:21
skgpu::Mipmapped mipmapped() const
Definition GrTexture.h:62
GrVkImage * nonMSAAAttachment() const
GrBackendFormat backendFormat() const override

◆ onRelease()

void GrVkTextureRenderTarget::onRelease ( )
inlineoverrideprotectedvirtual

Overridden to free GPU resources in the backend API.

Reimplemented from GrVkTexture.

Definition at line 57 of file GrVkTextureRenderTarget.h.

57 {
58 // In order to correctly handle calling texture idle procs, GrVkTexture must go first.
61 }
void onRelease() override
void onRelease() override

◆ onSetLabel()

void GrVkTextureRenderTarget::onSetLabel ( )
inlineoverrideprivatevirtual

Reimplemented from GrVkTexture.

Definition at line 84 of file GrVkTextureRenderTarget.h.

84{}

◆ onSetRelease()

void GrVkTextureRenderTarget::onSetRelease ( sk_sp< RefCntedReleaseProc releaseHelper)
inlineoverrideprivatevirtual

Reimplemented from GrVkTexture.

Definition at line 88 of file GrVkTextureRenderTarget.h.

88 {
89 // Forward the release proc on to GrVkImage
90 GrVkTexture::onSetRelease(std::move(releaseHelper));
91 }
void onSetRelease(sk_sp< RefCntedReleaseProc > releaseHelper) override
Definition GrVkTexture.h:80

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