Skia
2DGraphicsLibrary
|
Provides custom shader code to the Ganesh shading pipeline. More...
#include <GrProcessor.h>
Public Types | |
enum | RequiredFeatures { kNone_RequiredFeatures = 0, kFragmentPosition_RequiredFeature = 1 << 0, kSampleLocations_RequiredFeature = 1 << 1 } |
Platform specific built-in features that a processor can request for the fragment shader. | |
Public Member Functions | |
virtual const char * | name () const =0 |
Human-meaningful string to identify this prcoessor; may be embedded in generated shader code. More... | |
virtual SkString | dumpInfo () const |
int | numTextures () const |
const GrTextureAccess & | textureAccess (int index) const |
Returns the access pattern for the texture at index. More... | |
GrTexture * | texture (int index) const |
Shortcut for textureAccess(index).texture();. | |
int | numBuffers () const |
const GrBufferAccess & | bufferAccess (int index) const |
Returns the access pattern for the buffer at index. More... | |
GR_DECL_BITFIELD_OPS_FRIENDS (RequiredFeatures) | |
RequiredFeatures | requiredFeatures () const |
void * | operator new (size_t size) |
void | operator delete (void *target) |
void * | operator new (size_t size, void *placement) |
void | operator delete (void *target, void *placement) |
template<typename T > | |
const T & | cast () const |
Helper for down-casting to a GrProcessor subclass. | |
uint32_t | classID () const |
Public Member Functions inherited from GrProgramElement | |
void | ref () const |
void | unref () const |
uint32_t | getUniqueID () const |
Gets an id that is unique for this GrProgramElement object. More... | |
void | validate () const |
Protected Member Functions | |
virtual void | addTextureAccess (const GrTextureAccess *textureAccess) |
Subclasses call these from their constructor to register sampler sources. More... | |
virtual void | addBufferAccess (const GrBufferAccess *bufferAccess) |
bool | hasSameSamplers (const GrProcessor &) const |
void | setWillReadFragmentPosition () |
If the prcoessor will generate code that uses platform specific built-in features, then it must call these methods from its constructor. More... | |
void | setWillUseSampleLocations () |
void | combineRequiredFeatures (const GrProcessor &other) |
template<typename PROC_SUBCLASS > | |
void | initClassID () |
Protected Member Functions inherited from GrProgramElement | |
void | addGpuResource (const GrGpuResourceRef *res) |
Subclasses registers their resources using this function. More... | |
void | addPendingExecution () const |
void | completedExecution () const |
Protected Attributes | |
uint32_t | fClassID |
SkSTArray< 4, const GrTextureAccess *, true > | fTextureAccesses |
SkSTArray< 2, const GrBufferAccess *, true > | fBufferAccesses |
Private Types | |
enum | { kIllegalProcessorClassID = 0 } |
typedef GrProgramElement | INHERITED |
Static Private Member Functions | |
static uint32_t | GenClassID () |
Private Attributes | |
RequiredFeatures | fRequiredFeatures |
Static Private Attributes | |
static int32_t | gCurrProcessorClassID |
Provides custom shader code to the Ganesh shading pipeline.
GrProcessor objects must be immutable: after being constructed, their fields may not change.
Dynamically allocated GrProcessors are managed by a per-thread memory pool. The ref count of an processor must reach 0 before the thread terminates and the pool is destroyed.
|
protectedvirtual |
Subclasses call these from their constructor to register sampler sources.
The processor subclass manages the lifetime of the objects (these functions only store pointers). The GrTextureAccess and/or GrBufferAccess instances are typically member fields of the GrProcessor subclass. These must only be called from the constructor because GrProcessors are immutable.
Reimplemented in GrFragmentProcessor.
|
inline |
Returns the access pattern for the buffer at index.
index must be valid according to numBuffers().
|
pure virtual |
Human-meaningful string to identify this prcoessor; may be embedded in generated shader code.
|
inlineprotected |
If the prcoessor will generate code that uses platform specific built-in features, then it must call these methods from its constructor.
Otherwise, requests to use these features will be denied.
|
inline |
Returns the access pattern for the texture at index.
index must be valid according to numTextures().