Index: src/gpu/effects/GrBezierEffect.cpp |
diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp |
index 488af1585f0f5b0c4869e5fd73da391dcb496740..0c204969ca9e3fcb66a5ba5786f864e1fef781dd 100644 |
--- a/src/gpu/effects/GrBezierEffect.cpp |
+++ b/src/gpu/effects/GrBezierEffect.cpp |
@@ -10,10 +10,10 @@ |
#include "gl/GrGLEffect.h" |
#include "gl/GrGLSL.h" |
-#include "gl/GrGLVertexEffect.h" |
+#include "gl/GrGLGeometryProcessor.h" |
#include "GrTBackendEffectFactory.h" |
-class GrGLConicEffect : public GrGLVertexEffect { |
+class GrGLConicEffect : public GrGLGeometryProcessor { |
public: |
GrGLConicEffect(const GrBackendEffectFactory&, const GrDrawEffect&); |
@@ -32,7 +32,7 @@ public: |
private: |
GrEffectEdgeType fEdgeType; |
- typedef GrGLVertexEffect INHERITED; |
+ typedef GrGLGeometryProcessor INHERITED; |
}; |
GrGLConicEffect::GrGLConicEffect(const GrBackendEffectFactory& factory, |
@@ -54,10 +54,9 @@ void GrGLConicEffect::emitCode(GrGLFullProgramBuilder* builder, |
builder->addVarying(kVec4f_GrSLType, "ConicCoeffs", |
&vsName, &fsName); |
+ const GrShaderVar& aConicCoeffs = drawEffect.castEffect<GrConicEffect>().aConicCoeffs(); |
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, aConicCoeffs.c_str()); |
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
fsBuilder->codeAppend("float edgeAlpha;"); |
@@ -135,9 +134,12 @@ const GrBackendEffectFactory& GrConicEffect::getFactory() const { |
return GrTBackendEffectFactory<GrConicEffect>::getInstance(); |
} |
-GrConicEffect::GrConicEffect(GrEffectEdgeType edgeType) : GrVertexEffect() { |
- this->addVertexAttrib(kVec4f_GrSLType); |
- fEdgeType = edgeType; |
+GrConicEffect::GrConicEffect(GrEffectEdgeType edgeType) |
+ : GrGeometryProcessor() |
bsalomon
2014/09/12 00:34:17
We usually use the INHERITED typedef for the base
joshua.litt
2014/09/12 00:46:07
Acknowledged.
|
+ , fEdgeType(edgeType) |
+ , fAttrConicCoeffs(this->addVertexAttrib(GrShaderVar("aConicCoeffs", |
+ kVec4f_GrSLType, |
+ GrShaderVar::kAttribute_TypeModifier))) { |
} |
bool GrConicEffect::onIsEqual(const GrEffect& other) const { |
@@ -166,7 +168,7 @@ GrEffect* GrConicEffect::TestCreate(SkRandom* random, |
// Quad |
////////////////////////////////////////////////////////////////////////////// |
-class GrGLQuadEffect : public GrGLVertexEffect { |
+class GrGLQuadEffect : public GrGLGeometryProcessor { |
public: |
GrGLQuadEffect(const GrBackendEffectFactory&, const GrDrawEffect&); |
@@ -185,7 +187,7 @@ public: |
private: |
GrEffectEdgeType fEdgeType; |
- typedef GrGLVertexEffect INHERITED; |
+ typedef GrGLGeometryProcessor INHERITED; |
}; |
GrGLQuadEffect::GrGLQuadEffect(const GrBackendEffectFactory& factory, |
@@ -206,9 +208,8 @@ 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()); |
+ const GrShaderVar& aHairQuadEdge = drawEffect.castEffect<GrQuadEffect>().aHairQuadEdge(); |
bsalomon
2014/09/12 00:34:17
similar for the local vars, hairQuadAttr? I don't
joshua.litt
2014/09/12 00:46:06
Yea, I probably should have discussed this with yo
|
+ vsBuilder->codeAppendf("%s = %s;", vsName, aHairQuadEdge.c_str()); |
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
fsBuilder->codeAppendf("float edgeAlpha;"); |
@@ -272,9 +273,12 @@ const GrBackendEffectFactory& GrQuadEffect::getFactory() const { |
return GrTBackendEffectFactory<GrQuadEffect>::getInstance(); |
} |
-GrQuadEffect::GrQuadEffect(GrEffectEdgeType edgeType) : GrVertexEffect() { |
- this->addVertexAttrib(kVec4f_GrSLType); |
- fEdgeType = edgeType; |
+GrQuadEffect::GrQuadEffect(GrEffectEdgeType edgeType) |
+ : GrGeometryProcessor() |
+ , fEdgeType(edgeType) |
+ , fAttrHairQuadEdge(this->addVertexAttrib(GrShaderVar("aCubicCoeffs", |
+ kVec4f_GrSLType, |
+ GrShaderVar::kAttribute_TypeModifier))) { |
} |
bool GrQuadEffect::onIsEqual(const GrEffect& other) const { |
@@ -303,7 +307,7 @@ GrEffect* GrQuadEffect::TestCreate(SkRandom* random, |
// Cubic |
////////////////////////////////////////////////////////////////////////////// |
-class GrGLCubicEffect : public GrGLVertexEffect { |
+class GrGLCubicEffect : public GrGLGeometryProcessor { |
public: |
GrGLCubicEffect(const GrBackendEffectFactory&, const GrDrawEffect&); |
@@ -322,7 +326,7 @@ public: |
private: |
GrEffectEdgeType fEdgeType; |
- typedef GrGLVertexEffect INHERITED; |
+ typedef GrGLGeometryProcessor INHERITED; |
}; |
GrGLCubicEffect::GrGLCubicEffect(const GrBackendEffectFactory& factory, |
@@ -345,9 +349,8 @@ 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()); |
+ const GrShaderVar& aCubicCoeffs = drawEffect.castEffect<GrCubicEffect>().aCubicCoeffs(); |
+ vsBuilder->codeAppendf("%s = %s;", vsName, aCubicCoeffs.c_str()); |
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
@@ -451,9 +454,12 @@ const GrBackendEffectFactory& GrCubicEffect::getFactory() const { |
return GrTBackendEffectFactory<GrCubicEffect>::getInstance(); |
} |
-GrCubicEffect::GrCubicEffect(GrEffectEdgeType edgeType) : GrVertexEffect() { |
- this->addVertexAttrib(kVec4f_GrSLType); |
- fEdgeType = edgeType; |
+GrCubicEffect::GrCubicEffect(GrEffectEdgeType edgeType) |
+ : GrGeometryProcessor() |
+ , fEdgeType(edgeType) |
+ , fAttrCubicCoeffs(this->addVertexAttrib(GrShaderVar("aCubicCoeffs", |
+ kVec4f_GrSLType, |
+ GrShaderVar::kAttribute_TypeModifier))) { |
} |
bool GrCubicEffect::onIsEqual(const GrEffect& other) const { |