Simplify adding attributes to GrGeometryProcessor
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2248323003

Review-Url: https://codereview.chromium.org/2248323003
diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp
index f76acc6..6268906 100644
--- a/src/gpu/GrDefaultGeoProcFactory.cpp
+++ b/src/gpu/GrDefaultGeoProcFactory.cpp
@@ -234,14 +234,13 @@
         bool hasTransformedLocalCoords = SkToBool(gpTypeFlags & kTransformedLocalCoord_GPFlag);
         bool hasLocalCoord = hasExplicitLocalCoords || hasTransformedLocalCoords;
         bool hasCoverage = SkToBool(gpTypeFlags & kCoverage_GPFlag);
-        fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
-                                                       kHigh_GrSLPrecision));
+        fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
+                                             kHigh_GrSLPrecision);
         if (hasColor) {
-            fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
+            fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
         }
         if (hasLocalCoord) {
-            fInLocalCoords = &this->addVertexAttrib(Attribute("inLocalCoord",
-                                                              kVec2f_GrVertexAttribType));
+            fInLocalCoords = &this->addVertexAttrib("inLocalCoord", kVec2f_GrVertexAttribType);
             if (hasExplicitLocalCoords) {
                 this->setHasExplicitLocalCoords();
             } else {
@@ -250,8 +249,7 @@
             }
         }
         if (hasCoverage) {
-            fInCoverage = &this->addVertexAttrib(Attribute("inCoverage",
-                                                           kFloat_GrVertexAttribType));
+            fInCoverage = &this->addVertexAttrib("inCoverage", kFloat_GrVertexAttribType);
         }
     }
 
diff --git a/src/gpu/GrGeometryProcessor.h b/src/gpu/GrGeometryProcessor.h
index 1dbf153..ebb48fc 100644
--- a/src/gpu/GrGeometryProcessor.h
+++ b/src/gpu/GrGeometryProcessor.h
@@ -53,9 +53,10 @@
      * The processor key should reflect the vertex attributes, or there lack thereof in the
      * GrGeometryProcessor.
      */
-    const Attribute& addVertexAttrib(const Attribute& attribute) {
-        fVertexStride += attribute.fOffset;
-        fAttribs.push_back(attribute);
+    const Attribute& addVertexAttrib(const char* name, GrVertexAttribType type,
+                                     GrSLPrecision precision = kDefault_GrSLPrecision) {
+        fAttribs.emplace_back(name, type, precision);
+        fVertexStride += fAttribs.back().fOffset;
         return fAttribs.back();
     }
 
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index 1b8124f..622df15 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -81,11 +81,10 @@
 public:
     CircleGeometryProcessor(bool stroke, const SkMatrix& localMatrix) : fLocalMatrix(localMatrix){
         this->initClassID<CircleGeometryProcessor>();
-        fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
-                                                       kHigh_GrSLPrecision));
-        fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
-        fInCircleEdge = &this->addVertexAttrib(Attribute("inCircleEdge",
-                                                         kVec4f_GrVertexAttribType));
+        fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
+                                             kHigh_GrSLPrecision);
+        fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
+        fInCircleEdge = &this->addVertexAttrib("inCircleEdge", kVec4f_GrVertexAttribType);
         fStroke = stroke;
     }
 
@@ -223,12 +222,10 @@
     EllipseGeometryProcessor(bool stroke, const SkMatrix& localMatrix)
         : fLocalMatrix(localMatrix) {
         this->initClassID<EllipseGeometryProcessor>();
-        fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
-        fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
-        fInEllipseOffset = &this->addVertexAttrib(Attribute("inEllipseOffset",
-                                                            kVec2f_GrVertexAttribType));
-        fInEllipseRadii = &this->addVertexAttrib(Attribute("inEllipseRadii",
-                                                           kVec4f_GrVertexAttribType));
+        fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType);
+        fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
+        fInEllipseOffset = &this->addVertexAttrib("inEllipseOffset", kVec2f_GrVertexAttribType);
+        fInEllipseRadii = &this->addVertexAttrib("inEllipseRadii", kVec4f_GrVertexAttribType);
         fStroke = stroke;
     }
 
@@ -372,13 +369,11 @@
     DIEllipseGeometryProcessor(const SkMatrix& viewMatrix, DIEllipseStyle style)
         : fViewMatrix(viewMatrix) {
         this->initClassID<DIEllipseGeometryProcessor>();
-        fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
-                                                       kHigh_GrSLPrecision));
-        fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
-        fInEllipseOffsets0 = &this->addVertexAttrib(Attribute("inEllipseOffsets0",
-                                                              kVec2f_GrVertexAttribType));
-        fInEllipseOffsets1 = &this->addVertexAttrib(Attribute("inEllipseOffsets1",
-                                                              kVec2f_GrVertexAttribType));
+        fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
+                                             kHigh_GrSLPrecision);
+        fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
+        fInEllipseOffsets0 = &this->addVertexAttrib("inEllipseOffsets0", kVec2f_GrVertexAttribType);
+        fInEllipseOffsets1 = &this->addVertexAttrib("inEllipseOffsets1", kVec2f_GrVertexAttribType);
         fStyle = style;
     }
 
diff --git a/src/gpu/GrPrimitiveProcessor.h b/src/gpu/GrPrimitiveProcessor.h
index d27a6f3..5239a86 100644
--- a/src/gpu/GrPrimitiveProcessor.h
+++ b/src/gpu/GrPrimitiveProcessor.h
@@ -156,8 +156,7 @@
             : fName(nullptr)
             , fType(kFloat_GrVertexAttribType)
             , fOffset(0) {}
-        Attribute(const char* name, GrVertexAttribType type,
-                  GrSLPrecision precision = kDefault_GrSLPrecision)
+        Attribute(const char* name, GrVertexAttribType type, GrSLPrecision precision)
             : fName(name)
             , fType(type)
             , fOffset(SkAlign4(GrVertexAttribTypeSize(type)))
diff --git a/src/gpu/batches/GrAAConvexPathRenderer.cpp b/src/gpu/batches/GrAAConvexPathRenderer.cpp
index 1ce0083..a24a0c5 100644
--- a/src/gpu/batches/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/batches/GrAAConvexPathRenderer.cpp
@@ -653,8 +653,8 @@
         , fLocalMatrix(localMatrix)
         , fUsesLocalCoords(usesLocalCoords) {
         this->initClassID<QuadEdgeEffect>();
-        fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
-        fInQuadEdge = &this->addVertexAttrib(Attribute("inQuadEdge", kVec4f_GrVertexAttribType));
+        fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType);
+        fInQuadEdge = &this->addVertexAttrib("inQuadEdge", kVec4f_GrVertexAttribType);
     }
 
     const Attribute* fInPosition;
diff --git a/src/gpu/batches/GrAnalyticRectBatch.cpp b/src/gpu/batches/GrAnalyticRectBatch.cpp
index 4d75d91..7be0ad3 100644
--- a/src/gpu/batches/GrAnalyticRectBatch.cpp
+++ b/src/gpu/batches/GrAnalyticRectBatch.cpp
@@ -55,12 +55,11 @@
 public:
     RectGeometryProcessor(const SkMatrix& localMatrix) : fLocalMatrix(localMatrix) {
         this->initClassID<RectGeometryProcessor>();
-        fInPosition    = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
-                                                          kHigh_GrSLPrecision));
-        fInColor       = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
-        fInRectEdge    = &this->addVertexAttrib(Attribute("inRectEdge", kVec4f_GrVertexAttribType));
-        fInWidthHeight = &this->addVertexAttrib(Attribute("inWidthHeight",
-                                                          kVec2f_GrVertexAttribType));
+        fInPosition    = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
+                                                kHigh_GrSLPrecision);
+        fInColor       = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
+        fInRectEdge    = &this->addVertexAttrib("inRectEdge", kVec4f_GrVertexAttribType);
+        fInWidthHeight = &this->addVertexAttrib("inWidthHeight", kVec2f_GrVertexAttribType);
     }
 
     bool implementsDistanceVector() const override { return true; };
diff --git a/src/gpu/batches/GrMSAAPathRenderer.cpp b/src/gpu/batches/GrMSAAPathRenderer.cpp
index 324a976..05a23a1 100644
--- a/src/gpu/batches/GrMSAAPathRenderer.cpp
+++ b/src/gpu/batches/GrMSAAPathRenderer.cpp
@@ -195,11 +195,10 @@
     MSAAQuadProcessor(const SkMatrix& viewMatrix)
         : fViewMatrix(viewMatrix) {
         this->initClassID<MSAAQuadProcessor>();
-        fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
-                                                       kHigh_GrSLPrecision));
-        fInUV = &this->addVertexAttrib(Attribute("inUV", kVec2f_GrVertexAttribType,
-                                                 kHigh_GrSLPrecision));
-        fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
+        fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
+                                             kHigh_GrSLPrecision);
+        fInUV = &this->addVertexAttrib("inUV", kVec2f_GrVertexAttribType, kHigh_GrSLPrecision);
+        fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
         this->setSampleShading(1.0f);
     }
 
diff --git a/src/gpu/batches/GrPLSPathRenderer.cpp b/src/gpu/batches/GrPLSPathRenderer.cpp
index fa0bd90..81009a6 100644
--- a/src/gpu/batches/GrPLSPathRenderer.cpp
+++ b/src/gpu/batches/GrPLSPathRenderer.cpp
@@ -421,16 +421,16 @@
         : fLocalMatrix(localMatrix)
         , fUsesLocalCoords(usesLocalCoords) {
         this->initClassID<PLSAATriangleEffect>();
-        fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
-                                                       kHigh_GrSLPrecision));
-        fInVertex1 = &this->addVertexAttrib(Attribute("inVertex1", kVec2f_GrVertexAttribType,
-                                                      kHigh_GrSLPrecision));
-        fInVertex2 = &this->addVertexAttrib(Attribute("inVertex2", kVec2f_GrVertexAttribType,
-                                                      kHigh_GrSLPrecision));
-        fInVertex3 = &this->addVertexAttrib(Attribute("inVertex3", kVec2f_GrVertexAttribType,
-                                                      kHigh_GrSLPrecision));
-        fInWindings = &this->addVertexAttrib(Attribute("inWindings", kInt_GrVertexAttribType,
-                                                       kLow_GrSLPrecision));
+        fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
+                                             kHigh_GrSLPrecision);
+        fInVertex1 = &this->addVertexAttrib("inVertex1", kVec2f_GrVertexAttribType,
+                                            kHigh_GrSLPrecision);
+        fInVertex2 = &this->addVertexAttrib("inVertex2", kVec2f_GrVertexAttribType,
+                                            kHigh_GrSLPrecision);
+        fInVertex3 = &this->addVertexAttrib("inVertex3", kVec2f_GrVertexAttribType,
+                                            kHigh_GrSLPrecision);
+        fInWindings = &this->addVertexAttrib("inWindings", kInt_GrVertexAttribType,
+                                             kLow_GrSLPrecision);
         this->setWillReadFragmentPosition();
     }
 
@@ -611,16 +611,15 @@
         : fLocalMatrix(localMatrix)
         , fUsesLocalCoords(usesLocalCoords) {
         this->initClassID<PLSQuadEdgeEffect>();
-        fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
-                                                       kHigh_GrSLPrecision));
-        fInUV = &this->addVertexAttrib(Attribute("inUV", kVec2f_GrVertexAttribType,
-                                                 kHigh_GrSLPrecision));
-        fInEndpoint1 = &this->addVertexAttrib(Attribute("inEndpoint1", kVec2f_GrVertexAttribType,
-                                                        kHigh_GrSLPrecision));
-        fInEndpoint2 = &this->addVertexAttrib(Attribute("inEndpoint2", kVec2f_GrVertexAttribType,
-                                                        kHigh_GrSLPrecision));
-        fInWindings  = &this->addVertexAttrib(Attribute("inWindings", kInt_GrVertexAttribType,
-                                                        kLow_GrSLPrecision));
+        fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
+                                             kHigh_GrSLPrecision);
+        fInUV = &this->addVertexAttrib("inUV", kVec2f_GrVertexAttribType, kHigh_GrSLPrecision);
+        fInEndpoint1 = &this->addVertexAttrib("inEndpoint1", kVec2f_GrVertexAttribType,
+                                              kHigh_GrSLPrecision);
+        fInEndpoint2 = &this->addVertexAttrib("inEndpoint2", kVec2f_GrVertexAttribType,
+                                              kHigh_GrSLPrecision);
+        fInWindings  = &this->addVertexAttrib("inWindings", kInt_GrVertexAttribType,
+                                              kLow_GrSLPrecision);
         this->setWillReadFragmentPosition();
     }
 
@@ -762,8 +761,8 @@
         , fLocalMatrix(localMatrix)
         , fUsesLocalCoords(usesLocalCoords) {
         this->initClassID<PLSFinishEffect>();
-        fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
-                                                       kHigh_GrSLPrecision));
+        fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
+                                             kHigh_GrSLPrecision);
     }
 
     const Attribute* fInPosition;
diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp
index 1904b20..1894192 100644
--- a/src/gpu/effects/GrBezierEffect.cpp
+++ b/src/gpu/effects/GrBezierEffect.cpp
@@ -263,10 +263,9 @@
     , fCoverageScale(coverage)
     , fEdgeType(edgeType) {
     this->initClassID<GrConicEffect>();
-    fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
-                                                   kHigh_GrSLPrecision));
-    fInConicCoeffs = &this->addVertexAttrib(Attribute("inConicCoeffs",
-                                                      kVec4f_GrVertexAttribType));
+    fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
+                                         kHigh_GrSLPrecision);
+    fInConicCoeffs = &this->addVertexAttrib("inConicCoeffs", kVec4f_GrVertexAttribType);
 }
 
 //////////////////////////////////////////////////////////////////////////////
@@ -480,10 +479,9 @@
     , fCoverageScale(coverage)
     , fEdgeType(edgeType) {
     this->initClassID<GrQuadEffect>();
-    fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
-                                                   kHigh_GrSLPrecision));
-    fInHairQuadEdge = &this->addVertexAttrib(Attribute("inHairQuadEdge",
-                                                        kVec4f_GrVertexAttribType));
+    fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
+                                                   kHigh_GrSLPrecision);
+    fInHairQuadEdge = &this->addVertexAttrib("inHairQuadEdge", kVec4f_GrVertexAttribType);
 }
 
 //////////////////////////////////////////////////////////////////////////////
@@ -708,10 +706,9 @@
     , fViewMatrix(viewMatrix)
     , fEdgeType(edgeType) {
     this->initClassID<GrCubicEffect>();
-    fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
-                                                   kHigh_GrSLPrecision));
-    fInCubicCoeffs = &this->addVertexAttrib(Attribute("inCubicCoeffs",
-                                                        kVec4f_GrVertexAttribType));
+    fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
+                                         kHigh_GrSLPrecision);
+    fInCubicCoeffs = &this->addVertexAttrib("inCubicCoeffs", kVec4f_GrVertexAttribType);
 }
 
 //////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index e0ec49c..20a4e93 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -139,16 +139,15 @@
     , fInColor(nullptr)
     , fMaskFormat(format) {
     this->initClassID<GrBitmapTextGeoProc>();
-    fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
+    fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType);
 
     bool hasVertexColor = kA8_GrMaskFormat == fMaskFormat ||
                           kA565_GrMaskFormat == fMaskFormat;
     if (hasVertexColor) {
-        fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
+        fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
     }
-    fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords",
-                                                        kVec2us_GrVertexAttribType,
-                                                        kHigh_GrSLPrecision));
+    fInTextureCoords = &this->addVertexAttrib("inTextureCoords",  kVec2us_GrVertexAttribType,
+                                              kHigh_GrSLPrecision);
     this->addTextureAccess(&fTextureAccess);
 }
 
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp
index 1848c18..167cefa 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -950,10 +950,9 @@
     , fUsesLocalCoords(usesLocalCoords)
     , fAAMode(aaMode) {
     this->initClassID<DashingCircleEffect>();
-    fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
-    fInDashParams = &this->addVertexAttrib(Attribute("inDashParams", kVec3f_GrVertexAttribType));
-    fInCircleParams = &this->addVertexAttrib(Attribute("inCircleParams",
-                                                       kVec2f_GrVertexAttribType));
+    fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType);
+    fInDashParams = &this->addVertexAttrib("inDashParams", kVec3f_GrVertexAttribType);
+    fInCircleParams = &this->addVertexAttrib("inCircleParams", kVec2f_GrVertexAttribType);
 }
 
 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingCircleEffect);
@@ -1184,9 +1183,9 @@
     , fUsesLocalCoords(usesLocalCoords)
     , fAAMode(aaMode) {
     this->initClassID<DashingLineEffect>();
-    fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType));
-    fInDashParams = &this->addVertexAttrib(Attribute("inDashParams", kVec3f_GrVertexAttribType));
-    fInRectParams = &this->addVertexAttrib(Attribute("inRect", kVec4f_GrVertexAttribType));
+    fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType);
+    fInDashParams = &this->addVertexAttrib("inDashParams", kVec3f_GrVertexAttribType);
+    fInRectParams = &this->addVertexAttrib("inRect", kVec4f_GrVertexAttribType);
 }
 
 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingLineEffect);
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
index cb1e496..be7b9ac 100644
--- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
@@ -248,12 +248,11 @@
     , fUsesLocalCoords(usesLocalCoords) {
     SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask));
     this->initClassID<GrDistanceFieldA8TextGeoProc>();
-    fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
-                                                   kHigh_GrSLPrecision));
-    fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
-    fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords",
-                                                        kVec2us_GrVertexAttribType,
-                                                        kHigh_GrSLPrecision));
+    fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
+                                         kHigh_GrSLPrecision);
+    fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
+    fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kVec2us_GrVertexAttribType,
+                                              kHigh_GrSLPrecision);
     this->addTextureAccess(&fTextureAccess);
 }
 
@@ -493,11 +492,10 @@
     , fUsesLocalCoords(usesLocalCoords) {
     SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask));
     this->initClassID<GrDistanceFieldPathGeoProc>();
-    fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
-                                                   kHigh_GrSLPrecision));
-    fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
-    fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords",
-                                                        kVec2f_GrVertexAttribType));
+    fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
+                                         kHigh_GrSLPrecision);
+    fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
+    fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kVec2f_GrVertexAttribType);
     this->addTextureAccess(&fTextureAccess);
 }
 
@@ -799,12 +797,11 @@
     , fUsesLocalCoords(usesLocalCoords) {
     SkASSERT(!(flags & ~kLCD_DistanceFieldEffectMask) && (flags & kUseLCD_DistanceFieldEffectFlag));
     this->initClassID<GrDistanceFieldLCDTextGeoProc>();
-    fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType,
-                                                   kHigh_GrSLPrecision));
-    fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
-    fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords",
-                                                        kVec2us_GrVertexAttribType,
-                                                        kHigh_GrSLPrecision));
+    fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType,
+                                         kHigh_GrSLPrecision);
+    fInColor = &this->addVertexAttrib("inColor", kVec4ub_GrVertexAttribType);
+    fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kVec2us_GrVertexAttribType,
+                                              kHigh_GrSLPrecision);
     this->addTextureAccess(&fTextureAccess);
 }
 
diff --git a/src/gpu/instanced/InstanceProcessor.cpp b/src/gpu/instanced/InstanceProcessor.cpp
index 50bc219..2b05ec1 100644
--- a/src/gpu/instanced/InstanceProcessor.cpp
+++ b/src/gpu/instanced/InstanceProcessor.cpp
@@ -44,15 +44,13 @@
     : fBatchInfo(batchInfo) {
     this->initClassID<InstanceProcessor>();
 
-    this->addVertexAttrib(Attribute("shapeCoords", kVec2f_GrVertexAttribType, kHigh_GrSLPrecision));
-    this->addVertexAttrib(Attribute("vertexAttrs", kInt_GrVertexAttribType));
-    this->addVertexAttrib(Attribute("instanceInfo", kUint_GrVertexAttribType));
-    this->addVertexAttrib(Attribute("shapeMatrixX", kVec3f_GrVertexAttribType,
-                                    kHigh_GrSLPrecision));
-    this->addVertexAttrib(Attribute("shapeMatrixY", kVec3f_GrVertexAttribType,
-                                    kHigh_GrSLPrecision));
-    this->addVertexAttrib(Attribute("color", kVec4f_GrVertexAttribType, kLow_GrSLPrecision));
-    this->addVertexAttrib(Attribute("localRect", kVec4f_GrVertexAttribType, kHigh_GrSLPrecision));
+    this->addVertexAttrib("shapeCoords", kVec2f_GrVertexAttribType, kHigh_GrSLPrecision);
+    this->addVertexAttrib("vertexAttrs", kInt_GrVertexAttribType);
+    this->addVertexAttrib("instanceInfo", kUint_GrVertexAttribType);
+    this->addVertexAttrib("shapeMatrixX", kVec3f_GrVertexAttribType, kHigh_GrSLPrecision);
+    this->addVertexAttrib("shapeMatrixY", kVec3f_GrVertexAttribType, kHigh_GrSLPrecision);
+    this->addVertexAttrib("color", kVec4f_GrVertexAttribType, kLow_GrSLPrecision);
+    this->addVertexAttrib("localRect", kVec4f_GrVertexAttribType, kHigh_GrSLPrecision);
 
     GR_STATIC_ASSERT(0 == (int)Attrib::kShapeCoords);
     GR_STATIC_ASSERT(1 == (int)Attrib::kVertexAttrs);
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index 7a080c5..55049ea 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -56,12 +56,7 @@
                     fAttribNames.push_back().printf("attr%d", i);
                 }
                 for (auto i = 0; i < numAttribs; ++i) {
-                    Attribute attribute;
-                    attribute.fType = kVec2f_GrVertexAttribType;
-                    attribute.fName = fAttribNames[i].c_str();
-                    attribute.fOffset = 2 * sizeof(float) * i;
-                    attribute.fPrecision = kDefault_GrSLPrecision;
-                    this->addVertexAttrib(attribute);
+                    this->addVertexAttrib(fAttribNames[i].c_str(), kVec2f_GrVertexAttribType);
                 }
             };
             const char* name() const override { return "Dummy GP"; }