Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
GrGpuResource::ResourcePriv Class Reference

#include <GrGpuResourcePriv.h>

Public Member Functions

void setUniqueKey (const skgpu::UniqueKey &key)
 
void removeUniqueKey ()
 
void makeBudgeted ()
 
void makeUnbudgeted ()
 
GrBudgetedType budgetedType () const
 
bool refsWrappedObjects () const
 
const skgpu::ScratchKeygetScratchKey () const
 
void removeScratchKey () const
 
bool isPurgeable () const
 
bool hasRefOrCommandBufferUsage () const
 

Protected Member Functions

 ResourcePriv (GrGpuResource *resource)
 
 ResourcePriv (const ResourcePriv &that)
 
ResourcePrivoperator= (const CacheAccess &)=delete
 
const ResourcePrivoperator& () const
 
ResourcePrivoperator& ()
 

Protected Attributes

GrGpuResourcefResource
 

Friends

class GrGpuResource
 

Detailed Description

This class allows code internal to Skia privileged access to manage the cache keys and budget status of a GrGpuResource object.

Definition at line 17 of file GrGpuResourcePriv.h.

Constructor & Destructor Documentation

◆ ResourcePriv() [1/2]

GrGpuResource::ResourcePriv::ResourcePriv ( GrGpuResource resource)
inlineprotected

Definition at line 78 of file GrGpuResourcePriv.h.

static SkString resource(SkPDFResourceType type, int index)

◆ ResourcePriv() [2/2]

GrGpuResource::ResourcePriv::ResourcePriv ( const ResourcePriv that)
inlineprotected

Definition at line 79 of file GrGpuResourcePriv.h.

79: fResource(that.fResource) {}

Member Function Documentation

◆ budgetedType()

GrBudgetedType GrGpuResource::ResourcePriv::budgetedType ( ) const
inline

Get the resource's budgeted-type which indicates whether it counts against the resource cache budget and if not whether it is allowed to be cached.

Definition at line 47 of file GrGpuResourcePriv.h.

47 {
49 !fResource->getUniqueKey().isValid() || fResource->fRefsWrappedObjects);
50 return fResource->fBudgetedType;
51 }
#define SkASSERT(cond)
Definition: SkAssert.h:116
const skgpu::UniqueKey & getUniqueKey() const
bool isValid() const
Definition: ResourceKey.h:55

◆ getScratchKey()

const skgpu::ScratchKey & GrGpuResource::ResourcePriv::getScratchKey ( ) const
inline

If this resource can be used as a scratch resource this returns a valid scratch key. Otherwise it returns a key for which isNullScratch is true. The resource may currently be used as a uniquely keyed resource rather than scratch. Check isScratch().

Definition at line 63 of file GrGpuResourcePriv.h.

63{ return fResource->fScratchKey; }

◆ hasRefOrCommandBufferUsage()

bool GrGpuResource::ResourcePriv::hasRefOrCommandBufferUsage ( ) const
inline

Definition at line 73 of file GrGpuResourcePriv.h.

73 {
74 return fResource->hasRef() || !fResource->hasNoCommandBufferUsages();
75 }

◆ isPurgeable()

bool GrGpuResource::ResourcePriv::isPurgeable ( ) const
inline

Definition at line 71 of file GrGpuResourcePriv.h.

71{ return fResource->isPurgeable(); }

◆ makeBudgeted()

void GrGpuResource::ResourcePriv::makeBudgeted ( )
inline

If the resource is uncached make it cached. Has no effect on resources that are wrapped or already cached.

Definition at line 35 of file GrGpuResourcePriv.h.

35{ fResource->makeBudgeted(); }

◆ makeUnbudgeted()

void GrGpuResource::ResourcePriv::makeUnbudgeted ( )
inline

If the resource is cached make it uncached. Has no effect on resources that are wrapped or already uncached. Furthermore, resources with unique keys cannot be made unbudgeted.

Definition at line 41 of file GrGpuResourcePriv.h.

41{ fResource->makeUnbudgeted(); }

◆ operator&() [1/2]

ResourcePriv * GrGpuResource::ResourcePriv::operator& ( )
protected

◆ operator&() [2/2]

const ResourcePriv * GrGpuResource::ResourcePriv::operator& ( ) const
protected

◆ operator=()

ResourcePriv & GrGpuResource::ResourcePriv::operator= ( const CacheAccess )
protecteddelete

◆ refsWrappedObjects()

bool GrGpuResource::ResourcePriv::refsWrappedObjects ( ) const
inline

Is the resource object wrapping an externally allocated GPU resource?

Definition at line 56 of file GrGpuResourcePriv.h.

56{ return fResource->fRefsWrappedObjects; }

◆ removeScratchKey()

void GrGpuResource::ResourcePriv::removeScratchKey ( ) const
inline

If the resource has a scratch key, the key will be removed. Since scratch keys are installed at resource creation time, this means the resource will never again be used as scratch.

Definition at line 69 of file GrGpuResourcePriv.h.

69{ fResource->removeScratchKey(); }

◆ removeUniqueKey()

void GrGpuResource::ResourcePriv::removeUniqueKey ( )
inline

Removes the unique key from a resource. If the resource has a scratch key, it may be preserved for recycling as scratch.

Definition at line 29 of file GrGpuResourcePriv.h.

29{ fResource->removeUniqueKey(); }

◆ setUniqueKey()

void GrGpuResource::ResourcePriv::setUniqueKey ( const skgpu::UniqueKey key)
inline

Sets a unique key for the resource. If the resource was previously cached as scratch it will be converted to a uniquely-keyed resource. If the key is invalid then this is equivalent to removeUniqueKey(). If another resource is using the key then its unique key is removed and this resource takes over the key.

Definition at line 25 of file GrGpuResourcePriv.h.

25{ fResource->setUniqueKey(key); }

Friends And Related Function Documentation

◆ GrGpuResource

friend class GrGpuResource
friend

Definition at line 88 of file GrGpuResourcePriv.h.

Member Data Documentation

◆ fResource

GrGpuResource* GrGpuResource::ResourcePriv::fResource
protected

Definition at line 86 of file GrGpuResourcePriv.h.


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