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
GrGLTextureRenderTarget Class Reference

#include <GrGLTextureRenderTarget.h>

Inheritance diagram for GrGLTextureRenderTarget:
GrGLTexture GrGLRenderTarget GrTexture GrRenderTarget GrSurface GrSurface GrGpuResource GrGpuResource GrIORef< GrGpuResource > GrIORef< GrGpuResource > SkNoncopyable SkNoncopyable

Public Member Functions

 GrGLTextureRenderTarget (GrGLGpu *gpu, skgpu::Budgeted budgeted, int sampleCount, const GrGLTexture::Desc &texDesc, const GrGLRenderTarget::IDs &, GrMipmapStatus, std::string_view label)
 
bool canAttemptStencilAttachment (bool useMultisampleFBO) const override
 
void dumpMemoryStatistics (SkTraceMemoryDump *traceMemoryDump) const override
 
GrBackendFormat backendFormat () const override
 
- Public Member Functions inherited from GrGLTexture
 GrGLTexture (GrGLGpu *, skgpu::Budgeted, const Desc &, GrMipmapStatus, std::string_view label)
 
 ~GrGLTexture () override
 
GrBackendTexture getBackendTexture () const override
 
void textureParamsModified () override
 
GrGLTextureParametersparameters ()
 
GrGLuint textureID () const
 
GrGLenum target () const
 
GrGLFormat format () const
 
bool hasBaseLevelBeenBoundToFBO () const
 
void baseLevelWasBoundToFBO ()
 
- 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
 
- 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 GrGLRenderTarget
bool alwaysClearStencil () const override
 
bool isFBO0 (bool multisample) const
 
bool isMultisampledRenderToTexture () const
 
GrBackendRenderTarget getBackendRenderTarget () const override
 
GrGLFormat format () const
 
bool hasDynamicMSAAAttachment () const
 
bool ensureDynamicMSAAAttachment ()
 
void bind (bool useMultisampleFBO)
 
bool mustRebind (bool useMultisampleFBO) const
 
void bindForPixelOps (GrGLenum fboTarget)
 
void bindForResolve (ResolveDirection)
 
bool glRTFBOIDis0 () const
 
- Public Member Functions inherited from GrRenderTarget
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< GrGLTextureRenderTargetMakeWrapped (GrGLGpu *gpu, int sampleCount, const GrGLTexture::Desc &, sk_sp< GrGLTextureParameters >, const GrGLRenderTarget::IDs &, GrWrapCacheable, GrMipmapStatus, std::string_view label)
 
- Static Public Member Functions inherited from GrGLTexture
static GrTextureType TextureTypeFromTarget (GrGLenum textureTarget)
 
static sk_sp< GrGLTextureMakeWrapped (GrGLGpu *, GrMipmapStatus, const Desc &, sk_sp< GrGLTextureParameters >, GrWrapCacheable, GrIOType, std::string_view label)
 
- 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 GrGLRenderTarget
static sk_sp< GrGLRenderTargetMakeWrapped (GrGLGpu *, const SkISize &, GrGLFormat, int sampleCount, const IDs &, int stencilBits, skgpu::Protected, std::string_view label)
 

Protected Member Functions

void onAbandon () override
 
void onRelease () override
 
- Protected Member Functions inherited from GrGLTexture
 GrGLTexture (GrGLGpu *, const Desc &, sk_sp< GrGLTextureParameters >, GrMipmapStatus, std::string_view label)
 
 GrGLTexture (GrGLGpu *, const Desc &, GrMipmapStatus, sk_sp< GrGLTextureParameters >, GrWrapCacheable, GrIOType, std::string_view label)
 
void init (const Desc &)
 
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
 
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 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 GrGLRenderTarget
 GrGLRenderTarget (GrGLGpu *, const SkISize &, GrGLFormat, int sampleCount, const IDs &, skgpu::Protected, std::string_view label)
 
void init (GrGLFormat, const IDs &)
 
void bindInternal (GrGLenum fboTarget, bool useMultisampleFBO)
 
int totalMemorySamplesPerPixel () const
 
- 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
 

Private Member Functions

size_t onGpuMemorySize () const override
 
void onSetLabel () 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 GrGLRenderTarget
enum  { kUnresolvableFBOID = 0 }
 
enum class  ResolveDirection : bool { kSingleToMSAA , kMSAAToSingle }
 

Detailed Description

Definition at line 23 of file GrGLTextureRenderTarget.h.

Constructor & Destructor Documentation

◆ GrGLTextureRenderTarget()

GrGLTextureRenderTarget::GrGLTextureRenderTarget ( GrGLGpu gpu,
skgpu::Budgeted  budgeted,
int  sampleCount,
const GrGLTexture::Desc texDesc,
const GrGLRenderTarget::IDs rtIDs,
GrMipmapStatus  mipmapStatus,
std::string_view  label 
)

Definition at line 16 of file GrGLTextureRenderTarget.cpp.

23 : GrSurface(gpu, texDesc.fSize, texDesc.fIsProtected, label)
24 , GrGLTexture(gpu, texDesc, nullptr, mipmapStatus, label)
25 , GrGLRenderTarget(gpu, texDesc.fSize, texDesc.fFormat, sampleCount, rtIDs,
26 texDesc.fIsProtected, label) {
27 this->registerWithCache(budgeted);
28}
void registerWithCache(skgpu::Budgeted)
GrMipmapStatus mipmapStatus() const
Definition GrTexture.h:66
skgpu::Protected fIsProtected
Definition GrGLTexture.h:28
GrGLFormat fFormat
Definition GrGLTexture.h:26

Member Function Documentation

◆ backendFormat()

GrBackendFormat GrGLTextureRenderTarget::backendFormat ( ) const
inlineoverridevirtual

Reimplemented from GrGLTexture.

Definition at line 48 of file GrGLTextureRenderTarget.h.

48 {
49 // It doesn't matter if we take the texture or render target path, so just pick texture.
51 }
GrBackendFormat backendFormat() const override

◆ canAttemptStencilAttachment()

bool GrGLTextureRenderTarget::canAttemptStencilAttachment ( bool  useMultisampleFBO) const
overridevirtual

Reimplemented from GrGLRenderTarget.

Definition at line 59 of file GrGLTextureRenderTarget.cpp.

59 {
60 // This cap should have been handled at a higher level.
61 SkASSERT(!this->getGpu()->getContext()->priv().caps()->avoidStencilBuffers());
62 // The RT FBO of GrGLTextureRenderTarget is never created from a wrapped FBO.
63 return true;
64}
#define SkASSERT(cond)
Definition SkAssert.h:116
GrGpu * getGpu() const
const GrDirectContext * getContext() const
FlPixelBufferTexturePrivate * priv

◆ dumpMemoryStatistics()

void GrGLTextureRenderTarget::dumpMemoryStatistics ( SkTraceMemoryDump traceMemoryDump) const
overridevirtual

Dumps memory usage information for this GrGpuResource to traceMemoryDump. Typically, subclasses should not need to override this, and should only need to override setMemoryBacking.

Reimplemented from GrGLTexture.

Definition at line 45 of file GrGLTextureRenderTarget.cpp.

46 {
47#ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK
48 // Delegate to the base classes
50 GrGLTexture::dumpMemoryStatistics(traceMemoryDump);
51#else
52 SkString resourceName = this->getResourceName();
53 resourceName.append("/texture_renderbuffer");
54 this->dumpMemoryStatisticsPriv(traceMemoryDump, resourceName, "RenderTarget",
55 this->gpuMemorySize());
56#endif
57}
void dumpMemoryStatistics(SkTraceMemoryDump *traceMemoryDump) const override
void dumpMemoryStatistics(SkTraceMemoryDump *traceMemoryDump) const override
size_t gpuMemorySize() const
void dumpMemoryStatisticsPriv(SkTraceMemoryDump *traceMemoryDump, const SkString &resourceName, const char *type, size_t size) const
SkString getResourceName() const
void append(const char text[])
Definition SkString.h:203

◆ MakeWrapped()

sk_sp< GrGLTextureRenderTarget > GrGLTextureRenderTarget::MakeWrapped ( GrGLGpu gpu,
int  sampleCount,
const GrGLTexture::Desc texDesc,
sk_sp< GrGLTextureParameters parameters,
const GrGLRenderTarget::IDs rtIDs,
GrWrapCacheable  cacheable,
GrMipmapStatus  mipmapStatus,
std::string_view  label 
)
static

Definition at line 66 of file GrGLTextureRenderTarget.cpp.

74 {
77 sampleCount,
78 texDesc,
79 std::move(parameters),
80 rtIDs,
81 cacheable,
83 label));
84}
GrGLTextureParameters * parameters()
Definition GrGLTexture.h:44

◆ onAbandon()

void GrGLTextureRenderTarget::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 GrGLTexture.

Definition at line 54 of file GrGLTextureRenderTarget.h.

54 {
57 }
void onAbandon() override
void onAbandon() override

◆ onGpuMemorySize()

size_t GrGLTextureRenderTarget::onGpuMemorySize ( ) const
overrideprivatevirtual

Implements GrGpuResource.

Definition at line 86 of file GrGLTextureRenderTarget.cpp.

86 {
87 return GrSurface::ComputeSize(this->backendFormat(), this->dimensions(),
88 this->totalMemorySamplesPerPixel(), this->mipmapped());
89}
int totalMemorySamplesPerPixel() const
GrBackendFormat backendFormat() const override
SkISize dimensions() const
Definition GrSurface.h:27
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

◆ onRelease()

void GrGLTextureRenderTarget::onRelease ( )
inlineoverrideprotectedvirtual

Overridden to free GPU resources in the backend API.

Reimplemented from GrGLTexture.

Definition at line 59 of file GrGLTextureRenderTarget.h.

59 {
62 }
void onRelease() override
void onRelease() override

◆ onSetLabel()

void GrGLTextureRenderTarget::onSetLabel ( )
overrideprivatevirtual

Reimplemented from GrGLTexture.

Definition at line 91 of file GrGLTextureRenderTarget.cpp.

91 {
93}
void onSetLabel() override

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