Some cleanup in processor header files.
R=joshualitt@google.com
Review URL: https://codereview.chromium.org/659803004
diff --git a/include/gpu/GrFragmentProcessor.h b/include/gpu/GrFragmentProcessor.h
index 28778fd..f872d90 100644
--- a/include/gpu/GrFragmentProcessor.h
+++ b/include/gpu/GrFragmentProcessor.h
@@ -70,9 +70,9 @@
void addCoordTransform(const GrCoordTransform*);
/**
- * If the prceossor subclass will read the destination pixel value then it must call this function
- * from its constructor. Otherwise, when its generated backend-specific prceossor class attempts
- * to generate code that reads the destination pixel it will fail.
+ * If the prceossor subclass will read the destination pixel value then it must call this
+ * function from its constructor. Otherwise, when its generated backend-specific prceossor class
+ * attempts to generate code that reads the destination pixel it will fail.
*/
void setWillReadDstColor() { fWillReadDstColor = true; }
@@ -96,13 +96,4 @@
typedef GrProcessor INHERITED;
};
-/**
- * This creates an effect outside of the effect memory pool. The effect's destructor will be called
- * at global destruction time. NAME will be the name of the created GrProcessor.
- */
-#define GR_CREATE_STATIC_FRAGMENT_PROCESSOR(NAME, FP_CLASS, ARGS) \
-static SkAlignedSStorage<sizeof(FP_CLASS)> g_##NAME##_Storage; \
-static GrFragmentProcessor* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), FP_CLASS, ARGS); \
-static SkAutoTDestroy<GrFragmentProcessor> NAME##_ad(NAME);
-
#endif
diff --git a/include/gpu/GrGeometryProcessor.h b/include/gpu/GrGeometryProcessor.h
index 5b509ca..5f32c5d 100644
--- a/include/gpu/GrGeometryProcessor.h
+++ b/include/gpu/GrGeometryProcessor.h
@@ -37,12 +37,12 @@
const VertexAttribArray& getVertexAttribs() const { return fVertexAttribs; }
- /** Returns true if this and other effect conservatively draw identically. It can only return
- true when the two effects are of the same subclass (i.e. they return the same object from
+ /** Returns true if this and other processor conservatively draw identically. It can only return
+ true when the two prcoessors are of the same subclass (i.e. they return the same object from
from getFactory()).
- A return value of true from isEqual() should not be used to test whether the effects would
- generate the same shader code. To test for identical code generation use the effects' keys
- computed by the GrBackendEffectFactory. */
+ A return value of true from isEqual() should not be used to test whether the prcoessors
+ would generate the same shader code. To test for identical code generation use the
+ processors' keys computed by the GrBackendEffectFactory. */
bool isEqual(const GrGeometryProcessor& that) const {
if (&this->getFactory() != &that.getFactory()) {
return false;
@@ -75,13 +75,4 @@
typedef GrProcessor INHERITED;
};
-/**
- * This creates an effect outside of the effect memory pool. The effect's destructor will be called
- * at global destruction time. NAME will be the name of the created GrProcessor.
- */
-#define GR_CREATE_STATIC_GEOMETRY_PROCESSOR(NAME, GP_CLASS, ARGS) \
-static SkAlignedSStorage<sizeof(GP_CLASS)> g_##NAME##_Storage; \
-static GrGeometryProcessor* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), GP_CLASS, ARGS); \
-static SkAutoTDestroy<GrGeometryProcessor> NAME##_ad(NAME);
-
#endif
diff --git a/include/gpu/GrProcessor.h b/include/gpu/GrProcessor.h
index b41f94d..63ab7ba 100644
--- a/include/gpu/GrProcessor.h
+++ b/include/gpu/GrProcessor.h
@@ -17,16 +17,13 @@
class GrContext;
class GrCoordTransform;
-/** Provides custom vertex shader, fragment shader, uniform data for a particular stage of the
- Ganesh shading pipeline.
- Subclasses must have a function that produces a human-readable name:
- static const char* Name();
- GrProcessor objects *must* be immutable: after being constructed, their fields may not change.
+/** 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
- effect must reach 0 before the thread terminates and the pool is destroyed. To create a static
- effect use the macro GR_CREATE_STATIC_EFFECT declared below.
- */
+ processor must reach 0 before the thread terminates and the pool is destroyed. To create a
+ static processor use the helper macro GR_CREATE_STATIC_PROCESSOR declared below.
+ */
class GrProcessor : public GrProgramElement {
public:
SK_DECLARE_INST_COUNT(GrProcessor)
@@ -141,7 +138,7 @@
/**
* This function is used to perform optimizations. When called the invarientOuput param
- * indicate whether the input components to this effect in the FS will have known values.
+ * indicate whether the input components to this processor in the FS will have known values.
* In inout the validFlags member is a bitfield of GrColorComponentFlags. The isSingleComponent
* member indicates whether the input will be 1 or 4 bytes. The function updates the members of
* inout to indicate known values of its output. A component of the color member only has
@@ -161,17 +158,17 @@
GrGLProcessor created by the factory.
Example:
- class MyCustomEffect : public GrProcessor {
+ class MyCustomProcessor : public GrProcessor {
...
virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE {
- return GrTBackendEffectFactory<MyCustomEffect>::getInstance();
+ return GrTBackendEffectFactory<MyCustomProcessor>::getInstance();
}
...
};
*/
virtual const GrBackendProcessorFactory& getFactory() const = 0;
- /** Human-meaningful string to identify this effect; may be embedded
+ /** Human-meaningful string to identify this prcoessor; may be embedded
in generated shader code. */
const char* name() const;
@@ -184,7 +181,7 @@
/** Shortcut for textureAccess(index).texture(); */
GrTexture* texture(int index) const { return this->textureAccess(index).getTexture(); }
- /** Will this effect read the fragment position? */
+ /** Will this processor read the fragment position? */
bool willReadFragmentPosition() const { return fWillReadFragmentPosition; }
void* operator new(size_t size);
@@ -204,7 +201,7 @@
protected:
/**
- * Subclasses call this from their constructor to register GrTextureAccesses. The effect
+ * Subclasses call this from their constructor to register GrTextureAccesses. The processor
* subclass manages the lifetime of the accesses (this function only stores a pointer). The
* GrTextureAccess is typically a member field of the GrProcessor subclass. This must only be
* called from the constructor because GrProcessors are immutable.
@@ -215,9 +212,9 @@
: fWillReadFragmentPosition(false) {}
/**
- * If the effect will generate a backend-specific effect that will read the fragment position
- * in the FS then it must call this method from its constructor. Otherwise, the request to
- * access the fragment position will be denied.
+ * If the prcoessor will generate a backend-specific processor that will read the fragment
+ * position in the FS then it must call this method from its constructor. Otherwise, the
+ * request to access the fragment position will be denied.
*/
void setWillReadFragmentPosition() { fWillReadFragmentPosition = true; }
@@ -236,4 +233,14 @@
typedef GrProgramElement INHERITED;
};
+
+/**
+ * This creates a processor outside of the memory pool. The processor's destructor will be called
+ * at global destruction time. NAME will be the name of the created instance.
+ */
+#define GR_CREATE_STATIC_PROCESSOR(NAME, PROC_CLASS, ARGS) \
+static SkAlignedSStorage<sizeof(PROC_CLASS)> g_##NAME##_Storage; \
+static PROC_CLASS* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), PROC_CLASS, ARGS); \
+static SkAutoTDestroy<GrProcessor> NAME##_ad(NAME);
+
#endif
diff --git a/src/effects/SkLumaColorFilter.cpp b/src/effects/SkLumaColorFilter.cpp
index 411757f..d06a213 100644
--- a/src/effects/SkLumaColorFilter.cpp
+++ b/src/effects/SkLumaColorFilter.cpp
@@ -63,7 +63,7 @@
class LumaColorFilterEffect : public GrFragmentProcessor {
public:
static GrFragmentProcessor* Create() {
- GR_CREATE_STATIC_FRAGMENT_PROCESSOR(gLumaEffect, LumaColorFilterEffect, ());
+ GR_CREATE_STATIC_PROCESSOR(gLumaEffect, LumaColorFilterEffect, ());
return SkRef(gLumaEffect);
}
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index 00f886c..d5bc307 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -508,7 +508,7 @@
public:
static GrGeometryProcessor* Create() {
- GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gQuadEdgeEffect, QuadEdgeEffect, ());
+ GR_CREATE_STATIC_PROCESSOR(gQuadEdgeEffect, QuadEdgeEffect, ());
gQuadEdgeEffect->ref();
return gQuadEdgeEffect;
}
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp
index ff5ba06..2db42cc 100644
--- a/src/gpu/GrAARectRenderer.cpp
+++ b/src/gpu/GrAARectRenderer.cpp
@@ -21,7 +21,7 @@
class GrAlignedRectEffect : public GrGeometryProcessor {
public:
static GrGeometryProcessor* Create() {
- GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gAlignedRectEffect, GrAlignedRectEffect, ());
+ GR_CREATE_STATIC_PROCESSOR(gAlignedRectEffect, GrAlignedRectEffect, ());
gAlignedRectEffect->ref();
return gAlignedRectEffect;
}
@@ -145,7 +145,7 @@
class GrRectEffect : public GrGeometryProcessor {
public:
static GrGeometryProcessor* Create() {
- GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gRectEffect, GrRectEffect, ());
+ GR_CREATE_STATIC_PROCESSOR(gRectEffect, GrRectEffect, ());
gRectEffect->ref();
return gRectEffect;
}
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index 9718bc2..5863651 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -63,8 +63,8 @@
class CircleEdgeEffect : public GrGeometryProcessor {
public:
static GrGeometryProcessor* Create(bool stroke) {
- GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gCircleStrokeEdge, CircleEdgeEffect, (true));
- GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gCircleFillEdge, CircleEdgeEffect, (false));
+ GR_CREATE_STATIC_PROCESSOR(gCircleStrokeEdge, CircleEdgeEffect, (true));
+ GR_CREATE_STATIC_PROCESSOR(gCircleFillEdge, CircleEdgeEffect, (false));
if (stroke) {
gCircleStrokeEdge->ref();
@@ -179,8 +179,8 @@
class EllipseEdgeEffect : public GrGeometryProcessor {
public:
static GrGeometryProcessor* Create(bool stroke) {
- GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gEllipseStrokeEdge, EllipseEdgeEffect, (true));
- GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gEllipseFillEdge, EllipseEdgeEffect, (false));
+ GR_CREATE_STATIC_PROCESSOR(gEllipseStrokeEdge, EllipseEdgeEffect, (true));
+ GR_CREATE_STATIC_PROCESSOR(gEllipseFillEdge, EllipseEdgeEffect, (false));
if (stroke) {
gEllipseStrokeEdge->ref();
@@ -323,9 +323,9 @@
enum Mode { kStroke = 0, kHairline, kFill };
static GrGeometryProcessor* Create(Mode mode) {
- GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gEllipseStrokeEdge, DIEllipseEdgeEffect, (kStroke));
- GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gEllipseHairlineEdge, DIEllipseEdgeEffect, (kHairline));
- GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gEllipseFillEdge, DIEllipseEdgeEffect, (kFill));
+ GR_CREATE_STATIC_PROCESSOR(gEllipseStrokeEdge, DIEllipseEdgeEffect, (kStroke));
+ GR_CREATE_STATIC_PROCESSOR(gEllipseHairlineEdge, DIEllipseEdgeEffect, (kHairline));
+ GR_CREATE_STATIC_PROCESSOR(gEllipseFillEdge, DIEllipseEdgeEffect, (kFill));
if (kStroke == mode) {
gEllipseStrokeEdge->ref();
diff --git a/src/gpu/effects/GrBezierEffect.h b/src/gpu/effects/GrBezierEffect.h
index df06fba..5d2917d 100644
--- a/src/gpu/effects/GrBezierEffect.h
+++ b/src/gpu/effects/GrBezierEffect.h
@@ -59,12 +59,9 @@
public:
static GrGeometryProcessor* Create(const GrPrimitiveEdgeType edgeType,
const GrDrawTargetCaps& caps) {
- GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gConicFillAA, GrConicEffect,
- (kFillAA_GrProcessorEdgeType));
- GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gConicHairAA, GrConicEffect,
- (kHairlineAA_GrProcessorEdgeType));
- GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gConicFillBW, GrConicEffect,
- (kFillBW_GrProcessorEdgeType));
+ GR_CREATE_STATIC_PROCESSOR(gConicFillAA, GrConicEffect, (kFillAA_GrProcessorEdgeType));
+ GR_CREATE_STATIC_PROCESSOR(gConicHairAA, GrConicEffect, (kHairlineAA_GrProcessorEdgeType));
+ GR_CREATE_STATIC_PROCESSOR(gConicFillBW, GrConicEffect, (kFillBW_GrProcessorEdgeType));
switch (edgeType) {
case kFillAA_GrProcessorEdgeType:
if (!caps.shaderDerivativeSupport()) {
@@ -131,12 +128,9 @@
public:
static GrGeometryProcessor* Create(const GrPrimitiveEdgeType edgeType,
const GrDrawTargetCaps& caps) {
- GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gQuadFillAA, GrQuadEffect,
- (kFillAA_GrProcessorEdgeType));
- GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gQuadHairAA, GrQuadEffect,
- (kHairlineAA_GrProcessorEdgeType));
- GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gQuadFillBW, GrQuadEffect,
- (kFillBW_GrProcessorEdgeType));
+ GR_CREATE_STATIC_PROCESSOR(gQuadFillAA, GrQuadEffect, (kFillAA_GrProcessorEdgeType));
+ GR_CREATE_STATIC_PROCESSOR(gQuadHairAA, GrQuadEffect, (kHairlineAA_GrProcessorEdgeType));
+ GR_CREATE_STATIC_PROCESSOR(gQuadFillBW, GrQuadEffect, (kFillBW_GrProcessorEdgeType));
switch (edgeType) {
case kFillAA_GrProcessorEdgeType:
if (!caps.shaderDerivativeSupport()) {
@@ -205,12 +199,9 @@
public:
static GrGeometryProcessor* Create(const GrPrimitiveEdgeType edgeType,
const GrDrawTargetCaps& caps) {
- GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gCubicFillAA, GrCubicEffect,
- (kFillAA_GrProcessorEdgeType));
- GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gCubicHairAA, GrCubicEffect,
- (kHairlineAA_GrProcessorEdgeType));
- GR_CREATE_STATIC_GEOMETRY_PROCESSOR(gCubicFillBW, GrCubicEffect,
- (kFillBW_GrProcessorEdgeType));
+ GR_CREATE_STATIC_PROCESSOR(gCubicFillAA, GrCubicEffect, (kFillAA_GrProcessorEdgeType));
+ GR_CREATE_STATIC_PROCESSOR(gCubicHairAA, GrCubicEffect, (kHairlineAA_GrProcessorEdgeType));
+ GR_CREATE_STATIC_PROCESSOR(gCubicFillBW, GrCubicEffect, (kFillBW_GrProcessorEdgeType));
switch (edgeType) {
case kFillAA_GrProcessorEdgeType:
if (!caps.shaderDerivativeSupport()) {
diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp
index 0e7df5e..068a23e 100644
--- a/src/gpu/effects/GrDitherEffect.cpp
+++ b/src/gpu/effects/GrDitherEffect.cpp
@@ -21,7 +21,7 @@
class DitherEffect : public GrFragmentProcessor {
public:
static GrFragmentProcessor* Create() {
- GR_CREATE_STATIC_FRAGMENT_PROCESSOR(gDitherEffect, DitherEffect, ())
+ GR_CREATE_STATIC_PROCESSOR(gDitherEffect, DitherEffect, ())
return SkRef(gDitherEffect);
}
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 16e4a1c..1ec6a73 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -24,7 +24,7 @@
#include "Test.h"
/*
- * A dummy effect which just tries to insert a massive key and verify that it can retrieve the
+ * A dummy processor which just tries to insert a massive key and verify that it can retrieve the
* whole thing correctly
*/
static const uint32_t kMaxKeySize = 1024;
@@ -34,7 +34,7 @@
class BigKeyProcessor : public GrFragmentProcessor {
public:
static GrFragmentProcessor* Create() {
- GR_CREATE_STATIC_FRAGMENT_PROCESSOR(gBigKeyProcessor, BigKeyProcessor, ())
+ GR_CREATE_STATIC_PROCESSOR(gBigKeyProcessor, BigKeyProcessor, ())
return SkRef(gBigKeyProcessor);
}