Skia
2DGraphicsLibrary
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GrRenderTarget Class Referenceabstract

GrRenderTarget represents a 2D buffer of pixels that can be rendered to. More...

#include <GrRenderTarget.h>

Inheritance diagram for GrRenderTarget:
GrSurface GrGpuResource GrIORef< GrGpuResource >

Public Types

enum  ResolveType { kCanResolve_ResolveType, kAutoResolves_ResolveType, kCantResolve_ResolveType }
 

Public Member Functions

GrRenderTargetasRenderTarget () override
 
const GrRenderTargetasRenderTarget () const override
 
bool isStencilBufferMultisampled () const
 
GrFSAAType fsaaType () const
 
int numStencilSamples () const
 Returns the number of samples/pixel in the stencil buffer (Zero if non-MSAA).
 
int numColorSamples () const
 Returns the number of samples/pixel in the color buffer (Zero if non-MSAA or mixed sampled).
 
void flagAsNeedingResolve (const SkIRect *rect=NULL)
 Call to indicate the multisample contents were modified such that the render target needs to be resolved before it can be used as texture. More...
 
void overrideResolveRect (const SkIRect rect)
 Call to override the region that needs to be resolved.
 
void flagAsResolved ()
 Call to indicate that GrRenderTarget was externally resolved. More...
 
bool needsResolve () const
 
const SkIRectgetResolveRect () const
 Returns a rect bounding the region needing resolving.
 
virtual ResolveType getResolveType () const =0
 
virtual GrBackendObject getRenderTargetHandle () const =0
 Return the native ID or handle to the rendertarget, depending on the platform. More...
 
virtual bool canAttemptStencilAttachment () const =0
 
GrRenderTargetPriv renderTargetPriv ()
 
const GrRenderTargetPriv renderTargetPriv () const
 
- Public Member Functions inherited from GrSurface
int width () const
 Retrieves the width of the surface.
 
int height () const
 Retrieves the height of the surface.
 
SkRect getBoundsRect () const
 Helper that gets the width and height of the surface as a bounding rectangle.
 
GrSurfaceOrigin origin () const
 
GrPixelConfig config () const
 Retrieves the pixel config specified when the surface was created. More...
 
virtual GrTextureasTexture ()
 
virtual const GrTextureasTexture () const
 
GrSurfacePriv surfacePriv ()
 Access methods that are only to be used within Skia code. More...
 
const GrSurfacePriv surfacePriv () const
 
- Public Member Functions inherited from GrGpuResource
bool wasDestroyed () const
 Tests whether a object has been abandoned or released. More...
 
const GrContextgetContext () const
 Retrieves the context that owns the object. More...
 
GrContextgetContext ()
 
size_t gpuMemorySize () const
 Retrieves the amount of GPU memory used by this resource in bytes. More...
 
UniqueID uniqueID () const
 Gets an id that is unique for this GrGpuResource object. More...
 
const GrUniqueKeygetUniqueKey () const
 Returns the current unique key for the resource. More...
 
CacheAccess cacheAccess ()
 
const CacheAccess cacheAccess () const
 
ResourcePriv resourcePriv ()
 
const ResourcePriv resourcePriv () const
 
void abandon ()
 Removes references to objects in the underlying 3D API without freeing them. More...
 
virtual void dumpMemoryStatistics (SkTraceMemoryDump *traceMemoryDump) const
 Dumps memory usage information for this GrGpuResource to traceMemoryDump. More...
 
- Public Member Functions inherited from GrIORef< GrGpuResource >
void ref () const
 
void unref () const
 
void validate () const
 

Protected Member Functions

 GrRenderTarget (GrGpu *, const GrSurfaceDesc &, GrRenderTargetFlags=GrRenderTargetFlags::kNone, GrStencilAttachment *=nullptr)
 
void onAbandon () override
 Overridden to abandon any internal handles, ptrs, etc to backend API resources. More...
 
void onRelease () override
 Overridden to free GPU resources in the backend API. More...
 
- Protected Member Functions inherited from GrSurface
bool hasPendingRead () const
 
bool hasPendingWrite () const
 
bool hasPendingIO () const
 
 GrSurface (GrGpu *gpu, const GrSurfaceDesc &desc)
 
void onRelease () override
 Overridden to free GPU resources in the backend API. More...
 
void onAbandon () override
 Overridden to abandon any internal handles, ptrs, etc to backend API resources. More...
 
- Protected Member Functions inherited from GrGpuResource
void registerWithCache (SkBudgeted)
 
void registerWithCacheWrapped ()
 
 GrGpuResource (GrGpu *)
 
GrGpu * getGpu () const
 
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...
 
- Protected Member Functions inherited from GrIORef< GrGpuResource >
bool isPurgeable () const
 
bool internalHasPendingRead () const
 
bool internalHasPendingWrite () const
 
bool internalHasPendingIO () const
 
bool internalHasRef () const
 

Private Types

typedef GrSurface INHERITED
 

Private Member Functions

virtual bool completeStencilAttachment ()=0
 

Private Attributes

int fSampleCnt
 
GrStencilAttachment * fStencilAttachment
 
uint8_t fMultisampleSpecsID
 
GrRenderTargetFlags fFlags
 
SkIRect fResolveRect
 

Friends

class GrRenderTargetPriv
 

Additional Inherited Members

- Static Public Member Functions inherited from GrSurface
static size_t WorstCaseSize (const GrSurfaceDesc &desc, bool useNextPow2=false)
 
static size_t ComputeSize (GrPixelConfig config, int width, int height, int colorSamplesPerPixel, bool hasMIPMaps, bool useNextPow2=false)
 
- Static Public Member Functions inherited from GrGpuResource
static uint32_t CreateUniqueID ()
 
- Protected Types inherited from GrIORef< GrGpuResource >
enum  CntType
 

Detailed Description

GrRenderTarget represents a 2D buffer of pixels that can be rendered to.

A context's render target is set by setRenderTarget(). Render targets are created by a createTexture with the kRenderTarget_SurfaceFlag flag. Additionally, GrContext provides methods for creating GrRenderTargets that wrap externally created render targets.

Member Function Documentation

GrRenderTarget* GrRenderTarget::asRenderTarget ( )
inlineoverridevirtual
Returns
the render target underlying this surface, may be null.

Reimplemented from GrSurface.

void GrRenderTarget::flagAsNeedingResolve ( const SkIRect rect = NULL)

Call to indicate the multisample contents were modified such that the render target needs to be resolved before it can be used as texture.

Gr tracks this for its own drawing and thus this only needs to be called when the render target has been modified outside of Gr. This has no effect on wrapped backend render targets.

Parameters
recta rect bounding the area needing resolve. NULL indicates the whole RT needs resolving.
void GrRenderTarget::flagAsResolved ( )
inline

Call to indicate that GrRenderTarget was externally resolved.

This may allow Gr to skip a redundant resolve step.

virtual GrBackendObject GrRenderTarget::getRenderTargetHandle ( ) const
pure virtual

Return the native ID or handle to the rendertarget, depending on the platform.

e.g. on OpenGL, return the FBO ID.

bool GrRenderTarget::needsResolve ( ) const
inline
Returns
true if the GrRenderTarget requires MSAA resolving
void GrRenderTarget::onAbandon ( )
overrideprotectedvirtual

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 GrGpuResource.

void GrRenderTarget::onRelease ( )
overrideprotectedvirtual

Overridden to free GPU resources in the backend API.

Reimplemented from GrGpuResource.


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