aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2014-09-23 09:50:21 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-23 09:50:21 -0700
commitb0a8a377f832c59cee939ad721e1f87d378b7142 (patch)
tree7edeac33c817af28d73f3fbe1b31776ac34e8773 /src/gpu/effects
parente51ac563de24ed4b25fde97c225580a30a55e9ca (diff)
Patch to create a distinct geometry processor. The vast majority of this patch
is just a rename. The meat is in GrGeometryProcessor, GrProcessor, GrGL*Processor, GrProcessorStage, Gr*BackendProcessorFactory, GrProcessUnitTestFactory, and the builders BUG=skia: R=bsalomon@google.com Author: joshualitt@chromium.org Review URL: https://codereview.chromium.org/582963002
Diffstat (limited to 'src/gpu/effects')
-rw-r--r--src/gpu/effects/GrBezierEffect.cpp204
-rw-r--r--src/gpu/effects/GrBezierEffect.h110
-rw-r--r--src/gpu/effects/GrBicubicEffect.cpp50
-rw-r--r--src/gpu/effects/GrBicubicEffect.h24
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.cpp74
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.h18
-rw-r--r--src/gpu/effects/GrConvexPolyEffect.cpp170
-rw-r--r--src/gpu/effects/GrConvexPolyEffect.h34
-rw-r--r--src/gpu/effects/GrConvolutionEffect.cpp58
-rw-r--r--src/gpu/effects/GrConvolutionEffect.h32
-rw-r--r--src/gpu/effects/GrCustomCoordsTextureEffect.cpp38
-rw-r--r--src/gpu/effects/GrCustomCoordsTextureEffect.h12
-rw-r--r--src/gpu/effects/GrDashingEffect.cpp197
-rw-r--r--src/gpu/effects/GrDashingEffect.h7
-rwxr-xr-xsrc/gpu/effects/GrDistanceFieldTextureEffect.cpp98
-rw-r--r--src/gpu/effects/GrDistanceFieldTextureEffect.h38
-rw-r--r--src/gpu/effects/GrDitherEffect.cpp52
-rw-r--r--src/gpu/effects/GrDitherEffect.h4
-rw-r--r--src/gpu/effects/GrGeometryProcessor.h41
-rw-r--r--src/gpu/effects/GrMatrixConvolutionEffect.cpp83
-rw-r--r--src/gpu/effects/GrMatrixConvolutionEffect.h46
-rw-r--r--src/gpu/effects/GrOvalEffect.cpp190
-rw-r--r--src/gpu/effects/GrOvalEffect.h4
-rw-r--r--src/gpu/effects/GrRRectEffect.cpp193
-rw-r--r--src/gpu/effects/GrRRectEffect.h4
-rw-r--r--src/gpu/effects/GrSimpleTextureEffect.cpp34
-rw-r--r--src/gpu/effects/GrSimpleTextureEffect.h30
-rw-r--r--src/gpu/effects/GrSingleTextureEffect.h6
-rw-r--r--src/gpu/effects/GrTextureDomain.cpp76
-rw-r--r--src/gpu/effects/GrTextureDomain.h37
-rw-r--r--src/gpu/effects/GrYUVtoRGBEffect.cpp47
-rw-r--r--src/gpu/effects/GrYUVtoRGBEffect.h6
32 files changed, 1002 insertions, 1015 deletions
diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp
index c342291523..fe509b60a4 100644
--- a/src/gpu/effects/GrBezierEffect.cpp
+++ b/src/gpu/effects/GrBezierEffect.cpp
@@ -8,43 +8,43 @@
#include "GrBezierEffect.h"
#include "gl/builders/GrGLFullProgramBuilder.h"
-#include "gl/GrGLEffect.h"
+#include "gl/GrGLProcessor.h"
#include "gl/GrGLSL.h"
#include "gl/GrGLGeometryProcessor.h"
-#include "GrTBackendEffectFactory.h"
+#include "GrTBackendProcessorFactory.h"
class GrGLConicEffect : public GrGLGeometryProcessor {
public:
- GrGLConicEffect(const GrBackendEffectFactory&, const GrEffect&);
+ GrGLConicEffect(const GrBackendProcessorFactory&, const GrProcessor&);
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrGeometryProcessor& geometryProcessor,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE {}
+ virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE {}
private:
- GrEffectEdgeType fEdgeType;
+ GrPrimitiveEdgeType fEdgeType;
typedef GrGLGeometryProcessor INHERITED;
};
-GrGLConicEffect::GrGLConicEffect(const GrBackendEffectFactory& factory,
- const GrEffect& effect)
+GrGLConicEffect::GrGLConicEffect(const GrBackendProcessorFactory& factory,
+ const GrProcessor& effect)
: INHERITED (factory) {
const GrConicEffect& ce = effect.cast<GrConicEffect>();
fEdgeType = ce.getEdgeType();
}
void GrGLConicEffect::emitCode(GrGLFullProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrGeometryProcessor& geometryProcessor,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@@ -54,15 +54,15 @@ void GrGLConicEffect::emitCode(GrGLFullProgramBuilder* builder,
builder->addVarying(kVec4f_GrSLType, "ConicCoeffs",
&vsName, &fsName);
- const GrShaderVar& inConicCoeffs = effect.cast<GrConicEffect>().inConicCoeffs();
+ const GrShaderVar& inConicCoeffs = geometryProcessor.cast<GrConicEffect>().inConicCoeffs();
GrGLVertexShaderBuilder* vsBuilder = builder->getVertexShaderBuilder();
vsBuilder->codeAppendf("%s = %s;", vsName, inConicCoeffs.c_str());
- GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
+ GrGLProcessorFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
fsBuilder->codeAppend("float edgeAlpha;");
switch (fEdgeType) {
- case kHairlineAA_GrEffectEdgeType: {
+ case kHairlineAA_GrProcessorEdgeType: {
SkAssertResult(fsBuilder->enableFeature(
GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
fsBuilder->codeAppendf("vec3 dklmdx = dFdx(%s.xyz);", fsName);
@@ -84,7 +84,7 @@ void GrGLConicEffect::emitCode(GrGLFullProgramBuilder* builder,
// fsBuilder->codeAppend("edgeAlpha = edgeAlpha*edgeAlpha*(3.0-2.0*edgeAlpha);");
break;
}
- case kFillAA_GrEffectEdgeType: {
+ case kFillAA_GrProcessorEdgeType: {
SkAssertResult(fsBuilder->enableFeature(
GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
fsBuilder->codeAppendf("vec3 dklmdx = dFdx(%s.xyz);", fsName);
@@ -105,7 +105,7 @@ void GrGLConicEffect::emitCode(GrGLFullProgramBuilder* builder,
// fsBuilder->codeAppend("edgeAlpha = edgeAlpha*edgeAlpha*(3.0-2.0*edgeAlpha);");
break;
}
- case kFillBW_GrEffectEdgeType: {
+ case kFillBW_GrProcessorEdgeType: {
fsBuilder->codeAppendf("edgeAlpha = %s.x * %s.x - %s.y * %s.z;", fsName, fsName,
fsName, fsName);
fsBuilder->codeAppend("edgeAlpha = float(edgeAlpha < 0.0);");
@@ -119,9 +119,9 @@ void GrGLConicEffect::emitCode(GrGLFullProgramBuilder* builder,
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("edgeAlpha")).c_str());
}
-void GrGLConicEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
- GrEffectKeyBuilder* b) {
- const GrConicEffect& ce = effect.cast<GrConicEffect>();
+void GrGLConicEffect::GenKey(const GrProcessor& processor, const GrGLCaps&,
+ GrProcessorKeyBuilder* b) {
+ const GrConicEffect& ce = processor.cast<GrConicEffect>();
uint32_t key = ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2;
b->add32(key);
}
@@ -130,37 +130,37 @@ void GrGLConicEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
GrConicEffect::~GrConicEffect() {}
-const GrBackendEffectFactory& GrConicEffect::getFactory() const {
- return GrTBackendEffectFactory<GrConicEffect>::getInstance();
+const GrBackendGeometryProcessorFactory& GrConicEffect::getFactory() const {
+ return GrTBackendGeometryProcessorFactory<GrConicEffect>::getInstance();
}
-GrConicEffect::GrConicEffect(GrEffectEdgeType edgeType)
+GrConicEffect::GrConicEffect(GrPrimitiveEdgeType edgeType)
: fEdgeType(edgeType)
, fInConicCoeffs(this->addVertexAttrib(GrShaderVar("inConicCoeffs",
kVec4f_GrSLType,
GrShaderVar::kAttribute_TypeModifier))) {
}
-bool GrConicEffect::onIsEqual(const GrEffect& other) const {
+bool GrConicEffect::onIsEqual(const GrProcessor& other) const {
const GrConicEffect& ce = other.cast<GrConicEffect>();
return (ce.fEdgeType == fEdgeType);
}
//////////////////////////////////////////////////////////////////////////////
-GR_DEFINE_EFFECT_TEST(GrConicEffect);
+GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrConicEffect);
-GrEffect* GrConicEffect::TestCreate(SkRandom* random,
- GrContext*,
- const GrDrawTargetCaps& caps,
- GrTexture*[]) {
- GrEffect* effect;
+GrGeometryProcessor* GrConicEffect::TestCreate(SkRandom* random,
+ GrContext*,
+ const GrDrawTargetCaps& caps,
+ GrTexture*[]) {
+ GrGeometryProcessor* gp;
do {
- GrEffectEdgeType edgeType = static_cast<GrEffectEdgeType>(
- random->nextULessThan(kGrEffectEdgeTypeCnt));
- effect = GrConicEffect::Create(edgeType, caps);
- } while (NULL == effect);
- return effect;
+ GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
+ random->nextULessThan(kGrProcessorEdgeTypeCnt));
+ gp = GrConicEffect::Create(edgeType, caps);
+ } while (NULL == gp);
+ return gp;
}
//////////////////////////////////////////////////////////////////////////////
@@ -169,36 +169,36 @@ GrEffect* GrConicEffect::TestCreate(SkRandom* random,
class GrGLQuadEffect : public GrGLGeometryProcessor {
public:
- GrGLQuadEffect(const GrBackendEffectFactory&, const GrEffect&);
+ GrGLQuadEffect(const GrBackendProcessorFactory&, const GrProcessor&);
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrGeometryProcessor& geometryProcessor,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE {}
+ virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE {}
private:
- GrEffectEdgeType fEdgeType;
+ GrPrimitiveEdgeType fEdgeType;
typedef GrGLGeometryProcessor INHERITED;
};
-GrGLQuadEffect::GrGLQuadEffect(const GrBackendEffectFactory& factory,
- const GrEffect& effect)
+GrGLQuadEffect::GrGLQuadEffect(const GrBackendProcessorFactory& factory,
+ const GrProcessor& effect)
: INHERITED (factory) {
const GrQuadEffect& ce = effect.cast<GrQuadEffect>();
fEdgeType = ce.getEdgeType();
}
void GrGLQuadEffect::emitCode(GrGLFullProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrGeometryProcessor& geometryProcessor,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@@ -207,14 +207,14 @@ void GrGLQuadEffect::emitCode(GrGLFullProgramBuilder* builder,
builder->addVarying(kVec4f_GrSLType, "HairQuadEdge", &vsName, &fsName);
GrGLVertexShaderBuilder* vsBuilder = builder->getVertexShaderBuilder();
- const GrShaderVar& inHairQuadEdge = effect.cast<GrQuadEffect>().inHairQuadEdge();
+ const GrShaderVar& inHairQuadEdge = geometryProcessor.cast<GrQuadEffect>().inHairQuadEdge();
vsBuilder->codeAppendf("%s = %s;", vsName, inHairQuadEdge.c_str());
- GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
+ GrGLProcessorFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
fsBuilder->codeAppendf("float edgeAlpha;");
switch (fEdgeType) {
- case kHairlineAA_GrEffectEdgeType: {
+ case kHairlineAA_GrProcessorEdgeType: {
SkAssertResult(fsBuilder->enableFeature(
GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
fsBuilder->codeAppendf("vec2 duvdx = dFdx(%s.xy);", fsName);
@@ -229,7 +229,7 @@ void GrGLQuadEffect::emitCode(GrGLFullProgramBuilder* builder,
// fsBuilder->codeAppend("edgeAlpha = edgeAlpha*edgeAlpha*(3.0-2.0*edgeAlpha);");
break;
}
- case kFillAA_GrEffectEdgeType: {
+ case kFillAA_GrProcessorEdgeType: {
SkAssertResult(fsBuilder->enableFeature(
GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
fsBuilder->codeAppendf("vec2 duvdx = dFdx(%s.xy);", fsName);
@@ -244,7 +244,7 @@ void GrGLQuadEffect::emitCode(GrGLFullProgramBuilder* builder,
// fsBuilder->codeAppend("edgeAlpha = edgeAlpha*edgeAlpha*(3.0-2.0*edgeAlpha);");
break;
}
- case kFillBW_GrEffectEdgeType: {
+ case kFillBW_GrProcessorEdgeType: {
fsBuilder->codeAppendf("edgeAlpha = (%s.x * %s.x - %s.y);", fsName, fsName, fsName);
fsBuilder->codeAppend("edgeAlpha = float(edgeAlpha < 0.0);");
break;
@@ -257,9 +257,9 @@ void GrGLQuadEffect::emitCode(GrGLFullProgramBuilder* builder,
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("edgeAlpha")).c_str());
}
-void GrGLQuadEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
- GrEffectKeyBuilder* b) {
- const GrQuadEffect& ce = effect.cast<GrQuadEffect>();
+void GrGLQuadEffect::GenKey(const GrProcessor& processor, const GrGLCaps&,
+ GrProcessorKeyBuilder* b) {
+ const GrQuadEffect& ce = processor.cast<GrQuadEffect>();
uint32_t key = ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2;
b->add32(key);
}
@@ -268,37 +268,37 @@ void GrGLQuadEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
GrQuadEffect::~GrQuadEffect() {}
-const GrBackendEffectFactory& GrQuadEffect::getFactory() const {
- return GrTBackendEffectFactory<GrQuadEffect>::getInstance();
+const GrBackendGeometryProcessorFactory& GrQuadEffect::getFactory() const {
+ return GrTBackendGeometryProcessorFactory<GrQuadEffect>::getInstance();
}
-GrQuadEffect::GrQuadEffect(GrEffectEdgeType edgeType)
+GrQuadEffect::GrQuadEffect(GrPrimitiveEdgeType edgeType)
: fEdgeType(edgeType)
, fInHairQuadEdge(this->addVertexAttrib(GrShaderVar("inCubicCoeffs",
kVec4f_GrSLType,
GrShaderVar::kAttribute_TypeModifier))) {
}
-bool GrQuadEffect::onIsEqual(const GrEffect& other) const {
+bool GrQuadEffect::onIsEqual(const GrProcessor& other) const {
const GrQuadEffect& ce = other.cast<GrQuadEffect>();
return (ce.fEdgeType == fEdgeType);
}
//////////////////////////////////////////////////////////////////////////////
-GR_DEFINE_EFFECT_TEST(GrQuadEffect);
+GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrQuadEffect);
-GrEffect* GrQuadEffect::TestCreate(SkRandom* random,
- GrContext*,
- const GrDrawTargetCaps& caps,
- GrTexture*[]) {
- GrEffect* effect;
+GrGeometryProcessor* GrQuadEffect::TestCreate(SkRandom* random,
+ GrContext*,
+ const GrDrawTargetCaps& caps,
+ GrTexture*[]) {
+ GrGeometryProcessor* gp;
do {
- GrEffectEdgeType edgeType = static_cast<GrEffectEdgeType>(
- random->nextULessThan(kGrEffectEdgeTypeCnt));
- effect = GrQuadEffect::Create(edgeType, caps);
- } while (NULL == effect);
- return effect;
+ GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
+ random->nextULessThan(kGrProcessorEdgeTypeCnt));
+ gp = GrQuadEffect::Create(edgeType, caps);
+ } while (NULL == gp);
+ return gp;
}
//////////////////////////////////////////////////////////////////////////////
@@ -307,36 +307,36 @@ GrEffect* GrQuadEffect::TestCreate(SkRandom* random,
class GrGLCubicEffect : public GrGLGeometryProcessor {
public:
- GrGLCubicEffect(const GrBackendEffectFactory&, const GrEffect&);
+ GrGLCubicEffect(const GrBackendProcessorFactory&, const GrProcessor&);
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrGeometryProcessor& geometryProcessor,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE {}
+ virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE {}
private:
- GrEffectEdgeType fEdgeType;
+ GrPrimitiveEdgeType fEdgeType;
typedef GrGLGeometryProcessor INHERITED;
};
-GrGLCubicEffect::GrGLCubicEffect(const GrBackendEffectFactory& factory,
- const GrEffect& effect)
+GrGLCubicEffect::GrGLCubicEffect(const GrBackendProcessorFactory& factory,
+ const GrProcessor& processor)
: INHERITED (factory) {
- const GrCubicEffect& ce = effect.cast<GrCubicEffect>();
+ const GrCubicEffect& ce = processor.cast<GrCubicEffect>();
fEdgeType = ce.getEdgeType();
}
void GrGLCubicEffect::emitCode(GrGLFullProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrGeometryProcessor& geometryProcessor,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@@ -347,10 +347,10 @@ void GrGLCubicEffect::emitCode(GrGLFullProgramBuilder* builder,
&vsName, &fsName, GrGLShaderVar::kHigh_Precision);
GrGLVertexShaderBuilder* vsBuilder = builder->getVertexShaderBuilder();
- const GrShaderVar& inCubicCoeffs = effect.cast<GrCubicEffect>().inCubicCoeffs();
+ const GrShaderVar& inCubicCoeffs = geometryProcessor.cast<GrCubicEffect>().inCubicCoeffs();
vsBuilder->codeAppendf("%s = %s;", vsName, inCubicCoeffs.c_str());
- GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
+ GrGLProcessorFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
GrGLShaderVar edgeAlpha("edgeAlpha", kFloat_GrSLType, 0, GrGLShaderVar::kHigh_Precision);
GrGLShaderVar dklmdx("dklmdx", kVec3f_GrSLType, 0, GrGLShaderVar::kHigh_Precision);
@@ -371,7 +371,7 @@ void GrGLCubicEffect::emitCode(GrGLFullProgramBuilder* builder,
fsBuilder->declAppend(func);
switch (fEdgeType) {
- case kHairlineAA_GrEffectEdgeType: {
+ case kHairlineAA_GrProcessorEdgeType: {
SkAssertResult(fsBuilder->enableFeature(
GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
fsBuilder->codeAppendf("%s = dFdx(%s.xyz);", dklmdx.c_str(), fsName);
@@ -397,7 +397,7 @@ void GrGLCubicEffect::emitCode(GrGLFullProgramBuilder* builder,
// edgeAlpha.c_str());
break;
}
- case kFillAA_GrEffectEdgeType: {
+ case kFillAA_GrProcessorEdgeType: {
SkAssertResult(fsBuilder->enableFeature(
GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
fsBuilder->codeAppendf("%s = dFdx(%s.xyz);", dklmdx.c_str(), fsName);
@@ -423,7 +423,7 @@ void GrGLCubicEffect::emitCode(GrGLFullProgramBuilder* builder,
// edgeAlpha.c_str());
break;
}
- case kFillBW_GrEffectEdgeType: {
+ case kFillBW_GrProcessorEdgeType: {
fsBuilder->codeAppendf("%s = %s.x * %s.x * %s.x - %s.y * %s.z;",
edgeAlpha.c_str(), fsName, fsName, fsName, fsName, fsName);
fsBuilder->codeAppendf("%s = float(%s < 0.0);", edgeAlpha.c_str(), edgeAlpha.c_str());
@@ -437,9 +437,9 @@ void GrGLCubicEffect::emitCode(GrGLFullProgramBuilder* builder,
(GrGLSLExpr4(inputColor) * GrGLSLExpr1(edgeAlpha.c_str())).c_str());
}
-void GrGLCubicEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
- GrEffectKeyBuilder* b) {
- const GrCubicEffect& ce = effect.cast<GrCubicEffect>();
+void GrGLCubicEffect::GenKey(const GrProcessor& processor, const GrGLCaps&,
+ GrProcessorKeyBuilder* b) {
+ const GrCubicEffect& ce = processor.cast<GrCubicEffect>();
uint32_t key = ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2;
b->add32(key);
}
@@ -448,36 +448,36 @@ void GrGLCubicEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
GrCubicEffect::~GrCubicEffect() {}
-const GrBackendEffectFactory& GrCubicEffect::getFactory() const {
- return GrTBackendEffectFactory<GrCubicEffect>::getInstance();
+const GrBackendGeometryProcessorFactory& GrCubicEffect::getFactory() const {
+ return GrTBackendGeometryProcessorFactory<GrCubicEffect>::getInstance();
}
-GrCubicEffect::GrCubicEffect(GrEffectEdgeType edgeType)
+GrCubicEffect::GrCubicEffect(GrPrimitiveEdgeType edgeType)
: fEdgeType(edgeType)
, fInCubicCoeffs(this->addVertexAttrib(GrShaderVar("inCubicCoeffs",
kVec4f_GrSLType,
GrShaderVar::kAttribute_TypeModifier))) {
}
-bool GrCubicEffect::onIsEqual(const GrEffect& other) const {
+bool GrCubicEffect::onIsEqual(const GrProcessor& other) const {
const GrCubicEffect& ce = other.cast<GrCubicEffect>();
return (ce.fEdgeType == fEdgeType);
}
//////////////////////////////////////////////////////////////////////////////
-GR_DEFINE_EFFECT_TEST(GrCubicEffect);
+GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrCubicEffect);
-GrEffect* GrCubicEffect::TestCreate(SkRandom* random,
- GrContext*,
- const GrDrawTargetCaps& caps,
- GrTexture*[]) {
- GrEffect* effect;
+GrGeometryProcessor* GrCubicEffect::TestCreate(SkRandom* random,
+ GrContext*,
+ const GrDrawTargetCaps& caps,
+ GrTexture*[]) {
+ GrGeometryProcessor* gp;
do {
- GrEffectEdgeType edgeType = static_cast<GrEffectEdgeType>(
- random->nextULessThan(kGrEffectEdgeTypeCnt));
- effect = GrCubicEffect::Create(edgeType, caps);
- } while (NULL == effect);
- return effect;
+ GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
+ random->nextULessThan(kGrProcessorEdgeTypeCnt));
+ gp = GrCubicEffect::Create(edgeType, caps);
+ } while (NULL == gp);
+ return gp;
}
diff --git a/src/gpu/effects/GrBezierEffect.h b/src/gpu/effects/GrBezierEffect.h
index 4da16fe88b..cb79ac39c5 100644
--- a/src/gpu/effects/GrBezierEffect.h
+++ b/src/gpu/effects/GrBezierEffect.h
@@ -9,7 +9,7 @@
#define GrBezierEffect_DEFINED
#include "GrDrawTargetCaps.h"
-#include "GrEffect.h"
+#include "GrProcessor.h"
#include "GrGeometryProcessor.h"
#include "GrTypesPriv.h"
@@ -57,24 +57,28 @@ class GrGLConicEffect;
class GrConicEffect : public GrGeometryProcessor {
public:
- static GrEffect* Create(const GrEffectEdgeType edgeType, const GrDrawTargetCaps& caps) {
- GR_CREATE_STATIC_EFFECT(gConicFillAA, GrConicEffect, (kFillAA_GrEffectEdgeType));
- GR_CREATE_STATIC_EFFECT(gConicHairAA, GrConicEffect, (kHairlineAA_GrEffectEdgeType));
- GR_CREATE_STATIC_EFFECT(gConicFillBW, GrConicEffect, (kFillBW_GrEffectEdgeType));
+ 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));
switch (edgeType) {
- case kFillAA_GrEffectEdgeType:
+ case kFillAA_GrProcessorEdgeType:
if (!caps.shaderDerivativeSupport()) {
return NULL;
}
gConicFillAA->ref();
return gConicFillAA;
- case kHairlineAA_GrEffectEdgeType:
+ case kHairlineAA_GrProcessorEdgeType:
if (!caps.shaderDerivativeSupport()) {
return NULL;
}
gConicHairAA->ref();
return gConicHairAA;
- case kFillBW_GrEffectEdgeType:
+ case kFillBW_GrProcessorEdgeType:
gConicFillBW->ref();
return gConicFillBW;
default:
@@ -87,28 +91,28 @@ public:
static const char* Name() { return "Conic"; }
inline const GrShaderVar& inConicCoeffs() const { return fInConicCoeffs; }
- inline bool isAntiAliased() const { return GrEffectEdgeTypeIsAA(fEdgeType); }
- inline bool isFilled() const { return GrEffectEdgeTypeIsFill(fEdgeType); }
- inline GrEffectEdgeType getEdgeType() const { return fEdgeType; }
+ inline bool isAntiAliased() const { return GrProcessorEdgeTypeIsAA(fEdgeType); }
+ inline bool isFilled() const { return GrProcessorEdgeTypeIsFill(fEdgeType); }
+ inline GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
- typedef GrGLConicEffect GLEffect;
+ typedef GrGLConicEffect GLProcessor;
virtual void getConstantColorComponents(GrColor* color,
uint32_t* validFlags) const SK_OVERRIDE {
*validFlags = 0;
}
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+ virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERRIDE;
private:
- GrConicEffect(GrEffectEdgeType);
+ GrConicEffect(GrPrimitiveEdgeType);
- virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE;
+ virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
- GrEffectEdgeType fEdgeType;
+ GrPrimitiveEdgeType fEdgeType;
const GrShaderVar& fInConicCoeffs;
- GR_DECLARE_EFFECT_TEST;
+ GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
typedef GrGeometryProcessor INHERITED;
};
@@ -126,24 +130,28 @@ class GrGLQuadEffect;
class GrQuadEffect : public GrGeometryProcessor {
public:
- static GrEffect* Create(const GrEffectEdgeType edgeType, const GrDrawTargetCaps& caps) {
- GR_CREATE_STATIC_EFFECT(gQuadFillAA, GrQuadEffect, (kFillAA_GrEffectEdgeType));
- GR_CREATE_STATIC_EFFECT(gQuadHairAA, GrQuadEffect, (kHairlineAA_GrEffectEdgeType));
- GR_CREATE_STATIC_EFFECT(gQuadFillBW, GrQuadEffect, (kFillBW_GrEffectEdgeType));
+ 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));
switch (edgeType) {
- case kFillAA_GrEffectEdgeType:
+ case kFillAA_GrProcessorEdgeType:
if (!caps.shaderDerivativeSupport()) {
return NULL;
}
gQuadFillAA->ref();
return gQuadFillAA;
- case kHairlineAA_GrEffectEdgeType:
+ case kHairlineAA_GrProcessorEdgeType:
if (!caps.shaderDerivativeSupport()) {
return NULL;
}
gQuadHairAA->ref();
return gQuadHairAA;
- case kFillBW_GrEffectEdgeType:
+ case kFillBW_GrProcessorEdgeType:
gQuadFillBW->ref();
return gQuadFillBW;
default:
@@ -156,28 +164,28 @@ public:
static const char* Name() { return "Quad"; }
inline const GrShaderVar& inHairQuadEdge() const { return fInHairQuadEdge; }
- inline bool isAntiAliased() const { return GrEffectEdgeTypeIsAA(fEdgeType); }
- inline bool isFilled() const { return GrEffectEdgeTypeIsFill(fEdgeType); }
- inline GrEffectEdgeType getEdgeType() const { return fEdgeType; }
+ inline bool isAntiAliased() const { return GrProcessorEdgeTypeIsAA(fEdgeType); }
+ inline bool isFilled() const { return GrProcessorEdgeTypeIsFill(fEdgeType); }
+ inline GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
- typedef GrGLQuadEffect GLEffect;
+ typedef GrGLQuadEffect GLProcessor;
virtual void getConstantColorComponents(GrColor* color,
uint32_t* validFlags) const SK_OVERRIDE {
*validFlags = 0;
}
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+ virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERRIDE;
private:
- GrQuadEffect(GrEffectEdgeType);
+ GrQuadEffect(GrPrimitiveEdgeType);
- virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE;
+ virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
- GrEffectEdgeType fEdgeType;
+ GrPrimitiveEdgeType fEdgeType;
const GrShaderVar& fInHairQuadEdge;
- GR_DECLARE_EFFECT_TEST;
+ GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
typedef GrGeometryProcessor INHERITED;
};
@@ -197,24 +205,28 @@ class GrGLCubicEffect;
class GrCubicEffect : public GrGeometryProcessor {
public:
- static GrEffect* Create(const GrEffectEdgeType edgeType, const GrDrawTargetCaps& caps) {
- GR_CREATE_STATIC_EFFECT(gCubicFillAA, GrCubicEffect, (kFillAA_GrEffectEdgeType));
- GR_CREATE_STATIC_EFFECT(gCubicHairAA, GrCubicEffect, (kHairlineAA_GrEffectEdgeType));
- GR_CREATE_STATIC_EFFECT(gCubicFillBW, GrCubicEffect, (kFillBW_GrEffectEdgeType));
+ 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));
switch (edgeType) {
- case kFillAA_GrEffectEdgeType:
+ case kFillAA_GrProcessorEdgeType:
if (!caps.shaderDerivativeSupport()) {
return NULL;
}
gCubicFillAA->ref();
return gCubicFillAA;
- case kHairlineAA_GrEffectEdgeType:
+ case kHairlineAA_GrProcessorEdgeType:
if (!caps.shaderDerivativeSupport()) {
return NULL;
}
gCubicHairAA->ref();
return gCubicHairAA;
- case kFillBW_GrEffectEdgeType:
+ case kFillBW_GrProcessorEdgeType:
gCubicFillBW->ref();
return gCubicFillBW;
default:
@@ -227,28 +239,28 @@ public:
static const char* Name() { return "Cubic"; }
inline const GrShaderVar& inCubicCoeffs() const { return fInCubicCoeffs; }
- inline bool isAntiAliased() const { return GrEffectEdgeTypeIsAA(fEdgeType); }
- inline bool isFilled() const { return GrEffectEdgeTypeIsFill(fEdgeType); }
- inline GrEffectEdgeType getEdgeType() const { return fEdgeType; }
+ inline bool isAntiAliased() const { return GrProcessorEdgeTypeIsAA(fEdgeType); }
+ inline bool isFilled() const { return GrProcessorEdgeTypeIsFill(fEdgeType); }
+ inline GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
- typedef GrGLCubicEffect GLEffect;
+ typedef GrGLCubicEffect GLProcessor;
virtual void getConstantColorComponents(GrColor* color,
uint32_t* validFlags) const SK_OVERRIDE {
*validFlags = 0;
}
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+ virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERRIDE;
private:
- GrCubicEffect(GrEffectEdgeType);
+ GrCubicEffect(GrPrimitiveEdgeType);
- virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE;
+ virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
- GrEffectEdgeType fEdgeType;
+ GrPrimitiveEdgeType fEdgeType;
const GrShaderVar& fInCubicCoeffs;
- GR_DECLARE_EFFECT_TEST;
+ GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
typedef GrGeometryProcessor INHERITED;
};
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp
index e08a602207..d73e604b04 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -19,23 +19,23 @@ const SkScalar GrBicubicEffect::gMitchellCoefficients[16] = {
};
-class GrGLBicubicEffect : public GrGLEffect {
+class GrGLBicubicEffect : public GrGLFragmentProcessor {
public:
- GrGLBicubicEffect(const GrBackendEffectFactory& factory,
- const GrEffect&);
+ GrGLBicubicEffect(const GrBackendProcessorFactory& factory,
+ const GrProcessor&);
virtual void emitCode(GrGLProgramBuilder*,
- const GrEffect&,
- const GrEffectKey&,
+ const GrFragmentProcessor&,
+ const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE;
- static inline void GenKey(const GrEffect& effect, const GrGLCaps&,
- GrEffectKeyBuilder* b) {
+ static inline void GenKey(const GrProcessor& effect, const GrGLCaps&,
+ GrProcessorKeyBuilder* b) {
const GrTextureDomain& domain = effect.cast<GrBicubicEffect>().domain();
b->add32(GrTextureDomain::GLDomain::DomainKey(domain));
}
@@ -47,16 +47,16 @@ private:
UniformHandle fImageIncrementUni;
GrTextureDomain::GLDomain fDomain;
- typedef GrGLEffect INHERITED;
+ typedef GrGLFragmentProcessor INHERITED;
};
-GrGLBicubicEffect::GrGLBicubicEffect(const GrBackendEffectFactory& factory, const GrEffect&)
+GrGLBicubicEffect::GrGLBicubicEffect(const GrBackendProcessorFactory& factory, const GrProcessor&)
: INHERITED(factory) {
}
void GrGLBicubicEffect::emitCode(GrGLProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrFragmentProcessor& effect,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,
@@ -116,9 +116,9 @@ void GrGLBicubicEffect::emitCode(GrGLProgramBuilder* builder,
}
void GrGLBicubicEffect::setData(const GrGLProgramDataManager& pdman,
- const GrEffect& effect) {
- const GrBicubicEffect& bicubicEffect = effect.cast<GrBicubicEffect>();
- const GrTexture& texture = *effect.texture(0);
+ const GrProcessor& processor) {
+ const GrBicubicEffect& bicubicEffect = processor.cast<GrBicubicEffect>();
+ const GrTexture& texture = *processor.texture(0);
float imageIncrement[2];
imageIncrement[0] = 1.0f / texture.width();
imageIncrement[1] = 1.0f / texture.height();
@@ -158,11 +158,11 @@ GrBicubicEffect::GrBicubicEffect(GrTexture* texture,
GrBicubicEffect::~GrBicubicEffect() {
}
-const GrBackendEffectFactory& GrBicubicEffect::getFactory() const {
- return GrTBackendEffectFactory<GrBicubicEffect>::getInstance();
+const GrBackendFragmentProcessorFactory& GrBicubicEffect::getFactory() const {
+ return GrTBackendFragmentProcessorFactory<GrBicubicEffect>::getInstance();
}
-bool GrBicubicEffect::onIsEqual(const GrEffect& sBase) const {
+bool GrBicubicEffect::onIsEqual(const GrProcessor& sBase) const {
const GrBicubicEffect& s = sBase.cast<GrBicubicEffect>();
return this->textureAccess(0) == s.textureAccess(0) &&
!memcmp(fCoefficients, s.coefficients(), 16) &&
@@ -175,14 +175,14 @@ void GrBicubicEffect::getConstantColorComponents(GrColor* color, uint32_t* valid
return;
}
-GR_DEFINE_EFFECT_TEST(GrBicubicEffect);
+GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrBicubicEffect);
-GrEffect* GrBicubicEffect::TestCreate(SkRandom* random,
- GrContext* context,
- const GrDrawTargetCaps&,
- GrTexture* textures[]) {
- int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
- GrEffectUnitTest::kAlphaTextureIdx;
+GrFragmentProcessor* GrBicubicEffect::TestCreate(SkRandom* random,
+ GrContext* context,
+ const GrDrawTargetCaps&,
+ GrTexture* textures[]) {
+ int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
+ GrProcessorUnitTest::kAlphaTextureIdx;
SkScalar coefficients[16];
for (int i = 0; i < 16; i++) {
coefficients[i] = random->nextSScalar1();
diff --git a/src/gpu/effects/GrBicubicEffect.h b/src/gpu/effects/GrBicubicEffect.h
index 2c1a299f5c..03476da38f 100644
--- a/src/gpu/effects/GrBicubicEffect.h
+++ b/src/gpu/effects/GrBicubicEffect.h
@@ -10,8 +10,8 @@
#include "GrSingleTextureEffect.h"
#include "GrTextureDomain.h"
-#include "gl/GrGLEffect.h"
-#include "GrTBackendEffectFactory.h"
+#include "gl/GrGLProcessor.h"
+#include "GrTBackendProcessorFactory.h"
class GrGLBicubicEffect;
@@ -26,9 +26,9 @@ public:
static const char* Name() { return "Bicubic"; }
const float* coefficients() const { return fCoefficients; }
- typedef GrGLBicubicEffect GLEffect;
+ typedef GrGLBicubicEffect GLProcessor;
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+ virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE;
virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
const GrTextureDomain& domain() const { return fDomain; }
@@ -36,7 +36,7 @@ public:
/**
* Create a simple filter effect with custom bicubic coefficients and optional domain.
*/
- static GrEffect* Create(GrTexture* tex, const SkScalar coefficients[16],
+ static GrFragmentProcessor* Create(GrTexture* tex, const SkScalar coefficients[16],
const SkRect* domain = NULL) {
if (NULL == domain) {
static const SkShader::TileMode kTileModes[] = { SkShader::kClamp_TileMode,
@@ -53,7 +53,7 @@ public:
/**
* Create a Mitchell filter effect with specified texture matrix and x/y tile modes.
*/
- static GrEffect* Create(GrTexture* tex, const SkMatrix& matrix,
+ static GrFragmentProcessor* Create(GrTexture* tex, const SkMatrix& matrix,
SkShader::TileMode tileModes[2]) {
return Create(tex, gMitchellCoefficients, matrix, tileModes);
}
@@ -62,15 +62,17 @@ public:
* Create a filter effect with custom bicubic coefficients, the texture matrix, and the x/y
* tilemodes.
*/
- static GrEffect* Create(GrTexture* tex, const SkScalar coefficients[16],
- const SkMatrix& matrix, const SkShader::TileMode tileModes[2]) {
+ static GrFragmentProcessor* Create(GrTexture* tex, const SkScalar coefficients[16],
+ const SkMatrix& matrix,
+ const SkShader::TileMode tileModes[2]) {
return SkNEW_ARGS(GrBicubicEffect, (tex, coefficients, matrix, tileModes));
}
/**
* Create a Mitchell filter effect with a texture matrix and a domain.
*/
- static GrEffect* Create(GrTexture* tex, const SkMatrix& matrix, const SkRect& domain) {
+ static GrFragmentProcessor* Create(GrTexture* tex, const SkMatrix& matrix,
+ const SkRect& domain) {
return SkNEW_ARGS(GrBicubicEffect, (tex, gMitchellCoefficients, matrix, domain));
}
@@ -89,12 +91,12 @@ private:
const SkMatrix &matrix, const SkShader::TileMode tileModes[2]);
GrBicubicEffect(GrTexture*, const SkScalar coefficients[16],
const SkMatrix &matrix, const SkRect& domain);
- virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE;
+ virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
float fCoefficients[16];
GrTextureDomain fDomain;
- GR_DECLARE_EFFECT_TEST;
+ GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
static const SkScalar gMitchellCoefficients[16];
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index 40003068a0..3042d86f03 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -7,25 +7,26 @@
#include "GrConfigConversionEffect.h"
#include "GrContext.h"
-#include "GrTBackendEffectFactory.h"
+#include "GrTBackendProcessorFactory.h"
#include "GrSimpleTextureEffect.h"
-#include "gl/GrGLEffect.h"
+#include "gl/GrGLProcessor.h"
#include "gl/builders/GrGLProgramBuilder.h"
#include "SkMatrix.h"
-class GrGLConfigConversionEffect : public GrGLEffect {
+class GrGLConfigConversionEffect : public GrGLFragmentProcessor {
public:
- GrGLConfigConversionEffect(const GrBackendEffectFactory& factory,
- const GrEffect& effect)
+ GrGLConfigConversionEffect(const GrBackendProcessorFactory& factory,
+ const GrProcessor& processor)
: INHERITED (factory) {
- const GrConfigConversionEffect& configConversionEffect = effect.cast<GrConfigConversionEffect>();
+ const GrConfigConversionEffect& configConversionEffect =
+ processor.cast<GrConfigConversionEffect>();
fSwapRedAndBlue = configConversionEffect.swapsRedAndBlue();
fPMConversion = configConversionEffect.pmConversion();
}
virtual void emitCode(GrGLProgramBuilder* builder,
- const GrEffect&,
- const GrEffectKey& key,
+ const GrFragmentProcessor&,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,
@@ -84,9 +85,9 @@ public:
fsBuilder->codeAppend(modulate.c_str());
}
- static inline void GenKey(const GrEffect& effect, const GrGLCaps&,
- GrEffectKeyBuilder* b) {
- const GrConfigConversionEffect& conv = effect.cast<GrConfigConversionEffect>();
+ static inline void GenKey(const GrProcessor& processor, const GrGLCaps&,
+ GrProcessorKeyBuilder* b) {
+ const GrConfigConversionEffect& conv = processor.cast<GrConfigConversionEffect>();
uint32_t key = (conv.swapsRedAndBlue() ? 0 : 1) | (conv.pmConversion() << 1);
b->add32(key);
}
@@ -95,7 +96,7 @@ private:
bool fSwapRedAndBlue;
GrConfigConversionEffect::PMConversion fPMConversion;
- typedef GrGLEffect INHERITED;
+ typedef GrGLFragmentProcessor INHERITED;
};
@@ -114,11 +115,11 @@ GrConfigConversionEffect::GrConfigConversionEffect(GrTexture* texture,
SkASSERT(swapRedAndBlue || kNone_PMConversion != pmConversion);
}
-const GrBackendEffectFactory& GrConfigConversionEffect::getFactory() const {
- return GrTBackendEffectFactory<GrConfigConversionEffect>::getInstance();
+const GrBackendFragmentProcessorFactory& GrConfigConversionEffect::getFactory() const {
+ return GrTBackendFragmentProcessorFactory<GrConfigConversionEffect>::getInstance();
}
-bool GrConfigConversionEffect::onIsEqual(const GrEffect& s) const {
+bool GrConfigConversionEffect::onIsEqual(const GrProcessor& s) const {
const GrConfigConversionEffect& other = s.cast<GrConfigConversionEffect>();
return this->texture(0) == s.texture(0) &&
other.fSwapRedAndBlue == fSwapRedAndBlue &&
@@ -132,12 +133,12 @@ void GrConfigConversionEffect::getConstantColorComponents(GrColor* color,
///////////////////////////////////////////////////////////////////////////////
-GR_DEFINE_EFFECT_TEST(GrConfigConversionEffect);
+GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConfigConversionEffect);
-GrEffect* GrConfigConversionEffect::TestCreate(SkRandom* random,
- GrContext*,
- const GrDrawTargetCaps&,
- GrTexture* textures[]) {
+GrFragmentProcessor* GrConfigConversionEffect::TestCreate(SkRandom* random,
+ GrContext*,
+ const GrDrawTargetCaps&,
+ GrTexture* textures[]) {
PMConversion pmConv = static_cast<PMConversion>(random->nextULessThan(kPMConversionCnt));
bool swapRB;
if (kNone_PMConversion == pmConv) {
@@ -146,10 +147,10 @@ GrEffect* GrConfigConversionEffect::TestCreate(SkRandom* random,
swapRB = random->nextBool();
}
return SkNEW_ARGS(GrConfigConversionEffect,
- (textures[GrEffectUnitTest::kSkiaPMTextureIdx],
+ (textures[GrProcessorUnitTest::kSkiaPMTextureIdx],
swapRB,
pmConv,
- GrEffectUnitTest::TestMatrix(random)));
+ GrProcessorUnitTest::TestMatrix(random)));
}
///////////////////////////////////////////////////////////////////////////////
@@ -215,34 +216,31 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
// from readTex to tempTex followed by a PM->UPM draw to readTex and finally read the data.
// We then verify that two reads produced the same values.
- SkAutoTUnref<GrEffect> pmToUPM1(SkNEW_ARGS(GrConfigConversionEffect, (dataTex,
- false,
- *pmToUPMRule,
- SkMatrix::I())));
- SkAutoTUnref<GrEffect> upmToPM(SkNEW_ARGS(GrConfigConversionEffect, (readTex,
- false,
- *upmToPMRule,
- SkMatrix::I())));
- SkAutoTUnref<GrEffect> pmToUPM2(SkNEW_ARGS(GrConfigConversionEffect, (tempTex,
- false,
- *pmToUPMRule,
- SkMatrix::I())));
+ SkAutoTUnref<GrFragmentProcessor> pmToUPM1(
+ SkNEW_ARGS(GrConfigConversionEffect,
+ (dataTex, false, *pmToUPMRule, SkMatrix::I())));
+ SkAutoTUnref<GrFragmentProcessor> upmToPM(
+ SkNEW_ARGS(GrConfigConversionEffect,
+ (readTex, false, *upmToPMRule, SkMatrix::I())));
+ SkAutoTUnref<GrFragmentProcessor> pmToUPM2(
+ SkNEW_ARGS(GrConfigConversionEffect,
+ (tempTex, false, *pmToUPMRule, SkMatrix::I())));
context->setRenderTarget(readTex->asRenderTarget());
GrPaint paint1;
- paint1.addColorEffect(pmToUPM1);
+ paint1.addColorProcessor(pmToUPM1);
context->drawRectToRect(paint1, kDstRect, kSrcRect);
readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, firstRead);
context->setRenderTarget(tempTex->asRenderTarget());
GrPaint paint2;
- paint2.addColorEffect(upmToPM);
+ paint2.addColorProcessor(upmToPM);
context->drawRectToRect(paint2, kDstRect, kSrcRect);
context->setRenderTarget(readTex->asRenderTarget());
GrPaint paint3;
- paint3.addColorEffect(pmToUPM2);
+ paint3.addColorProcessor(pmToUPM2);
context->drawRectToRect(paint3, kDstRect, kSrcRect);
readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, secondRead);
@@ -263,7 +261,7 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
}
}
-const GrEffect* GrConfigConversionEffect::Create(GrTexture* texture,
+const GrFragmentProcessor* GrConfigConversionEffect::Create(GrTexture* texture,
bool swapRedAndBlue,
PMConversion pmConversion,
const SkMatrix& matrix) {
diff --git a/src/gpu/effects/GrConfigConversionEffect.h b/src/gpu/effects/GrConfigConversionEffect.h
index 4416d05452..765e49b45b 100644
--- a/src/gpu/effects/GrConfigConversionEffect.h
+++ b/src/gpu/effects/GrConfigConversionEffect.h
@@ -10,7 +10,7 @@
#include "GrSingleTextureEffect.h"
-class GrEffectStage;
+class GrProcessorStage;
class GrGLConfigConversionEffect;
/**
@@ -34,16 +34,14 @@ public:
kPMConversionCnt
};
- // Installs an effect in the GrEffectStage to perform a config conversion.
- static const GrEffect* Create(GrTexture*,
- bool swapRedAndBlue,
- PMConversion pmConversion,
- const SkMatrix& matrix);
+ // Installs an effect in the GrProcessorStage to perform a config conversion.
+ static const GrFragmentProcessor* Create(GrTexture*, bool swapRedAndBlue, PMConversion,
+ const SkMatrix&);
static const char* Name() { return "Config Conversion"; }
- typedef GrGLConfigConversionEffect GLEffect;
+ typedef GrGLConfigConversionEffect GLProcessor;
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+ virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE;
virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
@@ -65,12 +63,12 @@ private:
PMConversion pmConversion,
const SkMatrix& matrix);
- virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE;
+ virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
bool fSwapRedAndBlue;
PMConversion fPMConversion;
- GR_DECLARE_EFFECT_TEST;
+ GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
typedef GrSingleTextureEffect INHERITED;
};
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index afe3674d59..4857a9e96d 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -8,24 +8,24 @@
#include "gl/builders/GrGLProgramBuilder.h"
#include "GrConvexPolyEffect.h"
-#include "gl/GrGLEffect.h"
+#include "gl/GrGLProcessor.h"
#include "gl/GrGLSL.h"
-#include "GrTBackendEffectFactory.h"
+#include "GrTBackendProcessorFactory.h"
#include "SkPath.h"
//////////////////////////////////////////////////////////////////////////////
class GLAARectEffect;
-class AARectEffect : public GrEffect {
+class AARectEffect : public GrFragmentProcessor {
public:
- typedef GLAARectEffect GLEffect;
+ typedef GLAARectEffect GLProcessor;
const SkRect& getRect() const { return fRect; }
static const char* Name() { return "AARect"; }
- static GrEffect* Create(GrEffectEdgeType edgeType, const SkRect& rect) {
+ static GrFragmentProcessor* Create(GrPrimitiveEdgeType edgeType, const SkRect& rect) {
return SkNEW_ARGS(AARectEffect, (edgeType, rect));
}
@@ -40,87 +40,87 @@ public:
}
}
- GrEffectEdgeType getEdgeType() const { return fEdgeType; }
+ GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+ virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE;
private:
- AARectEffect(GrEffectEdgeType edgeType, const SkRect& rect) : fRect(rect), fEdgeType(edgeType) {
+ AARectEffect(GrPrimitiveEdgeType edgeType, const SkRect& rect) : fRect(rect), fEdgeType(edgeType) {
this->setWillReadFragmentPosition();
}
- virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE {
+ virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE {
const AARectEffect& aare = other.cast<AARectEffect>();
return fRect == aare.fRect;
}
- SkRect fRect;
- GrEffectEdgeType fEdgeType;
+ SkRect fRect;
+ GrPrimitiveEdgeType fEdgeType;
- typedef GrEffect INHERITED;
+ typedef GrFragmentProcessor INHERITED;
- GR_DECLARE_EFFECT_TEST;
+ GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
};
-GR_DEFINE_EFFECT_TEST(AARectEffect);
+GR_DEFINE_FRAGMENT_PROCESSOR_TEST(AARectEffect);
-GrEffect* AARectEffect::TestCreate(SkRandom* random,
- GrContext*,
- const GrDrawTargetCaps& caps,
- GrTexture*[]) {
+GrFragmentProcessor* AARectEffect::TestCreate(SkRandom* random,
+ GrContext*,
+ const GrDrawTargetCaps& caps,
+ GrTexture*[]) {
SkRect rect = SkRect::MakeLTRB(random->nextSScalar1(),
random->nextSScalar1(),
random->nextSScalar1(),
random->nextSScalar1());
- GrEffect* effect;
+ GrFragmentProcessor* fp;
do {
- GrEffectEdgeType edgeType = static_cast<GrEffectEdgeType>(random->nextULessThan(
- kGrEffectEdgeTypeCnt));
+ GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(random->nextULessThan(
+ kGrProcessorEdgeTypeCnt));
- effect = AARectEffect::Create(edgeType, rect);
- } while (NULL == effect);
- return effect;
+ fp = AARectEffect::Create(edgeType, rect);
+ } while (NULL == fp);
+ return fp;
}
//////////////////////////////////////////////////////////////////////////////
-class GLAARectEffect : public GrGLEffect {
+class GLAARectEffect : public GrGLFragmentProcessor {
public:
- GLAARectEffect(const GrBackendEffectFactory&, const GrEffect&);
+ GLAARectEffect(const GrBackendProcessorFactory&, const GrProcessor&);
virtual void emitCode(GrGLProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrFragmentProcessor& fp,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE;
private:
GrGLProgramDataManager::UniformHandle fRectUniform;
SkRect fPrevRect;
- typedef GrGLEffect INHERITED;
+ typedef GrGLFragmentProcessor INHERITED;
};
-GLAARectEffect::GLAARectEffect(const GrBackendEffectFactory& factory,
- const GrEffect& effect)
+GLAARectEffect::GLAARectEffect(const GrBackendProcessorFactory& factory,
+ const GrProcessor& effect)
: INHERITED (factory) {
fPrevRect.fLeft = SK_ScalarNaN;
}
void GLAARectEffect::emitCode(GrGLProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrFragmentProcessor& fp,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) {
- const AARectEffect& aare = effect.cast<AARectEffect>();
+ const AARectEffect& aare = fp.cast<AARectEffect>();
const char *rectName;
// The rect uniform's xyzw refer to (left + 0.5, top + 0.5, right - 0.5, bottom - 0.5),
// respectively.
@@ -131,7 +131,7 @@ void GLAARectEffect::emitCode(GrGLProgramBuilder* builder,
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
const char* fragmentPos = fsBuilder->fragmentPosition();
- if (GrEffectEdgeTypeIsAA(aare.getEdgeType())) {
+ if (GrProcessorEdgeTypeIsAA(aare.getEdgeType())) {
// The amount of coverage removed in x and y by the edges is computed as a pair of negative
// numbers, xSub and ySub.
fsBuilder->codeAppend("\t\tfloat xSub, ySub;\n");
@@ -150,15 +150,15 @@ void GLAARectEffect::emitCode(GrGLProgramBuilder* builder,
fsBuilder->codeAppendf("\t\talpha *= (%s.w - %s.y) > -0.5 ? 1.0 : 0.0;\n", rectName, fragmentPos);
}
- if (GrEffectEdgeTypeIsInverseFill(aare.getEdgeType())) {
+ if (GrProcessorEdgeTypeIsInverseFill(aare.getEdgeType())) {
fsBuilder->codeAppend("\t\talpha = 1.0 - alpha;\n");
}
fsBuilder->codeAppendf("\t\t%s = %s;\n", outputColor,
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_str());
}
-void GLAARectEffect::setData(const GrGLProgramDataManager& pdman, const GrEffect& effect) {
- const AARectEffect& aare = effect.cast<AARectEffect>();
+void GLAARectEffect::setData(const GrGLProgramDataManager& pdman, const GrProcessor& processor) {
+ const AARectEffect& aare = processor.cast<AARectEffect>();
const SkRect& rect = aare.getRect();
if (rect != fPrevRect) {
pdman.set4f(fRectUniform, rect.fLeft + 0.5f, rect.fTop + 0.5f,
@@ -167,54 +167,54 @@ void GLAARectEffect::setData(const GrGLProgramDataManager& pdman, const GrEffect
}
}
-void GLAARectEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
- GrEffectKeyBuilder* b) {
- const AARectEffect& aare = effect.cast<AARectEffect>();
+void GLAARectEffect::GenKey(const GrProcessor& processor, const GrGLCaps&,
+ GrProcessorKeyBuilder* b) {
+ const AARectEffect& aare = processor.cast<AARectEffect>();
b->add32(aare.getEdgeType());
}
-const GrBackendEffectFactory& AARectEffect::getFactory() const {
- return GrTBackendEffectFactory<AARectEffect>::getInstance();
+const GrBackendFragmentProcessorFactory& AARectEffect::getFactory() const {
+ return GrTBackendFragmentProcessorFactory<AARectEffect>::getInstance();
}
//////////////////////////////////////////////////////////////////////////////
-class GrGLConvexPolyEffect : public GrGLEffect {
+class GrGLConvexPolyEffect : public GrGLFragmentProcessor {
public:
- GrGLConvexPolyEffect(const GrBackendEffectFactory&, const GrEffect&);
+ GrGLConvexPolyEffect(const GrBackendProcessorFactory&, const GrProcessor&);
virtual void emitCode(GrGLProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrFragmentProcessor& fp,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE;
private:
GrGLProgramDataManager::UniformHandle fEdgeUniform;
SkScalar fPrevEdges[3 * GrConvexPolyEffect::kMaxEdges];
- typedef GrGLEffect INHERITED;
+ typedef GrGLFragmentProcessor INHERITED;
};
-GrGLConvexPolyEffect::GrGLConvexPolyEffect(const GrBackendEffectFactory& factory,
- const GrEffect& effect)
+GrGLConvexPolyEffect::GrGLConvexPolyEffect(const GrBackendProcessorFactory& factory,
+ const GrProcessor&)
: INHERITED (factory) {
fPrevEdges[0] = SK_ScalarNaN;
}
void GrGLConvexPolyEffect::emitCode(GrGLProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrFragmentProcessor& fp,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) {
- const GrConvexPolyEffect& cpe = effect.cast<GrConvexPolyEffect>();
+ const GrConvexPolyEffect& cpe = fp.cast<GrConvexPolyEffect>();
const char *edgeArrayName;
fEdgeUniform = builder->addUniformArray(GrGLProgramBuilder::kFragment_Visibility,
@@ -229,7 +229,7 @@ void GrGLConvexPolyEffect::emitCode(GrGLProgramBuilder* builder,
for (int i = 0; i < cpe.getEdgeCount(); ++i) {
fsBuilder->codeAppendf("\t\tedge = dot(%s[%d], vec3(%s.x, %s.y, 1));\n",
edgeArrayName, i, fragmentPos, fragmentPos);
- if (GrEffectEdgeTypeIsAA(cpe.getEdgeType())) {
+ if (GrProcessorEdgeTypeIsAA(cpe.getEdgeType())) {
fsBuilder->codeAppend("\t\tedge = clamp(edge, 0.0, 1.0);\n");
} else {
fsBuilder->codeAppend("\t\tedge = edge >= 0.5 ? 1.0 : 0.0;\n");
@@ -242,14 +242,14 @@ void GrGLConvexPolyEffect::emitCode(GrGLProgramBuilder* builder,
fsBuilder->codeAppend("\t\tif (-1.0 == alpha) {\n\t\t\tdiscard;\n\t\t}\n");
}
- if (GrEffectEdgeTypeIsInverseFill(cpe.getEdgeType())) {
+ if (GrProcessorEdgeTypeIsInverseFill(cpe.getEdgeType())) {
fsBuilder->codeAppend("\talpha = 1.0 - alpha;\n");
}
fsBuilder->codeAppendf("\t%s = %s;\n", outputColor,
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_str());
}
-void GrGLConvexPolyEffect::setData(const GrGLProgramDataManager& pdman, const GrEffect& effect) {
+void GrGLConvexPolyEffect::setData(const GrGLProgramDataManager& pdman, const GrProcessor& effect) {
const GrConvexPolyEffect& cpe = effect.cast<GrConvexPolyEffect>();
size_t byteSize = 3 * cpe.getEdgeCount() * sizeof(SkScalar);
if (0 != memcmp(fPrevEdges, cpe.getEdges(), byteSize)) {
@@ -258,19 +258,19 @@ void GrGLConvexPolyEffect::setData(const GrGLProgramDataManager& pdman, const Gr
}
}
-void GrGLConvexPolyEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
- GrEffectKeyBuilder* b) {
- const GrConvexPolyEffect& cpe = effect.cast<GrConvexPolyEffect>();
- GR_STATIC_ASSERT(kGrEffectEdgeTypeCnt <= 8);
+void GrGLConvexPolyEffect::GenKey(const GrProcessor& processor, const GrGLCaps&,
+ GrProcessorKeyBuilder* b) {
+ const GrConvexPolyEffect& cpe = processor.cast<GrConvexPolyEffect>();
+ GR_STATIC_ASSERT(kGrProcessorEdgeTypeCnt <= 8);
uint32_t key = (cpe.getEdgeCount() << 3) | cpe.getEdgeType();
b->add32(key);
}
//////////////////////////////////////////////////////////////////////////////
-GrEffect* GrConvexPolyEffect::Create(GrEffectEdgeType type, const SkPath& path,
- const SkVector* offset) {
- if (kHairlineAA_GrEffectEdgeType == type) {
+GrFragmentProcessor* GrConvexPolyEffect::Create(GrPrimitiveEdgeType type, const SkPath& path,
+ const SkVector* offset) {
+ if (kHairlineAA_GrProcessorEdgeType == type) {
return NULL;
}
if (path.getSegmentMasks() != SkPath::kLine_SegmentMask ||
@@ -314,13 +314,13 @@ GrEffect* GrConvexPolyEffect::Create(GrEffectEdgeType type, const SkPath& path,
}
}
if (path.isInverseFillType()) {
- type = GrInvertEffectEdgeType(type);
+ type = GrInvertProcessorEdgeType(type);
}
return Create(type, n, edges);
}
-GrEffect* GrConvexPolyEffect::Create(GrEffectEdgeType edgeType, const SkRect& rect) {
- if (kHairlineAA_GrEffectEdgeType == edgeType){
+GrFragmentProcessor* GrConvexPolyEffect::Create(GrPrimitiveEdgeType edgeType, const SkRect& rect) {
+ if (kHairlineAA_GrProcessorEdgeType == edgeType){
return NULL;
}
return AARectEffect::Create(edgeType, rect);
@@ -332,11 +332,11 @@ void GrConvexPolyEffect::getConstantColorComponents(GrColor* color, uint32_t* va
*validFlags = 0;
}
-const GrBackendEffectFactory& GrConvexPolyEffect::getFactory() const {
- return GrTBackendEffectFactory<GrConvexPolyEffect>::getInstance();
+const GrBackendFragmentProcessorFactory& GrConvexPolyEffect::getFactory() const {
+ return GrTBackendFragmentProcessorFactory<GrConvexPolyEffect>::getInstance();
}
-GrConvexPolyEffect::GrConvexPolyEffect(GrEffectEdgeType edgeType, int n, const SkScalar edges[])
+GrConvexPolyEffect::GrConvexPolyEffect(GrPrimitiveEdgeType edgeType, int n, const SkScalar edges[])
: fEdgeType(edgeType)
, fEdgeCount(n) {
// Factory function should have already ensured this.
@@ -350,7 +350,7 @@ GrConvexPolyEffect::GrConvexPolyEffect(GrEffectEdgeType edgeType, int n, const S
this->setWillReadFragmentPosition();
}
-bool GrConvexPolyEffect::onIsEqual(const GrEffect& other) const {
+bool GrConvexPolyEffect::onIsEqual(const GrProcessor& other) const {
const GrConvexPolyEffect& cpe = other.cast<GrConvexPolyEffect>();
// ignore the fact that 0 == -0 and just use memcmp.
return (cpe.fEdgeType == fEdgeType && cpe.fEdgeCount == fEdgeCount &&
@@ -359,23 +359,23 @@ bool GrConvexPolyEffect::onIsEqual(const GrEffect& other) const {
//////////////////////////////////////////////////////////////////////////////
-GR_DEFINE_EFFECT_TEST(GrConvexPolyEffect);
+GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConvexPolyEffect);
-GrEffect* GrConvexPolyEffect::TestCreate(SkRandom* random,
- GrContext*,
- const GrDrawTargetCaps& caps,
- GrTexture*[]) {
+GrFragmentProcessor* GrConvexPolyEffect::TestCreate(SkRandom* random,
+ GrContext*,
+ const GrDrawTargetCaps& caps,
+ GrTexture*[]) {
int count = random->nextULessThan(kMaxEdges) + 1;
SkScalar edges[kMaxEdges * 3];
for (int i = 0; i < 3 * count; ++i) {
edges[i] = random->nextSScalar1();
}
- GrEffect* effect;
+ GrFragmentProcessor* fp;
do {
- GrEffectEdgeType edgeType = static_cast<GrEffectEdgeType>(
- random->nextULessThan(kGrEffectEdgeTypeCnt));
- effect = GrConvexPolyEffect::Create(edgeType, count, edges);
- } while (NULL == effect);
- return effect;
+ GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
+ random->nextULessThan(kGrProcessorEdgeTypeCnt));
+ fp = GrConvexPolyEffect::Create(edgeType, count, edges);
+ } while (NULL == fp);
+ return fp;
}
diff --git a/src/gpu/effects/GrConvexPolyEffect.h b/src/gpu/effects/GrConvexPolyEffect.h
index 9164b3ecf2..e4749390a4 100644
--- a/src/gpu/effects/GrConvexPolyEffect.h
+++ b/src/gpu/effects/GrConvexPolyEffect.h
@@ -9,7 +9,7 @@
#define GrConvexPolyEffect_DEFINED
#include "GrDrawTargetCaps.h"
-#include "GrEffect.h"
+#include "GrProcessor.h"
#include "GrTypesPriv.h"
class GrGLConvexPolyEffect;
@@ -20,7 +20,7 @@ class SkPath;
* Bounding geometry is rendered and the effect computes coverage based on the fragment's
* position relative to the polygon.
*/
-class GrConvexPolyEffect : public GrEffect {
+class GrConvexPolyEffect : public GrFragmentProcessor {
public:
enum {
kMaxEdges = 8,
@@ -37,8 +37,9 @@ public:
* have to modify the effect/shaderbuilder interface to make it possible (e.g. give access
* to the view matrix or untransformed positions in the fragment shader).
*/
- static GrEffect* Create(GrEffectEdgeType edgeType, int n, const SkScalar edges[]) {
- if (n <= 0 || n > kMaxEdges || kHairlineAA_GrEffectEdgeType == edgeType) {
+ static GrFragmentProcessor* Create(GrPrimitiveEdgeType edgeType, int n,
+ const SkScalar edges[]) {
+ if (n <= 0 || n > kMaxEdges || kHairlineAA_GrProcessorEdgeType == edgeType) {
return NULL;
}
return SkNEW_ARGS(GrConvexPolyEffect, (edgeType, n, edges));
@@ -49,41 +50,42 @@ public:
* inverse filled, or has too many edges, this will return NULL. If offset is non-NULL, then
* the path is translated by the vector.
*/
- static GrEffect* Create(GrEffectEdgeType, const SkPath&, const SkVector* offset = NULL);
+ static GrFragmentProcessor* Create(GrPrimitiveEdgeType, const SkPath&,
+ const SkVector* offset = NULL);
/**
* Creates an effect that fills inside the rect with AA edges..
*/
- static GrEffect* Create(GrEffectEdgeType, const SkRect&);
+ static GrFragmentProcessor* Create(GrPrimitiveEdgeType, const SkRect&);
virtual ~GrConvexPolyEffect();
static const char* Name() { return "ConvexPoly"; }
- GrEffectEdgeType getEdgeType() const { return fEdgeType; }
+ GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
int getEdgeCount() const { return fEdgeCount; }
const SkScalar* getEdges() const { return fEdges; }
- typedef GrGLConvexPolyEffect GLEffect;
+ typedef GrGLConvexPolyEffect GLProcessor;
virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+ virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE;
private:
- GrConvexPolyEffect(GrEffectEdgeType edgeType, int n, const SkScalar edges[]);
+ GrConvexPolyEffect(GrPrimitiveEdgeType edgeType, int n, const SkScalar edges[]);
- virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE;
+ virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
- GrEffectEdgeType fEdgeType;
- int fEdgeCount;
- SkScalar fEdges[3 * kMaxEdges];
+ GrPrimitiveEdgeType fEdgeType;
+ int fEdgeCount;
+ SkScalar fEdges[3 * kMaxEdges];
- GR_DECLARE_EFFECT_TEST;
+ GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
- typedef GrEffect INHERITED;
+ typedef GrFragmentProcessor INHERITED;
};
diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp
index b0abdcf9ed..a836d43f2b 100644
--- a/src/gpu/effects/GrConvolutionEffect.cpp
+++ b/src/gpu/effects/GrConvolutionEffect.cpp
@@ -7,29 +7,29 @@
#include "gl/builders/GrGLProgramBuilder.h"
#include "GrConvolutionEffect.h"
-#include "gl/GrGLEffect.h"
+#include "gl/GrGLProcessor.h"
#include "gl/GrGLSL.h"
#include "gl/GrGLTexture.h"
-#include "GrTBackendEffectFactory.h"
+#include "GrTBackendProcessorFactory.h"
// For brevity
typedef GrGLProgramDataManager::UniformHandle UniformHandle;
-class GrGLConvolutionEffect : public GrGLEffect {
+class GrGLConvolutionEffect : public GrGLFragmentProcessor {
public:
- GrGLConvolutionEffect(const GrBackendEffectFactory&, const GrEffect&);
+ GrGLConvolutionEffect(const GrBackendProcessorFactory&, const GrProcessor&);
virtual void emitCode(GrGLProgramBuilder*,
- const GrEffect&,
- const GrEffectKey&,
+ const GrFragmentProcessor&,
+ const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- virtual void setData(const GrGLProgramDataManager& pdman, const GrEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager& pdman, const GrProcessor&) SK_OVERRIDE;
- static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*);
private:
int width() const { return Gr1DKernelEffect::WidthFromRadius(fRadius); }
@@ -43,21 +43,21 @@ private:
UniformHandle fImageIncrementUni;
UniformHandle fBoundsUni;
- typedef GrGLEffect INHERITED;
+ typedef GrGLFragmentProcessor INHERITED;
};
-GrGLConvolutionEffect::GrGLConvolutionEffect(const GrBackendEffectFactory& factory,
- const GrEffect& effect)
+GrGLConvolutionEffect::GrGLConvolutionEffect(const GrBackendProcessorFactory& factory,
+ const GrProcessor& processor)
: INHERITED(factory) {
- const GrConvolutionEffect& c = effect.cast<GrConvolutionEffect>();
+ const GrConvolutionEffect& c = processor.cast<GrConvolutionEffect>();
fRadius = c.radius();
fUseBounds = c.useBounds();
fDirection = c.direction();
}
void GrGLConvolutionEffect::emitCode(GrGLProgramBuilder* builder,
- const GrEffect&,
- const GrEffectKey& key,
+ const GrFragmentProcessor&,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,
@@ -106,8 +106,8 @@ void GrGLConvolutionEffect::emitCode(GrGLProgramBuilder* builder,
}
void GrGLConvolutionEffect::setData(const GrGLProgramDataManager& pdman,
- const GrEffect& effect) {
- const GrConvolutionEffect& conv = effect.cast<GrConvolutionEffect>();
+ const GrProcessor& processor) {
+ const GrConvolutionEffect& conv = processor.cast<GrConvolutionEffect>();
GrTexture& texture = *conv.texture(0);
// the code we generated was for a specific kernel radius
SkASSERT(conv.radius() == fRadius);
@@ -136,9 +136,9 @@ void GrGLConvolutionEffect::setData(const GrGLProgramDataManager& pdman,
pdman.set1fv(fKernelUni, this->width(), conv.kernel());
}
-void GrGLConvolutionEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
- GrEffectKeyBuilder* b) {
- const GrConvolutionEffect& conv = effect.cast<GrConvolutionEffect>();
+void GrGLConvolutionEffect::GenKey(const GrProcessor& processor, const GrGLCaps&,
+ GrProcessorKeyBuilder* b) {
+ const GrConvolutionEffect& conv = processor.cast<GrConvolutionEffect>();
uint32_t key = conv.radius();
key <<= 2;
if (conv.useBounds()) {
@@ -196,11 +196,11 @@ GrConvolutionEffect::GrConvolutionEffect(GrTexture* texture,
GrConvolutionEffect::~GrConvolutionEffect() {
}
-const GrBackendEffectFactory& GrConvolutionEffect::getFactory() const {
- return GrTBackendEffectFactory<GrConvolutionEffect>::getInstance();
+const GrBackendFragmentProcessorFactory& GrConvolutionEffect::getFactory() const {
+ return GrTBackendFragmentProcessorFactory<GrConvolutionEffect>::getInstance();
}
-bool GrConvolutionEffect::onIsEqual(const GrEffect& sBase) const {
+bool GrConvolutionEffect::onIsEqual(const GrProcessor& sBase) const {
const GrConvolutionEffect& s = sBase.cast<GrConvolutionEffect>();
return (this->texture(0) == s.texture(0) &&
this->radius() == s.radius() &&
@@ -212,14 +212,14 @@ bool GrConvolutionEffect::onIsEqual(const GrEffect& sBase) const {
///////////////////////////////////////////////////////////////////////////////
-GR_DEFINE_EFFECT_TEST(GrConvolutionEffect);
+GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConvolutionEffect);
-GrEffect* GrConvolutionEffect::TestCreate(SkRandom* random,
- GrContext*,
- const GrDrawTargetCaps&,
- GrTexture* textures[]) {
- int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
- GrEffectUnitTest::kAlphaTextureIdx;
+GrFragmentProcessor* GrConvolutionEffect::TestCreate(SkRandom* random,
+ GrContext*,
+ const GrDrawTargetCaps&,
+ GrTexture* textures[]) {
+ int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
+ GrProcessorUnitTest::kAlphaTextureIdx;
Direction dir = random->nextBool() ? kX_Direction : kY_Direction;
int radius = random->nextRangeU(1, kMaxKernelRadius);
float kernel[kMaxKernelWidth];
diff --git a/src/gpu/effects/GrConvolutionEffect.h b/src/gpu/effects/GrConvolutionEffect.h
index a96ea7be86..f2a2d5a779 100644
--- a/src/gpu/effects/GrConvolutionEffect.h
+++ b/src/gpu/effects/GrConvolutionEffect.h
@@ -22,12 +22,12 @@ class GrConvolutionEffect : public Gr1DKernelEffect {
public:
/// Convolve with an arbitrary user-specified kernel
- static GrEffect* Create(GrTexture* tex,
- Direction dir,
- int halfWidth,
- const float* kernel,
- bool useBounds,
- float bounds[2]) {
+ static GrFragmentProcessor* Create(GrTexture* tex,
+ Direction dir,
+ int halfWidth,
+ const float* kernel,
+ bool useBounds,
+ float bounds[2]) {
return SkNEW_ARGS(GrConvolutionEffect, (tex,
dir,
halfWidth,
@@ -37,12 +37,12 @@ public:
}
/// Convolve with a Gaussian kernel
- static GrEffect* CreateGaussian(GrTexture* tex,
- Direction dir,
- int halfWidth,
- float gaussianSigma,
- bool useBounds,
- float bounds[2]) {
+ static GrFragmentProcessor* CreateGaussian(GrTexture* tex,
+ Direction dir,
+ int halfWidth,
+ float gaussianSigma,
+ bool useBounds,
+ float bounds[2]) {
return SkNEW_ARGS(GrConvolutionEffect, (tex,
dir,
halfWidth,
@@ -60,9 +60,9 @@ public:
static const char* Name() { return "Convolution"; }
- typedef GrGLConvolutionEffect GLEffect;
+ typedef GrGLConvolutionEffect GLProcessor;
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+ virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE;
virtual void getConstantColorComponents(GrColor*, uint32_t* validFlags) const {
// If the texture was opaque we could know that the output color if we knew the sum of the
@@ -101,9 +101,9 @@ private:
bool useBounds,
float bounds[2]);
- virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE;
+ virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
- GR_DECLARE_EFFECT_TEST;
+ GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
typedef Gr1DKernelEffect INHERITED;
};
diff --git a/src/gpu/effects/GrCustomCoordsTextureEffect.cpp b/src/gpu/effects/GrCustomCoordsTextureEffect.cpp
index 212d181a22..b9794c149d 100644
--- a/src/gpu/effects/GrCustomCoordsTextureEffect.cpp
+++ b/src/gpu/effects/GrCustomCoordsTextureEffect.cpp
@@ -7,27 +7,27 @@
#include "GrCustomCoordsTextureEffect.h"
#include "gl/builders/GrGLFullProgramBuilder.h"
-#include "gl/GrGLEffect.h"
+#include "gl/GrGLProcessor.h"
#include "gl/GrGLSL.h"
#include "gl/GrGLTexture.h"
#include "gl/GrGLGeometryProcessor.h"
-#include "GrTBackendEffectFactory.h"
+#include "GrTBackendProcessorFactory.h"
#include "GrTexture.h"
class GrGLCustomCoordsTextureEffect : public GrGLGeometryProcessor {
public:
- GrGLCustomCoordsTextureEffect(const GrBackendEffectFactory& factory, const GrEffect& effect)
+ GrGLCustomCoordsTextureEffect(const GrBackendProcessorFactory& factory, const GrProcessor&)
: INHERITED (factory) {}
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrGeometryProcessor& geometryProcessor,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) SK_OVERRIDE {
const GrCustomCoordsTextureEffect& customCoordsTextureEffect =
- effect.cast<GrCustomCoordsTextureEffect>();
+ geometryProcessor.cast<GrCustomCoordsTextureEffect>();
SkASSERT(1 == customCoordsTextureEffect.getVertexAttribs().count());
SkString fsCoordName;
@@ -40,7 +40,7 @@ public:
const GrShaderVar& inTextureCoords = customCoordsTextureEffect.inTextureCoords();
vsBuilder->codeAppendf("\t%s = %s;\n", vsVaryingName, inTextureCoords.c_str());
- GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
+ GrGLProcessorFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
fsBuilder->codeAppendf("\t%s = ", outputColor);
fsBuilder->appendTextureLookupAndModulate(inputColor,
samplers[0],
@@ -49,8 +49,8 @@ public:
fsBuilder->codeAppend(";\n");
}
- virtual void setData(const GrGLProgramDataManager& pdman,
- const GrEffect& effect) SK_OVERRIDE {}
+ virtual void setData(const GrGLProgramDataManager&,
+ const GrProcessor&) SK_OVERRIDE {}
private:
typedef GrGLGeometryProcessor INHERITED;
@@ -67,7 +67,7 @@ GrCustomCoordsTextureEffect::GrCustomCoordsTextureEffect(GrTexture* texture,
this->addTextureAccess(&fTextureAccess);
}
-bool GrCustomCoordsTextureEffect::onIsEqual(const GrEffect& other) const {
+bool GrCustomCoordsTextureEffect::onIsEqual(const GrProcessor& other) const {
const GrCustomCoordsTextureEffect& cte = other.cast<GrCustomCoordsTextureEffect>();
return fTextureAccess == cte.fTextureAccess;
}
@@ -82,20 +82,20 @@ void GrCustomCoordsTextureEffect::getConstantColorComponents(GrColor* color,
}
}
-const GrBackendEffectFactory& GrCustomCoordsTextureEffect::getFactory() const {
- return GrTBackendEffectFactory<GrCustomCoordsTextureEffect>::getInstance();
+const GrBackendGeometryProcessorFactory& GrCustomCoordsTextureEffect::getFactory() const {
+ return GrTBackendGeometryProcessorFactory<GrCustomCoordsTextureEffect>::getInstance();
}
///////////////////////////////////////////////////////////////////////////////
-GR_DEFINE_EFFECT_TEST(GrCustomCoordsTextureEffect);
+GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrCustomCoordsTextureEffect);
-GrEffect* GrCustomCoordsTextureEffect::TestCreate(SkRandom* random,
- GrContext*,
- const GrDrawTargetCaps&,
- GrTexture* textures[]) {
- int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
- GrEffectUnitTest::kAlphaTextureIdx;
+GrGeometryProcessor* GrCustomCoordsTextureEffect::TestCreate(SkRandom* random,
+ GrContext*,
+ const GrDrawTargetCaps&,
+ GrTexture* textures[]) {
+ int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
+ GrProcessorUnitTest::kAlphaTextureIdx;
static const SkShader::TileMode kTileModes[] = {
SkShader::kClamp_TileMode,
SkShader::kRepeat_TileMode,
diff --git a/src/gpu/effects/GrCustomCoordsTextureEffect.h b/src/gpu/effects/GrCustomCoordsTextureEffect.h
index 02e7c44013..f48a144c56 100644
--- a/src/gpu/effects/GrCustomCoordsTextureEffect.h
+++ b/src/gpu/effects/GrCustomCoordsTextureEffect.h
@@ -8,7 +8,7 @@
#ifndef GrCustomCoordsTextureEffect_DEFINED
#define GrCustomCoordsTextureEffect_DEFINED
-#include "GrEffect.h"
+#include "GrProcessor.h"
#include "GrGeometryProcessor.h"
class GrGLCustomCoordsTextureEffect;
@@ -20,7 +20,7 @@ class GrGLCustomCoordsTextureEffect;
*/
class GrCustomCoordsTextureEffect : public GrGeometryProcessor {
public:
- static GrEffect* Create(GrTexture* tex, const GrTextureParams& p) {
+ static GrGeometryProcessor* Create(GrTexture* tex, const GrTextureParams& p) {
return SkNEW_ARGS(GrCustomCoordsTextureEffect, (tex, p));
}
@@ -32,19 +32,19 @@ public:
const GrShaderVar& inTextureCoords() const { return fInTextureCoords; }
- typedef GrGLCustomCoordsTextureEffect GLEffect;
+ typedef GrGLCustomCoordsTextureEffect GLProcessor;
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+ virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERRIDE;
private:
GrCustomCoordsTextureEffect(GrTexture* texture, const GrTextureParams& params);
- virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE;
+ virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
GrTextureAccess fTextureAccess;
const GrShaderVar& fInTextureCoords;
- GR_DECLARE_EFFECT_TEST;
+ GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
typedef GrGeometryProcessor INHERITED;
};
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp
index 38a2d4e4ba..704a6ac3e6 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -9,19 +9,19 @@
#include "../GrAARectRenderer.h"
-#include "effects/GrGeometryProcessor.h"
+#include "GrGeometryProcessor.h"
#include "gl/builders/GrGLFullProgramBuilder.h"
-#include "gl/GrGLEffect.h"
+#include "gl/GrGLProcessor.h"
#include "gl/GrGLGeometryProcessor.h"
#include "gl/GrGLSL.h"
#include "GrContext.h"
#include "GrCoordTransform.h"
#include "GrDrawTarget.h"
#include "GrDrawTargetCaps.h"
-#include "GrEffect.h"
+#include "GrProcessor.h"
#include "GrGpu.h"
#include "GrStrokeInfo.h"
-#include "GrTBackendEffectFactory.h"
+#include "GrTBackendProcessorFactory.h"
#include "SkGr.h"
///////////////////////////////////////////////////////////////////////////////
@@ -75,7 +75,7 @@ extern const GrVertexAttrib gDashLineNoAAVertexAttribs[] = {
extern const GrVertexAttrib gDashLineVertexAttribs[] = {
{ kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding },
- { kVec2f_GrVertexAttribType, sizeof(SkPoint), kEffect_GrVertexAttribBinding },
+ { kVec2f_GrVertexAttribType, sizeof(SkPoint), kGeometryProcessor_GrVertexAttribBinding },
};
};
@@ -344,13 +344,13 @@ bool GrDashingEffect::DrawDashLine(const SkPoint pts[2], const GrPaint& paint,
devInfo.fPhase = devPhase;
devInfo.fCount = 2;
devInfo.fIntervals = devIntervals;
- GrEffectEdgeType edgeType= useAA ? kFillAA_GrEffectEdgeType :
- kFillBW_GrEffectEdgeType;
+ GrPrimitiveEdgeType edgeType= useAA ? kFillAA_GrProcessorEdgeType :
+ kFillBW_GrProcessorEdgeType;
bool isRoundCap = SkPaint::kRound_Cap == cap;
GrDashingEffect::DashCap capType = isRoundCap ? GrDashingEffect::kRound_DashCap :
GrDashingEffect::kNonRound_DashCap;
drawState->setGeometryProcessor(
- GrDashingEffect::Create(edgeType, devInfo, strokeWidth, capType))->unref();
+ GrDashingEffect::Create(edgeType, devInfo, strokeWidth, capType))->unref();
// Set up the vertex data for the line and start/end dashes
drawState->setVertexAttribs<gDashLineVertexAttribs>(SK_ARRAY_COUNT(gDashLineVertexAttribs),
@@ -436,7 +436,9 @@ class DashingCircleEffect : public GrGeometryProcessor {
public:
typedef SkPathEffect::DashInfo DashInfo;
- static GrEffect* Create(GrEffectEdgeType edgeType, const DashInfo& info, SkScalar radius);
+ static GrGeometryProcessor* Create(GrPrimitiveEdgeType edgeType,
+ const DashInfo& info,
+ SkScalar radius);
virtual ~DashingCircleEffect();
@@ -444,7 +446,7 @@ public:
const GrShaderVar& inCoord() const { return fInCoord; }
- GrEffectEdgeType getEdgeType() const { return fEdgeType; }
+ GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
SkScalar getRadius() const { return fRadius; }
@@ -452,24 +454,24 @@ public:
SkScalar getIntervalLength() const { return fIntervalLength; }
- typedef GLDashingCircleEffect GLEffect;
+ typedef GLDashingCircleEffect GLProcessor;
virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+ virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERRIDE;
private:
- DashingCircleEffect(GrEffectEdgeType edgeType, const DashInfo& info, SkScalar radius);
+ DashingCircleEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkScalar radius);
- virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE;
+ virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
- GrEffectEdgeType fEdgeType;
+ GrPrimitiveEdgeType fEdgeType;
const GrShaderVar& fInCoord;
SkScalar fIntervalLength;
SkScalar fRadius;
SkScalar fCenterX;
- GR_DECLARE_EFFECT_TEST;
+ GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
typedef GrGeometryProcessor INHERITED;
};
@@ -478,19 +480,19 @@ private:
class GLDashingCircleEffect : public GrGLGeometryProcessor {
public:
- GLDashingCircleEffect(const GrBackendEffectFactory&, const GrEffect&);
+ GLDashingCircleEffect(const GrBackendProcessorFactory&, const GrProcessor&);
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrGeometryProcessor& geometryProcessor,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE;
private:
GrGLProgramDataManager::UniformHandle fParamUniform;
@@ -500,8 +502,8 @@ private:
typedef GrGLGeometryProcessor INHERITED;
};
-GLDashingCircleEffect::GLDashingCircleEffect(const GrBackendEffectFactory& factory,
- const GrEffect& effect)
+GLDashingCircleEffect::GLDashingCircleEffect(const GrBackendProcessorFactory& factory,
+ const GrProcessor&)
: INHERITED (factory) {
fPrevRadius = SK_ScalarMin;
fPrevCenterX = SK_ScalarMin;
@@ -509,13 +511,13 @@ GLDashingCircleEffect::GLDashingCircleEffect(const GrBackendEffectFactory& facto
}
void GLDashingCircleEffect::emitCode(GrGLFullProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrGeometryProcessor& geometryProcessor,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) {
- const DashingCircleEffect& dce = effect.cast<DashingCircleEffect>();
+ const DashingCircleEffect& dce = geometryProcessor.cast<DashingCircleEffect>();
const char *paramName;
// The param uniforms, xyz, refer to circle radius - 0.5, cicles center x coord, and
// the total interval length of the dash.
@@ -531,13 +533,13 @@ void GLDashingCircleEffect::emitCode(GrGLFullProgramBuilder* builder,
vsBuilder->codeAppendf("\t%s = %s;\n", vsCoordName, dce.inCoord().c_str());
// transforms all points so that we can compare them to our test circle
- GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
+ GrGLProcessorFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
fsBuilder->codeAppendf("\t\tfloat xShifted = %s.x - floor(%s.x / %s.z) * %s.z;\n",
fsCoordName, fsCoordName, paramName, paramName);
fsBuilder->codeAppendf("\t\tvec2 fragPosShifted = vec2(xShifted, %s.y);\n", fsCoordName);
fsBuilder->codeAppendf("\t\tvec2 center = vec2(%s.y, 0.0);\n", paramName);
fsBuilder->codeAppend("\t\tfloat dist = length(center - fragPosShifted);\n");
- if (GrEffectEdgeTypeIsAA(dce.getEdgeType())) {
+ if (GrProcessorEdgeTypeIsAA(dce.getEdgeType())) {
fsBuilder->codeAppendf("\t\tfloat diff = dist - %s.x;\n", paramName);
fsBuilder->codeAppend("\t\tdiff = 1.0 - diff;\n");
fsBuilder->codeAppend("\t\tfloat alpha = clamp(diff, 0.0, 1.0);\n");
@@ -549,8 +551,9 @@ void GLDashingCircleEffect::emitCode(GrGLFullProgramBuilder* builder,
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_str());
}
-void GLDashingCircleEffect::setData(const GrGLProgramDataManager& pdman, const GrEffect& effect) {
- const DashingCircleEffect& dce = effect.cast<DashingCircleEffect>();
+void GLDashingCircleEffect::setData(const GrGLProgramDataManager& pdman
+ , const GrProcessor& processor) {
+ const DashingCircleEffect& dce = processor.cast<DashingCircleEffect>();
SkScalar radius = dce.getRadius();
SkScalar centerX = dce.getCenterX();
SkScalar intervalLength = dce.getIntervalLength();
@@ -562,16 +565,16 @@ void GLDashingCircleEffect::setData(const GrGLProgramDataManager& pdman, const G
}
}
-void GLDashingCircleEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
- GrEffectKeyBuilder* b) {
- const DashingCircleEffect& dce = effect.cast<DashingCircleEffect>();
+void GLDashingCircleEffect::GenKey(const GrProcessor& processor, const GrGLCaps&,
+ GrProcessorKeyBuilder* b) {
+ const DashingCircleEffect& dce = processor.cast<DashingCircleEffect>();
b->add32(dce.getEdgeType());
}
//////////////////////////////////////////////////////////////////////////////
-GrEffect* DashingCircleEffect::Create(GrEffectEdgeType edgeType, const DashInfo& info,
- SkScalar radius) {
+GrGeometryProcessor* DashingCircleEffect::Create(GrPrimitiveEdgeType edgeType, const DashInfo& info,
+ SkScalar radius) {
if (info.fCount != 2 || info.fIntervals[0] != 0) {
return NULL;
}
@@ -585,11 +588,11 @@ void DashingCircleEffect::getConstantColorComponents(GrColor* color, uint32_t* v
*validFlags = 0;
}
-const GrBackendEffectFactory& DashingCircleEffect::getFactory() const {
- return GrTBackendEffectFactory<DashingCircleEffect>::getInstance();
+const GrBackendGeometryProcessorFactory& DashingCircleEffect::getFactory() const {
+ return GrTBackendGeometryProcessorFactory<DashingCircleEffect>::getInstance();
}
-DashingCircleEffect::DashingCircleEffect(GrEffectEdgeType edgeType, const DashInfo& info,
+DashingCircleEffect::DashingCircleEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info,
SkScalar radius)
: fEdgeType(edgeType)
, fInCoord(this->addVertexAttrib(GrShaderVar("inCoord",
@@ -602,7 +605,7 @@ DashingCircleEffect::DashingCircleEffect(GrEffectEdgeType edgeType, const DashIn
fCenterX = SkScalarHalf(offLen);
}
-bool DashingCircleEffect::onIsEqual(const GrEffect& other) const {
+bool DashingCircleEffect::onIsEqual(const GrProcessor& other) const {
const DashingCircleEffect& dce = other.cast<DashingCircleEffect>();
return (fEdgeType == dce.fEdgeType &&
fIntervalLength == dce.fIntervalLength &&
@@ -610,15 +613,14 @@ bool DashingCircleEffect::onIsEqual(const GrEffect& other) const {
fCenterX == dce.fCenterX);
}
-GR_DEFINE_EFFECT_TEST(DashingCircleEffect);
+GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingCircleEffect);
-GrEffect* DashingCircleEffect::TestCreate(SkRandom* random,
- GrContext*,
- const GrDrawTargetCaps& caps,
- GrTexture*[]) {
- GrEffect* effect;
- GrEffectEdgeType edgeType = static_cast<GrEffectEdgeType>(random->nextULessThan(
- kGrEffectEdgeTypeCnt));
+GrGeometryProcessor* DashingCircleEffect::TestCreate(SkRandom* random,
+ GrContext*,
+ const GrDrawTargetCaps& caps,
+ GrTexture*[]) {
+ GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(random->nextULessThan(
+ kGrProcessorEdgeTypeCnt));
SkScalar strokeWidth = random->nextRangeScalar(0, 100.f);
DashInfo info;
info.fCount = 2;
@@ -628,8 +630,7 @@ GrEffect* DashingCircleEffect::TestCreate(SkRandom* random,
info.fIntervals[1] = random->nextRangeScalar(0, 10.f);
info.fPhase = random->nextRangeScalar(0, info.fIntervals[1]);
- effect = DashingCircleEffect::Create(edgeType, info, strokeWidth);
- return effect;
+ return DashingCircleEffect::Create(edgeType, info, strokeWidth);
}
//////////////////////////////////////////////////////////////////////////////
@@ -649,7 +650,9 @@ class DashingLineEffect : public GrGeometryProcessor {
public:
typedef SkPathEffect::DashInfo DashInfo;
- static GrEffect* Create(GrEffectEdgeType edgeType, const DashInfo& info, SkScalar strokeWidth);
+ static GrGeometryProcessor* Create(GrPrimitiveEdgeType edgeType,
+ const DashInfo& info,
+ SkScalar strokeWidth);
virtual ~DashingLineEffect();
@@ -657,29 +660,29 @@ public:
const GrShaderVar& inCoord() const { return fInCoord; }
- GrEffectEdgeType getEdgeType() const { return fEdgeType; }
+ GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
const SkRect& getRect() const { return fRect; }
SkScalar getIntervalLength() const { return fIntervalLength; }
- typedef GLDashingLineEffect GLEffect;
+ typedef GLDashingLineEffect GLProcessor;
virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+ virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERRIDE;
private:
- DashingLineEffect(GrEffectEdgeType edgeType, const DashInfo& info, SkScalar strokeWidth);
+ DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info, SkScalar strokeWidth);
- virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE;
+ virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
- GrEffectEdgeType fEdgeType;
+ GrPrimitiveEdgeType fEdgeType;
const GrShaderVar& fInCoord;
SkRect fRect;
SkScalar fIntervalLength;
- GR_DECLARE_EFFECT_TEST;
+ GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
typedef GrGeometryProcessor INHERITED;
};
@@ -688,19 +691,19 @@ private:
class GLDashingLineEffect : public GrGLGeometryProcessor {
public:
- GLDashingLineEffect(const GrBackendEffectFactory&, const GrEffect&);
+ GLDashingLineEffect(const GrBackendProcessorFactory&, const GrProcessor&);
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrGeometryProcessor& geometryProcessor,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE;
private:
GrGLProgramDataManager::UniformHandle fRectUniform;
@@ -710,21 +713,21 @@ private:
typedef GrGLGeometryProcessor INHERITED;
};
-GLDashingLineEffect::GLDashingLineEffect(const GrBackendEffectFactory& factory,
- const GrEffect& effect)
+GLDashingLineEffect::GLDashingLineEffect(const GrBackendProcessorFactory& factory,
+ const GrProcessor&)
: INHERITED (factory) {
fPrevRect.fLeft = SK_ScalarNaN;
fPrevIntervalLength = SK_ScalarMax;
}
void GLDashingLineEffect::emitCode(GrGLFullProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
- const char* outputColor,
- const char* inputColor,
- const TransformedCoordsArray&,
- const TextureSamplerArray& samplers) {
- const DashingLineEffect& de = effect.cast<DashingLineEffect>();
+ const GrGeometryProcessor& geometryProcessor,
+ const GrProcessorKey& key,
+ const char* outputColor,
+ const char* inputColor,
+ const TransformedCoordsArray&,
+ const TextureSamplerArray& samplers) {
+ const DashingLineEffect& de = geometryProcessor.cast<DashingLineEffect>();
const char *rectName;
// The rect uniform's xyzw refer to (left + 0.5, top + 0.5, right - 0.5, bottom - 0.5),
// respectively.
@@ -745,11 +748,11 @@ void GLDashingLineEffect::emitCode(GrGLFullProgramBuilder* builder,
vsBuilder->codeAppendf("\t%s = %s;\n", vsCoordName, de.inCoord().c_str());
// transforms all points so that we can compare them to our test rect
- GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
+ GrGLProcessorFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
fsBuilder->codeAppendf("\t\tfloat xShifted = %s.x - floor(%s.x / %s) * %s;\n",
fsCoordName, fsCoordName, intervalName, intervalName);
fsBuilder->codeAppendf("\t\tvec2 fragPosShifted = vec2(xShifted, %s.y);\n", fsCoordName);
- if (GrEffectEdgeTypeIsAA(de.getEdgeType())) {
+ if (GrProcessorEdgeTypeIsAA(de.getEdgeType())) {
// The amount of coverage removed in x and y by the edges is computed as a pair of negative
// numbers, xSub and ySub.
fsBuilder->codeAppend("\t\tfloat xSub, ySub;\n");
@@ -770,8 +773,9 @@ void GLDashingLineEffect::emitCode(GrGLFullProgramBuilder* builder,
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_str());
}
-void GLDashingLineEffect::setData(const GrGLProgramDataManager& pdman, const GrEffect& effect) {
- const DashingLineEffect& de = effect.cast<DashingLineEffect>();
+void GLDashingLineEffect::setData(const GrGLProgramDataManager& pdman,
+ const GrProcessor& processor) {
+ const DashingLineEffect& de = processor.cast<DashingLineEffect>();
const SkRect& rect = de.getRect();
SkScalar intervalLength = de.getIntervalLength();
if (rect != fPrevRect || intervalLength != fPrevIntervalLength) {
@@ -783,16 +787,17 @@ void GLDashingLineEffect::setData(const GrGLProgramDataManager& pdman, const GrE
}
}
-void GLDashingLineEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
- GrEffectKeyBuilder* b) {
- const DashingLineEffect& de = effect.cast<DashingLineEffect>();
+void GLDashingLineEffect::GenKey(const GrProcessor& processor, const GrGLCaps&,
+ GrProcessorKeyBuilder* b) {
+ const DashingLineEffect& de = processor.cast<DashingLineEffect>();
b->add32(de.getEdgeType());
}
//////////////////////////////////////////////////////////////////////////////
-GrEffect* DashingLineEffect::Create(GrEffectEdgeType edgeType, const DashInfo& info,
- SkScalar strokeWidth) {
+GrGeometryProcessor* DashingLineEffect::Create(GrPrimitiveEdgeType edgeType,
+ const DashInfo& info,
+ SkScalar strokeWidth) {
if (info.fCount != 2) {
return NULL;
}
@@ -806,11 +811,11 @@ void DashingLineEffect::getConstantColorComponents(GrColor* color, uint32_t* val
*validFlags = 0;
}
-const GrBackendEffectFactory& DashingLineEffect::getFactory() const {
- return GrTBackendEffectFactory<DashingLineEffect>::getInstance();
+const GrBackendGeometryProcessorFactory& DashingLineEffect::getFactory() const {
+ return GrTBackendGeometryProcessorFactory<DashingLineEffect>::getInstance();
}
-DashingLineEffect::DashingLineEffect(GrEffectEdgeType edgeType, const DashInfo& info,
+DashingLineEffect::DashingLineEffect(GrPrimitiveEdgeType edgeType, const DashInfo& info,
SkScalar strokeWidth)
: fEdgeType(edgeType)
, fInCoord(this->addVertexAttrib(GrShaderVar("inCoord",
@@ -824,22 +829,21 @@ DashingLineEffect::DashingLineEffect(GrEffectEdgeType edgeType, const DashInfo&
fRect.set(halfOffLen, -halfStroke, halfOffLen + onLen, halfStroke);
}
-bool DashingLineEffect::onIsEqual(const GrEffect& other) const {
+bool DashingLineEffect::onIsEqual(const GrProcessor& other) const {
const DashingLineEffect& de = other.cast<DashingLineEffect>();
return (fEdgeType == de.fEdgeType &&
fRect == de.fRect &&
fIntervalLength == de.fIntervalLength);
}
-GR_DEFINE_EFFECT_TEST(DashingLineEffect);
+GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingLineEffect);
-GrEffect* DashingLineEffect::TestCreate(SkRandom* random,
- GrContext*,
- const GrDrawTargetCaps& caps,
- GrTexture*[]) {
- GrEffect* effect;
- GrEffectEdgeType edgeType = static_cast<GrEffectEdgeType>(random->nextULessThan(
- kGrEffectEdgeTypeCnt));
+GrGeometryProcessor* DashingLineEffect::TestCreate(SkRandom* random,
+ GrContext*,
+ const GrDrawTargetCaps& caps,
+ GrTexture*[]) {
+ GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(random->nextULessThan(
+ kGrProcessorEdgeTypeCnt));
SkScalar strokeWidth = random->nextRangeScalar(0, 100.f);
DashInfo info;
info.fCount = 2;
@@ -849,14 +853,15 @@ GrEffect* DashingLineEffect::TestCreate(SkRandom* random,
info.fIntervals[1] = random->nextRangeScalar(0, 10.f);
info.fPhase = random->nextRangeScalar(0, info.fIntervals[0] + info.fIntervals[1]);
- effect = DashingLineEffect::Create(edgeType, info, strokeWidth);
- return effect;
+ return DashingLineEffect::Create(edgeType, info, strokeWidth);
}
//////////////////////////////////////////////////////////////////////////////
-GrEffect* GrDashingEffect::Create(GrEffectEdgeType edgeType, const SkPathEffect::DashInfo& info,
- SkScalar strokeWidth, GrDashingEffect::DashCap cap) {
+GrGeometryProcessor* GrDashingEffect::Create(GrPrimitiveEdgeType edgeType,
+ const SkPathEffect::DashInfo& info,
+ SkScalar strokeWidth,
+ GrDashingEffect::DashCap cap) {
switch (cap) {
case GrDashingEffect::kRound_DashCap:
return DashingCircleEffect::Create(edgeType, info, SkScalarHalf(strokeWidth));
diff --git a/src/gpu/effects/GrDashingEffect.h b/src/gpu/effects/GrDashingEffect.h
index 1a51e89ac8..331b6c8d0f 100644
--- a/src/gpu/effects/GrDashingEffect.h
+++ b/src/gpu/effects/GrDashingEffect.h
@@ -14,6 +14,7 @@
class GrGpu;
class GrDrawTarget;
+class GrGeometryProcessor;
class GrPaint;
class GrStrokeInfo;
@@ -35,8 +36,10 @@ namespace GrDashingEffect {
* Bounding geometry is rendered and the effect computes coverage based on the fragment's
* position relative to the dashed line.
*/
- GrEffect* Create(GrEffectEdgeType edgeType, const SkPathEffect::DashInfo& info,
- SkScalar strokeWidth, DashCap cap);
+ GrGeometryProcessor* Create(GrPrimitiveEdgeType edgeType,
+ const SkPathEffect::DashInfo& info,
+ SkScalar strokeWidth,
+ DashCap cap);
}
#endif
diff --git a/src/gpu/effects/GrDistanceFieldTextureEffect.cpp b/src/gpu/effects/GrDistanceFieldTextureEffect.cpp
index ab76525719..d5d334805c 100755
--- a/src/gpu/effects/GrDistanceFieldTextureEffect.cpp
+++ b/src/gpu/effects/GrDistanceFieldTextureEffect.cpp
@@ -7,11 +7,11 @@
#include "GrDistanceFieldTextureEffect.h"
#include "gl/builders/GrGLFullProgramBuilder.h"
-#include "gl/GrGLEffect.h"
+#include "gl/GrGLProcessor.h"
#include "gl/GrGLSL.h"
#include "gl/GrGLTexture.h"
#include "gl/GrGLGeometryProcessor.h"
-#include "GrTBackendEffectFactory.h"
+#include "GrTBackendProcessorFactory.h"
#include "GrTexture.h"
#include "SkDistanceFieldGen.h"
@@ -31,8 +31,8 @@
class GrGLDistanceFieldTextureEffect : public GrGLGeometryProcessor {
public:
- GrGLDistanceFieldTextureEffect(const GrBackendEffectFactory& factory,
- const GrEffect& effect)
+ GrGLDistanceFieldTextureEffect(const GrBackendProcessorFactory& factory,
+ const GrProcessor&)
: INHERITED (factory)
, fTextureSize(SkISize::Make(-1,-1))
#ifdef SK_GAMMA_APPLY_TO_A8
@@ -41,17 +41,17 @@ public:
{}
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrGeometryProcessor& geometryProcessor,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) SK_OVERRIDE {
const GrDistanceFieldTextureEffect& dfTexEffect =
- effect.cast<GrDistanceFieldTextureEffect>();
+ geometryProcessor.cast<GrDistanceFieldTextureEffect>();
SkASSERT(1 == dfTexEffect.getVertexAttribs().count());
- GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
+ GrGLProcessorFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
SkAssertResult(fsBuilder->enableFeature(
GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
@@ -131,7 +131,7 @@ public:
}
virtual void setData(const GrGLProgramDataManager& pdman,
- const GrEffect& effect) SK_OVERRIDE {
+ const GrProcessor& effect) SK_OVERRIDE {
SkASSERT(fTextureSizeUni.isValid());
GrTexture* texture = effect.texture(0);
@@ -144,7 +144,7 @@ public:
}
#ifdef SK_GAMMA_APPLY_TO_A8
const GrDistanceFieldTextureEffect& dfTexEffect =
- effect.cast<GrDistanceFieldTextureEffect>();
+ effect.cast<GrDistanceFieldTextureEffect>();
float luminance = dfTexEffect.getLuminance();
if (luminance != fLuminance) {
pdman.set1f(fLuminanceUni, luminance);
@@ -153,10 +153,10 @@ public:
#endif
}
- static inline void GenKey(const GrEffect& effect, const GrGLCaps&,
- GrEffectKeyBuilder* b) {
+ static inline void GenKey(const GrProcessor& processor, const GrGLCaps&,
+ GrProcessorKeyBuilder* b) {
const GrDistanceFieldTextureEffect& dfTexEffect =
- effect.cast<GrDistanceFieldTextureEffect>();
+ processor.cast<GrDistanceFieldTextureEffect>();
b->add32(dfTexEffect.getFlags());
}
@@ -196,7 +196,7 @@ GrDistanceFieldTextureEffect::GrDistanceFieldTextureEffect(GrTexture* texture,
#endif
}
-bool GrDistanceFieldTextureEffect::onIsEqual(const GrEffect& other) const {
+bool GrDistanceFieldTextureEffect::onIsEqual(const GrProcessor& other) const {
const GrDistanceFieldTextureEffect& cte = other.cast<GrDistanceFieldTextureEffect>();
return fTextureAccess == cte.fTextureAccess &&
#ifdef SK_GAMMA_APPLY_TO_A8
@@ -216,23 +216,23 @@ void GrDistanceFieldTextureEffect::getConstantColorComponents(GrColor* color,
}
}
-const GrBackendEffectFactory& GrDistanceFieldTextureEffect::getFactory() const {
- return GrTBackendEffectFactory<GrDistanceFieldTextureEffect>::getInstance();
+const GrBackendGeometryProcessorFactory& GrDistanceFieldTextureEffect::getFactory() const {
+ return GrTBackendGeometryProcessorFactory<GrDistanceFieldTextureEffect>::getInstance();
}
///////////////////////////////////////////////////////////////////////////////
-GR_DEFINE_EFFECT_TEST(GrDistanceFieldTextureEffect);
+GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldTextureEffect);
-GrEffect* GrDistanceFieldTextureEffect::TestCreate(SkRandom* random,
- GrContext*,
- const GrDrawTargetCaps&,
- GrTexture* textures[]) {
- int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
- GrEffectUnitTest::kAlphaTextureIdx;
+GrGeometryProcessor* GrDistanceFieldTextureEffect::TestCreate(SkRandom* random,
+ GrContext*,
+ const GrDrawTargetCaps&,
+ GrTexture* textures[]) {
+ int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
+ GrProcessorUnitTest::kAlphaTextureIdx;
#ifdef SK_GAMMA_APPLY_TO_A8
- int texIdx2 = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
- GrEffectUnitTest::kAlphaTextureIdx;
+ int texIdx2 = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
+ GrProcessorUnitTest::kAlphaTextureIdx;
#endif
static const SkShader::TileMode kTileModes[] = {
SkShader::kClamp_TileMode,
@@ -263,21 +263,21 @@ GrEffect* GrDistanceFieldTextureEffect::TestCreate(SkRandom* random,
class GrGLDistanceFieldLCDTextureEffect : public GrGLGeometryProcessor {
public:
- GrGLDistanceFieldLCDTextureEffect(const GrBackendEffectFactory& factory,
- const GrEffect& effect)
+ GrGLDistanceFieldLCDTextureEffect(const GrBackendProcessorFactory& factory,
+ const GrProcessor&)
: INHERITED (factory)
, fTextureSize(SkISize::Make(-1,-1))
, fTextColor(GrColor_ILLEGAL) {}
virtual void emitCode(GrGLFullProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrGeometryProcessor& geometryProcessor,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) SK_OVERRIDE {
const GrDistanceFieldLCDTextureEffect& dfTexEffect =
- effect.cast<GrDistanceFieldLCDTextureEffect>();
+ geometryProcessor.cast<GrDistanceFieldLCDTextureEffect>();
SkASSERT(1 == dfTexEffect.getVertexAttribs().count());
SkString fsCoordName;
@@ -295,7 +295,7 @@ public:
kVec3f_GrSLType, "TextureSize",
&textureSizeUniName);
- GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
+ GrGLProcessorFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
SkAssertResult(fsBuilder->enableFeature(
GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
@@ -400,13 +400,13 @@ public:
}
virtual void setData(const GrGLProgramDataManager& pdman,
- const GrEffect& effect) SK_OVERRIDE {
+ const GrProcessor& processor) SK_OVERRIDE {
SkASSERT(fTextureSizeUni.isValid());
SkASSERT(fTextColorUni.isValid());
const GrDistanceFieldLCDTextureEffect& dfTexEffect =
- effect.cast<GrDistanceFieldLCDTextureEffect>();
- GrTexture* texture = effect.texture(0);
+ processor.cast<GrDistanceFieldLCDTextureEffect>();
+ GrTexture* texture = processor.texture(0);
if (texture->width() != fTextureSize.width() ||
texture->height() != fTextureSize.height()) {
fTextureSize = SkISize::Make(texture->width(), texture->height());
@@ -431,10 +431,10 @@ public:
}
}
- static inline void GenKey(const GrEffect& effect, const GrGLCaps&,
- GrEffectKeyBuilder* b) {
+ static inline void GenKey(const GrProcessor& processor, const GrGLCaps&,
+ GrProcessorKeyBuilder* b) {
const GrDistanceFieldLCDTextureEffect& dfTexEffect =
- effect.cast<GrDistanceFieldLCDTextureEffect>();
+ processor.cast<GrDistanceFieldLCDTextureEffect>();
b->add32(dfTexEffect.getFlags());
}
@@ -468,7 +468,7 @@ GrDistanceFieldLCDTextureEffect::GrDistanceFieldLCDTextureEffect(
this->addTextureAccess(&fGammaTextureAccess);
}
-bool GrDistanceFieldLCDTextureEffect::onIsEqual(const GrEffect& other) const {
+bool GrDistanceFieldLCDTextureEffect::onIsEqual(const GrProcessor& other) const {
const GrDistanceFieldLCDTextureEffect& cte = other.cast<GrDistanceFieldLCDTextureEffect>();
return (fTextureAccess == cte.fTextureAccess &&
fGammaTextureAccess == cte.fGammaTextureAccess &&
@@ -486,22 +486,22 @@ void GrDistanceFieldLCDTextureEffect::getConstantColorComponents(GrColor* color,
}
}
-const GrBackendEffectFactory& GrDistanceFieldLCDTextureEffect::getFactory() const {
- return GrTBackendEffectFactory<GrDistanceFieldLCDTextureEffect>::getInstance();
+const GrBackendGeometryProcessorFactory& GrDistanceFieldLCDTextureEffect::getFactory() const {
+ return GrTBackendGeometryProcessorFactory<GrDistanceFieldLCDTextureEffect>::getInstance();
}
///////////////////////////////////////////////////////////////////////////////
-GR_DEFINE_EFFECT_TEST(GrDistanceFieldLCDTextureEffect);
+GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldLCDTextureEffect);
-GrEffect* GrDistanceFieldLCDTextureEffect::TestCreate(SkRandom* random,
- GrContext*,
- const GrDrawTargetCaps&,
- GrTexture* textures[]) {
- int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
- GrEffectUnitTest::kAlphaTextureIdx;
- int texIdx2 = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
- GrEffectUnitTest::kAlphaTextureIdx;
+GrGeometryProcessor* GrDistanceFieldLCDTextureEffect::TestCreate(SkRandom* random,
+ GrContext*,
+ const GrDrawTargetCaps&,
+ GrTexture* textures[]) {
+ int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
+ GrProcessorUnitTest::kAlphaTextureIdx;
+ int texIdx2 = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
+ GrProcessorUnitTest::kAlphaTextureIdx;
static const SkShader::TileMode kTileModes[] = {
SkShader::kClamp_TileMode,
SkShader::kRepeat_TileMode,
diff --git a/src/gpu/effects/GrDistanceFieldTextureEffect.h b/src/gpu/effects/GrDistanceFieldTextureEffect.h
index 5f08edaa79..b8d774d610 100644
--- a/src/gpu/effects/GrDistanceFieldTextureEffect.h
+++ b/src/gpu/effects/GrDistanceFieldTextureEffect.h
@@ -8,7 +8,7 @@
#ifndef GrDistanceFieldTextureEffect_DEFINED
#define GrDistanceFieldTextureEffect_DEFINED
-#include "GrEffect.h"
+#include "GrProcessor.h"
#include "GrGeometryProcessor.h"
class GrGLDistanceFieldTextureEffect;
@@ -41,15 +41,15 @@ enum GrDistanceFieldEffectFlags {
class GrDistanceFieldTextureEffect : public GrGeometryProcessor {
public:
#ifdef SK_GAMMA_APPLY_TO_A8
- static GrEffect* Create(GrTexture* tex, const GrTextureParams& params,
- GrTexture* gamma, const GrTextureParams& gammaParams, float lum,
- uint32_t flags) {
+ static GrGeometryProcessor* Create(GrTexture* tex, const GrTextureParams& params,
+ GrTexture* gamma, const GrTextureParams& gammaParams,
+ float lum, uint32_t flags) {
return SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, params, gamma, gammaParams, lum,
flags));
}
#else
- static GrEffect* Create(GrTexture* tex, const GrTextureParams& params,
- uint32_t flags) {
+ static GrGeometryProcessor* Create(GrTexture* tex, const GrTextureParams& params,
+ uint32_t flags) {
return SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, params, flags));
}
#endif
@@ -66,9 +66,9 @@ public:
#endif
uint32_t getFlags() const { return fFlags; }
- typedef GrGLDistanceFieldTextureEffect GLEffect;
+ typedef GrGLDistanceFieldTextureEffect GLProcessor;
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+ virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERRIDE;
private:
GrDistanceFieldTextureEffect(GrTexture* texture, const GrTextureParams& params,
@@ -77,7 +77,7 @@ private:
#endif
uint32_t flags);
- virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE;
+ virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
GrTextureAccess fTextureAccess;
#ifdef SK_GAMMA_APPLY_TO_A8
@@ -87,9 +87,9 @@ private:
uint32_t fFlags;
const GrShaderVar& fInTextureCoords;
- GR_DECLARE_EFFECT_TEST;
+ GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
- typedef GrEffect INHERITED;
+ typedef GrFragmentProcessor INHERITED;
};
/**
@@ -100,9 +100,9 @@ private:
*/
class GrDistanceFieldLCDTextureEffect : public GrGeometryProcessor {
public:
- static GrEffect* Create(GrTexture* tex, const GrTextureParams& params,
- GrTexture* gamma, const GrTextureParams& gammaParams,
- SkColor textColor, uint32_t flags) {
+ static GrGeometryProcessor* Create(GrTexture* tex, const GrTextureParams& params,
+ GrTexture* gamma, const GrTextureParams& gammaParams,
+ SkColor textColor, uint32_t flags) {
return SkNEW_ARGS(GrDistanceFieldLCDTextureEffect,
(tex, params, gamma, gammaParams, textColor, flags));
}
@@ -116,9 +116,9 @@ public:
GrColor getTextColor() const { return fTextColor; }
uint32_t getFlags() const { return fFlags; }
- typedef GrGLDistanceFieldLCDTextureEffect GLEffect;
+ typedef GrGLDistanceFieldLCDTextureEffect GLProcessor;
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+ virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERRIDE;
private:
GrDistanceFieldLCDTextureEffect(GrTexture* texture, const GrTextureParams& params,
@@ -126,7 +126,7 @@ private:
SkColor textColor,
uint32_t flags);
- virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE;
+ virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
GrTextureAccess fTextureAccess;
GrTextureAccess fGammaTextureAccess;
@@ -134,9 +134,9 @@ private:
uint32_t fFlags;
const GrShaderVar& fInTextureCoords;
- GR_DECLARE_EFFECT_TEST;
+ GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
- typedef GrEffect INHERITED;
+ typedef GrFragmentProcessor INHERITED;
};
#endif
diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp
index 35726fdea7..fe7447d179 100644
--- a/src/gpu/effects/GrDitherEffect.cpp
+++ b/src/gpu/effects/GrDitherEffect.cpp
@@ -8,9 +8,9 @@
#include "gl/builders/GrGLProgramBuilder.h"
#include "GrDitherEffect.h"
-#include "gl/GrGLEffect.h"
+#include "gl/GrGLProcessor.h"
#include "gl/GrGLSL.h"
-#include "GrTBackendEffectFactory.h"
+#include "GrTBackendProcessorFactory.h"
#include "SkRect.h"
@@ -18,22 +18,22 @@
class GLDitherEffect;
-class DitherEffect : public GrEffect {
+class DitherEffect : public GrFragmentProcessor {
public:
- static GrEffect* Create() {
- GR_CREATE_STATIC_EFFECT(gDitherEffect, DitherEffect, ())
+ static GrFragmentProcessor* Create() {
+ GR_CREATE_STATIC_FRAGMENT_PROCESSOR(gDitherEffect, DitherEffect, ())
return SkRef(gDitherEffect);
}
virtual ~DitherEffect() {};
static const char* Name() { return "Dither"; }
- typedef GLDitherEffect GLEffect;
+ typedef GLDitherEffect GLProcessor;
virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE {
- return GrTBackendEffectFactory<DitherEffect>::getInstance();
+ virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE {
+ return GrTBackendFragmentProcessorFactory<DitherEffect>::getInstance();
}
private:
@@ -42,11 +42,11 @@ private:
}
// All dither effects are equal
- virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE { return true; }
+ virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE { return true; }
- GR_DECLARE_EFFECT_TEST;
+ GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
- typedef GrEffect INHERITED;
+ typedef GrFragmentProcessor INHERITED;
};
void DitherEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const {
@@ -55,41 +55,41 @@ void DitherEffect::getConstantColorComponents(GrColor* color, uint32_t* validFla
//////////////////////////////////////////////////////////////////////////////
-GR_DEFINE_EFFECT_TEST(DitherEffect);
+GR_DEFINE_FRAGMENT_PROCESSOR_TEST(DitherEffect);
-GrEffect* DitherEffect::TestCreate(SkRandom*,
- GrContext*,
- const GrDrawTargetCaps&,
- GrTexture*[]) {
+GrFragmentProcessor* DitherEffect::TestCreate(SkRandom*,
+ GrContext*,
+ const GrDrawTargetCaps&,
+ GrTexture*[]) {
return DitherEffect::Create();
}
//////////////////////////////////////////////////////////////////////////////
-class GLDitherEffect : public GrGLEffect {
+class GLDitherEffect : public GrGLFragmentProcessor {
public:
- GLDitherEffect(const GrBackendEffectFactory&, const GrEffect&);
+ GLDitherEffect(const GrBackendProcessorFactory&, const GrProcessor&);
virtual void emitCode(GrGLProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrFragmentProcessor& fp,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
private:
- typedef GrGLEffect INHERITED;
+ typedef GrGLFragmentProcessor INHERITED;
};
-GLDitherEffect::GLDitherEffect(const GrBackendEffectFactory& factory,
- const GrEffect& effect)
+GLDitherEffect::GLDitherEffect(const GrBackendProcessorFactory& factory,
+ const GrProcessor&)
: INHERITED (factory) {
}
void GLDitherEffect::emitCode(GrGLProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrFragmentProcessor& fp,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@@ -113,4 +113,4 @@ void GLDitherEffect::emitCode(GrGLProgramBuilder* builder,
//////////////////////////////////////////////////////////////////////////////
-GrEffect* GrDitherEffect::Create() { return DitherEffect::Create(); }
+GrFragmentProcessor* GrDitherEffect::Create() { return DitherEffect::Create(); }
diff --git a/src/gpu/effects/GrDitherEffect.h b/src/gpu/effects/GrDitherEffect.h
index 88e0a27ae1..ac4c784406 100644
--- a/src/gpu/effects/GrDitherEffect.h
+++ b/src/gpu/effects/GrDitherEffect.h
@@ -11,13 +11,13 @@
#include "GrTypes.h"
#include "GrTypesPriv.h"
-class GrEffect;
+class GrProcessor;
namespace GrDitherEffect {
/**
* Creates an effect that dithers the resulting color to an RGBA8 framebuffer
*/
- GrEffect* Create();
+ GrFragmentProcessor* Create();
};
#endif
diff --git a/src/gpu/effects/GrGeometryProcessor.h b/src/gpu/effects/GrGeometryProcessor.h
deleted file mode 100644
index 0e1c80c150..0000000000
--- a/src/gpu/effects/GrGeometryProcessor.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2013 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrGeometryProcessor_DEFINED
-#define GrGeometryProcessor_DEFINED
-
-#include "GrEffect.h"
-
-/**
- * If an effect needs specialized vertex shader code, then it must inherit from this class.
- * Otherwise it won't be able to add vertex attribs, and it will be given a vertexless shader
- * program in emitCode.
- */
-class GrGeometryProcessor : public GrEffect {
-public:
- GrGeometryProcessor() { fRequiresVertexShader = true; }
-
-protected:
- /**
- * Subclasses call this from their constructor to register vertex attributes (at most
- * kMaxVertexAttribs). This must only be called from the constructor because GrEffects are
- * immutable.
- *
- * We return a reference to the added var so that derived classes can name it nicely and use it
- * in shader code.
- */
- const GrShaderVar& addVertexAttrib(const GrShaderVar& var) {
- SkASSERT(GrShaderVar::kAttribute_TypeModifier == var.getTypeModifier());
- SkASSERT(fVertexAttribs.count() < kMaxVertexAttribs);
- return fVertexAttribs.push_back(var);
- }
-
-private:
- typedef GrEffect INHERITED;
-};
-
-#endif
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index 4ba1895ca1..c0080c61dc 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -6,26 +6,26 @@
*/
#include "gl/builders/GrGLProgramBuilder.h"
#include "GrMatrixConvolutionEffect.h"
-#include "gl/GrGLEffect.h"
+#include "gl/GrGLProcessor.h"
#include "gl/GrGLSL.h"
#include "gl/GrGLTexture.h"
-#include "GrTBackendEffectFactory.h"
+#include "GrTBackendProcessorFactory.h"
-class GrGLMatrixConvolutionEffect : public GrGLEffect {
+class GrGLMatrixConvolutionEffect : public GrGLFragmentProcessor {
public:
- GrGLMatrixConvolutionEffect(const GrBackendEffectFactory& factory,
- const GrEffect& effect);
+ GrGLMatrixConvolutionEffect(const GrBackendProcessorFactory& factory,
+ const GrProcessor&);
virtual void emitCode(GrGLProgramBuilder*,
- const GrEffect&,
- const GrEffectKey&,
+ const GrFragmentProcessor&,
+ const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE;
private:
typedef GrGLProgramDataManager::UniformHandle UniformHandle;
@@ -40,26 +40,26 @@ private:
UniformHandle fBiasUni;
GrTextureDomain::GLDomain fDomain;
- typedef GrGLEffect INHERITED;
+ typedef GrGLFragmentProcessor INHERITED;
};
-GrGLMatrixConvolutionEffect::GrGLMatrixConvolutionEffect(const GrBackendEffectFactory& factory,
- const GrEffect& effect)
+GrGLMatrixConvolutionEffect::GrGLMatrixConvolutionEffect(const GrBackendProcessorFactory& factory,
+ const GrProcessor& processor)
: INHERITED(factory) {
- const GrMatrixConvolutionEffect& m = effect.cast<GrMatrixConvolutionEffect>();
+ const GrMatrixConvolutionEffect& m = processor.cast<GrMatrixConvolutionEffect>();
fKernelSize = m.kernelSize();
fConvolveAlpha = m.convolveAlpha();
}
void GrGLMatrixConvolutionEffect::emitCode(GrGLProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrFragmentProcessor& fp,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,
const TextureSamplerArray& samplers) {
sk_ignore_unused_variable(inputColor);
- const GrTextureDomain& domain = effect.cast<GrMatrixConvolutionEffect>().domain();
+ const GrTextureDomain& domain = fp.cast<GrMatrixConvolutionEffect>().domain();
fBoundsUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
kVec4f_GrSLType, "Bounds");
@@ -120,9 +120,9 @@ void GrGLMatrixConvolutionEffect::emitCode(GrGLProgramBuilder* builder,
fsBuilder->codeAppend(modulate.c_str());
}
-void GrGLMatrixConvolutionEffect::GenKey(const GrEffect& effect,
- const GrGLCaps&, GrEffectKeyBuilder* b) {
- const GrMatrixConvolutionEffect& m = effect.cast<GrMatrixConvolutionEffect>();
+void GrGLMatrixConvolutionEffect::GenKey(const GrProcessor& processor,
+ const GrGLCaps&, GrProcessorKeyBuilder* b) {
+ const GrMatrixConvolutionEffect& m = processor.cast<GrMatrixConvolutionEffect>();
SkASSERT(m.kernelSize().width() <= 0x7FFF && m.kernelSize().height() <= 0xFFFF);
uint32_t key = m.kernelSize().width() << 16 | m.kernelSize().height();
key |= m.convolveAlpha() ? 1 << 31 : 0;
@@ -131,8 +131,8 @@ void GrGLMatrixConvolutionEffect::GenKey(const GrEffect& effect,
}
void GrGLMatrixConvolutionEffect::setData(const GrGLProgramDataManager& pdman,
- const GrEffect& effect) {
- const GrMatrixConvolutionEffect& conv = effect.cast<GrMatrixConvolutionEffect>();
+ const GrProcessor& processor) {
+ const GrMatrixConvolutionEffect& conv = processor.cast<GrMatrixConvolutionEffect>();
GrTexture& texture = *conv.texture(0);
// the code we generated was for a specific kernel size
SkASSERT(conv.kernelSize() == fKernelSize);
@@ -173,11 +173,11 @@ GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(GrTexture* texture,
GrMatrixConvolutionEffect::~GrMatrixConvolutionEffect() {
}
-const GrBackendEffectFactory& GrMatrixConvolutionEffect::getFactory() const {
- return GrTBackendEffectFactory<GrMatrixConvolutionEffect>::getInstance();
+const GrBackendFragmentProcessorFactory& GrMatrixConvolutionEffect::getFactory() const {
+ return GrTBackendFragmentProcessorFactory<GrMatrixConvolutionEffect>::getInstance();
}
-bool GrMatrixConvolutionEffect::onIsEqual(const GrEffect& sBase) const {
+bool GrMatrixConvolutionEffect::onIsEqual(const GrProcessor& sBase) const {
const GrMatrixConvolutionEffect& s = sBase.cast<GrMatrixConvolutionEffect>();
return this->texture(0) == s.texture(0) &&
fKernelSize == s.kernelSize() &&
@@ -191,16 +191,17 @@ bool GrMatrixConvolutionEffect::onIsEqual(const GrEffect& sBase) const {
}
// Static function to create a 2D convolution
-GrEffect* GrMatrixConvolutionEffect::CreateGaussian(GrTexture* texture,
- const SkIRect& bounds,
- const SkISize& kernelSize,
- SkScalar gain,
- SkScalar bias,
- const SkIPoint& kernelOffset,
- GrTextureDomain::Mode tileMode,
- bool convolveAlpha,
- SkScalar sigmaX,
- SkScalar sigmaY) {
+GrFragmentProcessor*
+GrMatrixConvolutionEffect::CreateGaussian(GrTexture* texture,
+ const SkIRect& bounds,
+ const SkISize& kernelSize,
+ SkScalar gain,
+ SkScalar bias,
+ const SkIPoint& kernelOffset,
+ GrTextureDomain::Mode tileMode,
+ bool convolveAlpha,
+ SkScalar sigmaX,
+ SkScalar sigmaY) {
float kernel[MAX_KERNEL_SIZE];
int width = kernelSize.width();
int height = kernelSize.height();
@@ -238,14 +239,14 @@ GrEffect* GrMatrixConvolutionEffect::CreateGaussian(GrTexture* texture,
convolveAlpha));
}
-GR_DEFINE_EFFECT_TEST(GrMatrixConvolutionEffect);
+GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMatrixConvolutionEffect);
-GrEffect* GrMatrixConvolutionEffect::TestCreate(SkRandom* random,
- GrContext* context,
- const GrDrawTargetCaps&,
- GrTexture* textures[]) {
- int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
- GrEffectUnitTest::kAlphaTextureIdx;
+GrFragmentProcessor* GrMatrixConvolutionEffect::TestCreate(SkRandom* random,
+ GrContext* context,
+ const GrDrawTargetCaps&,
+ GrTexture* textures[]) {
+ int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
+ GrProcessorUnitTest::kAlphaTextureIdx;
int width = random->nextRangeU(1, MAX_KERNEL_SIZE);
int height = random->nextRangeU(1, MAX_KERNEL_SIZE / width);
SkISize kernelSize = SkISize::Make(width, height);
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.h b/src/gpu/effects/GrMatrixConvolutionEffect.h
index 814299f2d1..4cc4296eee 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.h
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.h
@@ -19,15 +19,15 @@ class GrGLMatrixConvolutionEffect;
class GrMatrixConvolutionEffect : public GrSingleTextureEffect {
public:
- static GrEffect* Create(GrTexture* texture,
- const SkIRect& bounds,
- const SkISize& kernelSize,
- const SkScalar* kernel,
- SkScalar gain,
- SkScalar bias,
- const SkIPoint& kernelOffset,
- GrTextureDomain::Mode tileMode,
- bool convolveAlpha) {
+ static GrFragmentProcessor* Create(GrTexture* texture,
+ const SkIRect& bounds,
+ const SkISize& kernelSize,
+ const SkScalar* kernel,
+ SkScalar gain,
+ SkScalar bias,
+ const SkIPoint& kernelOffset,
+ GrTextureDomain::Mode tileMode,
+ bool convolveAlpha) {
return SkNEW_ARGS(GrMatrixConvolutionEffect, (texture,
bounds,
kernelSize,
@@ -39,16 +39,16 @@ public:
convolveAlpha));
}
- static GrEffect* CreateGaussian(GrTexture* texture,
- const SkIRect& bounds,
- const SkISize& kernelSize,
- SkScalar gain,
- SkScalar bias,
- const SkIPoint& kernelOffset,
- GrTextureDomain::Mode tileMode,
- bool convolveAlpha,
- SkScalar sigmaX,
- SkScalar sigmaY);
+ static GrFragmentProcessor* CreateGaussian(GrTexture* texture,
+ const SkIRect& bounds,
+ const SkISize& kernelSize,
+ SkScalar gain,
+ SkScalar bias,
+ const SkIPoint& kernelOffset,
+ GrTextureDomain::Mode tileMode,
+ bool convolveAlpha,
+ SkScalar sigmaX,
+ SkScalar sigmaY);
virtual ~GrMatrixConvolutionEffect();
@@ -68,9 +68,9 @@ public:
bool convolveAlpha() const { return fConvolveAlpha; }
const GrTextureDomain& domain() const { return fDomain; }
- typedef GrGLMatrixConvolutionEffect GLEffect;
+ typedef GrGLMatrixConvolutionEffect GLProcessor;
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+ virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE;
private:
GrMatrixConvolutionEffect(GrTexture*,
@@ -83,7 +83,7 @@ private:
GrTextureDomain::Mode tileMode,
bool convolveAlpha);
- virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE;
+ virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
SkIRect fBounds;
SkISize fKernelSize;
@@ -94,7 +94,7 @@ private:
bool fConvolveAlpha;
GrTextureDomain fDomain;
- GR_DECLARE_EFFECT_TEST;
+ GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
typedef GrSingleTextureEffect INHERITED;
};
diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp
index 65f188e908..10fd8a6bf4 100644
--- a/src/gpu/effects/GrOvalEffect.cpp
+++ b/src/gpu/effects/GrOvalEffect.cpp
@@ -8,9 +8,9 @@
#include "gl/builders/GrGLProgramBuilder.h"
#include "GrOvalEffect.h"
-#include "gl/GrGLEffect.h"
+#include "gl/GrGLProcessor.h"
#include "gl/GrGLSL.h"
-#include "GrTBackendEffectFactory.h"
+#include "GrTBackendProcessorFactory.h"
#include "SkRect.h"
@@ -18,9 +18,9 @@
class GLCircleEffect;
-class CircleEffect : public GrEffect {
+class CircleEffect : public GrFragmentProcessor {
public:
- static GrEffect* Create(GrEffectEdgeType, const SkPoint& center, SkScalar radius);
+ static GrFragmentProcessor* Create(GrPrimitiveEdgeType, const SkPoint& center, SkScalar radius);
virtual ~CircleEffect() {};
static const char* Name() { return "Circle"; }
@@ -28,29 +28,30 @@ public:
const SkPoint& getCenter() const { return fCenter; }
SkScalar getRadius() const { return fRadius; }
- GrEffectEdgeType getEdgeType() const { return fEdgeType; }
+ GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
- typedef GLCircleEffect GLEffect;
+ typedef GLCircleEffect GLProcessor;
virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+ virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE;
private:
- CircleEffect(GrEffectEdgeType, const SkPoint& center, SkScalar radius);
+ CircleEffect(GrPrimitiveEdgeType, const SkPoint& center, SkScalar radius);
- virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE;
+ virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
SkPoint fCenter;
SkScalar fRadius;
- GrEffectEdgeType fEdgeType;
+ GrPrimitiveEdgeType fEdgeType;
- GR_DECLARE_EFFECT_TEST;
+ GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
- typedef GrEffect INHERITED;
+ typedef GrFragmentProcessor INHERITED;
};
-GrEffect* CircleEffect::Create(GrEffectEdgeType edgeType, const SkPoint& center, SkScalar radius) {
+GrFragmentProcessor* CircleEffect::Create(GrPrimitiveEdgeType edgeType, const SkPoint& center,
+ SkScalar radius) {
SkASSERT(radius >= 0);
return SkNEW_ARGS(CircleEffect, (edgeType, center, radius));
}
@@ -59,81 +60,81 @@ void CircleEffect::getConstantColorComponents(GrColor* color, uint32_t* validFla
*validFlags = 0;
}
-const GrBackendEffectFactory& CircleEffect::getFactory() const {
- return GrTBackendEffectFactory<CircleEffect>::getInstance();
+const GrBackendFragmentProcessorFactory& CircleEffect::getFactory() const {
+ return GrTBackendFragmentProcessorFactory<CircleEffect>::getInstance();
}
-CircleEffect::CircleEffect(GrEffectEdgeType edgeType, const SkPoint& c, SkScalar r)
+CircleEffect::CircleEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkScalar r)
: fCenter(c)
, fRadius(r)
, fEdgeType(edgeType) {
this->setWillReadFragmentPosition();
}
-bool CircleEffect::onIsEqual(const GrEffect& other) const {
+bool CircleEffect::onIsEqual(const GrProcessor& other) const {
const CircleEffect& ce = other.cast<CircleEffect>();
return fEdgeType == ce.fEdgeType && fCenter == ce.fCenter && fRadius == ce.fRadius;
}
//////////////////////////////////////////////////////////////////////////////
-GR_DEFINE_EFFECT_TEST(CircleEffect);
+GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleEffect);
-GrEffect* CircleEffect::TestCreate(SkRandom* random,
- GrContext*,
- const GrDrawTargetCaps& caps,
- GrTexture*[]) {
+GrFragmentProcessor* CircleEffect::TestCreate(SkRandom* random,
+ GrContext*,
+ const GrDrawTargetCaps& caps,
+ GrTexture*[]) {
SkPoint center;
center.fX = random->nextRangeScalar(0.f, 1000.f);
center.fY = random->nextRangeScalar(0.f, 1000.f);
SkScalar radius = random->nextRangeF(0.f, 1000.f);
- GrEffectEdgeType et;
+ GrPrimitiveEdgeType et;
do {
- et = (GrEffectEdgeType)random->nextULessThan(kGrEffectEdgeTypeCnt);
- } while (kHairlineAA_GrEffectEdgeType == et);
+ et = (GrPrimitiveEdgeType)random->nextULessThan(kGrProcessorEdgeTypeCnt);
+ } while (kHairlineAA_GrProcessorEdgeType == et);
return CircleEffect::Create(et, center, radius);
}
//////////////////////////////////////////////////////////////////////////////
-class GLCircleEffect : public GrGLEffect {
+class GLCircleEffect : public GrGLFragmentProcessor {
public:
- GLCircleEffect(const GrBackendEffectFactory&, const GrEffect&);
+ GLCircleEffect(const GrBackendProcessorFactory&, const GrProcessor&);
virtual void emitCode(GrGLProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrFragmentProcessor& fp,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE;
private:
GrGLProgramDataManager::UniformHandle fCircleUniform;
SkPoint fPrevCenter;
SkScalar fPrevRadius;
- typedef GrGLEffect INHERITED;
+ typedef GrGLFragmentProcessor INHERITED;
};
-GLCircleEffect::GLCircleEffect(const GrBackendEffectFactory& factory,
- const GrEffect& effect)
+GLCircleEffect::GLCircleEffect(const GrBackendProcessorFactory& factory,
+ const GrProcessor&)
: INHERITED (factory) {
fPrevRadius = -1.f;
}
void GLCircleEffect::emitCode(GrGLProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrFragmentProcessor& fp,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) {
- const CircleEffect& ce = effect.cast<CircleEffect>();
+ const CircleEffect& ce = fp.cast<CircleEffect>();
const char *circleName;
// The circle uniform is (center.x, center.y, radius + 0.5) for regular fills and
// (... ,radius - 0.5) for inverse fills.
@@ -145,15 +146,15 @@ void GLCircleEffect::emitCode(GrGLProgramBuilder* builder,
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
const char* fragmentPos = fsBuilder->fragmentPosition();
- SkASSERT(kHairlineAA_GrEffectEdgeType != ce.getEdgeType());
- if (GrEffectEdgeTypeIsInverseFill(ce.getEdgeType())) {
+ SkASSERT(kHairlineAA_GrProcessorEdgeType != ce.getEdgeType());
+ if (GrProcessorEdgeTypeIsInverseFill(ce.getEdgeType())) {
fsBuilder->codeAppendf("\t\tfloat d = length(%s.xy - %s.xy) - %s.z;\n",
circleName, fragmentPos, circleName);
} else {
fsBuilder->codeAppendf("\t\tfloat d = %s.z - length(%s.xy - %s.xy);\n",
circleName, fragmentPos, circleName);
}
- if (GrEffectEdgeTypeIsAA(ce.getEdgeType())) {
+ if (GrProcessorEdgeTypeIsAA(ce.getEdgeType())) {
fsBuilder->codeAppend("\t\td = clamp(d, 0.0, 1.0);\n");
} else {
fsBuilder->codeAppend("\t\td = d > 0.5 ? 1.0 : 0.0;\n");
@@ -163,17 +164,17 @@ void GLCircleEffect::emitCode(GrGLProgramBuilder* builder,
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("d")).c_str());
}
-void GLCircleEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
- GrEffectKeyBuilder* b) {
- const CircleEffect& ce = effect.cast<CircleEffect>();
+void GLCircleEffect::GenKey(const GrProcessor& processor, const GrGLCaps&,
+ GrProcessorKeyBuilder* b) {
+ const CircleEffect& ce = processor.cast<CircleEffect>();
b->add32(ce.getEdgeType());
}
-void GLCircleEffect::setData(const GrGLProgramDataManager& pdman, const GrEffect& effect) {
- const CircleEffect& ce = effect.cast<CircleEffect>();
+void GLCircleEffect::setData(const GrGLProgramDataManager& pdman, const GrProcessor& processor) {
+ const CircleEffect& ce = processor.cast<CircleEffect>();
if (ce.getRadius() != fPrevRadius || ce.getCenter() != fPrevCenter) {
SkScalar radius = ce.getRadius();
- if (GrEffectEdgeTypeIsInverseFill(ce.getEdgeType())) {
+ if (GrProcessorEdgeTypeIsInverseFill(ce.getEdgeType())) {
radius -= 0.5f;
} else {
radius += 0.5f;
@@ -188,9 +189,10 @@ void GLCircleEffect::setData(const GrGLProgramDataManager& pdman, const GrEffect
class GLEllipseEffect;
-class EllipseEffect : public GrEffect {
+class EllipseEffect : public GrFragmentProcessor {
public:
- static GrEffect* Create(GrEffectEdgeType, const SkPoint& center, SkScalar rx, SkScalar ry);
+ static GrFragmentProcessor* Create(GrPrimitiveEdgeType, const SkPoint& center, SkScalar rx,
+ SkScalar ry);
virtual ~EllipseEffect() {};
static const char* Name() { return "Ellipse"; }
@@ -198,32 +200,32 @@ public:
const SkPoint& getCenter() const { return fCenter; }
SkVector getRadii() const { return fRadii; }
- GrEffectEdgeType getEdgeType() const { return fEdgeType; }
+ GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
- typedef GLEllipseEffect GLEffect;
+ typedef GLEllipseEffect GLProcessor;
virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+ virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE;
private:
- EllipseEffect(GrEffectEdgeType, const SkPoint& center, SkScalar rx, SkScalar ry);
+ EllipseEffect(GrPrimitiveEdgeType, const SkPoint& center, SkScalar rx, SkScalar ry);
- virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE;
+ virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
SkPoint fCenter;
SkVector fRadii;
- GrEffectEdgeType fEdgeType;
+ GrPrimitiveEdgeType fEdgeType;
- GR_DECLARE_EFFECT_TEST;
+ GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
- typedef GrEffect INHERITED;
+ typedef GrFragmentProcessor INHERITED;
};
-GrEffect* EllipseEffect::Create(GrEffectEdgeType edgeType,
- const SkPoint& center,
- SkScalar rx,
- SkScalar ry) {
+GrFragmentProcessor* EllipseEffect::Create(GrPrimitiveEdgeType edgeType,
+ const SkPoint& center,
+ SkScalar rx,
+ SkScalar ry) {
SkASSERT(rx >= 0 && ry >= 0);
return SkNEW_ARGS(EllipseEffect, (edgeType, center, rx, ry));
}
@@ -232,82 +234,82 @@ void EllipseEffect::getConstantColorComponents(GrColor* color, uint32_t* validFl
*validFlags = 0;
}
-const GrBackendEffectFactory& EllipseEffect::getFactory() const {
- return GrTBackendEffectFactory<EllipseEffect>::getInstance();
+const GrBackendFragmentProcessorFactory& EllipseEffect::getFactory() const {
+ return GrTBackendFragmentProcessorFactory<EllipseEffect>::getInstance();
}
-EllipseEffect::EllipseEffect(GrEffectEdgeType edgeType, const SkPoint& c, SkScalar rx, SkScalar ry)
+EllipseEffect::EllipseEffect(GrPrimitiveEdgeType edgeType, const SkPoint& c, SkScalar rx, SkScalar ry)
: fCenter(c)
, fRadii(SkVector::Make(rx, ry))
, fEdgeType(edgeType) {
this->setWillReadFragmentPosition();
}
-bool EllipseEffect::onIsEqual(const GrEffect& other) const {
+bool EllipseEffect::onIsEqual(const GrProcessor& other) const {
const EllipseEffect& ee = other.cast<EllipseEffect>();
return fEdgeType == ee.fEdgeType && fCenter == ee.fCenter && fRadii == ee.fRadii;
}
//////////////////////////////////////////////////////////////////////////////
-GR_DEFINE_EFFECT_TEST(EllipseEffect);
+GR_DEFINE_FRAGMENT_PROCESSOR_TEST(EllipseEffect);
-GrEffect* EllipseEffect::TestCreate(SkRandom* random,
- GrContext*,
- const GrDrawTargetCaps& caps,
- GrTexture*[]) {
+GrFragmentProcessor* EllipseEffect::TestCreate(SkRandom* random,
+ GrContext*,
+ const GrDrawTargetCaps& caps,
+ GrTexture*[]) {
SkPoint center;
center.fX = random->nextRangeScalar(0.f, 1000.f);
center.fY = random->nextRangeScalar(0.f, 1000.f);
SkScalar rx = random->nextRangeF(0.f, 1000.f);
SkScalar ry = random->nextRangeF(0.f, 1000.f);
- GrEffectEdgeType et;
+ GrPrimitiveEdgeType et;
do {
- et = (GrEffectEdgeType)random->nextULessThan(kGrEffectEdgeTypeCnt);
- } while (kHairlineAA_GrEffectEdgeType == et);
+ et = (GrPrimitiveEdgeType)random->nextULessThan(kGrProcessorEdgeTypeCnt);
+ } while (kHairlineAA_GrProcessorEdgeType == et);
return EllipseEffect::Create(et, center, rx, ry);
}
//////////////////////////////////////////////////////////////////////////////
-class GLEllipseEffect : public GrGLEffect {
+class GLEllipseEffect : public GrGLFragmentProcessor {
public:
- GLEllipseEffect(const GrBackendEffectFactory&, const GrEffect&);
+ GLEllipseEffect(const GrBackendProcessorFactory&, const GrProcessor&);
virtual void emitCode(GrGLProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrFragmentProcessor& fp,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE;
private:
GrGLProgramDataManager::UniformHandle fEllipseUniform;
SkPoint fPrevCenter;
SkVector fPrevRadii;
- typedef GrGLEffect INHERITED;
+ typedef GrGLFragmentProcessor INHERITED;
};
-GLEllipseEffect::GLEllipseEffect(const GrBackendEffectFactory& factory,
- const GrEffect& effect)
+GLEllipseEffect::GLEllipseEffect(const GrBackendProcessorFactory& factory,
+ const GrProcessor& effect)
: INHERITED (factory) {
fPrevRadii.fX = -1.f;
}
void GLEllipseEffect::emitCode(GrGLProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrFragmentProcessor& fp,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) {
- const EllipseEffect& ee = effect.cast<EllipseEffect>();
+ const EllipseEffect& ee = fp.cast<EllipseEffect>();
const char *ellipseName;
// The ellipse uniform is (center.x, center.y, 1 / rx^2, 1 / ry^2)
fEllipseUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
@@ -330,19 +332,19 @@ void GLEllipseEffect::emitCode(GrGLProgramBuilder* builder,
fsBuilder->codeAppendf("\t\tfloat approx_dist = implicit * inversesqrt(grad_dot);\n");
switch (ee.getEdgeType()) {
- case kFillAA_GrEffectEdgeType:
+ case kFillAA_GrProcessorEdgeType:
fsBuilder->codeAppend("\t\tfloat alpha = clamp(0.5 - approx_dist, 0.0, 1.0);\n");
break;
- case kInverseFillAA_GrEffectEdgeType:
+ case kInverseFillAA_GrProcessorEdgeType:
fsBuilder->codeAppend("\t\tfloat alpha = clamp(0.5 + approx_dist, 0.0, 1.0);\n");
break;
- case kFillBW_GrEffectEdgeType:
+ case kFillBW_GrProcessorEdgeType:
fsBuilder->codeAppend("\t\tfloat alpha = approx_dist > 0.0 ? 0.0 : 1.0;\n");
break;
- case kInverseFillBW_GrEffectEdgeType:
+ case kInverseFillBW_GrProcessorEdgeType:
fsBuilder->codeAppend("\t\tfloat alpha = approx_dist > 0.0 ? 1.0 : 0.0;\n");
break;
- case kHairlineAA_GrEffectEdgeType:
+ case kHairlineAA_GrProcessorEdgeType:
SkFAIL("Hairline not expected here.");
}
@@ -350,13 +352,13 @@ void GLEllipseEffect::emitCode(GrGLProgramBuilder* builder,
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_str());
}
-void GLEllipseEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
- GrEffectKeyBuilder* b) {
+void GLEllipseEffect::GenKey(const GrProcessor& effect, const GrGLCaps&,
+ GrProcessorKeyBuilder* b) {
const EllipseEffect& ee = effect.cast<EllipseEffect>();
b->add32(ee.getEdgeType());
}
-void GLEllipseEffect::setData(const GrGLProgramDataManager& pdman, const GrEffect& effect) {
+void GLEllipseEffect::setData(const GrGLProgramDataManager& pdman, const GrProcessor& effect) {
const EllipseEffect& ee = effect.cast<EllipseEffect>();
if (ee.getRadii() != fPrevRadii || ee.getCenter() != fPrevCenter) {
SkScalar invRXSqd = 1.f / (ee.getRadii().fX * ee.getRadii().fX);
@@ -369,8 +371,8 @@ void GLEllipseEffect::setData(const GrGLProgramDataManager& pdman, const GrEffec
//////////////////////////////////////////////////////////////////////////////
-GrEffect* GrOvalEffect::Create(GrEffectEdgeType edgeType, const SkRect& oval) {
- if (kHairlineAA_GrEffectEdgeType == edgeType) {
+GrFragmentProcessor* GrOvalEffect::Create(GrPrimitiveEdgeType edgeType, const SkRect& oval) {
+ if (kHairlineAA_GrProcessorEdgeType == edgeType) {
return NULL;
}
SkScalar w = oval.width();
diff --git a/src/gpu/effects/GrOvalEffect.h b/src/gpu/effects/GrOvalEffect.h
index 37574ec58c..41e22cc00c 100644
--- a/src/gpu/effects/GrOvalEffect.h
+++ b/src/gpu/effects/GrOvalEffect.h
@@ -11,14 +11,14 @@
#include "GrTypes.h"
#include "GrTypesPriv.h"
-class GrEffect;
+class GrProcessor;
struct SkRect;
namespace GrOvalEffect {
/**
* Creates an effect that performs clipping against an oval.
*/
- GrEffect* Create(GrEffectEdgeType, const SkRect&);
+ GrFragmentProcessor* Create(GrPrimitiveEdgeType, const SkRect&);
};
#endif
diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp
index 1c45c3774a..f5131feba4 100644
--- a/src/gpu/effects/GrRRectEffect.cpp
+++ b/src/gpu/effects/GrRRectEffect.cpp
@@ -8,11 +8,11 @@
#include "gl/builders/GrGLProgramBuilder.h"
#include "GrRRectEffect.h"
-#include "gl/GrGLEffect.h"
+#include "gl/GrGLProcessor.h"
#include "gl/GrGLSL.h"
#include "GrConvexPolyEffect.h"
#include "GrOvalEffect.h"
-#include "GrTBackendEffectFactory.h"
+#include "GrTBackendProcessorFactory.h"
#include "SkRRect.h"
@@ -23,7 +23,7 @@ static const SkScalar kRadiusMin = SK_ScalarHalf;
class GLCircularRRectEffect;
-class CircularRRectEffect : public GrEffect {
+class CircularRRectEffect : public GrFragmentProcessor {
public:
enum CornerFlags {
@@ -45,7 +45,8 @@ public:
// The flags are used to indicate which corners are circluar (unflagged corners are assumed to
// be square).
- static GrEffect* Create(GrEffectEdgeType, uint32_t circularCornerFlags, const SkRRect&);
+ static GrFragmentProcessor* Create(GrPrimitiveEdgeType, uint32_t circularCornerFlags,
+ const SkRRect&);
virtual ~CircularRRectEffect() {};
static const char* Name() { return "CircularRRect"; }
@@ -54,32 +55,32 @@ public:
uint32_t getCircularCornerFlags() const { return fCircularCornerFlags; }
- GrEffectEdgeType getEdgeType() const { return fEdgeType; }
+ GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
- typedef GLCircularRRectEffect GLEffect;
+ typedef GLCircularRRectEffect GLProcessor;
virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+ virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE;
private:
- CircularRRectEffect(GrEffectEdgeType, uint32_t circularCornerFlags, const SkRRect&);
+ CircularRRectEffect(GrPrimitiveEdgeType, uint32_t circularCornerFlags, const SkRRect&);
- virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE;
+ virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
- SkRRect fRRect;
- GrEffectEdgeType fEdgeType;
- uint32_t fCircularCornerFlags;
+ SkRRect fRRect;
+ GrPrimitiveEdgeType fEdgeType;
+ uint32_t fCircularCornerFlags;
- GR_DECLARE_EFFECT_TEST;
+ GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
- typedef GrEffect INHERITED;
+ typedef GrFragmentProcessor INHERITED;
};
-GrEffect* CircularRRectEffect::Create(GrEffectEdgeType edgeType,
- uint32_t circularCornerFlags,
- const SkRRect& rrect) {
- if (kFillAA_GrEffectEdgeType != edgeType && kInverseFillAA_GrEffectEdgeType != edgeType) {
+GrFragmentProcessor* CircularRRectEffect::Create(GrPrimitiveEdgeType edgeType,
+ uint32_t circularCornerFlags,
+ const SkRRect& rrect) {
+ if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdgeType != edgeType) {
return NULL;
}
return SkNEW_ARGS(CircularRRectEffect, (edgeType, circularCornerFlags, rrect));
@@ -89,19 +90,19 @@ void CircularRRectEffect::getConstantColorComponents(GrColor* color, uint32_t* v
*validFlags = 0;
}
-const GrBackendEffectFactory& CircularRRectEffect::getFactory() const {
- return GrTBackendEffectFactory<CircularRRectEffect>::getInstance();
+const GrBackendFragmentProcessorFactory& CircularRRectEffect::getFactory() const {
+ return GrTBackendFragmentProcessorFactory<CircularRRectEffect>::getInstance();
}
-CircularRRectEffect::CircularRRectEffect(GrEffectEdgeType edgeType, uint32_t circularCornerFlags,
- const SkRRect& rrect)
+CircularRRectEffect::CircularRRectEffect(GrPrimitiveEdgeType edgeType, uint32_t circularCornerFlags,
+ const SkRRect& rrect)
: fRRect(rrect)
, fEdgeType(edgeType)
, fCircularCornerFlags(circularCornerFlags) {
this->setWillReadFragmentPosition();
}
-bool CircularRRectEffect::onIsEqual(const GrEffect& other) const {
+bool CircularRRectEffect::onIsEqual(const GrProcessor& other) const {
const CircularRRectEffect& crre = other.cast<CircularRRectEffect>();
// The corner flags are derived from fRRect, so no need to check them.
return fEdgeType == crre.fEdgeType && fRRect == crre.fRRect;
@@ -109,64 +110,65 @@ bool CircularRRectEffect::onIsEqual(const GrEffect& other) const {
//////////////////////////////////////////////////////////////////////////////
-GR_DEFINE_EFFECT_TEST(CircularRRectEffect);
+GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircularRRectEffect);
-GrEffect* CircularRRectEffect::TestCreate(SkRandom* random,
- GrContext*,
- const GrDrawTargetCaps& caps,
- GrTexture*[]) {
+GrFragmentProcessor* CircularRRectEffect::TestCreate(SkRandom* random,
+ GrContext*,
+ const GrDrawTargetCaps& caps,
+ GrTexture*[]) {
SkScalar w = random->nextRangeScalar(20.f, 1000.f);
SkScalar h = random->nextRangeScalar(20.f, 1000.f);
SkScalar r = random->nextRangeF(kRadiusMin, 9.f);
SkRRect rrect;
rrect.setRectXY(SkRect::MakeWH(w, h), r, r);
- GrEffect* effect;
+ GrFragmentProcessor* fp;
do {
- GrEffectEdgeType et = (GrEffectEdgeType)random->nextULessThan(kGrEffectEdgeTypeCnt);
- effect = GrRRectEffect::Create(et, rrect);
- } while (NULL == effect);
- return effect;
+ GrPrimitiveEdgeType et =
+ (GrPrimitiveEdgeType)random->nextULessThan(kGrProcessorEdgeTypeCnt);
+ fp = GrRRectEffect::Create(et, rrect);
+ } while (NULL == fp);
+ return fp;
}
//////////////////////////////////////////////////////////////////////////////
-class GLCircularRRectEffect : public GrGLEffect {
+class GLCircularRRectEffect : public GrGLFragmentProcessor {
public:
- GLCircularRRectEffect(const GrBackendEffectFactory&, const GrEffect&);
+ GLCircularRRectEffect(const GrBackendProcessorFactory&, const GrProcessor&);
virtual void emitCode(GrGLProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrFragmentProcessor& fp,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE;
private:
GrGLProgramDataManager::UniformHandle fInnerRectUniform;
GrGLProgramDataManager::UniformHandle fRadiusPlusHalfUniform;
SkRRect fPrevRRect;
- typedef GrGLEffect INHERITED;
+ typedef GrGLFragmentProcessor INHERITED;
};
-GLCircularRRectEffect::GLCircularRRectEffect(const GrBackendEffectFactory& factory,
- const GrEffect& effect)
+GLCircularRRectEffect::GLCircularRRectEffect(const GrBackendProcessorFactory& factory,
+ const GrProcessor& )
: INHERITED (factory) {
fPrevRRect.setEmpty();
}
void GLCircularRRectEffect::emitCode(GrGLProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrFragmentProcessor& fp,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) {
- const CircularRRectEffect& crre = effect.cast<CircularRRectEffect>();
+ const CircularRRectEffect& crre = fp.cast<CircularRRectEffect>();
const char *rectName;
const char *radiusPlusHalfName;
// The inner rect is the rrect bounds inset by the radius. Its left, top, right, and bottom
@@ -285,7 +287,7 @@ void GLCircularRRectEffect::emitCode(GrGLProgramBuilder* builder,
break;
}
- if (kInverseFillAA_GrEffectEdgeType == crre.getEdgeType()) {
+ if (kInverseFillAA_GrProcessorEdgeType == crre.getEdgeType()) {
fsBuilder->codeAppend("\t\talpha = 1.0 - alpha;\n");
}
@@ -293,16 +295,16 @@ void GLCircularRRectEffect::emitCode(GrGLProgramBuilder* builder,
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_str());
}
-void GLCircularRRectEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
- GrEffectKeyBuilder* b) {
- const CircularRRectEffect& crre = effect.cast<CircularRRectEffect>();
- GR_STATIC_ASSERT(kGrEffectEdgeTypeCnt <= 8);
+void GLCircularRRectEffect::GenKey(const GrProcessor& processor, const GrGLCaps&,
+ GrProcessorKeyBuilder* b) {
+ const CircularRRectEffect& crre = processor.cast<CircularRRectEffect>();
+ GR_STATIC_ASSERT(kGrProcessorEdgeTypeCnt <= 8);
b->add32((crre.getCircularCornerFlags() << 3) | crre.getEdgeType());
}
void GLCircularRRectEffect::setData(const GrGLProgramDataManager& pdman,
- const GrEffect& effect) {
- const CircularRRectEffect& crre = effect.cast<CircularRRectEffect>();
+ const GrProcessor& processor) {
+ const CircularRRectEffect& crre = processor.cast<CircularRRectEffect>();
const SkRRect& rrect = crre.getRRect();
if (rrect != fPrevRRect) {
SkRect rect = rrect.getBounds();
@@ -383,9 +385,9 @@ void GLCircularRRectEffect::setData(const GrGLProgramDataManager& pdman,
class GLEllipticalRRectEffect;
-class EllipticalRRectEffect : public GrEffect {
+class EllipticalRRectEffect : public GrFragmentProcessor {
public:
- static GrEffect* Create(GrEffectEdgeType, const SkRRect&);
+ static GrFragmentProcessor* Create(GrPrimitiveEdgeType, const SkRRect&);
virtual ~EllipticalRRectEffect() {};
static const char* Name() { return "EllipticalRRect"; }
@@ -393,29 +395,30 @@ public:
const SkRRect& getRRect() const { return fRRect; }
- GrEffectEdgeType getEdgeType() const { return fEdgeType; }
+ GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
- typedef GLEllipticalRRectEffect GLEffect;
+ typedef GLEllipticalRRectEffect GLProcessor;
virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+ virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE;
private:
- EllipticalRRectEffect(GrEffectEdgeType, const SkRRect&);
+ EllipticalRRectEffect(GrPrimitiveEdgeType, const SkRRect&);
- virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE;
+ virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
SkRRect fRRect;
- GrEffectEdgeType fEdgeType;
+ GrPrimitiveEdgeType fEdgeType;
- GR_DECLARE_EFFECT_TEST;
+ GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
- typedef GrEffect INHERITED;
+ typedef GrFragmentProcessor INHERITED;
};
-GrEffect* EllipticalRRectEffect::Create(GrEffectEdgeType edgeType, const SkRRect& rrect) {
- if (kFillAA_GrEffectEdgeType != edgeType && kInverseFillAA_GrEffectEdgeType != edgeType) {
+GrFragmentProcessor*
+EllipticalRRectEffect::Create(GrPrimitiveEdgeType edgeType, const SkRRect& rrect) {
+ if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdgeType != edgeType) {
return NULL;
}
return SkNEW_ARGS(EllipticalRRectEffect, (edgeType, rrect));
@@ -425,29 +428,29 @@ void EllipticalRRectEffect::getConstantColorComponents(GrColor* color, uint32_t*
*validFlags = 0;
}
-const GrBackendEffectFactory& EllipticalRRectEffect::getFactory() const {
- return GrTBackendEffectFactory<EllipticalRRectEffect>::getInstance();
+const GrBackendFragmentProcessorFactory& EllipticalRRectEffect::getFactory() const {
+ return GrTBackendFragmentProcessorFactory<EllipticalRRectEffect>::getInstance();
}
-EllipticalRRectEffect::EllipticalRRectEffect(GrEffectEdgeType edgeType, const SkRRect& rrect)
+EllipticalRRectEffect::EllipticalRRectEffect(GrPrimitiveEdgeType edgeType, const SkRRect& rrect)
: fRRect(rrect)
, fEdgeType(edgeType){
this->setWillReadFragmentPosition();
}
-bool EllipticalRRectEffect::onIsEqual(const GrEffect& other) const {
+bool EllipticalRRectEffect::onIsEqual(const GrProcessor& other) const {
const EllipticalRRectEffect& erre = other.cast<EllipticalRRectEffect>();
return fEdgeType == erre.fEdgeType && fRRect == erre.fRRect;
}
//////////////////////////////////////////////////////////////////////////////
-GR_DEFINE_EFFECT_TEST(EllipticalRRectEffect);
+GR_DEFINE_FRAGMENT_PROCESSOR_TEST(EllipticalRRectEffect);
-GrEffect* EllipticalRRectEffect::TestCreate(SkRandom* random,
- GrContext*,
- const GrDrawTargetCaps& caps,
- GrTexture*[]) {
+GrFragmentProcessor* EllipticalRRectEffect::TestCreate(SkRandom* random,
+ GrContext*,
+ const GrDrawTargetCaps& caps,
+ GrTexture*[]) {
SkScalar w = random->nextRangeScalar(20.f, 1000.f);
SkScalar h = random->nextRangeScalar(20.f, 1000.f);
SkVector r[4];
@@ -474,48 +477,48 @@ GrEffect* EllipticalRRectEffect::TestCreate(SkRandom* random,
rrect.setRectXY(SkRect::MakeWH(w, h), r[SkRRect::kUpperLeft_Corner].fX,
r[SkRRect::kUpperLeft_Corner].fY);
}
- GrEffect* effect;
+ GrFragmentProcessor* fp;
do {
- GrEffectEdgeType et = (GrEffectEdgeType)random->nextULessThan(kGrEffectEdgeTypeCnt);
- effect = GrRRectEffect::Create(et, rrect);
- } while (NULL == effect);
- return effect;
+ GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)random->nextULessThan(kGrProcessorEdgeTypeCnt);
+ fp = GrRRectEffect::Create(et, rrect);
+ } while (NULL == fp);
+ return fp;
}
//////////////////////////////////////////////////////////////////////////////
-class GLEllipticalRRectEffect : public GrGLEffect {
+class GLEllipticalRRectEffect : public GrGLFragmentProcessor {
public:
- GLEllipticalRRectEffect(const GrBackendEffectFactory&, const GrEffect&);
+ GLEllipticalRRectEffect(const GrBackendProcessorFactory&, const GrProcessor&);
virtual void emitCode(GrGLProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrFragmentProcessor& effect,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*);
- virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE;
private:
GrGLProgramDataManager::UniformHandle fInnerRectUniform;
GrGLProgramDataManager::UniformHandle fInvRadiiSqdUniform;
SkRRect fPrevRRect;
- typedef GrGLEffect INHERITED;
+ typedef GrGLFragmentProcessor INHERITED;
};
-GLEllipticalRRectEffect::GLEllipticalRRectEffect(const GrBackendEffectFactory& factory,
- const GrEffect& effect)
+GLEllipticalRRectEffect::GLEllipticalRRectEffect(const GrBackendProcessorFactory& factory,
+ const GrProcessor& effect)
: INHERITED (factory) {
fPrevRRect.setEmpty();
}
void GLEllipticalRRectEffect::emitCode(GrGLProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrFragmentProcessor& effect,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@@ -580,7 +583,7 @@ void GLEllipticalRRectEffect::emitCode(GrGLProgramBuilder* builder,
fsBuilder->codeAppend("\t\tgrad_dot = max(grad_dot, 1.0e-4);\n");
fsBuilder->codeAppendf("\t\tfloat approx_dist = implicit * inversesqrt(grad_dot);\n");
- if (kFillAA_GrEffectEdgeType == erre.getEdgeType()) {
+ if (kFillAA_GrProcessorEdgeType == erre.getEdgeType()) {
fsBuilder->codeAppend("\t\tfloat alpha = clamp(0.5 - approx_dist, 0.0, 1.0);\n");
} else {
fsBuilder->codeAppend("\t\tfloat alpha = clamp(0.5 + approx_dist, 0.0, 1.0);\n");
@@ -590,15 +593,15 @@ void GLEllipticalRRectEffect::emitCode(GrGLProgramBuilder* builder,
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_str());
}
-void GLEllipticalRRectEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
- GrEffectKeyBuilder* b) {
+void GLEllipticalRRectEffect::GenKey(const GrProcessor& effect, const GrGLCaps&,
+ GrProcessorKeyBuilder* b) {
const EllipticalRRectEffect& erre = effect.cast<EllipticalRRectEffect>();
- GR_STATIC_ASSERT(kLast_GrEffectEdgeType < (1 << 3));
+ GR_STATIC_ASSERT(kLast_GrProcessorEdgeType < (1 << 3));
b->add32(erre.getRRect().getType() | erre.getEdgeType() << 3);
}
void GLEllipticalRRectEffect::setData(const GrGLProgramDataManager& pdman,
- const GrEffect& effect) {
+ const GrProcessor& effect) {
const EllipticalRRectEffect& erre = effect.cast<EllipticalRRectEffect>();
const SkRRect& rrect = erre.getRRect();
if (rrect != fPrevRRect) {
@@ -636,7 +639,7 @@ void GLEllipticalRRectEffect::setData(const GrGLProgramDataManager& pdman,
//////////////////////////////////////////////////////////////////////////////
-GrEffect* GrRRectEffect::Create(GrEffectEdgeType edgeType, const SkRRect& rrect) {
+GrFragmentProcessor* GrRRectEffect::Create(GrPrimitiveEdgeType edgeType, const SkRRect& rrect) {
if (rrect.isRect()) {
return GrConvexPolyEffect::Create(edgeType, rrect.getBounds());
}
diff --git a/src/gpu/effects/GrRRectEffect.h b/src/gpu/effects/GrRRectEffect.h
index bcf4884ddd..eaaf9a0726 100644
--- a/src/gpu/effects/GrRRectEffect.h
+++ b/src/gpu/effects/GrRRectEffect.h
@@ -11,7 +11,7 @@
#include "GrTypes.h"
#include "GrTypesPriv.h"
-class GrEffect;
+class GrProcessor;
class SkRRect;
namespace GrRRectEffect {
@@ -19,7 +19,7 @@ namespace GrRRectEffect {
* Creates an effect that performs anti-aliased clipping against a SkRRect. It doesn't support
* all varieties of SkRRect so the caller must check for a NULL return.
*/
- GrEffect* Create(GrEffectEdgeType, const SkRRect&);
+ GrFragmentProcessor* Create(GrPrimitiveEdgeType, const SkRRect&);
};
#endif
diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp
index f2a932b02b..6743ddbbe1 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.cpp
+++ b/src/gpu/effects/GrSimpleTextureEffect.cpp
@@ -7,21 +7,21 @@
#include "gl/builders/GrGLProgramBuilder.h"
#include "GrSimpleTextureEffect.h"
-#include "gl/GrGLEffect.h"
+#include "gl/GrGLProcessor.h"
#include "gl/GrGLSL.h"
#include "gl/GrGLTexture.h"
-#include "GrTBackendEffectFactory.h"
+#include "GrTBackendProcessorFactory.h"
#include "GrTexture.h"
-class GrGLSimpleTextureEffect : public GrGLEffect {
+class GrGLSimpleTextureEffect : public GrGLFragmentProcessor {
public:
- GrGLSimpleTextureEffect(const GrBackendEffectFactory& factory, const GrEffect&)
+ GrGLSimpleTextureEffect(const GrBackendProcessorFactory& factory, const GrProcessor&)
: INHERITED (factory) {
}
virtual void emitCode(GrGLProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrFragmentProcessor& fp,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,
@@ -36,7 +36,7 @@ public:
}
private:
- typedef GrGLEffect INHERITED;
+ typedef GrGLFragmentProcessor INHERITED;
};
///////////////////////////////////////////////////////////////////////////////
@@ -45,20 +45,20 @@ void GrSimpleTextureEffect::getConstantColorComponents(GrColor* color, uint32_t*
this->updateConstantColorComponentsForModulation(color, validFlags);
}
-const GrBackendEffectFactory& GrSimpleTextureEffect::getFactory() const {
- return GrTBackendEffectFactory<GrSimpleTextureEffect>::getInstance();
+const GrBackendFragmentProcessorFactory& GrSimpleTextureEffect::getFactory() const {
+ return GrTBackendFragmentProcessorFactory<GrSimpleTextureEffect>::getInstance();
}
///////////////////////////////////////////////////////////////////////////////
-GR_DEFINE_EFFECT_TEST(GrSimpleTextureEffect);
+GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSimpleTextureEffect);
-GrEffect* GrSimpleTextureEffect::TestCreate(SkRandom* random,
- GrContext*,
- const GrDrawTargetCaps&,
- GrTexture* textures[]) {
- int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
- GrEffectUnitTest::kAlphaTextureIdx;
+GrFragmentProcessor* GrSimpleTextureEffect::TestCreate(SkRandom* random,
+ GrContext*,
+ const GrDrawTargetCaps&,
+ GrTexture* textures[]) {
+ int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
+ GrProcessorUnitTest::kAlphaTextureIdx;
static const SkShader::TileMode kTileModes[] = {
SkShader::kClamp_TileMode,
SkShader::kRepeat_TileMode,
@@ -77,6 +77,6 @@ GrEffect* GrSimpleTextureEffect::TestCreate(SkRandom* random,
};
GrCoordSet coordSet = kCoordSets[random->nextULessThan(SK_ARRAY_COUNT(kCoordSets))];
- const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random);
+ const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random);
return GrSimpleTextureEffect::Create(textures[texIdx], matrix, coordSet);
}
diff --git a/src/gpu/effects/GrSimpleTextureEffect.h b/src/gpu/effects/GrSimpleTextureEffect.h
index e81dd86cb2..dc9cf85e0f 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.h
+++ b/src/gpu/effects/GrSimpleTextureEffect.h
@@ -23,25 +23,25 @@ class GrGLSimpleTextureEffect;
class GrSimpleTextureEffect : public GrSingleTextureEffect {
public:
/* unfiltered, clamp mode */
- static GrEffect* Create(GrTexture* tex,
- const SkMatrix& matrix,
- GrCoordSet coordSet = kLocal_GrCoordSet) {
+ static GrFragmentProcessor* Create(GrTexture* tex,
+ const SkMatrix& matrix,
+ GrCoordSet coordSet = kLocal_GrCoordSet) {
return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, GrTextureParams::kNone_FilterMode,
coordSet));
}
/* clamp mode */
- static GrEffect* Create(GrTexture* tex,
- const SkMatrix& matrix,
- GrTextureParams::FilterMode filterMode,
- GrCoordSet coordSet = kLocal_GrCoordSet) {
+ static GrFragmentProcessor* Create(GrTexture* tex,
+ const SkMatrix& matrix,
+ GrTextureParams::FilterMode filterMode,
+ GrCoordSet coordSet = kLocal_GrCoordSet) {
return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, filterMode, coordSet));
}
- static GrEffect* Create(GrTexture* tex,
- const SkMatrix& matrix,
- const GrTextureParams& p,
- GrCoordSet coordSet = kLocal_GrCoordSet) {
+ static GrFragmentProcessor* Create(GrTexture* tex,
+ const SkMatrix& matrix,
+ const GrTextureParams& p,
+ GrCoordSet coordSet = kLocal_GrCoordSet) {
return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, p, coordSet));
}
@@ -51,9 +51,9 @@ public:
virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
- typedef GrGLSimpleTextureEffect GLEffect;
+ typedef GrGLSimpleTextureEffect GLProcessor;
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+ virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE;
private:
GrSimpleTextureEffect(GrTexture* texture,
@@ -70,12 +70,12 @@ private:
: GrSingleTextureEffect(texture, matrix, params, coordSet) {
}
- virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE {
+ virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE {
const GrSimpleTextureEffect& ste = other.cast<GrSimpleTextureEffect>();
return this->hasSameTextureParamsMatrixAndSourceCoords(ste);
}
- GR_DECLARE_EFFECT_TEST;
+ GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
typedef GrSingleTextureEffect INHERITED;
};
diff --git a/src/gpu/effects/GrSingleTextureEffect.h b/src/gpu/effects/GrSingleTextureEffect.h
index a8f9a6d521..6349ee7896 100644
--- a/src/gpu/effects/GrSingleTextureEffect.h
+++ b/src/gpu/effects/GrSingleTextureEffect.h
@@ -8,7 +8,7 @@
#ifndef GrSingleTextureEffect_DEFINED
#define GrSingleTextureEffect_DEFINED
-#include "GrEffect.h"
+#include "GrProcessor.h"
#include "SkMatrix.h"
#include "GrCoordTransform.h"
@@ -18,7 +18,7 @@ class GrTexture;
* A base class for effects that draw a single texture with a texture matrix. This effect has no
* backend implementations. One must be provided by the subclass.
*/
-class GrSingleTextureEffect : public GrEffect {
+class GrSingleTextureEffect : public GrFragmentProcessor {
public:
virtual ~GrSingleTextureEffect();
@@ -61,7 +61,7 @@ private:
GrCoordTransform fCoordTransform;
GrTextureAccess fTextureAccess;
- typedef GrEffect INHERITED;
+ typedef GrFragmentProcessor INHERITED;
};
#endif
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index 664c65c121..1d3b37dddd 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -8,8 +8,8 @@
#include "gl/builders/GrGLProgramBuilder.h"
#include "GrTextureDomain.h"
#include "GrSimpleTextureEffect.h"
-#include "GrTBackendEffectFactory.h"
-#include "gl/GrGLEffect.h"
+#include "GrTBackendProcessorFactory.h"
+#include "gl/GrGLProcessor.h"
#include "SkFloatingPoint.h"
@@ -44,7 +44,7 @@ void GrTextureDomain::GLDomain::sampleTexture(GrGLShaderBuilder* builder,
const GrTextureDomain& textureDomain,
const char* outColor,
const SkString& inCoords,
- const GrGLEffect::TextureSampler sampler,
+ const GrGLProcessor::TextureSampler sampler,
const char* inModulateColor) {
SkASSERT((Mode)-1 == fMode || textureDomain.mode() == fMode);
SkDEBUGCODE(fMode = textureDomain.mode();)
@@ -165,40 +165,40 @@ void GrTextureDomain::GLDomain::setData(const GrGLProgramDataManager& pdman,
//////////////////////////////////////////////////////////////////////////////
-class GrGLTextureDomainEffect : public GrGLEffect {
+class GrGLTextureDomainEffect : public GrGLFragmentProcessor {
public:
- GrGLTextureDomainEffect(const GrBackendEffectFactory&, const GrEffect&);
+ GrGLTextureDomainEffect(const GrBackendProcessorFactory&, const GrProcessor&);
virtual void emitCode(GrGLProgramBuilder*,
- const GrEffect&,
- const GrEffectKey&,
+ const GrFragmentProcessor&,
+ const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) SK_OVERRIDE;
- virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE;
+ virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE;
- static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*);
+ static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*);
private:
GrTextureDomain::GLDomain fGLDomain;
- typedef GrGLEffect INHERITED;
+ typedef GrGLFragmentProcessor INHERITED;
};
-GrGLTextureDomainEffect::GrGLTextureDomainEffect(const GrBackendEffectFactory& factory,
- const GrEffect&)
+GrGLTextureDomainEffect::GrGLTextureDomainEffect(const GrBackendProcessorFactory& factory,
+ const GrProcessor&)
: INHERITED(factory) {
}
void GrGLTextureDomainEffect::emitCode(GrGLProgramBuilder* builder,
- const GrEffect& effect,
- const GrEffectKey& key,
+ const GrFragmentProcessor& fp,
+ const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,
const TextureSamplerArray& samplers) {
- const GrTextureDomainEffect& textureDomainEffect = effect.cast<GrTextureDomainEffect>();
+ const GrTextureDomainEffect& textureDomainEffect = fp.cast<GrTextureDomainEffect>();
const GrTextureDomain& domain = textureDomainEffect.textureDomain();
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
@@ -207,27 +207,27 @@ void GrGLTextureDomainEffect::emitCode(GrGLProgramBuilder* builder,
}
void GrGLTextureDomainEffect::setData(const GrGLProgramDataManager& pdman,
- const GrEffect& effect) {
- const GrTextureDomainEffect& textureDomainEffect = effect.cast<GrTextureDomainEffect>();
+ const GrProcessor& processor) {
+ const GrTextureDomainEffect& textureDomainEffect = processor.cast<GrTextureDomainEffect>();
const GrTextureDomain& domain = textureDomainEffect.textureDomain();
- fGLDomain.setData(pdman, domain, effect.texture(0)->origin());
+ fGLDomain.setData(pdman, domain, processor.texture(0)->origin());
}
-void GrGLTextureDomainEffect::GenKey(const GrEffect& effect, const GrGLCaps&,
- GrEffectKeyBuilder* b) {
- const GrTextureDomain& domain = effect.cast<GrTextureDomainEffect>().textureDomain();
+void GrGLTextureDomainEffect::GenKey(const GrProcessor& processor, const GrGLCaps&,
+ GrProcessorKeyBuilder* b) {
+ const GrTextureDomain& domain = processor.cast<GrTextureDomainEffect>().textureDomain();
b->add32(GrTextureDomain::GLDomain::DomainKey(domain));
}
///////////////////////////////////////////////////////////////////////////////
-GrEffect* GrTextureDomainEffect::Create(GrTexture* texture,
- const SkMatrix& matrix,
- const SkRect& domain,
- GrTextureDomain::Mode mode,
- GrTextureParams::FilterMode filterMode,
- GrCoordSet coordSet) {
+GrFragmentProcessor* GrTextureDomainEffect::Create(GrTexture* texture,
+ const SkMatrix& matrix,
+ const SkRect& domain,
+ GrTextureDomain::Mode mode,
+ GrTextureParams::FilterMode filterMode,
+ GrCoordSet coordSet) {
static const SkRect kFullRect = {0, 0, SK_Scalar1, SK_Scalar1};
if (GrTextureDomain::kIgnore_Mode == mode ||
(GrTextureDomain::kClamp_Mode == mode && domain.contains(kFullRect))) {
@@ -259,11 +259,11 @@ GrTextureDomainEffect::~GrTextureDomainEffect() {
}
-const GrBackendEffectFactory& GrTextureDomainEffect::getFactory() const {
- return GrTBackendEffectFactory<GrTextureDomainEffect>::getInstance();
+const GrBackendFragmentProcessorFactory& GrTextureDomainEffect::getFactory() const {
+ return GrTBackendFragmentProcessorFactory<GrTextureDomainEffect>::getInstance();
}
-bool GrTextureDomainEffect::onIsEqual(const GrEffect& sBase) const {
+bool GrTextureDomainEffect::onIsEqual(const GrProcessor& sBase) const {
const GrTextureDomainEffect& s = sBase.cast<GrTextureDomainEffect>();
return this->hasSameTextureParamsMatrixAndSourceCoords(s) &&
this->fTextureDomain == s.fTextureDomain;
@@ -279,14 +279,14 @@ void GrTextureDomainEffect::getConstantColorComponents(GrColor* color, uint32_t*
///////////////////////////////////////////////////////////////////////////////
-GR_DEFINE_EFFECT_TEST(GrTextureDomainEffect);
+GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrTextureDomainEffect);
-GrEffect* GrTextureDomainEffect::TestCreate(SkRandom* random,
- GrContext*,
- const GrDrawTargetCaps&,
- GrTexture* textures[]) {
- int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
- GrEffectUnitTest::kAlphaTextureIdx;
+GrFragmentProcessor* GrTextureDomainEffect::TestCreate(SkRandom* random,
+ GrContext*,
+ const GrDrawTargetCaps&,
+ GrTexture* textures[]) {
+ int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
+ GrProcessorUnitTest::kAlphaTextureIdx;
SkRect domain;
domain.fLeft = random->nextUScalar1();
domain.fRight = random->nextRangeScalar(domain.fLeft, SK_Scalar1);
@@ -294,7 +294,7 @@ GrEffect* GrTextureDomainEffect::TestCreate(SkRandom* random,
domain.fBottom = random->nextRangeScalar(domain.fTop, SK_Scalar1);
GrTextureDomain::Mode mode =
(GrTextureDomain::Mode) random->nextULessThan(GrTextureDomain::kModeCount);
- const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random);
+ const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random);
bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? random->nextBool() : false;
GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kPosition_GrCoordSet;
return GrTextureDomainEffect::Create(textures[texIdx],
diff --git a/src/gpu/effects/GrTextureDomain.h b/src/gpu/effects/GrTextureDomain.h
index 6cb5ad408e..5751bad0f7 100644
--- a/src/gpu/effects/GrTextureDomain.h
+++ b/src/gpu/effects/GrTextureDomain.h
@@ -9,7 +9,7 @@
#define GrTextureDomainEffect_DEFINED
#include "GrSingleTextureEffect.h"
-#include "gl/GrGLEffect.h"
+#include "gl/GrGLProcessor.h"
class GrGLProgramBuilder;
class GrGLShaderBuilder;
@@ -73,7 +73,7 @@ public:
}
/**
- * A GrGLEffect subclass that corresponds to a GrEffect subclass that uses GrTextureDomain
+ * A GrGLProcessor subclass that corresponds to a GrProcessor subclass that uses GrTextureDomain
* should include this helper. It generates the texture domain GLSL, produces the part of the
* effect key that reflects the texture domain code, and performs the uniform uploads necessary
* for texture domains.
@@ -86,7 +86,8 @@ public:
}
/**
- * Call this from GrGLEffect::emitCode() to sample the texture W.R.T. the domain and mode.
+ * Call this from GrGLProcessor::emitCode() to sample the texture W.R.T. the domain and
+ * mode.
*
* @param outcolor name of vec4 variable to hold the sampled color.
* @param inCoords name of vec2 variable containing the coords to be used with the domain.
@@ -98,12 +99,12 @@ public:
const GrTextureDomain& textureDomain,
const char* outColor,
const SkString& inCoords,
- const GrGLEffect::TextureSampler sampler,
+ const GrGLProcessor::TextureSampler sampler,
const char* inModulateColor = NULL);
/**
- * Call this from GrGLEffect::setData() to upload uniforms necessary for the texture domain.
- * The rectangle is automatically adjusted to account for the texture's origin.
+ * Call this from GrGLProcessor::setData() to upload uniforms necessary for the texture
+ * domain. The rectangle is automatically adjusted to account for the texture's origin.
*/
void setData(const GrGLProgramDataManager& pdman, const GrTextureDomain& textureDomain,
GrSurfaceOrigin textureOrigin);
@@ -113,8 +114,8 @@ public:
};
/**
- * GrGLEffect::GenKey() must call this and include the returned value in it's computed key.
- * The returned will be limited to the lower kDomainKeyBits bits.
+ * GrGLProcessor::GenKey() must call this and include the returned value in it's computed
+ * key. The returned will be limited to the lower kDomainKeyBits bits.
*/
static uint32_t DomainKey(const GrTextureDomain& domain) {
GR_STATIC_ASSERT(kModeCount <= 4);
@@ -144,20 +145,20 @@ class GrGLTextureDomainEffect;
class GrTextureDomainEffect : public GrSingleTextureEffect {
public:
- static GrEffect* Create(GrTexture*,
- const SkMatrix&,
- const SkRect& domain,
- GrTextureDomain::Mode,
- GrTextureParams::FilterMode filterMode,
- GrCoordSet = kLocal_GrCoordSet);
+ static GrFragmentProcessor* Create(GrTexture*,
+ const SkMatrix&,
+ const SkRect& domain,
+ GrTextureDomain::Mode,
+ GrTextureParams::FilterMode filterMode,
+ GrCoordSet = kLocal_GrCoordSet);
virtual ~GrTextureDomainEffect();
static const char* Name() { return "TextureDomain"; }
- typedef GrGLTextureDomainEffect GLEffect;
+ typedef GrGLTextureDomainEffect GLProcessor;
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+ virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE;
virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
const GrTextureDomain& textureDomain() const { return fTextureDomain; }
@@ -173,9 +174,9 @@ private:
GrTextureParams::FilterMode,
GrCoordSet);
- virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE;
+ virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
- GR_DECLARE_EFFECT_TEST;
+ GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
typedef GrSingleTextureEffect INHERITED;
};
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp
index dc67028df3..436106c991 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.cpp
+++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp
@@ -9,23 +9,23 @@
#include "GrYUVtoRGBEffect.h"
#include "GrCoordTransform.h"
-#include "GrEffect.h"
-#include "gl/GrGLEffect.h"
-#include "GrTBackendEffectFactory.h"
+#include "GrProcessor.h"
+#include "gl/GrGLProcessor.h"
+#include "GrTBackendProcessorFactory.h"
namespace {
-class YUVtoRGBEffect : public GrEffect {
+class YUVtoRGBEffect : public GrFragmentProcessor {
public:
- static GrEffect* Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture,
- SkYUVColorSpace colorSpace) {
+ static GrFragmentProcessor* Create(GrTexture* yTexture, GrTexture* uTexture,
+ GrTexture* vTexture, SkYUVColorSpace colorSpace) {
return SkNEW_ARGS(YUVtoRGBEffect, (yTexture, uTexture, vTexture, colorSpace));
}
static const char* Name() { return "YUV to RGB"; }
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE {
- return GrTBackendEffectFactory<YUVtoRGBEffect>::getInstance();
+ virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE {
+ return GrTBackendFragmentProcessorFactory<YUVtoRGBEffect>::getInstance();
}
virtual void getConstantColorComponents(GrColor* color,
@@ -39,22 +39,22 @@ public:
return fColorSpace;
}
- class GLEffect : public GrGLEffect {
+ class GLProcessor : public GrGLFragmentProcessor {
public:
static const GrGLfloat kJPEGConversionMatrix[16];
static const GrGLfloat kRec601ConversionMatrix[16];
// this class always generates the same code.
- static void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*) {}
+ static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*) {}
- GLEffect(const GrBackendEffectFactory& factory,
- const GrEffect&)
+ GLProcessor(const GrBackendProcessorFactory& factory,
+ const GrProcessor&)
: INHERITED(factory) {
}
virtual void emitCode(GrGLProgramBuilder* builder,
- const GrEffect&,
- const GrEffectKey&,
+ const GrFragmentProcessor&,
+ const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,
@@ -75,8 +75,8 @@ public:
}
virtual void setData(const GrGLProgramDataManager& pdman,
- const GrEffect& effect) SK_OVERRIDE {
- const YUVtoRGBEffect& yuvEffect = effect.cast<YUVtoRGBEffect>();
+ const GrProcessor& processor) SK_OVERRIDE {
+ const YUVtoRGBEffect& yuvEffect = processor.cast<YUVtoRGBEffect>();
switch (yuvEffect.getColorSpace()) {
case kJPEG_SkYUVColorSpace:
pdman.setMatrix4f(fMatrixUni, kJPEGConversionMatrix);
@@ -90,7 +90,7 @@ public:
private:
GrGLProgramDataManager::UniformHandle fMatrixUni;
- typedef GrGLEffect INHERITED;
+ typedef GrGLFragmentProcessor INHERITED;
};
private:
@@ -109,7 +109,7 @@ private:
this->setWillNotUseInputColor();
}
- virtual bool onIsEqual(const GrEffect& sBase) const {
+ virtual bool onIsEqual(const GrProcessor& sBase) const {
const YUVtoRGBEffect& s = sBase.cast<YUVtoRGBEffect>();
return fYAccess.getTexture() == s.fYAccess.getTexture() &&
fUAccess.getTexture() == s.fUAccess.getTexture() &&
@@ -123,15 +123,15 @@ private:
GrTextureAccess fVAccess;
SkYUVColorSpace fColorSpace;
- typedef GrEffect INHERITED;
+ typedef GrFragmentProcessor INHERITED;
};
-const GrGLfloat YUVtoRGBEffect::GLEffect::kJPEGConversionMatrix[16] = {
+const GrGLfloat YUVtoRGBEffect::GLProcessor::kJPEGConversionMatrix[16] = {
1.0f, 0.0f, 1.402f, -0.701f,
1.0f, -0.34414f, -0.71414f, 0.529f,
1.0f, 1.772f, 0.0f, -0.886f,
0.0f, 0.0f, 0.0f, 1.0};
-const GrGLfloat YUVtoRGBEffect::GLEffect::kRec601ConversionMatrix[16] = {
+const GrGLfloat YUVtoRGBEffect::GLProcessor::kRec601ConversionMatrix[16] = {
1.164f, 0.0f, 1.596f, -0.87075f,
1.164f, -0.391f, -0.813f, 0.52925f,
1.164f, 2.018f, 0.0f, -1.08175f,
@@ -140,7 +140,8 @@ const GrGLfloat YUVtoRGBEffect::GLEffect::kRec601ConversionMatrix[16] = {
//////////////////////////////////////////////////////////////////////////////
-GrEffect* GrYUVtoRGBEffect::Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture,
- SkYUVColorSpace colorSpace) {
+GrFragmentProcessor*
+GrYUVtoRGBEffect::Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture,
+ SkYUVColorSpace colorSpace) {
return YUVtoRGBEffect::Create(yTexture, uTexture, vTexture, colorSpace);
}
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.h b/src/gpu/effects/GrYUVtoRGBEffect.h
index 52ccd23bbb..4c057bd0ac 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.h
+++ b/src/gpu/effects/GrYUVtoRGBEffect.h
@@ -10,15 +10,15 @@
#include "SkImageInfo.h"
-class GrEffect;
+class GrFragmentProcessor;
class GrTexture;
namespace GrYUVtoRGBEffect {
/**
* Creates an effect that performs color conversion from YUV to RGB
*/
- GrEffect* Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture,
- SkYUVColorSpace colorSpace);
+ GrFragmentProcessor* Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture,
+ SkYUVColorSpace colorSpace);
};
#endif