Base class for objects that can be kept in the GrResourceCache.
More...
#include <GrGpuResource.h>
|
static uint32_t | CreateUniqueID () |
|
|
void | registerWithCache (SkBudgeted) |
|
void | registerWithCacheWrapped () |
|
| GrGpuResource (GrGpu *) |
|
GrGpu * | getGpu () const |
|
virtual void | onRelease () |
| Overridden to free GPU resources in the backend API. More...
|
|
virtual void | onAbandon () |
| Overridden to abandon any internal handles, ptrs, etc to backend API resources. More...
|
|
void | didChangeGpuMemorySize () const |
| This entry point should be called whenever gpuMemorySize() should report a different size. More...
|
|
virtual void | setMemoryBacking (SkTraceMemoryDump *, const SkString &) const |
| Allows subclasses to add additional backing information to the SkTraceMemoryDump. More...
|
|
bool | isPurgeable () const |
|
bool | internalHasPendingRead () const |
|
bool | internalHasPendingWrite () const |
|
bool | internalHasPendingIO () const |
|
bool | internalHasRef () const |
|
|
virtual void | computeScratchKey (GrScratchKey *) const |
| Called by the registerWithCache if the resource is available to be used as scratch. More...
|
|
void | release () |
| Frees the object in the underlying 3D API. More...
|
|
virtual size_t | onGpuMemorySize () const =0 |
|
void | setUniqueKey (const GrUniqueKey &) |
|
void | removeUniqueKey () |
|
void | notifyAllCntsAreZero (CntType) const |
|
bool | notifyRefCountIsZero () const |
|
void | removeScratchKey () |
|
void | makeBudgeted () |
|
void | makeUnbudgeted () |
|
|
int | fCacheArrayIndex |
|
uint32_t | fTimestamp |
|
uint32_t | fExternalFlushCntWhenBecamePurgeable |
|
GrStdSteadyClock::time_point | fTimeWhenBecamePurgeable |
|
GrScratchKey | fScratchKey |
|
GrUniqueKey | fUniqueKey |
|
GrGpu * | fGpu |
|
size_t | fGpuMemorySize |
|
SkBudgeted | fBudgeted |
|
bool | fRefsWrappedObjects |
|
const UniqueID | fUniqueID |
|
|
static const size_t | kInvalidGpuMemorySize = ~static_cast<size_t>(0) |
|
|
class | GrIORef< GrGpuResource > |
|
Base class for objects that can be kept in the GrResourceCache.
void GrGpuResource::abandon |
( |
| ) |
|
Removes references to objects in the underlying 3D API without freeing them.
Called by CacheAccess. In general this method should not be called outside of skia. It was made by public for a special case where it needs to be called in Blink when a texture becomes unsafe to use after having been shared through a texture mailbox.
virtual void GrGpuResource::computeScratchKey |
( |
GrScratchKey * |
| ) |
const |
|
inlineprivatevirtual |
Called by the registerWithCache if the resource is available to be used as scratch.
Resource subclasses should override this if the instances should be recycled as scratch resources and populate the scratchKey with the key. By default resources are not recycled as scratch.
Reimplemented in GrTexture.
void GrGpuResource::didChangeGpuMemorySize |
( |
| ) |
const |
|
protected |
This entry point should be called whenever gpuMemorySize() should report a different size.
The cache will call gpuMemorySize() to update the current size of the resource.
virtual void GrGpuResource::dumpMemoryStatistics |
( |
SkTraceMemoryDump * |
traceMemoryDump | ) |
const |
|
virtual |
Dumps memory usage information for this GrGpuResource to traceMemoryDump.
Typically, subclasses should not need to override this, and should only need to override setMemoryBacking.
const GrContext* GrGpuResource::getContext |
( |
| ) |
const |
Retrieves the context that owns the object.
Note that it is possible for this to return NULL. When objects have been release()ed or abandon()ed they no longer have an owning context. Destroying a GrContext automatically releases all its resources.
const GrUniqueKey& GrGpuResource::getUniqueKey |
( |
| ) |
const |
|
inline |
Returns the current unique key for the resource.
It will be invalid if the resource has no associated unique key.
size_t GrGpuResource::gpuMemorySize |
( |
| ) |
const |
|
inline |
Retrieves the amount of GPU memory used by this resource in bytes.
It is approximate since we aren't aware of additional padding or copies made by the driver.
- Returns
- the amount of GPU memory used in bytes
virtual void GrGpuResource::onAbandon |
( |
| ) |
|
|
inlineprotectedvirtual |
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 in GrRenderTarget, and GrSurface.
virtual void GrGpuResource::onRelease |
( |
| ) |
|
|
inlineprotectedvirtual |
void GrGpuResource::release |
( |
| ) |
|
|
private |
Frees the object in the underlying 3D API.
Called by CacheAccess.
Allows subclasses to add additional backing information to the SkTraceMemoryDump.
Called by onMemoryDump. The default implementation adds no backing information.
UniqueID GrGpuResource::uniqueID |
( |
| ) |
const |
|
inline |
Gets an id that is unique for this GrGpuResource object.
It is static in that it does not change when the content of the GrGpuResource object changes. This will never return 0.
bool GrGpuResource::wasDestroyed |
( |
| ) |
const |
|
inline |
Tests whether a object has been abandoned or released.
All objects will be in this state after their creating GrContext is destroyed or has contextLost called. It's up to the client to test wasDestroyed() before attempting to use an object if it holds refs on objects across ~GrContext, freeResources with the force flag, or contextLost.
- Returns
- true if the object has been released or abandoned, false otherwise.
The documentation for this class was generated from the following file: