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

Unified Diff: src/gpu/GrAAConvexPathRenderer.cpp

Issue 543623004: Removing vertex attrib indices (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: warning fixed 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
« no previous file with comments | « include/gpu/GrShaderVar.h ('k') | src/gpu/GrAAHairLinePathRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAAConvexPathRenderer.cpp
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index e4fc6ec87d914741bfd47b96f0cdd8c48936497c..c6da45e926d560ff407b5daf913f3f493bd6504d 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;
}
+ const GrShaderVar& inQuadEdge() const { return fInQuadEdge; }
+
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& inQuadEdge = drawEffect.castEffect<QuadEdgeEffect>().inQuadEdge();
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, inQuadEdge.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()
+ : fInQuadEdge(this->addVertexAttrib(GrShaderVar("inQuadEdge",
+ kVec4f_GrSLType,
+ GrShaderVar::kAttribute_TypeModifier))) {
}
virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE {
return true;
}
+ const GrShaderVar& fInQuadEdge;
+
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()) {
« no previous file with comments | « include/gpu/GrShaderVar.h ('k') | src/gpu/GrAAHairLinePathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698