class GrProcessor;
/**
- * Used by effects to build their keys. It incorporates each per-processor key into a larger shader
- * key.
+ * Used by processors to build their keys. It incorporates each per-processor key into a larger shader
+ * key.
*/
class GrProcessorKeyBuilder {
public:
private:
SkTArray<uint8_t, true>* fData; // unowned ptr to the larger key.
- int fCount; // number of uint32_ts added to fData by the effect.
+ int fCount; // number of uint32_ts added to fData by the processor.
};
/**
SkASSERT(0 == reinterpret_cast<intptr_t>(key) % sizeof(uint32_t));
}
- /** Gets the uint32_t values that the effect inserted into the key. */
+ /** Gets the uint32_t values that the processor inserted into the key. */
uint32_t get32(int index) const {
SkASSERT(index >=0 && index < fCount);
return fKey[index];
}
- /** Gets the number of uint32_t values that the effect inserted into the key. */
+ /** Gets the number of uint32_t values that the processor inserted into the key. */
int count32() const { return fCount; }
private:
const uint32_t* fKey; // unowned ptr into the larger key.
- int fCount; // number of uint32_ts inserted by the effect into its key.
+ int fCount; // number of uint32_ts inserted by the processor into its key.
};
/**
* Given a GrProcessor of a particular type, creates the corresponding graphics-backend-specific
- * effect object. It also tracks equivalence of shaders generated via a key. The factory for an
- * effect is accessed via GrProcessor::getFactory(). Each factory instance is assigned an ID at
+ * processor object. It also tracks equivalence of shaders generated via a key. The factory for an
+ * processor is accessed via GrProcessor::getFactory(). Each factory instance is assigned an ID at
* construction. The ID of GrProcessor::getFactory() is used as a type identifier. Thus, a
* GrProcessor subclass must always return the same object from getFactory() and that factory object
* must be unique to the GrProcessor subclass (and unique from any further derived subclasses).
*
* Rather than subclassing this class themselves, it is recommended that GrProcessor authors use
- * the templated subclass GrTBackendEffectFactory by writing their getFactory() method as:
+ * the templated subclass GrTBackendProcessorFactory by writing their getFactory() method as:
*
- * const GrBackendEffectFactory& MyEffect::getFactory() const {
- * return GrTBackendEffectFactory<MyEffect>::getInstance();
+ * const GrBackendProcessorFactory& MyProcessor::getFactory() const {
+ * return GrTBackendProcessorFactory<MyProcessor>::getInstance();
* }
*
- * Using GrTBackendEffectFactory places a few constraints on the effect. See that class's comments.
+ * Using GrTBackendProcessorFactory places a few constraints on the processor. See that class's
+ * comments.
*/
class GrBackendProcessorFactory : SkNoncopyable {
public:
/**
- * Generates an effect's key. The key is based on the aspects of the GrProcessor object's
+ * Generates an processor's key. The key is based on the aspects of the GrProcessor object's
* configuration that affect GLSL code generation. Two GrProcessor instances that would cause
* this->createGLInstance()->emitCode() to produce different code must produce different keys.
*/
GrProcessorKeyBuilder*) const = 0;
/**
- * Produces a human-reable name for the effect.
+ * Produces a human-reable name for the v.
*/
virtual const char* name() const = 0;
/**
* A unique value for every instance of this factory. It is automatically incorporated into the
- * effect's key. This allows keys generated by getGLProcessorKey() to only be unique within a
+ * processor's key. This allows keys generated by getGLProcessorKey() to only be unique within a
* GrProcessor subclass and not necessarily across subclasses.
*/
- uint32_t effectClassID() const { return fEffectClassID; }
+ uint32_t classID() const { return fProcessorClassID; }
protected:
- GrBackendProcessorFactory() : fEffectClassID(GenID()) {}
+ GrBackendProcessorFactory() : fProcessorClassID(GenClassID()) {}
virtual ~GrBackendProcessorFactory() {}
private:
enum {
- kIllegalEffectClassID = 0,
+ kIllegalProcessorClassID = 0,
};
- static uint32_t GenID() {
- // fCurrEffectClassID has been initialized to kIllegalEffectClassID. The
+ static uint32_t GenClassID() {
+ // fCurrProcessorClassID has been initialized to kIllegalProcessorClassID. The
// atomic inc returns the old value not the incremented value. So we add
// 1 to the returned value.
- uint32_t id = static_cast<uint32_t>(sk_atomic_inc(&fCurrEffectClassID)) + 1;
+ uint32_t id = static_cast<uint32_t>(sk_atomic_inc(&fCurrProcessorClassID)) + 1;
if (!id) {
SkFAIL("This should never wrap as it should only be called once for each GrProcessor "
"subclass.");
return id;
}
- const uint32_t fEffectClassID;
- static int32_t fCurrEffectClassID;
+ const uint32_t fProcessorClassID;
+ static int32_t fCurrProcessorClassID;
};
class GrFragmentProcessor;