| Index: src/gpu/effects/GrBezierEffect.cpp
|
| diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp
|
| index 488af1585f0f5b0c4869e5fd73da391dcb496740..3cecd574eb094da7e4750a62cb39322b9f56d83c 100644
|
| --- a/src/gpu/effects/GrBezierEffect.cpp
|
| +++ b/src/gpu/effects/GrBezierEffect.cpp
|
| @@ -10,10 +10,15 @@
|
|
|
| #include "gl/GrGLEffect.h"
|
| #include "gl/GrGLSL.h"
|
| -#include "gl/GrGLVertexEffect.h"
|
| +#include "gl/GrGLGeometryProcessor.h"
|
| #include "GrTBackendEffectFactory.h"
|
|
|
| -class GrGLConicEffect : public GrGLVertexEffect {
|
| +// Shader variable local constants
|
| +const GrShaderVar kAttrConicCoeffs("aConicCoeffs",
|
| + kVec4f_GrSLType,
|
| + GrShaderVar::kAttribute_TypeModifier);
|
| +
|
| +class GrGLConicEffect : public GrGLGeometryProcessor {
|
| public:
|
| GrGLConicEffect(const GrBackendEffectFactory&, const GrDrawEffect&);
|
|
|
| @@ -32,7 +37,7 @@ public:
|
| private:
|
| GrEffectEdgeType fEdgeType;
|
|
|
| - typedef GrGLVertexEffect INHERITED;
|
| + typedef GrGLGeometryProcessor INHERITED;
|
| };
|
|
|
| GrGLConicEffect::GrGLConicEffect(const GrBackendEffectFactory& factory,
|
| @@ -55,9 +60,7 @@ void GrGLConicEffect::emitCode(GrGLFullProgramBuilder* builder,
|
| &vsName, &fsName);
|
|
|
| GrGLVertexShaderBuilder* vsBuilder = builder->getVertexShaderBuilder();
|
| - const SkString* attr0Name =
|
| - vsBuilder->getEffectAttributeName(drawEffect.getVertexAttribIndices()[0]);
|
| - vsBuilder->codeAppendf("%s = %s;", vsName, attr0Name->c_str());
|
| + vsBuilder->codeAppendf("%s = %s;", vsName, kAttrConicCoeffs.c_str());
|
|
|
| GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
| fsBuilder->codeAppend("float edgeAlpha;");
|
| @@ -135,8 +138,8 @@ const GrBackendEffectFactory& GrConicEffect::getFactory() const {
|
| return GrTBackendEffectFactory<GrConicEffect>::getInstance();
|
| }
|
|
|
| -GrConicEffect::GrConicEffect(GrEffectEdgeType edgeType) : GrVertexEffect() {
|
| - this->addVertexAttrib(kVec4f_GrSLType);
|
| +GrConicEffect::GrConicEffect(GrEffectEdgeType edgeType) : GrGeometryProcessor() {
|
| + this->addVertexAttrib(kAttrConicCoeffs);
|
| fEdgeType = edgeType;
|
| }
|
|
|
| @@ -166,7 +169,11 @@ GrEffect* GrConicEffect::TestCreate(SkRandom* random,
|
| // Quad
|
| //////////////////////////////////////////////////////////////////////////////
|
|
|
| -class GrGLQuadEffect : public GrGLVertexEffect {
|
| +const GrShaderVar kAttrHairQuadEdge("aHairQuadEdge",
|
| + kVec4f_GrSLType,
|
| + GrShaderVar::kAttribute_TypeModifier);
|
| +
|
| +class GrGLQuadEffect : public GrGLGeometryProcessor {
|
| public:
|
| GrGLQuadEffect(const GrBackendEffectFactory&, const GrDrawEffect&);
|
|
|
| @@ -185,7 +192,7 @@ public:
|
| private:
|
| GrEffectEdgeType fEdgeType;
|
|
|
| - typedef GrGLVertexEffect INHERITED;
|
| + typedef GrGLGeometryProcessor INHERITED;
|
| };
|
|
|
| GrGLQuadEffect::GrGLQuadEffect(const GrBackendEffectFactory& factory,
|
| @@ -206,9 +213,7 @@ void GrGLQuadEffect::emitCode(GrGLFullProgramBuilder* builder,
|
| builder->addVarying(kVec4f_GrSLType, "HairQuadEdge", &vsName, &fsName);
|
|
|
| GrGLVertexShaderBuilder* vsBuilder = builder->getVertexShaderBuilder();
|
| - const SkString* attrName =
|
| - vsBuilder->getEffectAttributeName(drawEffect.getVertexAttribIndices()[0]);
|
| - vsBuilder->codeAppendf("%s = %s;", vsName, attrName->c_str());
|
| + vsBuilder->codeAppendf("%s = %s;", vsName, kAttrHairQuadEdge.c_str());
|
|
|
| GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
| fsBuilder->codeAppendf("float edgeAlpha;");
|
| @@ -272,8 +277,8 @@ const GrBackendEffectFactory& GrQuadEffect::getFactory() const {
|
| return GrTBackendEffectFactory<GrQuadEffect>::getInstance();
|
| }
|
|
|
| -GrQuadEffect::GrQuadEffect(GrEffectEdgeType edgeType) : GrVertexEffect() {
|
| - this->addVertexAttrib(kVec4f_GrSLType);
|
| +GrQuadEffect::GrQuadEffect(GrEffectEdgeType edgeType) : GrGeometryProcessor() {
|
| + this->addVertexAttrib(kAttrHairQuadEdge);
|
| fEdgeType = edgeType;
|
| }
|
|
|
| @@ -303,7 +308,11 @@ GrEffect* GrQuadEffect::TestCreate(SkRandom* random,
|
| // Cubic
|
| //////////////////////////////////////////////////////////////////////////////
|
|
|
| -class GrGLCubicEffect : public GrGLVertexEffect {
|
| +const GrShaderVar kAttrCubicCoeffs("aCubicCoeffs",
|
| + kVec4f_GrSLType,
|
| + GrShaderVar::kAttribute_TypeModifier);
|
| +
|
| +class GrGLCubicEffect : public GrGLGeometryProcessor {
|
| public:
|
| GrGLCubicEffect(const GrBackendEffectFactory&, const GrDrawEffect&);
|
|
|
| @@ -322,7 +331,7 @@ public:
|
| private:
|
| GrEffectEdgeType fEdgeType;
|
|
|
| - typedef GrGLVertexEffect INHERITED;
|
| + typedef GrGLGeometryProcessor INHERITED;
|
| };
|
|
|
| GrGLCubicEffect::GrGLCubicEffect(const GrBackendEffectFactory& factory,
|
| @@ -345,9 +354,7 @@ void GrGLCubicEffect::emitCode(GrGLFullProgramBuilder* builder,
|
| &vsName, &fsName, GrGLShaderVar::kHigh_Precision);
|
|
|
| GrGLVertexShaderBuilder* vsBuilder = builder->getVertexShaderBuilder();
|
| - const SkString* attr0Name =
|
| - vsBuilder->getEffectAttributeName(drawEffect.getVertexAttribIndices()[0]);
|
| - vsBuilder->codeAppendf("%s = %s;", vsName, attr0Name->c_str());
|
| + vsBuilder->codeAppendf("%s = %s;", vsName, kAttrCubicCoeffs.c_str());
|
|
|
| GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
|
|
| @@ -451,8 +458,8 @@ const GrBackendEffectFactory& GrCubicEffect::getFactory() const {
|
| return GrTBackendEffectFactory<GrCubicEffect>::getInstance();
|
| }
|
|
|
| -GrCubicEffect::GrCubicEffect(GrEffectEdgeType edgeType) : GrVertexEffect() {
|
| - this->addVertexAttrib(kVec4f_GrSLType);
|
| +GrCubicEffect::GrCubicEffect(GrEffectEdgeType edgeType) : GrGeometryProcessor() {
|
| + this->addVertexAttrib(kAttrCubicCoeffs);
|
| fEdgeType = edgeType;
|
| }
|
|
|
|
|