Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Unified Diff: src/gpu/GrAAConvexPathRenderer.cpp

Issue 543623004: Removing vertex attrib indices (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrAAConvexPathRenderer.cpp
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index e4fc6ec87d914741bfd47b96f0cdd8c48936497c..c6238d7f77a12289ac2e7424d80d1f07c395c19e 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,11 @@ static void create_vertices(const SegmentArray& segments,
* Requires shader derivative instruction support.
*/
-class QuadEdgeEffect : public GrVertexEffect {
+const GrShaderVar kAttrQuadEdge("aQuadEdge",
+ kVec4f_GrSLType,
+ GrShaderVar::kAttribute_TypeModifier);
+
+class QuadEdgeEffect : public GrGeometryProcessor {
public:
static GrEffect* Create() {
@@ -526,7 +530,7 @@ public:
return GrTBackendEffectFactory<QuadEdgeEffect>::getInstance();
}
- class GLEffect : public GrGLVertexEffect {
+ class GLEffect : public GrGLGeometryProcessor {
public:
GLEffect(const GrBackendEffectFactory& factory, const GrDrawEffect&)
: INHERITED (factory) {}
@@ -568,9 +572,7 @@ public:
(GrGLSLExpr4(inputColor) * GrGLSLExpr1("edgeAlpha")).c_str());
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, kAttrQuadEdge.c_str());
}
static inline void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuilder*) {}
@@ -578,12 +580,12 @@ public:
virtual void setData(const GrGLProgramDataManager&, const GrDrawEffect&) SK_OVERRIDE {}
private:
- typedef GrGLVertexEffect INHERITED;
+ typedef GrGLGeometryProcessor INHERITED;
};
private:
QuadEdgeEffect() {
- this->addVertexAttrib(kVec4f_GrSLType);
+ this->addVertexAttrib(kAttrQuadEdge);
}
virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE {
@@ -676,9 +678,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()) {

Powered by Google App Engine
This is Rietveld 408576698