Chromium Code Reviews| Index: src/gpu/GrAAConvexPathRenderer.cpp |
| diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp |
| index e4fc6ec87d914741bfd47b96f0cdd8c48936497c..98fb18f9f9bdd0fd75e93762906ed8578151e26c 100644 |
| --- a/src/gpu/GrAAConvexPathRenderer.cpp |
| +++ b/src/gpu/GrAAConvexPathRenderer.cpp |
| @@ -21,9 +21,9 @@ |
| #include "gl/GrGLEffect.h" |
| #include "gl/GrGLSL.h" |
| -#include "gl/GrGLVertexEffect.h" |
| +#include "gl/GrGLGeometryProcessor.h" |
| -#include "effects/GrVertexEffect.h" |
| +#include "effects/GrGeometryProcessor.h" |
| GrAAConvexPathRenderer::GrAAConvexPathRenderer() { |
| } |
| @@ -504,7 +504,7 @@ static void create_vertices(const SegmentArray& segments, |
| * Requires shader derivative instruction support. |
| */ |
| -class QuadEdgeEffect : public GrVertexEffect { |
| +class QuadEdgeEffect : public GrGeometryProcessor { |
| public: |
| static GrEffect* Create() { |
| @@ -522,11 +522,13 @@ public: |
| *validFlags = 0; |
| } |
|
bsalomon
2014/09/12 00:34:17
I find the 'a' prefix naming a little bit weird. W
joshua.litt
2014/09/12 00:46:06
I was trying to follow the convention we use in th
bsalomon
2014/09/12 01:17:47
I don't have a strong opinion about w/ or w/o "get
|
| + const GrShaderVar& aQuadEdge() const { return fAttrQuadEdge; } |
| + |
| virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE { |
| return GrTBackendEffectFactory<QuadEdgeEffect>::getInstance(); |
| } |
| - class GLEffect : public GrGLVertexEffect { |
| + class GLEffect : public GrGLGeometryProcessor { |
| public: |
| GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&) |
| : INHERITED (factory) {} |
| @@ -567,10 +569,9 @@ public: |
| fsBuilder->codeAppendf("\t%s = %s;\n", outputColor, |
| (GrGLSLExpr4(inputColor) * GrGLSLExpr1("edgeAlpha")).c_str()); |
| + const GrShaderVar& aQuadEdge = drawEffect.castEffect<QuadEdgeEffect>().aQuadEdge(); |
| GrGLVertexShaderBuilder* vsBuilder = builder->getVertexShaderBuilder(); |
| - const SkString* attr0Name = |
| - vsBuilder->getEffectAttributeName(drawEffect.getVertexAttribIndices()[0]); |
| - vsBuilder->codeAppendf("\t%s = %s;\n", vsName, attr0Name->c_str()); |
| + vsBuilder->codeAppendf("\t%s = %s;\n", vsName, aQuadEdge.c_str()); |
| } |
| static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*) {} |
| @@ -578,18 +579,22 @@ public: |
| virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE {} |
| private: |
| - typedef GrGLVertexEffect INHERITED; |
| + typedef GrGLGeometryProcessor INHERITED; |
| }; |
| private: |
| - QuadEdgeEffect() { |
| - this->addVertexAttrib(kVec4f_GrSLType); |
| + QuadEdgeEffect() |
| + : fAttrQuadEdge(this->addVertexAttrib(GrShaderVar("aQuadEdge", |
| + kVec4f_GrSLType, |
| + GrShaderVar::kAttribute_TypeModifier))) { |
| } |
| virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE { |
| return true; |
| } |
| + const GrShaderVar& fAttrQuadEdge; |
| + |
| GR_DECLARE_EFFECT_TEST; |
| typedef GrEffect INHERITED; |
| @@ -676,9 +681,8 @@ bool GrAAConvexPathRenderer::onDrawPath(const SkPath& origPath, |
| drawState->setVertexAttribs<gPathAttribs>(SK_ARRAY_COUNT(gPathAttribs), sizeof(QuadVertex)); |
| - static const int kEdgeAttrIndex = 1; |
| GrEffect* quadEffect = QuadEdgeEffect::Create(); |
| - drawState->setGeometryProcessor(quadEffect, kEdgeAttrIndex)->unref(); |
| + drawState->setGeometryProcessor(quadEffect)->unref(); |
| GrDrawTarget::AutoReleaseGeometry arg(target, vCount, iCount); |
| if (!arg.succeeded()) { |