Introduce GrBatch subclasses GrDrawBatch and GrVertexBatch to prepare for non-drawing batches

Review URL: https://codereview.chromium.org/1293583002
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index b5bea9f..ac142e2 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -739,7 +739,7 @@
     return CreateForDeviceSpace(color, coverage, localCoords, viewMatrix);
 }
 
-class AAConvexPathBatch : public GrBatch {
+class AAConvexPathBatch : public GrVertexBatch {
 public:
     struct Geometry {
         GrColor fColor;
@@ -747,7 +747,7 @@
         SkPath fPath;
     };
 
-    static GrBatch* Create(const Geometry& geometry) {
+    static GrDrawBatch* Create(const Geometry& geometry) {
         return SkNEW_ARGS(AAConvexPathBatch, (geometry));
     }
 
@@ -941,13 +941,12 @@
     }
 
     bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
-        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(),
-                                    caps)) {
+        AAConvexPathBatch* that = t->cast<AAConvexPathBatch>();
+        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
+                                    that->bounds(), caps)) {
             return false;
         }
 
-        AAConvexPathBatch* that = t->cast<AAConvexPathBatch>();
-
         if (this->color() != that->color()) {
             return false;
         }
@@ -1002,7 +1001,7 @@
     geometry.fViewMatrix = *args.fViewMatrix;
     geometry.fPath = *args.fPath;
 
-    SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry));
+    SkAutoTUnref<GrDrawBatch> batch(AAConvexPathBatch::Create(geometry));
     args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
 
     return true;
@@ -1013,7 +1012,7 @@
 
 #ifdef GR_TEST_UTILS
 
-BATCH_TEST_DEFINE(AAConvexPathBatch) {
+DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) {
     AAConvexPathBatch::Geometry geometry;
     geometry.fColor = GrRandomColor(random);
     geometry.fViewMatrix = GrTest::TestMatrixInvertible(random);
diff --git a/src/gpu/GrAADistanceFieldPathRenderer.cpp b/src/gpu/GrAADistanceFieldPathRenderer.cpp
index 50116dd..c4d59dd 100755
--- a/src/gpu/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/GrAADistanceFieldPathRenderer.cpp
@@ -109,7 +109,7 @@
 // padding around path bounds to allow for antialiased pixels
 static const SkScalar kAntiAliasPad = 1.0f;
 
-class AADistanceFieldPathBatch : public GrBatch {
+class AADistanceFieldPathBatch : public GrVertexBatch {
 public:
     typedef GrAADistanceFieldPathRenderer::PathData PathData;
     typedef SkTDynamicHash<PathData, PathData::Key> PathCache;
@@ -123,8 +123,8 @@
         PathData* fPathData;
     };
 
-    static GrBatch* Create(const Geometry& geometry, GrColor color, const SkMatrix& viewMatrix,
-                           GrBatchAtlas* atlas, PathCache* pathCache, PathDataList* pathList) {
+    static GrDrawBatch* Create(const Geometry& geometry, GrColor color, const SkMatrix& viewMatrix,
+                               GrBatchAtlas* atlas, PathCache* pathCache, PathDataList* pathList) {
         return SkNEW_ARGS(AADistanceFieldPathBatch, (geometry, color, viewMatrix,
                                                      atlas, pathCache, pathList));
     }
@@ -485,13 +485,12 @@
     bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; }
 
     bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
-        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(),
-                                    caps)) {
+        AADistanceFieldPathBatch* that = t->cast<AADistanceFieldPathBatch>();
+        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
+                                    that->bounds(), caps)) {
             return false;
         }
 
-        AADistanceFieldPathBatch* that = t->cast<AADistanceFieldPathBatch>();
-
         // TODO we could actually probably do a bunch of this work on the CPU, ie map viewMatrix,
         // maybe upload color via attribute
         if (this->color() != that->color()) {
@@ -543,9 +542,9 @@
     geometry.fPath = *args.fPath;
     geometry.fAntiAlias = args.fAntiAlias;
 
-    SkAutoTUnref<GrBatch> batch(AADistanceFieldPathBatch::Create(geometry, args.fColor,
-                                                                 *args.fViewMatrix, fAtlas,
-                                                                 &fPathCache, &fPathList));
+    SkAutoTUnref<GrDrawBatch> batch(AADistanceFieldPathBatch::Create(geometry, args.fColor,
+                                                                     *args.fViewMatrix, fAtlas,
+                                                                     &fPathCache, &fPathList));
     args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
 
     return true;
@@ -597,7 +596,7 @@
     PathDataList fPathList;
 };
 
-BATCH_TEST_DEFINE(AADistanceFieldPathBatch) {
+DRAW_BATCH_TEST_DEFINE(AADistanceFieldPathBatch) {
     static PathTestStruct gTestStruct;
 
     if (context->uniqueID() != gTestStruct.fContextID) {
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index bfdff8d..f65fb74 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -670,7 +670,7 @@
     return true;
 }
 
-class AAHairlineBatch : public GrBatch {
+class AAHairlineBatch : public GrVertexBatch {
 public:
     struct Geometry {
         GrColor fColor;
@@ -680,7 +680,7 @@
         SkIRect fDevClipBounds;
     };
 
-    static GrBatch* Create(const Geometry& geometry) {
+    static GrDrawBatch* Create(const Geometry& geometry) {
         return SkNEW_ARGS(AAHairlineBatch, (geometry));
     }
 
@@ -732,13 +732,13 @@
     }
 
     bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
-        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(),
-                                    caps)) {
+        AAHairlineBatch* that = t->cast<AAHairlineBatch>();
+
+        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
+                                    that->bounds(), caps)) {
             return false;
         }
 
-        AAHairlineBatch* that = t->cast<AAHairlineBatch>();
-
         if (this->viewMatrix().hasPerspective() != that->viewMatrix().hasPerspective()) {
             return false;
         }
@@ -950,11 +950,11 @@
     }
 }
 
-static GrBatch* create_hairline_batch(GrColor color,
-                                      const SkMatrix& viewMatrix,
-                                      const SkPath& path,
-                                      const GrStrokeInfo& stroke,
-                                      const SkIRect& devClipBounds) {
+static GrDrawBatch* create_hairline_batch(GrColor color,
+                                          const SkMatrix& viewMatrix,
+                                          const SkPath& path,
+                                          const GrStrokeInfo& stroke,
+                                          const SkIRect& devClipBounds) {
     SkScalar hairlineCoverage;
     uint8_t newCoverage = 0xff;
     if (GrPathRenderer::IsStrokeHairlineOrEquivalent(stroke, viewMatrix, &hairlineCoverage)) {
@@ -976,8 +976,8 @@
     args.fPipelineBuilder->clip().getConservativeBounds(args.fPipelineBuilder->getRenderTarget(),
                                                         &devClipBounds);
 
-    SkAutoTUnref<GrBatch> batch(create_hairline_batch(args.fColor, *args.fViewMatrix, *args.fPath,
-                                                      *args.fStroke, devClipBounds));
+    SkAutoTUnref<GrDrawBatch> batch(create_hairline_batch(args.fColor, *args.fViewMatrix, *args.fPath,
+                                                          *args.fStroke, devClipBounds));
     args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
 
     return true;
@@ -987,7 +987,7 @@
 
 #ifdef GR_TEST_UTILS
 
-BATCH_TEST_DEFINE(AAHairlineBatch) {
+DRAW_BATCH_TEST_DEFINE(AAHairlineBatch) {
     GrColor color = GrRandomColor(random);
     SkMatrix viewMatrix = GrTest::TestMatrix(random);
     GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle);
diff --git a/src/gpu/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/GrAALinearizingConvexPathRenderer.cpp
index d1c6355..a019ed9 100644
--- a/src/gpu/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/GrAALinearizingConvexPathRenderer.cpp
@@ -114,7 +114,7 @@
     return CreateForDeviceSpace(color, coverage, localCoords, viewMatrix);
 }
 
-class AAFlatteningConvexPathBatch : public GrBatch {
+class AAFlatteningConvexPathBatch : public GrVertexBatch {
 public:
     struct Geometry {
         GrColor fColor;
@@ -125,7 +125,7 @@
         SkScalar fMiterLimit;
     };
 
-    static GrBatch* Create(const Geometry& geometry) {
+    static GrDrawBatch* Create(const Geometry& geometry) {
         return SkNEW_ARGS(AAFlatteningConvexPathBatch, (geometry));
     }
 
@@ -265,13 +265,12 @@
     }
 
     bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
-        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(),
-                                    caps)) {
+        AAFlatteningConvexPathBatch* that = t->cast<AAFlatteningConvexPathBatch>();
+        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
+                                    that->bounds(), caps)) {
             return false;
         }
 
-        AAFlatteningConvexPathBatch* that = t->cast<AAFlatteningConvexPathBatch>();
-
         SkASSERT(this->usesLocalCoords() == that->usesLocalCoords());
         if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->viewMatrix())) {
             return false;
@@ -321,7 +320,7 @@
                                                    args.fStroke->getJoin();
     geometry.fMiterLimit = args.fStroke->getMiter();
 
-    SkAutoTUnref<GrBatch> batch(AAFlatteningConvexPathBatch::Create(geometry));
+    SkAutoTUnref<GrDrawBatch> batch(AAFlatteningConvexPathBatch::Create(geometry));
     args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
 
     return true;
@@ -331,7 +330,7 @@
 
 #ifdef GR_TEST_UTILS
 
-BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) {
+DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) {
     AAFlatteningConvexPathBatch::Geometry geometry;
     geometry.fColor = GrRandomColor(random);
     geometry.fViewMatrix = GrTest::TestMatrixInvertible(random);
diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp
index e3149ad..3ba32cf 100644
--- a/src/gpu/GrAtlasTextContext.cpp
+++ b/src/gpu/GrAtlasTextContext.cpp
@@ -1432,7 +1432,7 @@
     subRun->fVertexEndIndex += vertexStride * kVerticesPerGlyph;
 }
 
-class TextBatch : public GrBatch {
+class TextBatch : public GrVertexBatch {
 public:
     typedef GrAtlasTextContext::DistanceAdjustTable DistanceAdjustTable;
     typedef GrAtlasTextBlob Blob;
@@ -1893,13 +1893,12 @@
     int numGlyphs() const { return fBatch.fNumGlyphs; }
 
     bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
-        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(),
-                                    caps)) {
+        TextBatch* that = t->cast<TextBatch>();
+        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
+                                    that->bounds(), caps)) {
             return false;
         }
 
-        TextBatch* that = t->cast<TextBatch>();
-
         if (fMaskType != that->fMaskType) {
             return false;
         }
@@ -2087,7 +2086,7 @@
     }
 }
 
-inline GrBatch*
+inline GrDrawBatch*
 GrAtlasTextContext::createBatch(GrAtlasTextBlob* cacheBlob, const PerSubRunInfo& info,
                                 int glyphCount, int run, int subRun,
                                 GrColor color, SkScalar transX, SkScalar transY,
@@ -2140,9 +2139,9 @@
             continue;
         }
 
-        SkAutoTUnref<GrBatch> batch(this->createBatch(cacheBlob, info, glyphCount, run,
-                                                      subRun, color, transX, transY,
-                                                      skPaint));
+        SkAutoTUnref<GrDrawBatch> batch(this->createBatch(cacheBlob, info, glyphCount, run,
+                                                          subRun, color, transX, transY,
+                                                          skPaint));
         fDrawContext->drawBatch(pipelineBuilder, batch);
     }
 }
@@ -2227,7 +2226,7 @@
 
 #ifdef GR_TEST_UTILS
 
-BATCH_TEST_DEFINE(TextBlobBatch) {
+DRAW_BATCH_TEST_DEFINE(TextBlobBatch) {
     static uint32_t gContextID = SK_InvalidGenID;
     static GrAtlasTextContext* gTextContext = NULL;
     static SkSurfaceProps gSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType);
diff --git a/src/gpu/GrAtlasTextContext.h b/src/gpu/GrAtlasTextContext.h
index 41c5217..2945b02 100644
--- a/src/gpu/GrAtlasTextContext.h
+++ b/src/gpu/GrAtlasTextContext.h
@@ -18,6 +18,7 @@
 #include "GrBatchTest.h"
 #endif
 
+class GrDrawBatch;
 class GrDrawContext;
 class GrDrawTarget;
 class GrPipelineBuilder;
@@ -75,10 +76,10 @@
                                 const SkPaint&, SkDrawFilter*,
                                 const SkMatrix& viewMatrix, const SkIRect& clipBounds, SkScalar x,
                                 SkScalar y);
-    inline GrBatch* createBatch(GrAtlasTextBlob*, const PerSubRunInfo&,
-                                int glyphCount, int run, int subRun,
-                                GrColor, SkScalar transX, SkScalar transY,
-                                const SkPaint&);
+    inline GrDrawBatch* createBatch(GrAtlasTextBlob*, const PerSubRunInfo&,
+                                    int glyphCount, int run, int subRun,
+                                    GrColor, SkScalar transX, SkScalar transY,
+                                    const SkPaint&);
     inline void flushRun(GrPipelineBuilder*, GrAtlasTextBlob*, int run, GrColor,
                          SkScalar transX, SkScalar transY, const SkPaint&);
     inline void flushBigGlyphs(GrAtlasTextBlob* cacheBlob, GrRenderTarget*,
@@ -186,7 +187,7 @@
     friend class TextBatch;
 
 #ifdef GR_TEST_UTILS
-    BATCH_TEST_FRIEND(TextBlobBatch);
+    DRAW_BATCH_TEST_FRIEND(TextBlobBatch);
 #endif
 
     typedef GrTextContext INHERITED;
diff --git a/src/gpu/GrBatchTest.cpp b/src/gpu/GrBatchTest.cpp
index 181f0e6..1fc2ce8 100644
--- a/src/gpu/GrBatchTest.cpp
+++ b/src/gpu/GrBatchTest.cpp
@@ -11,45 +11,45 @@
 
 #ifdef GR_TEST_UTILS
 
-BATCH_TEST_EXTERN(AAConvexPathBatch);
-BATCH_TEST_EXTERN(AADistanceFieldPathBatch);
-BATCH_TEST_EXTERN(AAFillRectBatch);
-BATCH_TEST_EXTERN(AAFillRectBatchLocalMatrix);
-BATCH_TEST_EXTERN(AAHairlineBatch);
-BATCH_TEST_EXTERN(AAStrokeRectBatch);
-BATCH_TEST_EXTERN(DashBatch);
-BATCH_TEST_EXTERN(DefaultPathBatch);
-BATCH_TEST_EXTERN(CircleBatch);
-BATCH_TEST_EXTERN(DIEllipseBatch);
-BATCH_TEST_EXTERN(EllipseBatch);
-BATCH_TEST_EXTERN(GrDrawAtlasBatch);
-BATCH_TEST_EXTERN(GrStrokeRectBatch);
-BATCH_TEST_EXTERN(RRectBatch);
-BATCH_TEST_EXTERN(TesselatingPathBatch);
-BATCH_TEST_EXTERN(TextBlobBatch);
-BATCH_TEST_EXTERN(VerticesBatch);
+DRAW_BATCH_TEST_EXTERN(AAConvexPathBatch);
+DRAW_BATCH_TEST_EXTERN(AADistanceFieldPathBatch);
+DRAW_BATCH_TEST_EXTERN(AAFillRectBatch);
+DRAW_BATCH_TEST_EXTERN(AAFillRectBatchLocalMatrix);
+DRAW_BATCH_TEST_EXTERN(AAHairlineBatch);
+DRAW_BATCH_TEST_EXTERN(AAStrokeRectBatch);
+DRAW_BATCH_TEST_EXTERN(DashBatch);
+DRAW_BATCH_TEST_EXTERN(DefaultPathBatch);
+DRAW_BATCH_TEST_EXTERN(CircleBatch);
+DRAW_BATCH_TEST_EXTERN(DIEllipseBatch);
+DRAW_BATCH_TEST_EXTERN(EllipseBatch);
+DRAW_BATCH_TEST_EXTERN(GrDrawAtlasBatch);
+DRAW_BATCH_TEST_EXTERN(GrStrokeRectBatch);
+DRAW_BATCH_TEST_EXTERN(RRectBatch);
+DRAW_BATCH_TEST_EXTERN(TesselatingPathBatch);
+DRAW_BATCH_TEST_EXTERN(TextBlobBatch);
+DRAW_BATCH_TEST_EXTERN(VerticesBatch);
 
 static BatchTestFunc gTestBatches[] = {
-    BATCH_TEST_ENTRY(AAConvexPathBatch),
-    BATCH_TEST_ENTRY(AADistanceFieldPathBatch),
-    BATCH_TEST_ENTRY(AAFillRectBatch),
-    BATCH_TEST_ENTRY(AAFillRectBatchLocalMatrix),
-    BATCH_TEST_ENTRY(AAHairlineBatch),
-    BATCH_TEST_ENTRY(AAStrokeRectBatch),
-    BATCH_TEST_ENTRY(DashBatch),
-    BATCH_TEST_ENTRY(DefaultPathBatch),
-    BATCH_TEST_ENTRY(CircleBatch),
-    BATCH_TEST_ENTRY(DIEllipseBatch),
-    BATCH_TEST_ENTRY(EllipseBatch),
-    BATCH_TEST_ENTRY(GrDrawAtlasBatch),
-    BATCH_TEST_ENTRY(GrStrokeRectBatch),
-    BATCH_TEST_ENTRY(RRectBatch),
-    BATCH_TEST_ENTRY(TesselatingPathBatch),
-    BATCH_TEST_ENTRY(TextBlobBatch),
-    BATCH_TEST_ENTRY(VerticesBatch)
+    DRAW_BATCH_TEST_ENTRY(AAConvexPathBatch),
+    DRAW_BATCH_TEST_ENTRY(AADistanceFieldPathBatch),
+    DRAW_BATCH_TEST_ENTRY(AAFillRectBatch),
+    DRAW_BATCH_TEST_ENTRY(AAFillRectBatchLocalMatrix),
+    DRAW_BATCH_TEST_ENTRY(AAHairlineBatch),
+    DRAW_BATCH_TEST_ENTRY(AAStrokeRectBatch),
+    DRAW_BATCH_TEST_ENTRY(DashBatch),
+    DRAW_BATCH_TEST_ENTRY(DefaultPathBatch),
+    DRAW_BATCH_TEST_ENTRY(CircleBatch),
+    DRAW_BATCH_TEST_ENTRY(DIEllipseBatch),
+    DRAW_BATCH_TEST_ENTRY(EllipseBatch),
+    DRAW_BATCH_TEST_ENTRY(GrDrawAtlasBatch),
+    DRAW_BATCH_TEST_ENTRY(GrStrokeRectBatch),
+    DRAW_BATCH_TEST_ENTRY(RRectBatch),
+    DRAW_BATCH_TEST_ENTRY(TesselatingPathBatch),
+    DRAW_BATCH_TEST_ENTRY(TextBlobBatch),
+    DRAW_BATCH_TEST_ENTRY(VerticesBatch)
 };
 
-GrBatch* GrRandomBatch(SkRandom* random, GrContext* context) {
+GrDrawBatch* GrRandomDrawBatch(SkRandom* random, GrContext* context) {
     uint32_t index = random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gTestBatches)));
     BatchTestFunc func = gTestBatches[index];
     return (*func)(random, context);
diff --git a/src/gpu/GrBatchTest.h b/src/gpu/GrBatchTest.h
index 9daa960..32e8e28 100644
--- a/src/gpu/GrBatchTest.h
+++ b/src/gpu/GrBatchTest.h
@@ -12,7 +12,7 @@
 
 #ifdef GR_TEST_UTILS
 
-class GrBatch;
+class GrDrawBatch;
 class GrContext;
 class SkRandom;
 
@@ -21,19 +21,19 @@
  * are generally useful for GrBatch testing
  */
 
-// Batches should define test functions using BATCH_TEST_DEFINE.  The other macros defined below
-// are used exclusively by the test harness.
-typedef GrBatch* (*BatchTestFunc)(SkRandom* random, GrContext* context);
-#define BATCH_TEST_DEFINE(Batch) \
-    GrBatch* Batch##__Test(SkRandom* random, GrContext* context)
-#define BATCH_TEST_EXTERN(Batch) \
-    extern GrBatch* Batch##__Test(SkRandom*, GrContext* context);
-#define BATCH_TEST_ENTRY(Batch) \
+// Batches should define test functions using DRAW_BATCH_TEST_DEFINE.  The other macros defined
+// below are used exclusively by the test harness.
+typedef GrDrawBatch* (*BatchTestFunc)(SkRandom* random, GrContext* context);
+#define DRAW_BATCH_TEST_DEFINE(Batch) \
+    GrDrawBatch* Batch##__Test(SkRandom* random, GrContext* context)
+#define DRAW_BATCH_TEST_EXTERN(Batch) \
+    extern GrDrawBatch* Batch##__Test(SkRandom*, GrContext* context);
+#define DRAW_BATCH_TEST_ENTRY(Batch) \
     Batch##__Test
-#define BATCH_TEST_FRIEND(Batch) \
-    friend GrBatch* Batch##__Test(SkRandom* random, GrContext* context);
+#define DRAW_BATCH_TEST_FRIEND(Batch) \
+    friend GrDrawBatch* Batch##__Test(SkRandom* random, GrContext* context);
 
-GrBatch* GrRandomBatch(SkRandom*, GrContext*);
+GrDrawBatch* GrRandomDrawBatch(SkRandom*, GrContext*);
 
 #endif
 #endif
diff --git a/src/gpu/GrBufferedDrawTarget.cpp b/src/gpu/GrBufferedDrawTarget.cpp
index e33950b..36542a1 100644
--- a/src/gpu/GrBufferedDrawTarget.cpp
+++ b/src/gpu/GrBufferedDrawTarget.cpp
@@ -26,7 +26,7 @@
     this->reset();
 }
 
-void GrBufferedDrawTarget::onDrawBatch(GrBatch* batch) {
+void GrBufferedDrawTarget::onDrawBatch(GrDrawBatch* batch) {
     fCommands->recordDrawBatch(batch, *this->caps());
 }
 
diff --git a/src/gpu/GrBufferedDrawTarget.h b/src/gpu/GrBufferedDrawTarget.h
index cc5e0e3..bb7fd89 100644
--- a/src/gpu/GrBufferedDrawTarget.h
+++ b/src/gpu/GrBufferedDrawTarget.h
@@ -78,7 +78,7 @@
     void onFlush() override;
 
     // overrides from GrDrawTarget
-    void onDrawBatch(GrBatch*) override;
+    void onDrawBatch(GrDrawBatch*) override;
     void onStencilPath(const GrPipelineBuilder&,
                        const GrPathProcessor*,
                        const GrPath*,
@@ -109,7 +109,7 @@
 
     StateForPathDraw* SK_WARN_UNUSED_RESULT createStateForPathDraw(
         const GrPrimitiveProcessor*,
-        const GrDrawTarget::PipelineInfo&,
+        const PipelineInfo&,
         GrPipelineOptimizations* opts);
 
     // TODO: Use a single allocator for commands and records
diff --git a/src/gpu/GrCommandBuilder.h b/src/gpu/GrCommandBuilder.h
index 8d8e11c..95fd8ec 100644
--- a/src/gpu/GrCommandBuilder.h
+++ b/src/gpu/GrCommandBuilder.h
@@ -28,7 +28,7 @@
                                         bool insideClip,
                                         GrRenderTarget* renderTarget);
     virtual Cmd* recordDiscard(GrRenderTarget*);
-    virtual Cmd* recordDrawBatch(GrBatch*, const GrCaps&) = 0;
+    virtual Cmd* recordDrawBatch(GrDrawBatch*, const GrCaps&) = 0;
     virtual Cmd* recordStencilPath(const GrPipelineBuilder&,
                                    const GrPathProcessor*,
                                    const GrPath*,
diff --git a/src/gpu/GrDefaultPathRenderer.cpp b/src/gpu/GrDefaultPathRenderer.cpp
index 1dd9deb..5353877 100644
--- a/src/gpu/GrDefaultPathRenderer.cpp
+++ b/src/gpu/GrDefaultPathRenderer.cpp
@@ -209,7 +209,7 @@
     }
 }
 
-class DefaultPathBatch : public GrBatch {
+class DefaultPathBatch : public GrVertexBatch {
 public:
     struct Geometry {
         GrColor fColor;
@@ -217,8 +217,9 @@
         SkScalar fTolerance;
     };
 
-    static GrBatch* Create(const Geometry& geometry, uint8_t coverage, const SkMatrix& viewMatrix,
-                           bool isHairline, const SkRect& devBounds) {
+    static GrDrawBatch* Create(const Geometry& geometry, uint8_t coverage,
+                               const SkMatrix& viewMatrix, bool isHairline,
+                               const SkRect& devBounds) {
         return SkNEW_ARGS(DefaultPathBatch, (geometry, coverage, viewMatrix, isHairline,
                                              devBounds));
     }
@@ -387,13 +388,12 @@
     }
 
     bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
-        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(),
-                                    caps)) {
+        DefaultPathBatch* that = t->cast<DefaultPathBatch>();
+        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
+                                     that->bounds(), caps)) {
             return false;
         }
 
-        DefaultPathBatch* that = t->cast<DefaultPathBatch>();
-
         if (this->color() != that->color()) {
             return false;
         }
@@ -697,8 +697,9 @@
             geometry.fPath = path;
             geometry.fTolerance = srcSpaceTol;
 
-            SkAutoTUnref<GrBatch> batch(DefaultPathBatch::Create(geometry, newCoverage, viewMatrix,
-                                                                 isHairline, devBounds));
+            SkAutoTUnref<GrDrawBatch> batch(DefaultPathBatch::Create(geometry, newCoverage,
+                                                                     viewMatrix, isHairline,
+                                                                     devBounds));
 
             target->drawBatch(*pipelineBuilder, batch);
         }
@@ -734,7 +735,7 @@
 
 #ifdef GR_TEST_UTILS
 
-BATCH_TEST_DEFINE(DefaultPathBatch) {
+DRAW_BATCH_TEST_DEFINE(DefaultPathBatch) {
     GrColor color = GrRandomColor(random);
     SkMatrix viewMatrix = GrTest::TestMatrix(random);
 
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
index c471619..3033611 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrDrawContext.cpp
@@ -304,7 +304,7 @@
                                            width, viewMatrix, color);
 
     if (doAA) {
-        SkAutoTUnref<GrBatch> batch;
+        SkAutoTUnref<GrDrawBatch> batch;
         if (width >= 0) {
             batch.reset(GrRectBatchFactory::CreateStrokeAA(color, viewMatrix, rect, devBoundRect,
                                                            *strokeInfo));
@@ -318,8 +318,8 @@
     if (width >= 0) {
         // Non-AA hairlines are snapped to pixel centers to make which pixels are hit deterministic
         bool snapToPixelCenters = (0 == width && !rt->isUnifiedMultisampled());
-        SkAutoTUnref<GrBatch> batch(GrRectBatchFactory::CreateStrokeBW(color, viewMatrix, rect,
-                                                                       width, snapToPixelCenters));
+        SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateStrokeBW(
+                                        color, viewMatrix, rect, width, snapToPixelCenters));
 
         // Depending on sub-pixel coordinates and the particular GPU, we may lose a corner of
         // hairline rects. We jam all the vertices to pixel centers to avoid this, but not when MSAA
@@ -391,10 +391,10 @@
 
     GrDrawVerticesBatch::Geometry geometry;
     geometry.fColor = paint.getColor();
-    SkAutoTUnref<GrBatch> batch(GrDrawVerticesBatch::Create(geometry, primitiveType, viewMatrix,
-                                                            positions, vertexCount, indices,
-                                                            indexCount, colors, texCoords,
-                                                            bounds));
+    SkAutoTUnref<GrDrawBatch> batch(GrDrawVerticesBatch::Create(geometry, primitiveType, viewMatrix,
+                                                                positions, vertexCount, indices,
+                                                                indexCount, colors, texCoords,
+                                                                bounds));
 
     fDrawTarget->drawBatch(pipelineBuilder, batch);
 }
@@ -419,8 +419,8 @@
     
     GrDrawAtlasBatch::Geometry geometry;
     geometry.fColor = paint.getColor();
-    SkAutoTUnref<GrBatch> batch(GrDrawAtlasBatch::Create(geometry, viewMatrix, spriteCount,
-                                                         xform, texRect, colors));
+    SkAutoTUnref<GrDrawBatch> batch(GrDrawAtlasBatch::Create(geometry, viewMatrix, spriteCount,
+                                                             xform, texRect, colors));
     
     fDrawTarget->drawBatch(pipelineBuilder, batch);
 }
@@ -601,7 +601,7 @@
 }
 
 void GrDrawContext::drawBatch(GrRenderTarget* rt, const GrClip& clip,
-                              const GrPaint& paint, GrBatch* batch) {
+                              const GrPaint& paint, GrDrawBatch* batch) {
     RETURN_IF_ABANDONED
 
     AutoCheckFlush acf(fContext);
@@ -649,9 +649,8 @@
             SkRect rects[2];
 
             if (is_nested_rects(viewMatrix, path, strokeInfo, rects)) {
-                SkAutoTUnref<GrBatch> batch(GrRectBatchFactory::CreateFillNestedRectsAA(color,
-                                                                                        viewMatrix,
-                                                                                        rects));
+                SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateFillNestedRectsAA(
+                    color, viewMatrix, rects));
                 fDrawTarget->drawBatch(pipelineBuilder, batch);
                 return;
             }
@@ -772,6 +771,6 @@
     return true;
 }
 
-void GrDrawContext::drawBatch(GrPipelineBuilder* pipelineBuilder, GrBatch* batch) {
+void GrDrawContext::drawBatch(GrPipelineBuilder* pipelineBuilder, GrDrawBatch* batch) {
     fDrawTarget->drawBatch(*pipelineBuilder, batch);
 }
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 6f01a2f..985254e 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -125,7 +125,7 @@
     this->reset();
 }
 
-void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrBatch* batch) {
+void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawBatch* batch) {
     // TODO some kind of checkdraw, but not at this level
 
     // Setup clip
@@ -295,8 +295,8 @@
                               const SkRect& rect,
                               const SkRect* localRect,
                               const SkMatrix* localMatrix) {
-   SkAutoTUnref<GrBatch> batch(GrRectBatchFactory::CreateFillBW(color, viewMatrix, rect, localRect,
-                                                                localMatrix));
+   SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateFillBW(color, viewMatrix, rect,
+                                                                    localRect, localMatrix));
    this->drawBatch(pipelineBuilder, batch);
 }
 
@@ -305,7 +305,8 @@
                               const SkMatrix& viewMatrix,
                               const SkRect& rect,
                               const SkRect& devRect) {
-    SkAutoTUnref<GrBatch> batch(GrRectBatchFactory::CreateFillAA(color, viewMatrix, rect, devRect));
+    SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateFillAA(color, viewMatrix, rect,
+                                                                     devRect));
     this->drawBatch(pipelineBuilder, batch);
 }
 
@@ -480,7 +481,7 @@
 
 GrDrawTarget::PipelineInfo::PipelineInfo(const GrPipelineBuilder* pipelineBuilder,
                                          const GrScissorState* scissor,
-                                         const GrBatch* batch,
+                                         const GrDrawBatch* batch,
                                          const SkRect* devBounds,
                                          GrDrawTarget* target) {
     fArgs.fPipelineBuilder = pipelineBuilder;
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index c7a39e3..d552d39 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -34,6 +34,7 @@
 class GrCaps;
 class GrPath;
 class GrPathRange;
+class GrDrawBatch;
 
 class GrDrawTarget : public SkRefCnt {
 public:
@@ -66,7 +67,7 @@
      */
     const GrCaps* caps() const { return fCaps; }
 
-    void drawBatch(const GrPipelineBuilder&, GrBatch*);
+    void drawBatch(const GrPipelineBuilder&, GrDrawBatch*);
 
     /**
      * Draws path into the stencil buffer. The fill must be either even/odd or
@@ -206,7 +207,7 @@
                      const SkRect* devBounds, GrDrawTarget* target);
 
         PipelineInfo(const GrPipelineBuilder* pipelineBuilder, const GrScissorState* scissor,
-                     const GrBatch* batch, const SkRect* devBounds,
+                     const GrDrawBatch* batch, const SkRect* devBounds,
                      GrDrawTarget* target);
 
         bool valid() const { return SkToBool(fArgs.fPipelineBuilder); }
@@ -241,7 +242,7 @@
 
     virtual void onFlush() = 0;
 
-    virtual void onDrawBatch(GrBatch*) = 0;
+    virtual void onDrawBatch(GrDrawBatch*) = 0;
     virtual void onStencilPath(const GrPipelineBuilder&,
                                const GrPathProcessor*,
                                const GrPath*,
diff --git a/src/gpu/GrImmediateDrawTarget.cpp b/src/gpu/GrImmediateDrawTarget.cpp
index 999446f..3bff379 100644
--- a/src/gpu/GrImmediateDrawTarget.cpp
+++ b/src/gpu/GrImmediateDrawTarget.cpp
@@ -25,14 +25,17 @@
     this->reset();
 }
 
-void GrImmediateDrawTarget::onDrawBatch(GrBatch* batch) {
+void GrImmediateDrawTarget::onDrawBatch(GrDrawBatch* batch) {
     fBatchTarget.resetNumberOfDraws();
 
-    batch->generateGeometry(&fBatchTarget);
-    batch->setNumberOfDraws(fBatchTarget.numberOfDraws());
+    // TODO: encapsulate the specialization of GrVertexBatch in GrVertexBatch so that we can
+    // remove this cast. Currently all GrDrawBatches are in fact GrVertexBatch.
+    GrVertexBatch* vertexBatch = static_cast<GrVertexBatch*>(batch);
+    vertexBatch->generateGeometry(&fBatchTarget);
+    vertexBatch->setNumberOfDraws(fBatchTarget.numberOfDraws());
 
     fBatchTarget.preFlush();
-    fBatchTarget.flushNext(batch->numberOfDraws());
+    fBatchTarget.flushNext(vertexBatch->numberOfDraws());
     fBatchTarget.postFlush();
 }
 
diff --git a/src/gpu/GrImmediateDrawTarget.h b/src/gpu/GrImmediateDrawTarget.h
index 997a31b..e7ec287 100644
--- a/src/gpu/GrImmediateDrawTarget.h
+++ b/src/gpu/GrImmediateDrawTarget.h
@@ -37,7 +37,7 @@
     void onFlush() override;
 
     // overrides from GrDrawTarget
-    void onDrawBatch(GrBatch*) override;
+    void onDrawBatch(GrDrawBatch*) override;
     void onStencilPath(const GrPipelineBuilder&,
                        const GrPathProcessor*,
                        const GrPath*,
diff --git a/src/gpu/GrInOrderCommandBuilder.cpp b/src/gpu/GrInOrderCommandBuilder.cpp
index 208161d..31fc6a2 100644
--- a/src/gpu/GrInOrderCommandBuilder.cpp
+++ b/src/gpu/GrInOrderCommandBuilder.cpp
@@ -25,7 +25,7 @@
     return isWinding;
 }
 
-GrTargetCommands::Cmd* GrInOrderCommandBuilder::recordDrawBatch(GrBatch* batch,
+GrTargetCommands::Cmd* GrInOrderCommandBuilder::recordDrawBatch(GrDrawBatch* batch,
                                                                 const GrCaps& caps) {
     GrBATCH_INFO("In-Recording (%s, %u)\n", batch->name(), batch->uniqueID());
     if (!this->cmdBuffer()->empty() &&
diff --git a/src/gpu/GrInOrderCommandBuilder.h b/src/gpu/GrInOrderCommandBuilder.h
index 7e16c94..2908e10 100644
--- a/src/gpu/GrInOrderCommandBuilder.h
+++ b/src/gpu/GrInOrderCommandBuilder.h
@@ -17,7 +17,7 @@
 
     GrInOrderCommandBuilder(GrGpu* gpu) : INHERITED(gpu) { }
 
-    Cmd* recordDrawBatch(GrBatch*, const GrCaps&) override;
+    Cmd* recordDrawBatch(GrDrawBatch*, const GrCaps&) override;
     Cmd* recordStencilPath(const GrPipelineBuilder&,
                            const GrPathProcessor*,
                            const GrPath*,
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index fa51bb2..7b33afd 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -625,7 +625,7 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-class CircleBatch : public GrBatch {
+class CircleBatch : public GrVertexBatch {
 public:
     struct Geometry {
         GrColor fColor;
@@ -636,7 +636,9 @@
         SkRect fDevBounds;
     };
 
-    static GrBatch* Create(const Geometry& geometry) { return SkNEW_ARGS(CircleBatch, (geometry)); }
+    static GrDrawBatch* Create(const Geometry& geometry) {
+        return SkNEW_ARGS(CircleBatch, (geometry));
+    }
 
     const char* name() const override { return "CircleBatch"; }
 
@@ -734,13 +736,12 @@
     }
 
     bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
-        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(),
-                                    caps)) {
+        CircleBatch* that = t->cast<CircleBatch>();
+        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
+                                    that->bounds(), caps)) {
             return false;
         }
 
-        CircleBatch* that = t->cast<CircleBatch>();
-
         // TODO use vertex color to avoid breaking batches
         if (this->color() != that->color()) {
             return false;
@@ -777,11 +778,11 @@
     SkSTArray<1, Geometry, true> fGeoData;
 };
 
-static GrBatch* create_circle_batch(GrColor color,
-                                    const SkMatrix& viewMatrix,
-                                    bool useCoverageAA,
-                                    const SkRect& circle,
-                                    const SkStrokeRec& stroke) {
+static GrDrawBatch* create_circle_batch(GrColor color,
+                                        const SkMatrix& viewMatrix,
+                                        bool useCoverageAA,
+                                        const SkRect& circle,
+                                        const SkStrokeRec& stroke) {
     SkPoint center = SkPoint::Make(circle.centerX(), circle.centerY());
     viewMatrix.mapPoints(&center, 1);
     SkScalar radius = viewMatrix.mapRadius(SkScalarHalf(circle.width()));
@@ -834,14 +835,14 @@
                                 bool useCoverageAA,
                                 const SkRect& circle,
                                 const SkStrokeRec& stroke) {
-    SkAutoTUnref<GrBatch> batch(create_circle_batch(color, viewMatrix, useCoverageAA, circle,
-                                                    stroke));
+    SkAutoTUnref<GrDrawBatch> batch(create_circle_batch(color, viewMatrix, useCoverageAA, circle,
+                                                        stroke));
     target->drawBatch(pipelineBuilder, batch);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 
-class EllipseBatch : public GrBatch {
+class EllipseBatch : public GrVertexBatch {
 public:
     struct Geometry {
         GrColor fColor;
@@ -854,7 +855,7 @@
         SkRect fDevBounds;
     };
 
-    static GrBatch* Create(const Geometry& geometry) {
+    static GrDrawBatch* Create(const Geometry& geometry) {
         return SkNEW_ARGS(EllipseBatch, (geometry));
     }
 
@@ -958,13 +959,13 @@
     }
 
     bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
-        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(),
-                                    caps)) {
+        EllipseBatch* that = t->cast<EllipseBatch>();
+
+        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
+                                    that->bounds(), caps)) {
             return false;
         }
 
-        EllipseBatch* that = t->cast<EllipseBatch>();
-
         // TODO use vertex color to avoid breaking batches
         if (this->color() != that->color()) {
             return false;
@@ -1001,11 +1002,11 @@
     SkSTArray<1, Geometry, true> fGeoData;
 };
 
-static GrBatch* create_ellipse_batch(GrColor color,
-                                     const SkMatrix& viewMatrix,
-                                     bool useCoverageAA,
-                                     const SkRect& ellipse,
-                                     const SkStrokeRec& stroke) {
+static GrDrawBatch* create_ellipse_batch(GrColor color,
+                                         const SkMatrix& viewMatrix,
+                                         bool useCoverageAA,
+                                         const SkRect& ellipse,
+                                         const SkStrokeRec& stroke) {
 #ifdef SK_DEBUG
     {
         // we should have checked for this previously
@@ -1095,8 +1096,8 @@
                                  bool useCoverageAA,
                                  const SkRect& ellipse,
                                  const SkStrokeRec& stroke) {
-    SkAutoTUnref<GrBatch> batch(create_ellipse_batch(color, viewMatrix, useCoverageAA, ellipse,
-                                                     stroke));
+    SkAutoTUnref<GrDrawBatch> batch(create_ellipse_batch(color, viewMatrix, useCoverageAA, ellipse,
+                                                         stroke));
     if (!batch) {
         return false;
     }
@@ -1107,7 +1108,7 @@
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
 
-class DIEllipseBatch : public GrBatch {
+class DIEllipseBatch : public GrVertexBatch {
 public:
     struct Geometry {
         GrColor fColor;
@@ -1122,7 +1123,7 @@
         SkRect fBounds;
     };
 
-    static GrBatch* Create(const Geometry& geometry, const SkRect& bounds) {
+    static GrDrawBatch* Create(const Geometry& geometry, const SkRect& bounds) {
         return SkNEW_ARGS(DIEllipseBatch, (geometry, bounds));
     }
 
@@ -1217,13 +1218,12 @@
     }
 
     bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
-        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(),
-                                    caps)) {
+        DIEllipseBatch* that = t->cast<DIEllipseBatch>();
+        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
+                                    that->bounds(), caps)) {
             return false;
         }
 
-        DIEllipseBatch* that = t->cast<DIEllipseBatch>();
-
         // TODO use vertex color to avoid breaking batches
         if (this->color() != that->color()) {
             return false;
@@ -1260,11 +1260,11 @@
     SkSTArray<1, Geometry, true> fGeoData;
 };
 
-static GrBatch* create_diellipse_batch(GrColor color,
-                                       const SkMatrix& viewMatrix,
-                                       bool useCoverageAA,
-                                       const SkRect& ellipse,
-                                       const SkStrokeRec& stroke) {
+static GrDrawBatch* create_diellipse_batch(GrColor color,
+                                           const SkMatrix& viewMatrix,
+                                           bool useCoverageAA,
+                                           const SkRect& ellipse,
+                                           const SkStrokeRec& stroke) {
     SkPoint center = SkPoint::Make(ellipse.centerX(), ellipse.centerY());
     SkScalar xRadius = SkScalarHalf(ellipse.width());
     SkScalar yRadius = SkScalarHalf(ellipse.height());
@@ -1345,8 +1345,8 @@
                                    bool useCoverageAA,
                                    const SkRect& ellipse,
                                    const SkStrokeRec& stroke) {
-    SkAutoTUnref<GrBatch> batch(create_diellipse_batch(color, viewMatrix, useCoverageAA, ellipse,
-                                                       stroke));
+    SkAutoTUnref<GrDrawBatch> batch(create_diellipse_batch(color, viewMatrix, useCoverageAA,
+                                                           ellipse, stroke));
     if (!batch) {
         return false;
     }
@@ -1463,7 +1463,7 @@
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-class RRectCircleRendererBatch : public GrBatch {
+class RRectCircleRendererBatch : public GrVertexBatch {
 public:
     struct Geometry {
         GrColor fColor;
@@ -1474,7 +1474,7 @@
         SkRect fDevBounds;
     };
 
-    static GrBatch* Create(const Geometry& geometry) {
+    static GrDrawBatch* Create(const Geometry& geometry) {
         return SkNEW_ARGS(RRectCircleRendererBatch, (geometry));
     }
 
@@ -1595,13 +1595,12 @@
     }
 
     bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
-        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(),
-                                    caps)) {
+        RRectCircleRendererBatch* that = t->cast<RRectCircleRendererBatch>();
+        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
+                                    that->bounds(), caps)) {
             return false;
         }
 
-        RRectCircleRendererBatch* that = t->cast<RRectCircleRendererBatch>();
-
         // TODO use vertex color to avoid breaking batches
         if (this->color() != that->color()) {
             return false;
@@ -1638,7 +1637,7 @@
     SkSTArray<1, Geometry, true> fGeoData;
 };
 
-class RRectEllipseRendererBatch : public GrBatch {
+class RRectEllipseRendererBatch : public GrVertexBatch {
 public:
     struct Geometry {
         GrColor fColor;
@@ -1651,7 +1650,7 @@
         SkRect fDevBounds;
     };
 
-    static GrBatch* Create(const Geometry& geometry) {
+    static GrDrawBatch* Create(const Geometry& geometry) {
         return SkNEW_ARGS(RRectEllipseRendererBatch, (geometry));
     }
 
@@ -1782,13 +1781,13 @@
     }
 
     bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
-        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(),
-                                    caps)) {
+        RRectEllipseRendererBatch* that = t->cast<RRectEllipseRendererBatch>();
+
+        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
+                                    that->bounds(), caps)) {
             return false;
         }
 
-        RRectEllipseRendererBatch* that = t->cast<RRectEllipseRendererBatch>();
-
         // TODO use vertex color to avoid breaking batches
         if (this->color() != that->color()) {
             return false;
@@ -1825,10 +1824,10 @@
     SkSTArray<1, Geometry, true> fGeoData;
 };
 
-static GrBatch* create_rrect_batch(GrColor color,
-                                   const SkMatrix& viewMatrix,
-                                   const SkRRect& rrect,
-                                   const SkStrokeRec& stroke) {
+static GrDrawBatch* create_rrect_batch(GrColor color,
+                                       const SkMatrix& viewMatrix,
+                                       const SkRRect& rrect,
+                                       const SkStrokeRec& stroke) {
     SkASSERT(viewMatrix.rectStaysRect());
     SkASSERT(rrect.isSimple());
     SkASSERT(!rrect.isOval());
@@ -1997,7 +1996,7 @@
         return false;
     }
 
-    SkAutoTUnref<GrBatch> batch(create_rrect_batch(color, viewMatrix, rrect, stroke));
+    SkAutoTUnref<GrDrawBatch> batch(create_rrect_batch(color, viewMatrix, rrect, stroke));
     if (!batch) {
         return false;
     }
@@ -2010,7 +2009,7 @@
 
 #ifdef GR_TEST_UTILS
 
-BATCH_TEST_DEFINE(CircleBatch) {
+DRAW_BATCH_TEST_DEFINE(CircleBatch) {
     SkMatrix viewMatrix = GrTest::TestMatrix(random);
     GrColor color = GrRandomColor(random);
     bool useCoverageAA = random->nextBool();
@@ -2019,7 +2018,7 @@
                                GrTest::TestStrokeRec(random));
 }
 
-BATCH_TEST_DEFINE(EllipseBatch) {
+DRAW_BATCH_TEST_DEFINE(EllipseBatch) {
     SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random);
     GrColor color = GrRandomColor(random);
     SkRect ellipse = GrTest::TestSquare(random);
@@ -2027,7 +2026,7 @@
                                 GrTest::TestStrokeRec(random));
 }
 
-BATCH_TEST_DEFINE(DIEllipseBatch) {
+DRAW_BATCH_TEST_DEFINE(DIEllipseBatch) {
     SkMatrix viewMatrix = GrTest::TestMatrix(random);
     GrColor color = GrRandomColor(random);
     bool useCoverageAA = random->nextBool();
@@ -2036,7 +2035,7 @@
                                   GrTest::TestStrokeRec(random));
 }
 
-BATCH_TEST_DEFINE(RRectBatch) {
+DRAW_BATCH_TEST_DEFINE(RRectBatch) {
     SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random);
     GrColor color = GrRandomColor(random);
     const SkRRect& rrect = GrTest::TestRRectSimple(random);
diff --git a/src/gpu/GrPipelineBuilder.cpp b/src/gpu/GrPipelineBuilder.cpp
index 1c44218..b0fc7b0 100644
--- a/src/gpu/GrPipelineBuilder.cpp
+++ b/src/gpu/GrPipelineBuilder.cpp
@@ -145,12 +145,12 @@
     fCoverageProcInfoValid = false;
 }
 
-void GrPipelineBuilder::calcColorInvariantOutput(const GrBatch* batch) const {
+void GrPipelineBuilder::calcColorInvariantOutput(const GrDrawBatch* batch) const {
     fColorProcInfo.calcColorWithBatch(batch, fColorStages.begin(), this->numColorFragmentStages());
     fColorProcInfoValid = false;
 }
 
-void GrPipelineBuilder::calcCoverageInvariantOutput(const GrBatch* batch) const {
+void GrPipelineBuilder::calcCoverageInvariantOutput(const GrDrawBatch* batch) const {
     fCoverageProcInfo.calcCoverageWithBatch(batch, fCoverageStages.begin(),
                                             this->numCoverageFragmentStages());
     fCoverageProcInfoValid = false;
diff --git a/src/gpu/GrPipelineBuilder.h b/src/gpu/GrPipelineBuilder.h
index f36a36b..ad1bbfb 100644
--- a/src/gpu/GrPipelineBuilder.h
+++ b/src/gpu/GrPipelineBuilder.h
@@ -24,7 +24,7 @@
 #include "effects/GrPorterDuffXferProcessor.h"
 #include "effects/GrSimpleTextureEffect.h"
 
-class GrBatch;
+class GrDrawBatch;
 class GrCaps;
 class GrPaint;
 class GrTexture;
@@ -400,12 +400,12 @@
         return fCoverageProcInfo;
     }
 
-    const GrProcOptInfo& colorProcInfo(const GrBatch* batch) const {
+    const GrProcOptInfo& colorProcInfo(const GrDrawBatch* batch) const {
         this->calcColorInvariantOutput(batch);
         return fColorProcInfo;
     }
 
-    const GrProcOptInfo& coverageProcInfo(const GrBatch* batch) const {
+    const GrProcOptInfo& coverageProcInfo(const GrDrawBatch* batch) const {
         this->calcCoverageInvariantOutput(batch);
         return fCoverageProcInfo;
     }
@@ -434,8 +434,8 @@
     /**
      * GrBatch provides the initial seed for these loops based off of its initial geometry data
      */
-    void calcColorInvariantOutput(const GrBatch*) const;
-    void calcCoverageInvariantOutput(const GrBatch*) const;
+    void calcColorInvariantOutput(const GrDrawBatch*) const;
+    void calcCoverageInvariantOutput(const GrDrawBatch*) const;
 
     /**
      * If fColorProcInfoValid is false, function calculates the invariant output for the color
diff --git a/src/gpu/GrProcOptInfo.cpp b/src/gpu/GrProcOptInfo.cpp
index 17b42b6..e56fb74 100644
--- a/src/gpu/GrProcOptInfo.cpp
+++ b/src/gpu/GrProcOptInfo.cpp
@@ -11,7 +11,7 @@
 
 #include "batches/GrBatch.h"
 
-void GrProcOptInfo::calcColorWithBatch(const GrBatch* batch,
+void GrProcOptInfo::calcColorWithBatch(const GrDrawBatch* batch,
                                        const GrFragmentStage* stages,
                                        int stageCount) {
     GrInitInvariantOutput out;
@@ -20,7 +20,7 @@
     this->internalCalc(stages, stageCount, batch->willReadFragmentPosition());
 }
 
-void GrProcOptInfo::calcCoverageWithBatch(const GrBatch* batch,
+void GrProcOptInfo::calcCoverageWithBatch(const GrDrawBatch* batch,
                                           const GrFragmentStage* stages,
                                           int stageCount) {
     GrInitInvariantOutput out;
diff --git a/src/gpu/GrProcOptInfo.h b/src/gpu/GrProcOptInfo.h
index 0430916..cf7e350 100644
--- a/src/gpu/GrProcOptInfo.h
+++ b/src/gpu/GrProcOptInfo.h
@@ -12,7 +12,7 @@
 #include "GrInvariantOutput.h"
 #include "GrStagedProcessor.h"
 
-class GrBatch;
+class GrDrawBatch;
 class GrFragmentProcessor;
 class GrPrimitiveProcessor;
 class GrProcessor;
@@ -34,8 +34,8 @@
     void calcWithInitialValues(const GrFragmentStage*, int stageCount, GrColor startColor,
                                GrColorComponentFlags flags, bool areCoverageStages);
 
-    void calcColorWithBatch(const GrBatch*, const GrFragmentStage*, int stagecount);
-    void calcCoverageWithBatch(const GrBatch*, const GrFragmentStage*, int stagecount);
+    void calcColorWithBatch(const GrDrawBatch*, const GrFragmentStage*, int stagecount);
+    void calcCoverageWithBatch(const GrDrawBatch*, const GrFragmentStage*, int stagecount);
 
     // TODO delete these when batch is everywhere
     void calcColorWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentStage*, int stagecount);
diff --git a/src/gpu/GrReorderCommandBuilder.cpp b/src/gpu/GrReorderCommandBuilder.cpp
index 869ae53..f08b7f1 100644
--- a/src/gpu/GrReorderCommandBuilder.cpp
+++ b/src/gpu/GrReorderCommandBuilder.cpp
@@ -15,7 +15,7 @@
            a.fTop < b.fBottom && b.fTop < a.fBottom;
 }
 
-GrTargetCommands::Cmd* GrReorderCommandBuilder::recordDrawBatch(GrBatch* batch,
+GrTargetCommands::Cmd* GrReorderCommandBuilder::recordDrawBatch(GrDrawBatch* batch,
                                                                 const GrCaps& caps) {
     // Check if there is a Batch Draw we can batch with by linearly searching back until we either
     // 1) check every draw
diff --git a/src/gpu/GrReorderCommandBuilder.h b/src/gpu/GrReorderCommandBuilder.h
index 4a4ebe9..a5f984c 100644
--- a/src/gpu/GrReorderCommandBuilder.h
+++ b/src/gpu/GrReorderCommandBuilder.h
@@ -17,7 +17,7 @@
 
     GrReorderCommandBuilder(GrGpu* gpu) : INHERITED(gpu) {}
 
-    Cmd* recordDrawBatch(GrBatch*, const GrCaps&) override;
+    Cmd* recordDrawBatch(GrDrawBatch*, const GrCaps&) override;
     Cmd* recordStencilPath(const GrPipelineBuilder&,
                            const GrPathProcessor*,
                            const GrPath*,
diff --git a/src/gpu/GrTargetCommands.cpp b/src/gpu/GrTargetCommands.cpp
index 474bbbd..2347db8 100644
--- a/src/gpu/GrTargetCommands.cpp
+++ b/src/gpu/GrTargetCommands.cpp
@@ -30,8 +30,12 @@
         if (Cmd::kDrawBatch_CmdType == genIter->type()) {
             DrawBatch* db = reinterpret_cast<DrawBatch*>(genIter.get());
             fBatchTarget.resetNumberOfDraws();
-            db->batch()->generateGeometry(&fBatchTarget);
-            db->batch()->setNumberOfDraws(fBatchTarget.numberOfDraws());
+            // TODO: encapsulate the specialization of GrVertexBatch in GrVertexBatch so that we can
+            // remove this cast. Currently all GrDrawBatches are in fact GrVertexBatch.
+            GrVertexBatch* vertexBatch = static_cast<GrVertexBatch*>(db->batch());
+
+            vertexBatch->generateGeometry(&fBatchTarget);
+            vertexBatch->setNumberOfDraws(fBatchTarget.numberOfDraws());
         }
     }
 
@@ -76,7 +80,10 @@
 }
 
 void GrTargetCommands::DrawBatch::execute(GrGpu* gpu) {
-    fBatchTarget->flushNext(fBatch->numberOfDraws());
+    // TODO: encapsulate the specialization of GrVertexBatch in GrVertexBatch so that we can
+    // remove this cast. Currently all GrDrawBatches are in fact GrVertexBatch.
+    const GrVertexBatch* vertexBatch = static_cast<const GrVertexBatch*>(fBatch.get());
+    fBatchTarget->flushNext(vertexBatch->numberOfDraws());
 }
 
 void GrTargetCommands::Clear::execute(GrGpu* gpu) {
diff --git a/src/gpu/GrTargetCommands.h b/src/gpu/GrTargetCommands.h
index a15ac88..0240480 100644
--- a/src/gpu/GrTargetCommands.h
+++ b/src/gpu/GrTargetCommands.h
@@ -232,19 +232,19 @@
     };
 
     struct DrawBatch : public Cmd {
-        DrawBatch(GrBatch* batch, GrBatchTarget* batchTarget)
+        DrawBatch(GrDrawBatch* batch, GrBatchTarget* batchTarget)
             : Cmd(kDrawBatch_CmdType)
             , fBatch(SkRef(batch))
             , fBatchTarget(batchTarget) {
             SkASSERT(!batch->isUsed());
         }
 
-        GrBatch* batch() { return fBatch; }
+        GrDrawBatch* batch() { return fBatch; }
         void execute(GrGpu*) override;
 
     private:
-        SkAutoTUnref<GrBatch>  fBatch;
-        GrBatchTarget*         fBatchTarget;
+        SkAutoTUnref<GrDrawBatch>   fBatch;
+        GrBatchTarget*              fBatchTarget;
     };
 
     static const int kCmdBufferInitialSizeInBytes = 8 * 1024;
diff --git a/src/gpu/GrTessellatingPathRenderer.cpp b/src/gpu/GrTessellatingPathRenderer.cpp
index 9459cc5..30be341 100644
--- a/src/gpu/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/GrTessellatingPathRenderer.cpp
@@ -1384,14 +1384,14 @@
            !args.fAntiAlias && !args.fPath->isConvex();
 }
 
-class TessellatingPathBatch : public GrBatch {
+class TessellatingPathBatch : public GrVertexBatch {
 public:
 
-    static GrBatch* Create(const GrColor& color,
-                           const SkPath& path,
-                           const GrStrokeInfo& stroke,
-                           const SkMatrix& viewMatrix,
-                           SkRect clipBounds) {
+    static GrDrawBatch* Create(const GrColor& color,
+                               const SkPath& path,
+                               const GrStrokeInfo& stroke,
+                               const SkMatrix& viewMatrix,
+                               SkRect clipBounds) {
         return SkNEW_ARGS(TessellatingPathBatch, (color, path, stroke, viewMatrix, clipBounds));
     }
 
@@ -1620,9 +1620,9 @@
         return false;
     }
     vmi.mapRect(&clipBounds);
-    SkAutoTUnref<GrBatch> batch(TessellatingPathBatch::Create(args.fColor, *args.fPath,
-                                                              *args.fStroke, *args.fViewMatrix,
-                                                              clipBounds));
+    SkAutoTUnref<GrDrawBatch> batch(TessellatingPathBatch::Create(args.fColor, *args.fPath,
+                                                                  *args.fStroke, *args.fViewMatrix,
+                                                                  clipBounds));
     args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
 
     return true;
@@ -1632,7 +1632,7 @@
 
 #ifdef GR_TEST_UTILS
 
-BATCH_TEST_DEFINE(TesselatingPathBatch) {
+DRAW_BATCH_TEST_DEFINE(TesselatingPathBatch) {
     GrColor color = GrRandomColor(random);
     SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random);
     SkPath path = GrTest::TestPath(random);
diff --git a/src/gpu/batches/GrAAFillRectBatch.cpp b/src/gpu/batches/GrAAFillRectBatch.cpp
index 4cea65a..9b19028 100644
--- a/src/gpu/batches/GrAAFillRectBatch.cpp
+++ b/src/gpu/batches/GrAAFillRectBatch.cpp
@@ -62,7 +62,7 @@
  *                           SkPoint* fan0Position, const Geometry&)
  */
 template <typename Base>
-class AAFillRectBatch : public GrBatch {
+class AAFillRectBatch : public GrVertexBatch {
 public:
     typedef typename Base::Geometry Geometry;
 
@@ -165,12 +165,12 @@
     bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
 
     bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
-        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(),
-                                caps)) {
+        AAFillRectBatch* that = t->cast<AAFillRectBatch>();
+        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
+                                    that->bounds(), caps)) {
             return false;
         }
 
-        AAFillRectBatch* that = t->cast<AAFillRectBatch>();
         if (!Base::CanCombineLocalCoords(this->viewMatrix(), that->viewMatrix(),
                                          this->usesLocalCoords())) {
             return false;
@@ -399,10 +399,10 @@
 
 namespace GrAAFillRectBatch {
 
-GrBatch* Create(GrColor color,
-                const SkMatrix& viewMatrix,
-                const SkRect& rect,
-                const SkRect& devRect) {
+GrDrawBatch* Create(GrColor color,
+                    const SkMatrix& viewMatrix,
+                    const SkRect& rect,
+                    const SkRect& devRect) {
     AAFillRectBatchNoLocalMatrix* batch = AAFillRectBatchNoLocalMatrix::Create();
     AAFillRectBatchNoLocalMatrix::Geometry& geo = *batch->geometry();
     geo.fColor = color;
@@ -412,11 +412,11 @@
     return batch;
 }
 
-GrBatch* Create(GrColor color,
-                const SkMatrix& viewMatrix,
-                const SkMatrix& localMatrix,
-                const SkRect& rect,
-                const SkRect& devRect) {
+GrDrawBatch* Create(GrColor color,
+                    const SkMatrix& viewMatrix,
+                    const SkMatrix& localMatrix,
+                    const SkRect& rect,
+                    const SkRect& devRect) {
     AAFillRectBatchLocalMatrix* batch = AAFillRectBatchLocalMatrix::Create();
     AAFillRectBatchLocalMatrix::Geometry& geo = *batch->geometry();
     geo.fColor = color;
@@ -435,7 +435,7 @@
 
 #include "GrBatchTest.h"
 
-BATCH_TEST_DEFINE(AAFillRectBatch) {
+DRAW_BATCH_TEST_DEFINE(AAFillRectBatch) {
     AAFillRectBatchNoLocalMatrix* batch = AAFillRectBatchNoLocalMatrix::Create();
     AAFillRectBatchNoLocalMatrix::Geometry& geo = *batch->geometry();
     geo.fColor = GrRandomColor(random);
@@ -445,7 +445,7 @@
     return batch;
 }
 
-BATCH_TEST_DEFINE(AAFillRectBatchLocalMatrix) {
+DRAW_BATCH_TEST_DEFINE(AAFillRectBatchLocalMatrix) {
     AAFillRectBatchLocalMatrix* batch = AAFillRectBatchLocalMatrix::Create();
     AAFillRectBatchLocalMatrix::Geometry& geo = *batch->geometry();
     geo.fColor = GrRandomColor(random);
diff --git a/src/gpu/batches/GrAAFillRectBatch.h b/src/gpu/batches/GrAAFillRectBatch.h
index 3fc1e34..5a657a3 100644
--- a/src/gpu/batches/GrAAFillRectBatch.h
+++ b/src/gpu/batches/GrAAFillRectBatch.h
@@ -10,21 +10,21 @@
 
 #include "GrColor.h"
 
-class GrBatch;
+class GrDrawBatch;
 class SkMatrix;
 struct SkRect;
 
 namespace GrAAFillRectBatch {
-GrBatch* Create(GrColor color,
-                const SkMatrix& viewMatrix,
-                const SkRect& rect,
-                const SkRect& devRect);
+GrDrawBatch* Create(GrColor color,
+                    const SkMatrix& viewMatrix,
+                    const SkRect& rect,
+                    const SkRect& devRect);
 
-GrBatch* Create(GrColor color,
-                const SkMatrix& viewMatrix,
-                const SkMatrix& localMatrix,
-                const SkRect& rect,
-                const SkRect& devRect);
+GrDrawBatch* Create(GrColor color,
+                    const SkMatrix& viewMatrix,
+                    const SkMatrix& localMatrix,
+                    const SkRect& rect,
+                    const SkRect& devRect);
 };
 
 #endif
diff --git a/src/gpu/batches/GrAAStrokeRectBatch.cpp b/src/gpu/batches/GrAAStrokeRectBatch.cpp
index 0083aaa..91ff230 100644
--- a/src/gpu/batches/GrAAStrokeRectBatch.cpp
+++ b/src/gpu/batches/GrAAStrokeRectBatch.cpp
@@ -204,13 +204,13 @@
 }
 
 bool GrAAStrokeRectBatch::onCombineIfPossible(GrBatch* t, const GrCaps& caps) {
-    if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(),
-                                caps)) {
+    GrAAStrokeRectBatch* that = t->cast<GrAAStrokeRectBatch>();
+
+    if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
+                                that->bounds(), caps)) {
         return false;
     }
 
-    GrAAStrokeRectBatch* that = t->cast<GrAAStrokeRectBatch>();
-
     // TODO batch across miterstroke changes
     if (this->miterStroke() != that->miterStroke()) {
         return false;
@@ -356,7 +356,7 @@
 
 #include "GrBatchTest.h"
 
-BATCH_TEST_DEFINE(AAStrokeRectBatch) {
+DRAW_BATCH_TEST_DEFINE(AAStrokeRectBatch) {
     bool miterStroke = random->nextBool();
 
     // Create mock stroke rect
diff --git a/src/gpu/batches/GrAAStrokeRectBatch.h b/src/gpu/batches/GrAAStrokeRectBatch.h
index 7fa15f5..b6fb89f 100644
--- a/src/gpu/batches/GrAAStrokeRectBatch.h
+++ b/src/gpu/batches/GrAAStrokeRectBatch.h
@@ -14,7 +14,7 @@
 #include "SkMatrix.h"
 #include "SkRect.h"
 
-class GrAAStrokeRectBatch : public GrBatch {
+class GrAAStrokeRectBatch : public GrVertexBatch {
 public:
     // TODO support AA rotated stroke rects by copying around view matrices
     struct Geometry {
@@ -25,7 +25,7 @@
         bool fMiterStroke;
     };
 
-    static GrBatch* Create(const Geometry& geometry, const SkMatrix& viewMatrix) {
+    static GrDrawBatch* Create(const Geometry& geometry, const SkMatrix& viewMatrix) {
         return SkNEW_ARGS(GrAAStrokeRectBatch, (geometry, viewMatrix));
     }
 
diff --git a/src/gpu/batches/GrBWFillRectBatch.cpp b/src/gpu/batches/GrBWFillRectBatch.cpp
index c3ddc2b..0009789 100644
--- a/src/gpu/batches/GrBWFillRectBatch.cpp
+++ b/src/gpu/batches/GrBWFillRectBatch.cpp
@@ -17,7 +17,7 @@
 class SkMatrix;
 struct SkRect;
 
-class BWFillRectBatch : public GrBatch {
+class BWFillRectBatch : public GrVertexBatch {
 public:
     struct Geometry {
         SkMatrix fViewMatrix;
@@ -29,7 +29,7 @@
         bool fHasLocalMatrix;
     };
 
-    static GrBatch* Create(const Geometry& geometry) {
+    static GrDrawBatch* Create(const Geometry& geometry) {
         return SkNEW_ARGS(BWFillRectBatch, (geometry));
     }
 
@@ -134,13 +134,12 @@
     bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
 
     bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
-        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(),
-                                    caps)) {
+        BWFillRectBatch* that = t->cast<BWFillRectBatch>();
+        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
+                                    that->bounds(), caps)) {
             return false;
         }
 
-        BWFillRectBatch* that = t->cast<BWFillRectBatch>();
-
         if (this->hasLocalRect() != that->hasLocalRect()) {
             return false;
         }
@@ -210,11 +209,11 @@
 };
 
 namespace GrBWFillRectBatch {
-GrBatch* Create(GrColor color,
-                const SkMatrix& viewMatrix,
-                const SkRect& rect,
-                const SkRect* localRect,
-                const SkMatrix* localMatrix) {
+GrDrawBatch* Create(GrColor color,
+                    const SkMatrix& viewMatrix,
+                    const SkRect& rect,
+                    const SkRect* localRect,
+                    const SkMatrix* localMatrix) {
     BWFillRectBatch::Geometry geometry;
     geometry.fColor = color;
     geometry.fViewMatrix = viewMatrix;
@@ -244,7 +243,7 @@
 
 #include "GrBatchTest.h"
 
-BATCH_TEST_DEFINE(RectBatch) {
+DRAW_BATCH_TEST_DEFINE(RectBatch) {
     BWFillRectBatch::Geometry geometry;
     geometry.fColor = GrRandomColor(random);
 
diff --git a/src/gpu/batches/GrBWFillRectBatch.h b/src/gpu/batches/GrBWFillRectBatch.h
index ff1533c..c95fd70 100644
--- a/src/gpu/batches/GrBWFillRectBatch.h
+++ b/src/gpu/batches/GrBWFillRectBatch.h
@@ -10,12 +10,12 @@
 
 #include "GrColor.h"
 
-class GrBatch;
+class GrDrawBatch;
 class SkMatrix;
 struct SkRect;
 
 namespace GrBWFillRectBatch {
-GrBatch* Create(GrColor color,
+GrDrawBatch* Create(GrColor color,
                 const SkMatrix& viewMatrix,
                 const SkRect& rect,
                 const SkRect* localRect,
diff --git a/src/gpu/batches/GrBatch.cpp b/src/gpu/batches/GrBatch.cpp
index 3840b4c..b696d6b 100644
--- a/src/gpu/batches/GrBatch.cpp
+++ b/src/gpu/batches/GrBatch.cpp
@@ -50,8 +50,6 @@
 
 GrBatch::GrBatch()
     : fClassID(kIllegalBatchID)
-    , fNumberOfDraws(0)
-    , fPipelineInstalled(false)
 #if GR_BATCH_SPEW
     , fUniqueID(GenID(&gCurrBatchUniqueID))
 #endif
@@ -59,13 +57,34 @@
     SkDEBUGCODE(fUsed = false;)
 }
 
-GrBatch::~GrBatch() {
+GrBatch::~GrBatch() {}
+
+//////////////////////////////////////////////////////////////////////////////
+
+GrDrawBatch::GrDrawBatch() : fPipelineInstalled(false) { }
+
+GrDrawBatch::~GrDrawBatch() {
     if (fPipelineInstalled) {
         this->pipeline()->~GrPipeline();
     }
 }
 
-void* GrBatch::InstancedHelper::init(GrBatchTarget* batchTarget, GrPrimitiveType primType,
+bool GrDrawBatch::installPipeline(const GrPipeline::CreateArgs& args) {
+    GrPipelineOptimizations opts;
+    void* location = fPipelineStorage.get();
+    if (!GrPipeline::CreateAt(location, args, &opts)) {
+        return false;
+    }
+    this->initBatchTracker(opts);
+    fPipelineInstalled = true;
+    return true;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+GrVertexBatch::GrVertexBatch() : fNumberOfDraws(0) {}
+
+void* GrVertexBatch::InstancedHelper::init(GrBatchTarget* batchTarget, GrPrimitiveType primType,
                                      size_t vertexStride, const GrIndexBuffer* indexBuffer,
                                      int verticesPerInstance, int indicesPerInstance,
                                      int instancesToDraw) {
@@ -92,7 +111,8 @@
     return vertices;
 }
 
-void* GrBatch::QuadHelper::init(GrBatchTarget* batchTarget, size_t vertexStride, int quadsToDraw) {
+void* GrVertexBatch::QuadHelper::init(GrBatchTarget* batchTarget, size_t vertexStride,
+                                      int quadsToDraw) {
     SkAutoTUnref<const GrIndexBuffer> quadIndexBuffer(
         batchTarget->resourceProvider()->refQuadIndexBuffer());
     if (!quadIndexBuffer) {
@@ -102,14 +122,3 @@
     return this->INHERITED::init(batchTarget, kTriangles_GrPrimitiveType, vertexStride,
                                  quadIndexBuffer, kVerticesPerQuad, kIndicesPerQuad, quadsToDraw);
 }
-
-bool GrBatch::installPipeline(const GrPipeline::CreateArgs& args) {
-    GrPipelineOptimizations opts;
-    void* location = fPipelineStorage.get();
-    if (!GrPipeline::CreateAt(location, args, &opts)) {
-        return false;
-    }
-    this->initBatchTracker(opts);
-    fPipelineInstalled = true;
-    return true;
-}
diff --git a/src/gpu/batches/GrBatch.h b/src/gpu/batches/GrBatch.h
index 35844cd..ef8f56c 100644
--- a/src/gpu/batches/GrBatch.h
+++ b/src/gpu/batches/GrBatch.h
@@ -21,7 +21,7 @@
 
 struct GrInitInvariantOutput;
 
-/*
+/**
  * GrBatch is the base class for all Ganesh deferred geometry generators.  To facilitate
  * reorderable batching, Ganesh does not generate geometry inline with draw calls.  Instead, it
  * captures the arguments to the draw and then generates the geometry on demand.  This gives GrBatch
@@ -51,8 +51,6 @@
     ~GrBatch() override;
 
     virtual const char* name() const = 0;
-    virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const = 0;
-    virtual void getInvariantOutputCoverage(GrInitInvariantOutput* out) const = 0;
 
     bool combineIfPossible(GrBatch* that, const GrCaps& caps) {
         if (this->classID() != that->classID()) {
@@ -62,14 +60,8 @@
         return this->onCombineIfPossible(that, caps);
     }
 
-    virtual void generateGeometry(GrBatchTarget*) = 0;
-
     const SkRect& bounds() const { return fBounds; }
 
-    // TODO this goes away when batches are everywhere
-    void setNumberOfDraws(int numberOfDraws) { fNumberOfDraws = numberOfDraws; }
-    int numberOfDraws() const { return fNumberOfDraws; }
-
     void* operator new(size_t size);
     void operator delete(void* target);
 
@@ -81,28 +73,17 @@
     }
 
     /**
-      * Helper for down-casting to a GrBatch subclass
-      */
+     * Helper for down-casting to a GrBatch subclass
+     */
     template <typename T> const T& cast() const { return *static_cast<const T*>(this); }
     template <typename T> T* cast() { return static_cast<T*>(this); }
 
     uint32_t classID() const { SkASSERT(kIllegalBatchID != fClassID); return fClassID; }
 
-    // TODO no GrPrimitiveProcessors yet read fragment position
-    bool willReadFragmentPosition() const { return false; }
-
-    SkDEBUGCODE(bool isUsed() const { return fUsed; })
-
-    const GrPipeline* pipeline() const {
-        SkASSERT(fPipelineInstalled);
-        return reinterpret_cast<const GrPipeline*>(fPipelineStorage.get());
-    }
-
-    bool installPipeline(const GrPipeline::CreateArgs&);
-
 #if GR_BATCH_SPEW
     uint32_t uniqueID() const { return fUniqueID; }
 #endif
+    SkDEBUGCODE(bool isUsed() const { return fUsed; })
 
 protected:
     template <typename PROC_SUBCLASS> void initClassID() {
@@ -118,8 +99,86 @@
         return fBounds.joinPossiblyEmptyRect(otherBounds);
     }
 
+    SkRect                              fBounds;
+
+private:
+    virtual bool onCombineIfPossible(GrBatch*, const GrCaps& caps) = 0;
+
+    static uint32_t GenID(int32_t* idCounter) {
+        // fCurrProcessorClassID has been initialized to kIllegalProcessorClassID. The
+        // atomic inc returns the old value not the incremented value. So we add
+        // 1 to the returned value.
+        uint32_t id = static_cast<uint32_t>(sk_atomic_inc(idCounter)) + 1;
+        if (!id) {
+            SkFAIL("This should never wrap as it should only be called once for each GrBatch "
+                   "subclass.");
+        }
+        return id;
+    }
+
+    enum {
+        kIllegalBatchID = 0,
+    };
+
+    uint32_t                            fClassID;
+    SkDEBUGCODE(bool                    fUsed;)
+#if GR_BATCH_SPEW
+    uint32_t                            fUniqueID;
+    static int32_t gCurrBatchUniqueID;
+#endif
+    static int32_t gCurrBatchClassID;
+    typedef GrNonAtomicRef INHERITED;
+};
+
+/**
+ * Base class for GrBatches that draw. These batches have a GrPipeline installed by GrDrawTarget.
+ */
+class GrDrawBatch : public GrBatch {
+public:
+    GrDrawBatch();
+    ~GrDrawBatch() override;
+
+    virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const = 0;
+    virtual void getInvariantOutputCoverage(GrInitInvariantOutput* out) const = 0;
+
+    const GrPipeline* pipeline() const {
+        SkASSERT(fPipelineInstalled);
+        return reinterpret_cast<const GrPipeline*>(fPipelineStorage.get());
+    }
+
+    bool installPipeline(const GrPipeline::CreateArgs&);
+
+    // TODO no GrPrimitiveProcessors yet read fragment position
+    bool willReadFragmentPosition() const { return false; }
+
+private:
+    /**
+     * initBatchTracker is a hook for the some additional overrides / optimization possibilities
+     * from the GrXferProcessor.
+     */
+    virtual void initBatchTracker(const GrPipelineOptimizations&) = 0;
+
+    SkAlignedSTStorage<1, GrPipeline>   fPipelineStorage;
+    bool                                fPipelineInstalled;
+    typedef GrBatch INHERITED;
+};
+
+/**
+ * Base class for vertex-based GrBatches.
+ */
+class GrVertexBatch : public GrDrawBatch {
+public:
+    GrVertexBatch();
+
+    virtual void generateGeometry(GrBatchTarget*) = 0;
+
+    // TODO this goes away when batches are everywhere
+    void setNumberOfDraws(int numberOfDraws) { fNumberOfDraws = numberOfDraws; }
+    int numberOfDraws() const { return fNumberOfDraws; }
+
+protected:
     /** Helper for rendering instances using an instanced index index buffer. This class creates the
-        space for the vertices and flushes the draws to the batch target.*/
+        space for the vertices and flushes the draws to the batch target. */
    class InstancedHelper {
    public:
         InstancedHelper() {}
@@ -156,44 +215,9 @@
         typedef InstancedHelper INHERITED;
     };
 
-    uint32_t fClassID;
-    SkRect fBounds;
-
 private:
-    virtual bool onCombineIfPossible(GrBatch*, const GrCaps& caps) = 0;
-
-    /*
-     * initBatchTracker is a hook for the some additional overrides / optimization possibilities
-     * from the GrXferProcessor.
-     */
-    virtual void initBatchTracker(const GrPipelineOptimizations&) = 0;
-
-
-    static uint32_t GenID(int32_t* idCounter) {
-        // fCurrProcessorClassID has been initialized to kIllegalProcessorClassID. The
-        // atomic inc returns the old value not the incremented value. So we add
-        // 1 to the returned value.
-        uint32_t id = static_cast<uint32_t>(sk_atomic_inc(idCounter)) + 1;
-        if (!id) {
-            SkFAIL("This should never wrap as it should only be called once for each GrBatch "
-                   "subclass.");
-        }
-        return id;
-    }
-
-    enum {
-        kIllegalBatchID = 0,
-    };
-    SkAlignedSTStorage<1, GrPipeline>   fPipelineStorage;
     int                                 fNumberOfDraws;
-    SkDEBUGCODE(bool                    fUsed;)
-    bool                                fPipelineInstalled;
-#if GR_BATCH_SPEW
-    uint32_t                            fUniqueID;
-    static int32_t gCurrBatchUniqueID;
-#endif
-    static int32_t gCurrBatchClassID;
-    typedef SkRefCnt INHERITED;
+    typedef GrDrawBatch INHERITED;
 };
 
 #endif
diff --git a/src/gpu/batches/GrDrawAtlasBatch.cpp b/src/gpu/batches/GrDrawAtlasBatch.cpp
index f79412b..28c6922 100644
--- a/src/gpu/batches/GrDrawAtlasBatch.cpp
+++ b/src/gpu/batches/GrDrawAtlasBatch.cpp
@@ -157,13 +157,13 @@
 }
  
 bool GrDrawAtlasBatch::onCombineIfPossible(GrBatch* t, const GrCaps& caps) {
-    if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(),
-                                caps)) {
+    GrDrawAtlasBatch* that = t->cast<GrDrawAtlasBatch>();
+
+    if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
+                                that->bounds(), caps)) {
         return false;
     }
-    
-    GrDrawAtlasBatch* that = t->cast<GrDrawAtlasBatch>();
-    
+
     // We currently use a uniform viewmatrix for this batch
     if (!this->viewMatrix().cheapEqualTo(that->viewMatrix())) {
         return false;
@@ -231,7 +231,7 @@
     }
 }
 
-BATCH_TEST_DEFINE(GrDrawAtlasBatch) {
+DRAW_BATCH_TEST_DEFINE(GrDrawAtlasBatch) {
     uint32_t spriteCount = random->nextRangeU(1, 100);
     
     SkTArray<SkRSXform> xforms(spriteCount);
diff --git a/src/gpu/batches/GrDrawAtlasBatch.h b/src/gpu/batches/GrDrawAtlasBatch.h
index e6ce7a0..6b46cfb 100644
--- a/src/gpu/batches/GrDrawAtlasBatch.h
+++ b/src/gpu/batches/GrDrawAtlasBatch.h
@@ -12,15 +12,16 @@
 #include "GrColor.h"
 #include "GrDefaultGeoProcFactory.h"
 
-class GrDrawAtlasBatch : public GrBatch {
+class GrDrawAtlasBatch : public GrVertexBatch {
 public:
     struct Geometry {
         GrColor                 fColor;
         SkTArray<uint8_t, true> fVerts;
     };
     
-    static GrBatch* Create(const Geometry& geometry, const SkMatrix& viewMatrix, int spriteCount,
-                           const SkRSXform* xforms, const SkRect* rects, const SkColor* colors) {
+    static GrDrawBatch* Create(const Geometry& geometry, const SkMatrix& viewMatrix,
+                               int spriteCount, const SkRSXform* xforms, const SkRect* rects,
+                               const SkColor* colors) {
         return SkNEW_ARGS(GrDrawAtlasBatch, (geometry, viewMatrix, spriteCount,
                                              xforms, rects, colors));
     }
diff --git a/src/gpu/batches/GrDrawVerticesBatch.cpp b/src/gpu/batches/GrDrawVerticesBatch.cpp
index f36c54b..ebfda36 100644
--- a/src/gpu/batches/GrDrawVerticesBatch.cpp
+++ b/src/gpu/batches/GrDrawVerticesBatch.cpp
@@ -184,13 +184,13 @@
 }
 
 bool GrDrawVerticesBatch::onCombineIfPossible(GrBatch* t, const GrCaps& caps) {
-    if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(),
-                                caps)) {
+    GrDrawVerticesBatch* that = t->cast<GrDrawVerticesBatch>();
+
+    if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
+                                that->bounds(), caps)) {
         return false;
     }
 
-    GrDrawVerticesBatch* that = t->cast<GrDrawVerticesBatch>();
-
     if (!this->batchablePrimitiveType() || this->primitiveType() != that->primitiveType()) {
         return false;
     }
@@ -295,7 +295,7 @@
     }
 }
 
-BATCH_TEST_DEFINE(VerticesBatch) {
+DRAW_BATCH_TEST_DEFINE(VerticesBatch) {
     GrPrimitiveType type = GrPrimitiveType(random->nextULessThan(kLast_GrPrimitiveType + 1));
     uint32_t primitiveCount = random->nextRangeU(1, 100);
 
diff --git a/src/gpu/batches/GrDrawVerticesBatch.h b/src/gpu/batches/GrDrawVerticesBatch.h
index 9446d88..11decbe 100644
--- a/src/gpu/batches/GrDrawVerticesBatch.h
+++ b/src/gpu/batches/GrDrawVerticesBatch.h
@@ -18,7 +18,7 @@
 class GrBatchTarget;
 struct GrInitInvariantOutput;
 
-class GrDrawVerticesBatch : public GrBatch {
+class GrDrawVerticesBatch : public GrVertexBatch {
 public:
     struct Geometry {
         GrColor fColor;
@@ -28,12 +28,12 @@
         SkTDArray<SkPoint> fLocalCoords;
     };
 
-    static GrBatch* Create(const Geometry& geometry, GrPrimitiveType primitiveType,
-                           const SkMatrix& viewMatrix,
-                           const SkPoint* positions, int vertexCount,
-                           const uint16_t* indices, int indexCount,
-                           const GrColor* colors, const SkPoint* localCoords,
-                           const SkRect& bounds) {
+    static GrDrawBatch* Create(const Geometry& geometry, GrPrimitiveType primitiveType,
+                               const SkMatrix& viewMatrix,
+                               const SkPoint* positions, int vertexCount,
+                               const uint16_t* indices, int indexCount,
+                               const GrColor* colors, const SkPoint* localCoords,
+                               const SkRect& bounds) {
         return SkNEW_ARGS(GrDrawVerticesBatch, (geometry, primitiveType, viewMatrix, positions,
                                                 vertexCount, indices, indexCount, colors,
                                                 localCoords, bounds));
diff --git a/src/gpu/batches/GrRectBatchFactory.cpp b/src/gpu/batches/GrRectBatchFactory.cpp
index e874acb..86980d2 100644
--- a/src/gpu/batches/GrRectBatchFactory.cpp
+++ b/src/gpu/batches/GrRectBatchFactory.cpp
@@ -12,12 +12,12 @@
 
 #include "SkStrokeRec.h"
 
-static GrBatch* create_stroke_aa_batch(GrColor color,
-                                       const SkMatrix& viewMatrix,
-                                       const SkRect& devOutside,
-                                       const SkRect& devOutsideAssist,
-                                       const SkRect& devInside,
-                                       bool miterStroke) {
+static GrDrawBatch* create_stroke_aa_batch(GrColor color,
+                                           const SkMatrix& viewMatrix,
+                                           const SkRect& devOutside,
+                                           const SkRect& devOutsideAssist,
+                                           const SkRect& devInside,
+                                           bool miterStroke) {
     GrAAStrokeRectBatch::Geometry geometry;
     geometry.fColor = color;
     geometry.fDevOutside = devOutside;
@@ -30,12 +30,11 @@
 
 namespace GrRectBatchFactory {
 
-
-GrBatch* CreateStrokeBW(GrColor color,
-                        const SkMatrix& viewMatrix,
-                        const SkRect& rect,
-                        SkScalar strokeWidth,
-                        bool snapToPixelCenters) {
+GrDrawBatch* CreateStrokeBW(GrColor color,
+                            const SkMatrix& viewMatrix,
+                            const SkRect& rect,
+                            SkScalar strokeWidth,
+                            bool snapToPixelCenters) {
     GrStrokeRectBatch::Geometry geometry;
     geometry.fColor = color;
     geometry.fViewMatrix = viewMatrix;
@@ -44,11 +43,11 @@
     return GrStrokeRectBatch::Create(geometry, snapToPixelCenters);
 }
 
-GrBatch* CreateStrokeAA(GrColor color,
-                        const SkMatrix& viewMatrix,
-                        const SkRect& rect,
-                        const SkRect& devRect,
-                        const SkStrokeRec& stroke) {
+GrDrawBatch* CreateStrokeAA(GrColor color,
+                            const SkMatrix& viewMatrix,
+                            const SkRect& rect,
+                            const SkRect& devRect,
+                            const SkStrokeRec& stroke) {
     SkVector devStrokeSize;
     SkScalar width = stroke.getWidth();
     if (width > 0) {
@@ -103,9 +102,9 @@
                                   miterStroke);
 }
 
-GrBatch* CreateFillNestedRectsAA(GrColor color,
-                                 const SkMatrix& viewMatrix,
-                                 const SkRect rects[2]) {
+GrDrawBatch* CreateFillNestedRectsAA(GrColor color,
+                                     const SkMatrix& viewMatrix,
+                                     const SkRect rects[2]) {
     SkASSERT(viewMatrix.rectStaysRect());
     SkASSERT(!rects[0].isEmpty() && !rects[1].isEmpty());
 
diff --git a/src/gpu/batches/GrRectBatchFactory.h b/src/gpu/batches/GrRectBatchFactory.h
index 6ded22d..7eaec79 100644
--- a/src/gpu/batches/GrRectBatchFactory.h
+++ b/src/gpu/batches/GrRectBatchFactory.h
@@ -22,7 +22,7 @@
  */
 namespace GrRectBatchFactory {
 
-inline GrBatch* CreateFillBW(GrColor color,
+inline GrDrawBatch* CreateFillBW(GrColor color,
                              const SkMatrix& viewMatrix,
                              const SkRect& rect,
                              const SkRect* localRect,
@@ -30,29 +30,29 @@
     return GrBWFillRectBatch::Create(color, viewMatrix, rect, localRect, localMatrix);
 }
 
-inline GrBatch* CreateFillAA(GrColor color,
-                             const SkMatrix& viewMatrix,
-                             const SkRect& rect,
-                             const SkRect& devRect) {
+inline GrDrawBatch* CreateFillAA(GrColor color,
+                                 const SkMatrix& viewMatrix,
+                                 const SkRect& rect,
+                                 const SkRect& devRect) {
     return GrAAFillRectBatch::Create(color, viewMatrix, rect, devRect);
 }
 
-GrBatch* CreateStrokeBW(GrColor color,
-                        const SkMatrix& viewMatrix,
-                        const SkRect& rect,
-                        SkScalar strokeWidth,
-                        bool snapToPixelCenters);
+GrDrawBatch* CreateStrokeBW(GrColor color,
+                            const SkMatrix& viewMatrix,
+                            const SkRect& rect,
+                            SkScalar strokeWidth,
+                            bool snapToPixelCenters);
 
-GrBatch* CreateStrokeAA(GrColor,
-                        const SkMatrix& viewMatrix,
-                        const SkRect& rect,
-                        const SkRect& devRect,
-                        const SkStrokeRec& stroke);
+GrDrawBatch* CreateStrokeAA(GrColor,
+                            const SkMatrix& viewMatrix,
+                            const SkRect& rect,
+                            const SkRect& devRect,
+                            const SkStrokeRec& stroke);
 
 // First rect is outer; second rect is inner
-GrBatch* CreateFillNestedRectsAA(GrColor,
-                                 const SkMatrix& viewMatrix,
-                                 const SkRect rects[2]);
+GrDrawBatch* CreateFillNestedRectsAA(GrColor,
+                                     const SkMatrix& viewMatrix,
+                                     const SkRect rects[2]);
 
 };
 
diff --git a/src/gpu/batches/GrStrokeRectBatch.cpp b/src/gpu/batches/GrStrokeRectBatch.cpp
index 9c31149..649ba01 100644
--- a/src/gpu/batches/GrStrokeRectBatch.cpp
+++ b/src/gpu/batches/GrStrokeRectBatch.cpp
@@ -128,7 +128,7 @@
 
 #ifdef GR_TEST_UTILS
 
-BATCH_TEST_DEFINE(GrStrokeRectBatch) {
+DRAW_BATCH_TEST_DEFINE(GrStrokeRectBatch) {
     GrStrokeRectBatch::Geometry geometry;
     geometry.fViewMatrix = GrTest::TestMatrix(random);
     geometry.fColor = GrRandomColor(random);
diff --git a/src/gpu/batches/GrStrokeRectBatch.h b/src/gpu/batches/GrStrokeRectBatch.h
index 7979a64..2c891a4 100644
--- a/src/gpu/batches/GrStrokeRectBatch.h
+++ b/src/gpu/batches/GrStrokeRectBatch.h
@@ -12,7 +12,7 @@
 #include "GrColor.h"
 #include "GrDefaultGeoProcFactory.h"
 
-class GrStrokeRectBatch : public GrBatch {
+class GrStrokeRectBatch : public GrVertexBatch {
 public:
     struct Geometry {
         GrColor fColor;
@@ -21,7 +21,7 @@
         SkScalar fStrokeWidth;
     };
 
-    static GrBatch* Create(const Geometry& geometry, bool snapToPixelCenters) {
+    static GrDrawBatch* Create(const Geometry& geometry, bool snapToPixelCenters) {
         return SkNEW_ARGS(GrStrokeRectBatch, (geometry, snapToPixelCenters));
     }
 
diff --git a/src/gpu/batches/GrTestBatch.h b/src/gpu/batches/GrTestBatch.h
index 68ea676..d8986b6 100644
--- a/src/gpu/batches/GrTestBatch.h
+++ b/src/gpu/batches/GrTestBatch.h
@@ -16,7 +16,7 @@
  * A simple batch only for testing purposes which actually doesn't batch at all, but can fit into
  * the batch pipeline and generate arbitrary geometry
  */
-class GrTestBatch : public GrBatch {
+class GrTestBatch : public GrVertexBatch {
 public:
     struct Geometry {
         GrColor fColor;
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp
index 6a894f9..92f6104 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -243,7 +243,7 @@
                                            const SkMatrix& localMatrix,
                                            bool usesLocalCoords);
 
-class DashBatch : public GrBatch {
+class DashBatch : public GrVertexBatch {
 public:
     struct Geometry {
         GrColor fColor;
@@ -257,8 +257,8 @@
         SkScalar fPerpendicularScale;
     };
 
-    static GrBatch* Create(const Geometry& geometry, SkPaint::Cap cap, DashAAMode aaMode,
-                           bool fullDash) {
+    static GrDrawBatch* Create(const Geometry& geometry, SkPaint::Cap cap, DashAAMode aaMode,
+                               bool fullDash) {
         return SkNEW_ARGS(DashBatch, (geometry, cap, aaMode, fullDash));
     }
 
@@ -618,13 +618,12 @@
     }
 
     bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
-        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(),
-                                    caps)) {
+        DashBatch* that = t->cast<DashBatch>();
+        if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
+                                    that->bounds(), caps)) {
             return false;
         }
 
-        DashBatch* that = t->cast<DashBatch>();
-
         if (this->aaMode() != that->aaMode()) {
             return false;
         }
@@ -677,8 +676,8 @@
     SkSTArray<1, Geometry, true> fGeoData;
 };
 
-static GrBatch* create_batch(GrColor color, const SkMatrix& viewMatrix, const SkPoint pts[2],
-                             bool useAA, const GrStrokeInfo& strokeInfo, bool msaaRT) {
+static GrDrawBatch* create_batch(GrColor color, const SkMatrix& viewMatrix, const SkPoint pts[2],
+                                 bool useAA, const GrStrokeInfo& strokeInfo, bool msaaRT) {
     const SkScalar* intervals = strokeInfo.getDashIntervals();
     SkScalar phase = strokeInfo.getDashPhase();
 
@@ -734,7 +733,7 @@
                                    const GrPipelineBuilder& pipelineBuilder, GrColor color,
                                    const SkMatrix& viewMatrix, const SkPoint pts[2],
                                    bool useAA, const GrStrokeInfo& strokeInfo) {
-    SkAutoTUnref<GrBatch> batch(
+    SkAutoTUnref<GrDrawBatch> batch(
             create_batch(color, viewMatrix, pts, useAA, strokeInfo,
                          pipelineBuilder.getRenderTarget()->isUnifiedMultisampled()));
     if (!batch) {
@@ -1229,7 +1228,7 @@
 
 #ifdef GR_TEST_UTILS
 
-BATCH_TEST_DEFINE(DashBatch) {
+DRAW_BATCH_TEST_DEFINE(DashBatch) {
     GrColor color = GrRandomColor(random);
     SkMatrix viewMatrix = GrTest::TestMatrixPreservesRightAngles(random);
     bool useAA = random->nextBool();