Rename GrOptDrawState to GrPipeline and GrDrawState to GrPipelineBuilder

BUG=skia:

Review URL: https://codereview.chromium.org/858343002
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp
index b25ba7e..b96952a 100644
--- a/gm/beziereffects.cpp
+++ b/gm/beziereffects.cpp
@@ -150,7 +150,7 @@
                     context->getTestTarget(&tt);
                     SkASSERT(tt.target());
 
-                    GrDrawState ds;
+                    GrPipelineBuilder pipelineBuilder;
 
                     GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, gp->getVertexStride(), 0);
                     SkASSERT(gp->getVertexStride() == sizeof(Vertex));
@@ -165,10 +165,11 @@
                         verts[v].fKLM[2] = eval_line(verts[v].fPosition, klmEqs + 6, 1.f);
                     }
 
-                    ds.setRenderTarget(rt);
+                    pipelineBuilder.setRenderTarget(rt);
 
                     tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuffer());
-                    tt.target()->drawIndexed(&ds, gp, kTriangleFan_GrPrimitiveType, 0, 0,4,6);
+                    tt.target()->drawIndexed(&pipelineBuilder, gp, kTriangleFan_GrPrimitiveType,
+                                             0, 0,4,6);
                 }
                 ++col;
                 if (numCols == col) {
@@ -306,7 +307,7 @@
                     context->getTestTarget(&tt);
                     SkASSERT(tt.target());
 
-                    GrDrawState ds;
+                    GrPipelineBuilder pipelineBuilder;
 
                     GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, gp->getVertexStride(), 0);
                     SkASSERT(gp->getVertexStride() == sizeof(Vertex));
@@ -321,10 +322,11 @@
                         verts[v].fKLM[2] = eval_line(verts[v].fPosition, klmEqs + 6, 1.f);
                     }
 
-                    ds.setRenderTarget(rt);
+                    pipelineBuilder.setRenderTarget(rt);
 
                     tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuffer());
-                    tt.target()->drawIndexed(&ds, gp, kTriangleFan_GrPrimitiveType, 0, 0,4,6);
+                    tt.target()->drawIndexed(&pipelineBuilder, gp, kTriangleFan_GrPrimitiveType,
+                                             0, 0,4,6);
                 }
                 ++col;
                 if (numCols == col) {
@@ -493,7 +495,7 @@
                     context->getTestTarget(&tt);
                     SkASSERT(tt.target());
 
-                    GrDrawState ds;
+                    GrPipelineBuilder pipelineBuilder;
 
                     GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, gp->getVertexStride(), 0);
                     SkASSERT(gp->getVertexStride() == sizeof(Vertex));
@@ -506,10 +508,11 @@
                     GrPathUtils::QuadUVMatrix DevToUV(pts);
                     DevToUV.apply<4, sizeof(Vertex), sizeof(SkPoint)>(verts);
 
-                    ds.setRenderTarget(rt);
+                    pipelineBuilder.setRenderTarget(rt);
 
                     tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuffer());
-                    tt.target()->drawIndexed(&ds, gp, kTriangles_GrPrimitiveType, 0, 0, 4, 6);
+                    tt.target()->drawIndexed(&pipelineBuilder, gp, kTriangles_GrPrimitiveType,
+                                             0, 0, 4, 6);
                 }
                 ++col;
                 if (numCols == col) {
diff --git a/gm/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp
index 1ec7853..c92fd93 100644
--- a/gm/convexpolyeffect.cpp
+++ b/gm/convexpolyeffect.cpp
@@ -132,12 +132,12 @@
                     continue;
                 }
 
-                GrDrawState ds;
+                GrPipelineBuilder pipelineBuilder;
                 SkAutoTUnref<const GrGeometryProcessor> gp(
                         GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPosition_GPType,
                                                         0xff000000));
-                ds.addCoverageProcessor(fp);
-                ds.setRenderTarget(rt);
+                pipelineBuilder.addCoverageProcessor(fp);
+                pipelineBuilder.setRenderTarget(rt);
 
                 GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, gp->getVertexStride(), 0);
                 SkASSERT(gp->getVertexStride() == sizeof(SkPoint));
@@ -150,7 +150,8 @@
                 bounds.toQuad(verts);
 
                 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuffer());
-                tt.target()->drawIndexed(&ds, gp, kTriangleFan_GrPrimitiveType, 0, 0, 4, 6);
+                tt.target()->drawIndexed(&pipelineBuilder, gp, kTriangleFan_GrPrimitiveType,
+                                         0, 0, 4, 6);
 
                 x += SkScalarCeilToScalar(path->getBounds().width() + 10.f);
             }
@@ -189,12 +190,12 @@
                     continue;
                 }
 
-                GrDrawState ds;
+                GrPipelineBuilder pipelineBuilder;
                 SkAutoTUnref<const GrGeometryProcessor> gp(
                         GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPosition_GPType,
                                                         0xff000000));
-                ds.addCoverageProcessor(fp);
-                ds.setRenderTarget(rt);
+                pipelineBuilder.addCoverageProcessor(fp);
+                pipelineBuilder.setRenderTarget(rt);
 
                 GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, gp->getVertexStride(), 0);
                 SkASSERT(gp->getVertexStride() == sizeof(SkPoint));
@@ -205,7 +206,8 @@
                 bounds.toQuad(verts);
 
                 tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuffer());
-                tt.target()->drawIndexed(&ds, gp, kTriangleFan_GrPrimitiveType, 0, 0, 4, 6);
+                tt.target()->drawIndexed(&pipelineBuilder, gp, kTriangleFan_GrPrimitiveType,
+                                         0, 0, 4, 6);
 
                 x += SkScalarCeilToScalar(rect.width() + 10.f);
             }
diff --git a/gm/rrects.cpp b/gm/rrects.cpp
index 6016891..26d9194 100644
--- a/gm/rrects.cpp
+++ b/gm/rrects.cpp
@@ -112,7 +112,7 @@
                             SkDEBUGFAIL("Couldn't get Gr test target.");
                             return;
                         }
-                        GrDrawState drawState;
+                        GrPipelineBuilder pipelineBuilder;
 
                         SkRRect rrect = fRRects[curRRect];
                         rrect.offset(SkIntToScalar(x), SkIntToScalar(y));
@@ -120,13 +120,13 @@
                         SkAutoTUnref<GrFragmentProcessor> fp(GrRRectEffect::Create(edgeType,
                                                                                    rrect));
                         if (fp) {
-                            drawState.addCoverageProcessor(fp);
-                            drawState.setRenderTarget(rt);
+                            pipelineBuilder.addCoverageProcessor(fp);
+                            pipelineBuilder.setRenderTarget(rt);
 
                             SkRect bounds = rrect.getBounds();
                             bounds.outset(2.f, 2.f);
 
-                            tt.target()->drawSimpleRect(&drawState, 0xff000000, SkMatrix::I(),
+                            tt.target()->drawSimpleRect(&pipelineBuilder, 0xff000000, SkMatrix::I(),
                                                         bounds);
                         } else {
                             drew = false;
diff --git a/gm/texturedomaineffect.cpp b/gm/texturedomaineffect.cpp
index 9ea45e1..7b74cec 100644
--- a/gm/texturedomaineffect.cpp
+++ b/gm/texturedomaineffect.cpp
@@ -130,11 +130,12 @@
                     }
                     SkMatrix viewMatrix;
                     viewMatrix.setTranslate(x, y);
-                    GrDrawState drawState;
-                    drawState.setRenderTarget(rt);
-                    drawState.addColorProcessor(fp);
+                    GrPipelineBuilder pipelineBuilder;
+                    pipelineBuilder.setRenderTarget(rt);
+                    pipelineBuilder.addColorProcessor(fp);
 
-                    tt.target()->drawSimpleRect(&drawState, GrColor_WHITE, viewMatrix, renderRect);
+                    tt.target()->drawSimpleRect(&pipelineBuilder, GrColor_WHITE, viewMatrix,
+                                                renderRect);
                     x += renderRect.width() + kTestPad;
                 }
                 y += renderRect.height() + kTestPad;
diff --git a/gm/yuvtorgbeffect.cpp b/gm/yuvtorgbeffect.cpp
index 3be01cc..21d42cb 100644
--- a/gm/yuvtorgbeffect.cpp
+++ b/gm/yuvtorgbeffect.cpp
@@ -115,10 +115,11 @@
                 if (fp) {
                     SkMatrix viewMatrix;
                     viewMatrix.setTranslate(x, y);
-                    GrDrawState drawState;
-                    drawState.setRenderTarget(rt);
-                    drawState.addColorProcessor(fp);
-                    tt.target()->drawSimpleRect(&drawState, GrColor_WHITE, viewMatrix, renderRect);
+                    GrPipelineBuilder pipelineBuilder;
+                    pipelineBuilder.setRenderTarget(rt);
+                    pipelineBuilder.addColorProcessor(fp);
+                    tt.target()->drawSimpleRect(&pipelineBuilder, GrColor_WHITE, viewMatrix,
+                                                renderRect);
                 }
                 x += renderRect.width() + kTestPad;
             }
diff --git a/gyp/gpu.gypi b/gyp/gpu.gypi
index b46780d..77b29ff 100644
--- a/gyp/gpu.gypi
+++ b/gyp/gpu.gypi
@@ -76,8 +76,6 @@
       '<(skia_src_path)/gpu/GrDefaultPathRenderer.h',
       '<(skia_src_path)/gpu/GrDistanceFieldTextContext.h',
       '<(skia_src_path)/gpu/GrDistanceFieldTextContext.cpp',
-      '<(skia_src_path)/gpu/GrDrawState.cpp',
-      '<(skia_src_path)/gpu/GrDrawState.h',
       '<(skia_src_path)/gpu/GrDrawTarget.cpp',
       '<(skia_src_path)/gpu/GrDrawTarget.h',
       '<(skia_src_path)/gpu/GrDrawTargetCaps.h',
@@ -106,8 +104,6 @@
       '<(skia_src_path)/gpu/GrMemoryPool.cpp',
       '<(skia_src_path)/gpu/GrMemoryPool.h',
       '<(skia_src_path)/gpu/GrMurmur3HashKey.h',
-      '<(skia_src_path)/gpu/GrOptDrawState.cpp',
-      '<(skia_src_path)/gpu/GrOptDrawState.h',
       '<(skia_src_path)/gpu/GrOrderedSet.h',
       '<(skia_src_path)/gpu/GrOvalRenderer.cpp',
       '<(skia_src_path)/gpu/GrOvalRenderer.h',
@@ -125,6 +121,10 @@
       '<(skia_src_path)/gpu/GrPathUtils.h',
       '<(skia_src_path)/gpu/GrPendingProgramElement.h',
       '<(skia_src_path)/gpu/GrPendingFragmentStage.h',
+      '<(skia_src_path)/gpu/GrPipeline.cpp',
+      '<(skia_src_path)/gpu/GrPipeline.h',
+      '<(skia_src_path)/gpu/GrPipelineBuilder.cpp',
+      '<(skia_src_path)/gpu/GrPipelineBuilder.h',
       '<(skia_src_path)/gpu/GrProgramDesc.h',
       '<(skia_src_path)/gpu/GrProgramElement.cpp',
       '<(skia_src_path)/gpu/GrProcessor.cpp',
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 23711b9..70d34c5 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -19,7 +19,6 @@
 #include "SkTypes.h"
 
 class GrAARectRenderer;
-class GrDrawState;
 class GrDrawTarget;
 class GrFontCache;
 class GrFragmentProcessor;
@@ -32,6 +31,7 @@
 class GrOvalRenderer;
 class GrPath;
 class GrPathRenderer;
+class GrPipelineBuilder;
 class GrResourceEntry;
 class GrResourceCache2;
 class GrTestTarget;
@@ -773,7 +773,7 @@
 
     GrPathRenderer* getPathRenderer(
                     const GrDrawTarget* target,
-                    const GrDrawState*,
+                    const GrPipelineBuilder*,
                     const SkMatrix& viewMatrix,
                     const SkPath& path,
                     const SkStrokeRec& stroke,
@@ -861,10 +861,10 @@
     class AutoCheckFlush;
     // Sets the paint and returns the target to draw into.  This function is overloaded to either
     // take a GrDrawState, GrPaint, and AutoCheckFlush, or JUST an AutoCheckFlush
-    GrDrawTarget* prepareToDraw(GrDrawState* ds, const GrPaint* paint, const AutoCheckFlush*);
+    GrDrawTarget* prepareToDraw(GrPipelineBuilder*, const GrPaint* paint, const AutoCheckFlush*);
 
     void internalDrawPath(GrDrawTarget*,
-                          GrDrawState*,
+                          GrPipelineBuilder*,
                           const SkMatrix& viewMatrix,
                           GrColor,
                           bool useAA,
diff --git a/include/gpu/GrPathRendererChain.h b/include/gpu/GrPathRendererChain.h
index 07d6494..9c4b976 100644
--- a/include/gpu/GrPathRendererChain.h
+++ b/include/gpu/GrPathRendererChain.h
@@ -12,9 +12,9 @@
 #include "SkTArray.h"
 
 class GrContext;
-class GrDrawState;
 class GrDrawTarget;
 class GrPathRenderer;
+class GrPipelineBuilder;
 class SkMatrix;
 class SkPath;
 class SkStrokeRec;
@@ -58,7 +58,7 @@
         whether the path can be rendered with arbitrary stencil rules or not. See comments on
         StencilSupport in GrPathRenderer.h. */
     GrPathRenderer* getPathRenderer(const GrDrawTarget* target,
-                                    const GrDrawState*,
+                                    const GrPipelineBuilder*,
                                     const SkMatrix& viewMatrix,
                                     const SkPath& path,
                                     const SkStrokeRec& rec,
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index 27cc8aa..031dac3 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -9,12 +9,12 @@
 #include "GrAAConvexPathRenderer.h"
 
 #include "GrContext.h"
-#include "GrDrawState.h"
 #include "GrDrawTargetCaps.h"
 #include "GrGeometryProcessor.h"
 #include "GrInvariantOutput.h"
-#include "GrProcessor.h"
 #include "GrPathUtils.h"
+#include "GrProcessor.h"
+#include "GrPipelineBuilder.h"
 #include "SkGeometry.h"
 #include "SkString.h"
 #include "SkStrokeRec.h"
@@ -694,7 +694,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 bool GrAAConvexPathRenderer::canDrawPath(const GrDrawTarget* target,
-                                         const GrDrawState*,
+                                         const GrPipelineBuilder*,
                                          const SkMatrix& viewMatrix,
                                          const SkPath& path,
                                          const SkStrokeRec& stroke,
@@ -704,7 +704,7 @@
 }
 
 bool GrAAConvexPathRenderer::onDrawPath(GrDrawTarget* target,
-                                        GrDrawState* drawState,
+                                        GrPipelineBuilder* pipelineBuilder,
                                         GrColor color,
                                         const SkMatrix& vm,
                                         const SkPath& origPath,
@@ -782,7 +782,7 @@
     int vOffset = 0;
     for (int i = 0; i < draws.count(); ++i) {
         const Draw& draw = draws[i];
-        target->drawIndexed(drawState,
+        target->drawIndexed(pipelineBuilder,
                             quadProcessor,
                             kTriangles_GrPrimitiveType,
                             vOffset,  // start vertex
diff --git a/src/gpu/GrAAConvexPathRenderer.h b/src/gpu/GrAAConvexPathRenderer.h
index b07781f..bb2d3f0 100644
--- a/src/gpu/GrAAConvexPathRenderer.h
+++ b/src/gpu/GrAAConvexPathRenderer.h
@@ -16,7 +16,7 @@
     GrAAConvexPathRenderer();
 
     virtual bool canDrawPath(const GrDrawTarget*,
-                             const GrDrawState*,
+                             const GrPipelineBuilder*,
                              const SkMatrix& viewMatrix,
                              const SkPath&,
                              const SkStrokeRec&,
@@ -24,7 +24,7 @@
 
 protected:
     virtual bool onDrawPath(GrDrawTarget*,
-                            GrDrawState*,
+                            GrPipelineBuilder*,
                             GrColor,
                             const SkMatrix& viewMatrix,
                             const SkPath&,
diff --git a/src/gpu/GrAADistanceFieldPathRenderer.cpp b/src/gpu/GrAADistanceFieldPathRenderer.cpp
index 99093fa..b11769c 100755
--- a/src/gpu/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/GrAADistanceFieldPathRenderer.cpp
@@ -10,7 +10,7 @@
 
 #include "GrAtlas.h"
 #include "GrContext.h"
-#include "GrDrawState.h"
+#include "GrPipelineBuilder.h"
 #include "GrSurfacePriv.h"
 #include "GrSWMaskHelper.h"
 #include "GrTexturePriv.h"
@@ -66,7 +66,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 bool GrAADistanceFieldPathRenderer::canDrawPath(const GrDrawTarget* target,
-                                                const GrDrawState* drawState,
+                                                const GrPipelineBuilder* pipelineBuilder,
                                                 const SkMatrix& viewMatrix,
                                                 const SkPath& path,
                                                 const SkStrokeRec& stroke,
@@ -95,7 +95,7 @@
 
 GrPathRenderer::StencilSupport
 GrAADistanceFieldPathRenderer::onGetStencilSupport(const GrDrawTarget*,
-                                                   const GrDrawState*,
+                                                   const GrPipelineBuilder*,
                                                    const SkPath&,
                                                    const SkStrokeRec&) const {
     return GrPathRenderer::kNoSupport_StencilSupport;
@@ -104,7 +104,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 bool GrAADistanceFieldPathRenderer::onDrawPath(GrDrawTarget* target,
-                                               GrDrawState* drawState,
+                                               GrPipelineBuilder* pipelineBuilder,
                                                GrColor color,
                                                const SkMatrix& viewMatrix,
                                                const SkPath& path,
@@ -144,7 +144,7 @@
     }
 
     // use signed distance field to render
-    return this->internalDrawPath(target, drawState, color, viewMatrix, path, pathData);
+    return this->internalDrawPath(target, pipelineBuilder, color, viewMatrix, path, pathData);
 }
 
 // padding around path bounds to allow for antialiased pixels
@@ -306,13 +306,13 @@
 }
 
 bool GrAADistanceFieldPathRenderer::internalDrawPath(GrDrawTarget* target,
-                                                     GrDrawState* drawState,
+                                                     GrPipelineBuilder* pipelineBuilder,
                                                      GrColor color,
                                                      const SkMatrix& viewMatrix,
                                                      const SkPath& path,
                                                      const PathData* pathData) {
     GrTexture* texture = fAtlas->getTexture();
-    GrDrawState::AutoRestoreEffects are(drawState);
+    GrPipelineBuilder::AutoRestoreEffects are(pipelineBuilder);
     
     SkASSERT(pathData->fPlot);
     GrDrawTarget::DrawToken drawToken = target->getCurrentDrawToken();
@@ -374,7 +374,7 @@
     
     viewMatrix.mapRect(&r);
     target->setIndexSourceToBuffer(fContext->getQuadIndexBuffer());
-    target->drawIndexedInstances(drawState, fCachedGeometryProcessor.get(),
+    target->drawIndexedInstances(pipelineBuilder, fCachedGeometryProcessor.get(),
                                  kTriangles_GrPrimitiveType, 1, 4, 6, &r);
     target->resetVertexSource();
     
diff --git a/src/gpu/GrAADistanceFieldPathRenderer.h b/src/gpu/GrAADistanceFieldPathRenderer.h
index b17b305..994c1eb 100755
--- a/src/gpu/GrAADistanceFieldPathRenderer.h
+++ b/src/gpu/GrAADistanceFieldPathRenderer.h
@@ -25,7 +25,7 @@
     virtual ~GrAADistanceFieldPathRenderer();
     
     virtual bool canDrawPath(const GrDrawTarget*,
-                             const GrDrawState*,
+                             const GrPipelineBuilder*,
                              const SkMatrix& viewMatrix,
                              const SkPath&,
                              const SkStrokeRec&,
@@ -33,12 +33,12 @@
 
 protected:
     virtual StencilSupport onGetStencilSupport(const GrDrawTarget*,
-                                               const GrDrawState*,
+                                               const GrPipelineBuilder*,
                                                const SkPath&,
                                                const SkStrokeRec&) const SK_OVERRIDE;
     
     virtual bool onDrawPath(GrDrawTarget*,
-                            GrDrawState*,
+                            GrPipelineBuilder*,
                             GrColor,
                             const SkMatrix& viewMatrix,
                             const SkPath&,
@@ -81,7 +81,7 @@
     SkTDynamicHash<PathData, PathData::Key> fPathCache;
     PathDataList                       fPathList;
     
-    bool internalDrawPath(GrDrawTarget*, GrDrawState*, GrColor, const SkMatrix& viewMatrix,
+    bool internalDrawPath(GrDrawTarget*, GrPipelineBuilder*, GrColor, const SkMatrix& viewMatrix,
                           const SkPath& path, const PathData* pathData);
     PathData* addPathToAtlas(const SkPath& path, const SkStrokeRec& stroke, bool antiAlias,
                              uint32_t dimension, SkScalar scale);
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index eea6463..ce24cf8 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -9,11 +9,11 @@
 
 #include "GrContext.h"
 #include "GrDefaultGeoProcFactory.h"
-#include "GrDrawState.h"
 #include "GrDrawTargetCaps.h"
 #include "GrGpu.h"
 #include "GrIndexBuffer.h"
 #include "GrPathUtils.h"
+#include "GrPipelineBuilder.h"
 #include "GrProcessor.h"
 #include "SkGeometry.h"
 #include "SkStroke.h"
@@ -643,7 +643,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 bool GrAAHairLinePathRenderer::createLineGeom(GrDrawTarget* target,
-                                              GrDrawState* drawState,
+                                              GrPipelineBuilder* pipelineBuilder,
                                               const SkMatrix& viewMatrix,
                                               uint8_t coverage,
                                               size_t vertexStride,
@@ -683,7 +683,7 @@
 }
 
 bool GrAAHairLinePathRenderer::createBezierGeom(GrDrawTarget* target,
-                                                GrDrawState* drawState,
+                                                GrPipelineBuilder* pipelineBuilder,
                                                 const SkMatrix& viewMatrix,
                                                 GrDrawTarget::AutoReleaseGeometry* arg,
                                                 SkRect* devBounds,
@@ -743,7 +743,7 @@
 }
 
 bool GrAAHairLinePathRenderer::canDrawPath(const GrDrawTarget* target,
-                                           const GrDrawState* drawState,
+                                           const GrPipelineBuilder* pipelineBuilder,
                                            const SkMatrix& viewMatrix,
                                            const SkPath& path,
                                            const SkStrokeRec& stroke,
@@ -801,7 +801,7 @@
 }
 
 bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target,
-                                          GrDrawState* drawState,
+                                          GrPipelineBuilder* pipelineBuilder,
                                           GrColor color,
                                           const SkMatrix& viewMatrix,
                                           const SkPath& path,
@@ -814,7 +814,7 @@
     }
 
     SkIRect devClipBounds;
-    target->getClip()->getConservativeBounds(drawState->getRenderTarget(), &devClipBounds);
+    target->getClip()->getConservativeBounds(pipelineBuilder->getRenderTarget(), &devClipBounds);
 
     int lineCnt;
     int quadCnt;
@@ -845,7 +845,7 @@
         GrDrawTarget::AutoReleaseGeometry arg;
         SkRect devBounds;
 
-        GrDrawState::AutoRestoreEffects are(drawState);
+        GrPipelineBuilder::AutoRestoreEffects are(pipelineBuilder);
         uint32_t gpFlags = GrDefaultGeoProcFactory::kPosition_GPType |
                            GrDefaultGeoProcFactory::kCoverage_GPType;
         SkAutoTUnref<const GrGeometryProcessor> gp(GrDefaultGeoProcFactory::Create(gpFlags,
@@ -856,7 +856,7 @@
                                                                                    newCoverage));
 
         if (!this->createLineGeom(target,
-                                  drawState,
+                                  pipelineBuilder,
                                   viewMatrix,
                                   newCoverage,
                                   gp->getVertexStride(),
@@ -879,7 +879,7 @@
             int lines = 0;
             while (lines < lineCnt) {
                 int n = SkTMin(lineCnt - lines, kLineSegsNumInIdxBuffer);
-                target->drawIndexed(drawState,
+                target->drawIndexed(pipelineBuilder,
                                     gp,
                                     kTriangles_GrPrimitiveType,
                                     kLineSegNumVertices*lines,     // startV
@@ -898,7 +898,7 @@
         SkRect devBounds;
 
         if (!this->createBezierGeom(target,
-                                    drawState,
+                                    pipelineBuilder,
                                     viewMatrix,
                                     &arg,
                                     &devBounds,
@@ -930,13 +930,13 @@
                                          invert,
                                          newCoverage));
             SkASSERT(hairQuadProcessor);
-            GrDrawState::AutoRestoreEffects are(drawState);
+            GrPipelineBuilder::AutoRestoreEffects are(pipelineBuilder);
             target->setIndexSourceToBuffer(fQuadsIndexBuffer);
 
             int quads = 0;
             while (quads < quadCnt) {
                 int n = SkTMin(quadCnt - quads, kQuadsNumInIdxBuffer);
-                target->drawIndexed(drawState,
+                target->drawIndexed(pipelineBuilder,
                                     hairQuadProcessor,
                                     kTriangles_GrPrimitiveType,
                                     kQuadNumVertices*quads,               // startV
@@ -953,13 +953,13 @@
                     GrConicEffect::Create(color, vm, kHairlineAA_GrProcessorEdgeType,
                                           *target->caps(), invert, newCoverage));
             SkASSERT(hairConicProcessor);
-            GrDrawState::AutoRestoreEffects are(drawState);
+            GrPipelineBuilder::AutoRestoreEffects are(pipelineBuilder);
             target->setIndexSourceToBuffer(fQuadsIndexBuffer);
 
             int conics = 0;
             while (conics < conicCnt) {
                 int n = SkTMin(conicCnt - conics, kQuadsNumInIdxBuffer);
-                target->drawIndexed(drawState,
+                target->drawIndexed(pipelineBuilder,
                                     hairConicProcessor,
                                     kTriangles_GrPrimitiveType,
                                     kQuadNumVertices*(quadCnt + conics),  // startV
diff --git a/src/gpu/GrAAHairLinePathRenderer.h b/src/gpu/GrAAHairLinePathRenderer.h
index 8bc3e3e..91c00d7 100644
--- a/src/gpu/GrAAHairLinePathRenderer.h
+++ b/src/gpu/GrAAHairLinePathRenderer.h
@@ -18,7 +18,7 @@
     static GrPathRenderer* Create(GrContext* context);
 
     virtual bool canDrawPath(const GrDrawTarget*,
-                             const GrDrawState*,
+                             const GrPipelineBuilder*,
                              const SkMatrix& viewMatrix,
                              const SkPath&,
                              const SkStrokeRec&,
@@ -30,7 +30,7 @@
 
 protected:
     virtual bool onDrawPath(GrDrawTarget*,
-                            GrDrawState*,
+                            GrPipelineBuilder*,
                             GrColor,
                             const SkMatrix& viewMatrix,
                             const SkPath&,
@@ -43,7 +43,7 @@
                              const GrIndexBuffer* fQuadsIndexBuffer);
 
     bool createLineGeom(GrDrawTarget* target,
-                        GrDrawState*,
+                        GrPipelineBuilder*,
                         const SkMatrix& viewMatrix,
                         uint8_t coverage,
                         size_t vertexStride,
@@ -54,7 +54,7 @@
                         int lineCnt);
 
     bool createBezierGeom(GrDrawTarget* target,
-                          GrDrawState*,
+                          GrPipelineBuilder*,
                           const SkMatrix& viewMatrix,
                           GrDrawTarget::AutoReleaseGeometry* arg,
                           SkRect* devBounds,
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp
index 444bb51..0ffdd4d 100644
--- a/src/gpu/GrAARectRenderer.cpp
+++ b/src/gpu/GrAARectRenderer.cpp
@@ -25,13 +25,13 @@
 };
 }
 
-static const GrGeometryProcessor* create_rect_gp(const GrDrawState& drawState,
+static const GrGeometryProcessor* create_rect_gp(const GrPipelineBuilder& pipelineBuilder,
                                                  GrColor color,
                                                  CoverageAttribType* type,
                                                  const SkMatrix& localMatrix) {
     uint32_t flags = GrDefaultGeoProcFactory::kColor_GPType;
     const GrGeometryProcessor* gp;
-    if (drawState.canTweakAlphaForCoverage()) {
+    if (pipelineBuilder.canTweakAlphaForCoverage()) {
         gp = GrDefaultGeoProcFactory::Create(flags, color, SkMatrix::I(), localMatrix);
         SkASSERT(gp->getVertexStride() == sizeof(GrDefaultGeoProcFactory::PositionColorAttr));
         *type = kUseColor_CoverageAttribType;
@@ -179,12 +179,12 @@
 }
 
 void GrAARectRenderer::geometryFillAARect(GrDrawTarget* target,
-                                          GrDrawState* drawState,
+                                          GrPipelineBuilder* pipelineBuilder,
                                           GrColor color,
                                           const SkMatrix& viewMatrix,
                                           const SkRect& rect,
                                           const SkRect& devRect) {
-    GrDrawState::AutoRestoreEffects are(drawState);
+    GrPipelineBuilder::AutoRestoreEffects are(pipelineBuilder);
 
     SkMatrix localMatrix;
     if (!viewMatrix.invert(&localMatrix)) {
@@ -193,7 +193,7 @@
     }
 
     CoverageAttribType type;
-    SkAutoTUnref<const GrGeometryProcessor> gp(create_rect_gp(*drawState, color, &type,
+    SkAutoTUnref<const GrGeometryProcessor> gp(create_rect_gp(*pipelineBuilder, color, &type,
                                                               localMatrix));
 
     size_t vertexStride = gp->getVertexStride();
@@ -306,7 +306,7 @@
     }
 
     target->setIndexSourceToBuffer(indexBuffer);
-    target->drawIndexedInstances(drawState,
+    target->drawIndexedInstances(pipelineBuilder,
                                  gp,
                                  kTriangles_GrPrimitiveType,
                                  1,
@@ -316,7 +316,7 @@
 }
 
 void GrAARectRenderer::strokeAARect(GrDrawTarget* target,
-                                    GrDrawState* drawState,
+                                    GrPipelineBuilder* pipelineBuilder,
                                     GrColor color,
                                     const SkMatrix& viewMatrix,
                                     const SkRect& rect,
@@ -364,7 +364,7 @@
     }
 
     if (spare <= 0 && miterStroke) {
-        this->fillAARect(target, drawState, color, viewMatrix, devOutside,
+        this->fillAARect(target, pipelineBuilder, color, viewMatrix, devOutside,
                          devOutside);
         return;
     }
@@ -382,19 +382,19 @@
         devOutsideAssist.outset(0, ry);
     }
 
-    this->geometryStrokeAARect(target, drawState, color, viewMatrix, devOutside, devOutsideAssist,
+    this->geometryStrokeAARect(target, pipelineBuilder, color, viewMatrix, devOutside, devOutsideAssist,
                                devInside, miterStroke);
 }
 
 void GrAARectRenderer::geometryStrokeAARect(GrDrawTarget* target,
-                                            GrDrawState* drawState,
+                                            GrPipelineBuilder* pipelineBuilder,
                                             GrColor color,
                                             const SkMatrix& viewMatrix,
                                             const SkRect& devOutside,
                                             const SkRect& devOutsideAssist,
                                             const SkRect& devInside,
                                             bool miterStroke) {
-    GrDrawState::AutoRestoreEffects are(drawState);
+    GrPipelineBuilder::AutoRestoreEffects are(pipelineBuilder);
 
     SkMatrix localMatrix;
     if (!viewMatrix.invert(&localMatrix)) {
@@ -403,7 +403,7 @@
     }
 
     CoverageAttribType type;
-    SkAutoTUnref<const GrGeometryProcessor> gp(create_rect_gp(*drawState, color, &type,
+    SkAutoTUnref<const GrGeometryProcessor> gp(create_rect_gp(*pipelineBuilder, color, &type,
                                                               localMatrix));
 
     int innerVertexNum = 4;
@@ -517,7 +517,7 @@
     }
 
     target->setIndexSourceToBuffer(indexBuffer);
-    target->drawIndexedInstances(drawState,
+    target->drawIndexedInstances(pipelineBuilder,
                                  gp,
                                  kTriangles_GrPrimitiveType,
                                  1,
@@ -527,7 +527,7 @@
 }
 
 void GrAARectRenderer::fillAANestedRects(GrDrawTarget* target,
-                                         GrDrawState* drawState,
+                                         GrPipelineBuilder* pipelineBuilder,
                                          GrColor color,
                                          const SkMatrix& viewMatrix,
                                          const SkRect rects[2]) {
@@ -540,11 +540,11 @@
     viewMatrix.mapPoints((SkPoint*)&devInside, (const SkPoint*)&rects[1], 2);
 
     if (devInside.isEmpty()) {
-        this->fillAARect(target, drawState, color, viewMatrix, devOutside,
+        this->fillAARect(target, pipelineBuilder, color, viewMatrix, devOutside,
                          devOutside);
         return;
     }
 
-    this->geometryStrokeAARect(target, drawState, color, viewMatrix, devOutside, devOutsideAssist,
-                               devInside, true);
+    this->geometryStrokeAARect(target, pipelineBuilder, color, viewMatrix, devOutside,
+                               devOutsideAssist, devInside, true);
 }
diff --git a/src/gpu/GrAARectRenderer.h b/src/gpu/GrAARectRenderer.h
index d6d07dd..5a96f2c 100644
--- a/src/gpu/GrAARectRenderer.h
+++ b/src/gpu/GrAARectRenderer.h
@@ -15,7 +15,7 @@
 #include "SkStrokeRec.h"
 
 class GrGpu;
-class GrDrawState;
+class GrPipelineBuilder;
 class GrDrawTarget;
 class GrIndexBuffer;
 
@@ -43,16 +43,16 @@
     // between them by passing in stroke (==NULL means fill).
 
     void fillAARect(GrDrawTarget* target,
-                    GrDrawState* ds,
+                    GrPipelineBuilder* pipelineBuilder,
                     GrColor color,
                     const SkMatrix& viewMatrix,
                     const SkRect& rect,
                     const SkRect& devRect) {
-        this->geometryFillAARect(target, ds, color, viewMatrix, rect, devRect);
+        this->geometryFillAARect(target, pipelineBuilder, color, viewMatrix, rect, devRect);
     }
 
     void strokeAARect(GrDrawTarget*,
-                      GrDrawState*,
+                      GrPipelineBuilder*,
                       GrColor,
                       const SkMatrix& viewMatrix,
                       const SkRect& rect,
@@ -61,7 +61,7 @@
 
     // First rect is outer; second rect is inner
     void fillAANestedRects(GrDrawTarget*,
-                           GrDrawState*,
+                           GrPipelineBuilder*,
                            GrColor,
                            const SkMatrix& viewMatrix,
                            const SkRect rects[2]);
@@ -70,14 +70,14 @@
     GrIndexBuffer* aaStrokeRectIndexBuffer(bool miterStroke);
 
     void geometryFillAARect(GrDrawTarget*,
-                            GrDrawState*,
+                            GrPipelineBuilder*,
                             GrColor,
                             const SkMatrix& viewMatrix,
                             const SkRect& rect,
                             const SkRect& devRect);
 
     void geometryStrokeAARect(GrDrawTarget*,
-                              GrDrawState*,
+                              GrPipelineBuilder*,
                               GrColor,
                               const SkMatrix& viewMatrix,
                               const SkRect& devOutside,
diff --git a/src/gpu/GrBitmapTextContext.cpp b/src/gpu/GrBitmapTextContext.cpp
index 2df3a71..f39e7a1 100755
--- a/src/gpu/GrBitmapTextContext.cpp
+++ b/src/gpu/GrBitmapTextContext.cpp
@@ -529,8 +529,8 @@
     }
 
     if (fCurrVertex > 0) {
-        GrDrawState drawState;
-        drawState.setFromPaint(fPaint, fContext->getRenderTarget());
+        GrPipelineBuilder pipelineBuilder;
+        pipelineBuilder.setFromPaint(fPaint, fContext->getRenderTarget());
 
         // setup our sampler state for our text texture/atlas
         SkASSERT(SkIsAlign4(fCurrVertex));
@@ -550,7 +550,8 @@
                 // TODO: move supportsRGBCoverage check to setupCoverageEffect and only add LCD
                 // processor if the xp can support it. For now we will simply assume that if
                 // fUseLCDText is true, then we have a known color output.
-                if (!drawState.getXPFactory()->supportsRGBCoverage(0, kRGBA_GrColorComponentFlags)) {
+                const GrXPFactory* xpFactory = pipelineBuilder.getXPFactory();
+                if (!xpFactory->supportsRGBCoverage(0, kRGBA_GrColorComponentFlags)) {
                     SkDebugf("LCD Text will not draw correctly.\n");
                 }
                 break;
@@ -574,7 +575,7 @@
                                                                             params));
                 fEffectTextureUniqueID = textureUniqueID;
             }
-            drawState.addColorProcessor(fCachedTextureProcessor.get());
+            pipelineBuilder.addColorProcessor(fCachedTextureProcessor.get());
         } else {
             uint32_t textureUniqueID = fCurrTexture->getUniqueID();
             if (textureUniqueID != fEffectTextureUniqueID ||
@@ -594,7 +595,7 @@
 
         int nGlyphs = fCurrVertex / kVerticesPerGlyph;
         fDrawTarget->setIndexSourceToBuffer(fContext->getQuadIndexBuffer());
-        fDrawTarget->drawIndexedInstances(&drawState,
+        fDrawTarget->drawIndexedInstances(&pipelineBuilder,
                                           fCachedGeometryProcessor.get(),
                                           kTriangles_GrPrimitiveType,
                                           nGlyphs,
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index c2dc4fb..6bfdba6 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -31,9 +31,9 @@
 // set up the draw state to enable the aa clipping mask. Besides setting up the
 // stage matrix this also alters the vertex layout
 void setup_drawstate_aaclip(const SkIRect &devBound,
-                            GrDrawState* drawState,
+                            GrPipelineBuilder* pipelineBuilder,
                             GrTexture* result) {
-    SkASSERT(drawState);
+    SkASSERT(pipelineBuilder);
 
     SkMatrix mat;
     // We use device coords to compute the texture coordinates. We set our matrix to be a
@@ -44,7 +44,7 @@
 
     SkIRect domainTexels = SkIRect::MakeWH(devBound.width(), devBound.height());
     // This could be a long-lived effect that is cached with the alpha-mask.
-    drawState->addCoverageProcessor(
+    pipelineBuilder->addCoverageProcessor(
         GrTextureDomainEffect::Create(result,
                                       mat,
                                       GrTextureDomain::MakeTexelDomain(result, domainTexels),
@@ -55,7 +55,7 @@
 
 bool path_needs_SW_renderer(GrContext* context,
                             const GrDrawTarget* gpu,
-                            const GrDrawState* drawState,
+                            const GrPipelineBuilder* pipelineBuilder,
                             const SkMatrix& viewMatrix,
                             const SkPath& origPath,
                             const SkStrokeRec& stroke,
@@ -70,7 +70,8 @@
                                          GrPathRendererChain::kColorAntiAlias_DrawType :
                                          GrPathRendererChain::kColor_DrawType;
 
-    return NULL == context->getPathRenderer(gpu, drawState, viewMatrix, *path, stroke, false, type);
+    return NULL == context->getPathRenderer(gpu, pipelineBuilder, viewMatrix, *path, stroke,
+                                            false, type);
 }
 }
 
@@ -79,7 +80,7 @@
  * will be used on any element. If so, it returns true to indicate that the
  * entire clip should be rendered in SW and then uploaded en masse to the gpu.
  */
-bool GrClipMaskManager::useSWOnlyPath(const GrDrawState* drawState,
+bool GrClipMaskManager::useSWOnlyPath(const GrPipelineBuilder* pipelineBuilder,
                                       const SkVector& clipToMaskOffset,
                                       const GrReducedClip::ElementList& elements) {
     // TODO: generalize this function so that when
@@ -99,7 +100,7 @@
         if (Element::kRect_Type != element->getType()) {
             SkPath path;
             element->asPath(&path);
-            if (path_needs_SW_renderer(this->getContext(), fClipTarget, drawState, translate,
+            if (path_needs_SW_renderer(this->getContext(), fClipTarget, pipelineBuilder, translate,
                                        path, stroke, element->isAA())) {
                 return true;
             }
@@ -108,8 +109,8 @@
     return false;
 }
 
-bool GrClipMaskManager::installClipEffects(GrDrawState* drawState,
-                                           GrDrawState::AutoRestoreEffects* are,
+bool GrClipMaskManager::installClipEffects(GrPipelineBuilder* pipelineBuilder,
+                                           GrPipelineBuilder::AutoRestoreEffects* are,
                                            const GrReducedClip::ElementList& elements,
                                            const SkVector& clipToRTOffset,
                                            const SkRect* drawBounds) {
@@ -119,8 +120,8 @@
         boundsInClipSpace.offset(-clipToRTOffset.fX, -clipToRTOffset.fY);
     }
 
-    are->set(drawState);
-    GrRenderTarget* rt = drawState->getRenderTarget();
+    are->set(pipelineBuilder);
+    GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
     GrReducedClip::ElementList::Iter iter(elements);
     bool failed = false;
     while (iter.get()) {
@@ -186,7 +187,7 @@
                     break;
             }
             if (fp) {
-                drawState->addCoverageProcessor(fp);
+                pipelineBuilder->addCoverageProcessor(fp);
             } else {
                 failed = true;
                 break;
@@ -204,9 +205,9 @@
 ////////////////////////////////////////////////////////////////////////////////
 // sort out what kind of clip mask needs to be created: alpha, stencil,
 // scissor, or entirely software
-bool GrClipMaskManager::setupClipping(GrDrawState* drawState,
-                                      GrDrawState::AutoRestoreEffects* are,
-                                      GrDrawState::AutoRestoreStencil* ars,
+bool GrClipMaskManager::setupClipping(GrPipelineBuilder* pipelineBuilder,
+                                      GrPipelineBuilder::AutoRestoreEffects* are,
+                                      GrPipelineBuilder::AutoRestoreStencil* ars,
                                       GrScissorState* scissorState,
                                       const GrClipData* clipDataIn,
                                       const SkRect* devBounds) {
@@ -220,12 +221,12 @@
     GrReducedClip::InitialState initialState;
     SkIRect clipSpaceIBounds;
     bool requiresAA;
-    GrRenderTarget* rt = drawState->getRenderTarget();
+    GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
 
     // GrDrawTarget should have filtered this for us
     SkASSERT(rt);
 
-    bool ignoreClip = !drawState->isClipState() || clipDataIn->fClipStack->isWideOpen();
+    bool ignoreClip = !pipelineBuilder->isClipState() || clipDataIn->fClipStack->isWideOpen();
     if (!ignoreClip) {
         SkIRect clipSpaceRTIBounds = SkIRect::MakeWH(rt->width(), rt->height());
         clipSpaceRTIBounds.offset(clipDataIn->fOrigin);
@@ -246,7 +247,7 @@
     }
 
     if (ignoreClip) {
-        this->setDrawStateStencil(drawState, ars);
+        this->setPipelineBuilderStencil(pipelineBuilder, ars);
         return true;
     }
 
@@ -262,7 +263,7 @@
         SkVector clipToRTOffset = { SkIntToScalar(-clipDataIn->fOrigin.fX),
                                     SkIntToScalar(-clipDataIn->fOrigin.fY) };
         if (elements.isEmpty() ||
-            (requiresAA && this->installClipEffects(drawState, are, elements, clipToRTOffset,
+            (requiresAA && this->installClipEffects(pipelineBuilder, are, elements, clipToRTOffset,
                                                     devBounds))) {
             SkIRect scissorSpaceIBounds(clipSpaceIBounds);
             scissorSpaceIBounds.offset(-clipDataIn->fOrigin);
@@ -270,7 +271,7 @@
                 !SkRect::Make(scissorSpaceIBounds).contains(*devBounds)) {
                 scissorState->set(scissorSpaceIBounds);
             }
-            this->setDrawStateStencil(drawState, ars);
+            this->setPipelineBuilderStencil(pipelineBuilder, ars);
             return true;
         }
     }
@@ -286,7 +287,7 @@
             SkIntToScalar(-clipSpaceIBounds.fTop)
         };
 
-        if (this->useSWOnlyPath(drawState, clipToMaskOffset, elements)) {
+        if (this->useSWOnlyPath(pipelineBuilder, clipToMaskOffset, elements)) {
             // The clip geometry is complex enough that it will be more efficient to create it
             // entirely in software
             result = this->createSoftwareClipMask(genID,
@@ -307,8 +308,8 @@
             // clipSpace bounds. We determine the mask's position WRT to the render target here.
             SkIRect rtSpaceMaskBounds = clipSpaceIBounds;
             rtSpaceMaskBounds.offset(-clipDataIn->fOrigin);
-            setup_drawstate_aaclip(rtSpaceMaskBounds, drawState, result);
-            this->setDrawStateStencil(drawState, ars);
+            setup_drawstate_aaclip(rtSpaceMaskBounds, pipelineBuilder, result);
+            this->setPipelineBuilderStencil(pipelineBuilder, ars);
             return true;
         }
         // if alpha clip mask creation fails fall through to the non-AA code paths
@@ -337,28 +338,29 @@
     SkIRect scissorSpaceIBounds(clipSpaceIBounds);
     scissorSpaceIBounds.offset(clipSpaceToStencilSpaceOffset);
     scissorState->set(scissorSpaceIBounds);
-    this->setDrawStateStencil(drawState, ars);
+    this->setPipelineBuilderStencil(pipelineBuilder, ars);
     return true;
 }
 
 namespace {
 ////////////////////////////////////////////////////////////////////////////////
-// Set a coverage drawing XPF on the drawState for the given op and invertCoverage mode
-void set_coverage_drawing_xpf(SkRegion::Op op, bool invertCoverage, GrDrawState* drawState) {
+// Set a coverage drawing XPF on the pipelineBuilder for the given op and invertCoverage mode
+void set_coverage_drawing_xpf(SkRegion::Op op, bool invertCoverage,
+                              GrPipelineBuilder* pipelineBuilder) {
     SkASSERT(op <= SkRegion::kLastOp);
-    drawState->setCoverageSetOpXPFactory(op, invertCoverage);
+    pipelineBuilder->setCoverageSetOpXPFactory(op, invertCoverage);
 }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-bool GrClipMaskManager::drawElement(GrDrawState* drawState,
+bool GrClipMaskManager::drawElement(GrPipelineBuilder* pipelineBuilder,
                                     const SkMatrix& viewMatrix,
                                     GrTexture* target,
                                     const SkClipStack::Element* element,
                                     GrPathRenderer* pr) {
     GrDrawTarget::AutoGeometryPush agp(fClipTarget);
 
-    drawState->setRenderTarget(target->asRenderTarget());
+    pipelineBuilder->setRenderTarget(target->asRenderTarget());
 
     // The color we use to draw does not matter since we will always be using a GrCoverageSetOpXP
     // which ignores color.
@@ -376,13 +378,13 @@
                 SkRect devRect = element->getRect();
                 viewMatrix.mapRect(&devRect);
                 this->getContext()->getAARectRenderer()->fillAARect(fClipTarget,
-                                                                    drawState,
+                                                                    pipelineBuilder,
                                                                     color,
                                                                     viewMatrix,
                                                                     element->getRect(),
                                                                     devRect);
             } else {
-                fClipTarget->drawSimpleRect(drawState, color, viewMatrix, element->getRect());
+                fClipTarget->drawSimpleRect(pipelineBuilder, color, viewMatrix, element->getRect());
             }
             return true;
         default: {
@@ -397,25 +399,26 @@
                 GrPathRendererChain::DrawType type;
                 type = element->isAA() ? GrPathRendererChain::kColorAntiAlias_DrawType :
                                          GrPathRendererChain::kColor_DrawType;
-                pr = this->getContext()->getPathRenderer(fClipTarget, drawState, viewMatrix, path,
-                                                         stroke, false, type);
+                pr = this->getContext()->getPathRenderer(fClipTarget, pipelineBuilder, viewMatrix,
+                                                         path, stroke, false, type);
             }
             if (NULL == pr) {
                 return false;
             }
 
-            pr->drawPath(fClipTarget, drawState, color, viewMatrix, path, stroke, element->isAA());
+            pr->drawPath(fClipTarget, pipelineBuilder, color, viewMatrix, path, stroke,
+                         element->isAA());
             break;
         }
     }
     return true;
 }
 
-bool GrClipMaskManager::canStencilAndDrawElement(GrDrawState* drawState,
+bool GrClipMaskManager::canStencilAndDrawElement(GrPipelineBuilder* pipelineBuilder,
                                                  GrTexture* target,
                                                  GrPathRenderer** pr,
                                                  const SkClipStack::Element* element) {
-    drawState->setRenderTarget(target->asRenderTarget());
+    pipelineBuilder->setRenderTarget(target->asRenderTarget());
 
     if (Element::kRect_Type == element->getType()) {
         return true;
@@ -431,34 +434,35 @@
         GrPathRendererChain::DrawType type = element->isAA() ?
             GrPathRendererChain::kStencilAndColorAntiAlias_DrawType :
             GrPathRendererChain::kStencilAndColor_DrawType;
-        *pr = this->getContext()->getPathRenderer(fClipTarget, drawState, SkMatrix::I(), path,
+        *pr = this->getContext()->getPathRenderer(fClipTarget, pipelineBuilder, SkMatrix::I(), path,
                                                   stroke, false, type);
         return SkToBool(*pr);
     }
 }
 
-void GrClipMaskManager::mergeMask(GrDrawState* drawState,
+void GrClipMaskManager::mergeMask(GrPipelineBuilder* pipelineBuilder,
                                   GrTexture* dstMask,
                                   GrTexture* srcMask,
                                   SkRegion::Op op,
                                   const SkIRect& dstBound,
                                   const SkIRect& srcBound) {
-    drawState->setRenderTarget(dstMask->asRenderTarget());
+    pipelineBuilder->setRenderTarget(dstMask->asRenderTarget());
 
     // We want to invert the coverage here
-    set_coverage_drawing_xpf(op, false, drawState);
+    set_coverage_drawing_xpf(op, false, pipelineBuilder);
 
     SkMatrix sampleM;
     sampleM.setIDiv(srcMask->width(), srcMask->height());
 
-    drawState->addCoverageProcessor(
+    pipelineBuilder->addCoverageProcessor(
         GrTextureDomainEffect::Create(srcMask,
                                       sampleM,
                                       GrTextureDomain::MakeTexelDomain(srcMask, srcBound),
                                       GrTextureDomain::kDecal_Mode,
                                       GrTextureParams::kNone_FilterMode))->unref();
     // The color passed in here does not matter since the coverageSetOpXP won't read it.
-    fClipTarget->drawSimpleRect(drawState, GrColor_WHITE, SkMatrix::I(), SkRect::Make(dstBound));
+    fClipTarget->drawSimpleRect(pipelineBuilder, GrColor_WHITE, SkMatrix::I(),
+                                SkRect::Make(dstBound));
 }
 
 GrTexture* GrClipMaskManager::createTempMask(int width, int height) {
@@ -563,11 +567,11 @@
         SkRegion::Op op = element->getOp();
         bool invert = element->isInverseFilled();
         if (invert || SkRegion::kIntersect_Op == op || SkRegion::kReverseDifference_Op == op) {
-            GrDrawState drawState;
-            drawState.enableState(GrDrawState::kClip_StateBit);
+            GrPipelineBuilder pipelineBuilder;
+            pipelineBuilder.enableState(GrPipelineBuilder::kClip_StateBit);
 
             GrPathRenderer* pr = NULL;
-            bool useTemp = !this->canStencilAndDrawElement(&drawState, result, &pr, element);
+            bool useTemp = !this->canStencilAndDrawElement(&pipelineBuilder, result, &pr, element);
             GrTexture* dst;
             // This is the bounds of the clip element in the space of the alpha-mask. The temporary
             // mask buffer can be substantially larger than the actually clip stack element. We
@@ -598,7 +602,7 @@
                                    invert ? 0xffffffff : 0x00000000,
                                    true,
                                    dst->asRenderTarget());
-                set_coverage_drawing_xpf(SkRegion::kReplace_Op, invert, &drawState);
+                set_coverage_drawing_xpf(SkRegion::kReplace_Op, invert, &pipelineBuilder);
             } else {
                 // draw directly into the result with the stencil set to make the pixels affected
                 // by the clip shape be non-zero.
@@ -610,34 +614,34 @@
                                              0xffff,
                                              0xffff,
                                              0xffff);
-                drawState.setStencil(kStencilInElement);
-                set_coverage_drawing_xpf(op, invert, &drawState);
+                pipelineBuilder.setStencil(kStencilInElement);
+                set_coverage_drawing_xpf(op, invert, &pipelineBuilder);
             }
 
-            if (!this->drawElement(&drawState, translate, dst, element, pr)) {
+            if (!this->drawElement(&pipelineBuilder, translate, dst, element, pr)) {
                 fAACache.reset();
                 return NULL;
             }
 
             if (useTemp) {
-                GrDrawState backgroundDrawState;
-                backgroundDrawState.enableState(GrDrawState::kClip_StateBit);
-                backgroundDrawState.setRenderTarget(result->asRenderTarget());
+                GrPipelineBuilder backgroundPipelineBuilder;
+                backgroundPipelineBuilder.enableState(GrPipelineBuilder::kClip_StateBit);
+                backgroundPipelineBuilder.setRenderTarget(result->asRenderTarget());
 
                 // Now draw into the accumulator using the real operation and the temp buffer as a
                 // texture
-                this->mergeMask(&backgroundDrawState,
+                this->mergeMask(&backgroundPipelineBuilder,
                                 result,
                                 temp,
                                 op,
                                 maskSpaceIBounds,
                                 maskSpaceElementIBounds);
             } else {
-                GrDrawState backgroundDrawState;
-                backgroundDrawState.enableState(GrDrawState::kClip_StateBit);
-                backgroundDrawState.setRenderTarget(result->asRenderTarget());
+                GrPipelineBuilder backgroundPipelineBuilder;
+                backgroundPipelineBuilder.enableState(GrPipelineBuilder::kClip_StateBit);
+                backgroundPipelineBuilder.setRenderTarget(result->asRenderTarget());
 
-                set_coverage_drawing_xpf(op, !invert, &backgroundDrawState);
+                set_coverage_drawing_xpf(op, !invert, &backgroundPipelineBuilder);
                 // Draw to the exterior pixels (those with a zero stencil value).
                 GR_STATIC_CONST_SAME_STENCIL(kDrawOutsideElement,
                                              kZero_StencilOp,
@@ -646,19 +650,19 @@
                                              0xffff,
                                              0x0000,
                                              0xffff);
-                backgroundDrawState.setStencil(kDrawOutsideElement);
+                backgroundPipelineBuilder.setStencil(kDrawOutsideElement);
                 // The color passed in here does not matter since the coverageSetOpXP won't read it.
-                fClipTarget->drawSimpleRect(&backgroundDrawState, GrColor_WHITE, translate,
+                fClipTarget->drawSimpleRect(&backgroundPipelineBuilder, GrColor_WHITE, translate,
                                             clipSpaceIBounds);
             }
         } else {
-            GrDrawState drawState;
-            drawState.enableState(GrDrawState::kClip_StateBit);
+            GrPipelineBuilder pipelineBuilder;
+            pipelineBuilder.enableState(GrPipelineBuilder::kClip_StateBit);
 
             // all the remaining ops can just be directly draw into the accumulation buffer
-            set_coverage_drawing_xpf(op, false, &drawState);
+            set_coverage_drawing_xpf(op, false, &pipelineBuilder);
             // The color passed in here does not matter since the coverageSetOpXP won't read it.
-            this->drawElement(&drawState, translate, result, element);
+            this->drawElement(&pipelineBuilder, translate, result, element);
         }
     }
 
@@ -712,15 +716,15 @@
         for (GrReducedClip::ElementList::Iter iter(elements.headIter()); iter.get(); iter.next()) {
             const Element* element = iter.get();
 
-            GrDrawState drawState;
-            drawState.setRenderTarget(rt);
-            drawState.enableState(GrDrawState::kClip_StateBit);
+            GrPipelineBuilder pipelineBuilder;
+            pipelineBuilder.setRenderTarget(rt);
+            pipelineBuilder.enableState(GrPipelineBuilder::kClip_StateBit);
 
-            drawState.setDisableColorXPFactory();
+            pipelineBuilder.setDisableColorXPFactory();
 
             // if the target is MSAA then we want MSAA enabled when the clip is soft
             if (rt->isMultisampled()) {
-                drawState.setState(GrDrawState::kHWAntialias_StateBit, element->isAA());
+                pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_StateBit, element->isAA());
             }
 
             bool fillInverted = false;
@@ -746,7 +750,7 @@
                     clipPath.toggleInverseFillType();
                 }
                 pr = this->getContext()->getPathRenderer(fClipTarget,
-                                                         &drawState,
+                                                         &pipelineBuilder,
                                                          viewMatrix,
                                                          clipPath,
                                                          stroke,
@@ -784,18 +788,19 @@
                                              0x0000,
                                              0xffff);
                 if (Element::kRect_Type == element->getType()) {
-                    *drawState.stencil() = gDrawToStencil;
-                    fClipTarget->drawSimpleRect(&drawState, GrColor_WHITE, viewMatrix,
+                    *pipelineBuilder.stencil() = gDrawToStencil;
+                    fClipTarget->drawSimpleRect(&pipelineBuilder, GrColor_WHITE, viewMatrix,
                                                 element->getRect());
                 } else {
                     if (!clipPath.isEmpty()) {
                         GrDrawTarget::AutoGeometryPush agp(fClipTarget);
                         if (canRenderDirectToStencil) {
-                            *drawState.stencil() = gDrawToStencil;
-                            pr->drawPath(fClipTarget, &drawState, GrColor_WHITE, viewMatrix,
+                            *pipelineBuilder.stencil() = gDrawToStencil;
+                            pr->drawPath(fClipTarget, &pipelineBuilder, GrColor_WHITE, viewMatrix,
                                          clipPath, stroke, false);
                         } else {
-                            pr->stencilPath(fClipTarget, &drawState, viewMatrix, clipPath, stroke);
+                            pr->stencilPath(fClipTarget, &pipelineBuilder, viewMatrix, clipPath,
+                                            stroke);
                         }
                     }
                 }
@@ -805,22 +810,22 @@
             // element directly or a bounding rect of the entire clip.
             fClipMode = kModifyClip_StencilClipMode;
             for (int p = 0; p < passes; ++p) {
-                GrDrawState drawStateCopy(drawState);
-                *drawStateCopy.stencil() = stencilSettings[p];
+                GrPipelineBuilder pipelineBuilderCopy(pipelineBuilder);
+                *pipelineBuilderCopy.stencil() = stencilSettings[p];
 
                 if (canDrawDirectToClip) {
                     if (Element::kRect_Type == element->getType()) {
-                        fClipTarget->drawSimpleRect(&drawStateCopy, GrColor_WHITE, viewMatrix,
+                        fClipTarget->drawSimpleRect(&pipelineBuilderCopy, GrColor_WHITE, viewMatrix,
                                                     element->getRect());
                     } else {
                         GrDrawTarget::AutoGeometryPush agp(fClipTarget);
-                        pr->drawPath(fClipTarget, &drawStateCopy, GrColor_WHITE, viewMatrix,
+                        pr->drawPath(fClipTarget, &pipelineBuilderCopy, GrColor_WHITE, viewMatrix,
                                      clipPath, stroke, false);
                     }
                 } else {
                     // The view matrix is setup to do clip space -> stencil space translation, so
                     // draw rect in clip space.
-                    fClipTarget->drawSimpleRect(&drawStateCopy, GrColor_WHITE, viewMatrix,
+                    fClipTarget->drawSimpleRect(&pipelineBuilderCopy, GrColor_WHITE, viewMatrix,
                                                 SkRect::Make(clipSpaceIBounds));
                 }
             }
@@ -885,8 +890,8 @@
 }
 }
 
-void GrClipMaskManager::setDrawStateStencil(GrDrawState* drawState,
-                                            GrDrawState::AutoRestoreStencil* ars) {
+void GrClipMaskManager::setPipelineBuilderStencil(GrPipelineBuilder* pipelineBuilder,
+                                                  GrPipelineBuilder::AutoRestoreStencil* ars) {
     // We make two copies of the StencilSettings here (except in the early
     // exit scenario. One copy from draw state to the stack var. Then another
     // from the stack var to the gpu. We could make this class hold a ptr to
@@ -898,19 +903,19 @@
 
     // The GrGpu client may not be using the stencil buffer but we may need to
     // enable it in order to respect a stencil clip.
-    if (drawState->getStencil().isDisabled()) {
+    if (pipelineBuilder->getStencil().isDisabled()) {
         if (GrClipMaskManager::kRespectClip_StencilClipMode == fClipMode) {
             settings = basic_apply_stencil_clip_settings();
         } else {
             return;
         }
     } else {
-        settings = drawState->getStencil();
+        settings = pipelineBuilder->getStencil();
     }
 
     // TODO: dynamically attach a stencil buffer
     int stencilBits = 0;
-    GrStencilBuffer* stencilBuffer = drawState->getRenderTarget()->getStencilBuffer();
+    GrStencilBuffer* stencilBuffer = pipelineBuilder->getRenderTarget()->getStencilBuffer();
     if (stencilBuffer) {
         stencilBits = stencilBuffer->bits();
     }
@@ -918,8 +923,8 @@
     SkASSERT(fClipTarget->caps()->stencilWrapOpsSupport() || !settings.usesWrapOp());
     SkASSERT(fClipTarget->caps()->twoSidedStencilSupport() || !settings.isTwoSided());
     this->adjustStencilParams(&settings, fClipMode, stencilBits);
-    ars->set(drawState);
-    drawState->setStencil(settings);
+    ars->set(pipelineBuilder);
+    pipelineBuilder->setStencil(settings);
 }
 
 void GrClipMaskManager::adjustStencilParams(GrStencilSettings* settings,
diff --git a/src/gpu/GrClipMaskManager.h b/src/gpu/GrClipMaskManager.h
index fef47e4..ed3d431 100644
--- a/src/gpu/GrClipMaskManager.h
+++ b/src/gpu/GrClipMaskManager.h
@@ -9,7 +9,7 @@
 
 #include "GrClipMaskCache.h"
 #include "GrContext.h"
-#include "GrDrawState.h"
+#include "GrPipelineBuilder.h"
 #include "GrReducedClip.h"
 #include "GrStencil.h"
 #include "GrTexture.h"
@@ -48,9 +48,9 @@
      * the manager when it must install additional effects to implement the
      * clip. devBounds is optional but can help optimize clipping.
      */
-    bool setupClipping(GrDrawState*,
-                       GrDrawState::AutoRestoreEffects*,
-                       GrDrawState::AutoRestoreStencil*,
+    bool setupClipping(GrPipelineBuilder*,
+                       GrPipelineBuilder::AutoRestoreEffects*,
+                       GrPipelineBuilder::AutoRestoreStencil*,
                        GrScissorState*,
                        const GrClipData* clipDataIn,
                        const SkRect* devBounds);
@@ -94,8 +94,8 @@
 
     // Attempts to install a series of coverage effects to implement the clip. Return indicates
     // whether the element list was successfully converted to effects.
-    bool installClipEffects(GrDrawState*,
-                            GrDrawState::AutoRestoreEffects*,
+    bool installClipEffects(GrPipelineBuilder*,
+                            GrPipelineBuilder::AutoRestoreEffects*,
                             const GrReducedClip::ElementList&,
                             const SkVector& clipOffset,
                             const SkRect* devBounds);
@@ -133,14 +133,14 @@
                                 const SkIRect& clipSpaceIBounds,
                                 bool willUpload);
 
-    bool useSWOnlyPath(const GrDrawState*,
+    bool useSWOnlyPath(const GrPipelineBuilder*,
                        const SkVector& clipToMaskOffset,
                        const GrReducedClip::ElementList& elements);
 
     // Draws a clip element into the target alpha mask. The caller should have already setup the
     // desired blend operation. Optionally if the caller already selected a path renderer it can
     // be passed. Otherwise the function will select one if the element is a path.
-    bool drawElement(GrDrawState*,
+    bool drawElement(GrPipelineBuilder*,
                      const SkMatrix& viewMatrix,
                      GrTexture* target,
                      const SkClipStack::Element*,
@@ -149,12 +149,12 @@
     // Determines whether it is possible to draw the element to both the stencil buffer and the
     // alpha mask simultaneously. If so and the element is a path a compatible path renderer is
     // also returned.
-    bool canStencilAndDrawElement(GrDrawState*,
+    bool canStencilAndDrawElement(GrPipelineBuilder*,
                                   GrTexture* target,
                                   GrPathRenderer**,
                                   const SkClipStack::Element*);
 
-    void mergeMask(GrDrawState*,
+    void mergeMask(GrPipelineBuilder*,
                    GrTexture* dstMask,
                    GrTexture* srcMask,
                    SkRegion::Op op,
@@ -170,7 +170,7 @@
      * updates the GrGpu with stencil settings that account stencil-based
      * clipping.
      */
-    void setDrawStateStencil(GrDrawState*, GrDrawState::AutoRestoreStencil*);
+    void setPipelineBuilderStencil(GrPipelineBuilder*, GrPipelineBuilder::AutoRestoreStencil*);
 
     /**
      * Adjusts the stencil settings to account for interaction with stencil
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index a0fc678..b798ef0 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -294,8 +294,8 @@
     GrTexture* texture = fGpu->createTexture(rtDesc, true, NULL, 0);
 
     if (texture) {
-        GrDrawState drawState;
-        drawState.setRenderTarget(texture->asRenderTarget());
+        GrPipelineBuilder pipelineBuilder;
+        pipelineBuilder.setRenderTarget(texture->asRenderTarget());
 
         // if filtering is not desired then we want to ensure all
         // texels in the resampled image are copies of texels from
@@ -303,7 +303,7 @@
         GrTextureParams params(SkShader::kClamp_TileMode,
                                filter ? GrTextureParams::kBilerp_FilterMode :
                                         GrTextureParams::kNone_FilterMode);
-        drawState.addColorTextureProcessor(clampedTexture, SkMatrix::I(), params);
+        pipelineBuilder.addColorTextureProcessor(clampedTexture, SkMatrix::I(), params);
 
         uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType |
                          GrDefaultGeoProcFactory::kLocalCoord_GPType;
@@ -317,7 +317,7 @@
             SkPoint* verts = (SkPoint*) arg.vertices();
             verts[0].setIRectFan(0, 0, texture->width(), texture->height(), 2 * sizeof(SkPoint));
             verts[1].setIRectFan(0, 0, 1, 1, 2 * sizeof(SkPoint));
-            fDrawBuffer->drawNonIndexed(&drawState, gp, kTriangleFan_GrPrimitiveType, 0, 4);
+            fDrawBuffer->drawNonIndexed(&pipelineBuilder, gp, kTriangleFan_GrPrimitiveType, 0, 4);
         }
     } else {
         // TODO: Our CPU stretch doesn't filter. But we create separate
@@ -571,14 +571,14 @@
         }
 
         AutoCheckFlush acf(this);
-        GrDrawState drawState;
-        GrDrawTarget* target = this->prepareToDraw(&drawState, paint, &acf);
+        GrPipelineBuilder pipelineBuilder;
+        GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, paint, &acf);
         if (NULL == target) {
             return;
         }
 
         GR_CREATE_TRACE_MARKER("GrContext::drawPaintWithPerspective", target);
-        target->drawRect(&drawState, paint->getColor(), SkMatrix::I(), r, NULL, &localMatrix);
+        target->drawRect(&pipelineBuilder, paint->getColor(), SkMatrix::I(), r, NULL, &localMatrix);
     }
 }
 
@@ -618,21 +618,21 @@
 }
 
 static bool apply_aa_to_rect(GrDrawTarget* target,
-                             GrDrawState* ds,
+                             GrPipelineBuilder* pipelineBuilder,
                              SkRect* devBoundRect,
                              const SkRect& rect,
                              SkScalar strokeWidth,
                              const SkMatrix& combinedMatrix,
                              GrColor color) {
-    if (!ds->canTweakAlphaForCoverage() && !ds->canUseFracCoveragePrimProc(color,
-                                                                           *target->caps())) {
+    if (!pipelineBuilder->canTweakAlphaForCoverage() &&
+        !pipelineBuilder->canUseFracCoveragePrimProc(color, *target->caps())) {
 #ifdef SK_DEBUG
         //SkDebugf("Turning off AA to correctly apply blend.\n");
 #endif
         return false;
     }
 
-    if (ds->getRenderTarget()->isMultisampled()) {
+    if (pipelineBuilder->getRenderTarget()->isMultisampled()) {
         return false;
     }
 
@@ -680,8 +680,8 @@
     }
 
     AutoCheckFlush acf(this);
-    GrDrawState drawState;
-    GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &acf);
+    GrPipelineBuilder pipelineBuilder;
+    GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, &paint, &acf);
     if (NULL == target) {
         return;
     }
@@ -693,7 +693,7 @@
     // cases where the RT is fully inside a stroke.
     if (width < 0) {
         SkRect rtRect;
-        drawState.getRenderTarget()->getBoundsRect(&rtRect);
+        pipelineBuilder.getRenderTarget()->getBoundsRect(&rtRect);
         SkRect clipSpaceRTRect = rtRect;
         bool checkClip = false;
         if (this->getClip()) {
@@ -726,15 +726,15 @@
 
     GrColor color = paint.getColor();
     SkRect devBoundRect;
-    bool needAA = paint.isAntiAlias() && !drawState.getRenderTarget()->isMultisampled();
-    bool doAA = needAA && apply_aa_to_rect(target, &drawState, &devBoundRect, rect, width,
+    bool needAA = paint.isAntiAlias() && !pipelineBuilder.getRenderTarget()->isMultisampled();
+    bool doAA = needAA && apply_aa_to_rect(target, &pipelineBuilder, &devBoundRect, rect, width,
                                            viewMatrix, color);
 
     if (doAA) {
         if (width >= 0) {
             const SkStrokeRec& strokeRec = strokeInfo->getStrokeRec();
             fAARectRenderer->strokeAARect(target,
-                                          &drawState,
+                                          &pipelineBuilder,
                                           color,
                                           viewMatrix,
                                           rect,
@@ -743,7 +743,7 @@
         } else {
             // filled AA rect
             fAARectRenderer->fillAARect(target,
-                                        &drawState,
+                                        &pipelineBuilder,
                                         color,
                                         viewMatrix,
                                         rect,
@@ -793,10 +793,10 @@
             vertex[4].set(rect.fLeft, rect.fTop);
         }
 
-        target->drawNonIndexed(&drawState, gp, primType, 0, vertCount);
+        target->drawNonIndexed(&pipelineBuilder, gp, primType, 0, vertCount);
     } else {
         // filled BW rect
-        target->drawSimpleRect(&drawState, color, viewMatrix, rect);
+        target->drawSimpleRect(&pipelineBuilder, color, viewMatrix, rect);
     }
 }
 
@@ -806,15 +806,16 @@
                                     const SkRect& localRect,
                                     const SkMatrix* localMatrix) {
     AutoCheckFlush acf(this);
-    GrDrawState drawState;
-    GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &acf);
+    GrPipelineBuilder pipelineBuilder;
+    GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, &paint, &acf);
     if (NULL == target) {
         return;
     }
 
     GR_CREATE_TRACE_MARKER("GrContext::drawRectToRect", target);
 
-    target->drawRect(&drawState, paint.getColor(), viewMatrix, rectToDraw, &localRect, localMatrix);
+    target->drawRect(&pipelineBuilder, paint.getColor(), viewMatrix, rectToDraw, &localRect,
+                     localMatrix);
 }
 
 static const GrGeometryProcessor* set_vertex_attributes(const SkPoint* texCoords,
@@ -851,10 +852,10 @@
                              const uint16_t indices[],
                              int indexCount) {
     AutoCheckFlush acf(this);
-    GrDrawState drawState;
+    GrPipelineBuilder pipelineBuilder;
     GrDrawTarget::AutoReleaseGeometry geo; // must be inside AutoCheckFlush scope
 
-    GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &acf);
+    GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, &paint, &acf);
     if (NULL == target) {
         return;
     }
@@ -894,9 +895,9 @@
         for (int i = 0; i < indexCount; ++i) {
             curIndex[i] = indices[i];
         }
-        target->drawIndexed(&drawState, gp, primitiveType, 0, 0, vertexCount, indexCount);
+        target->drawIndexed(&pipelineBuilder, gp, primitiveType, 0, 0, vertexCount, indexCount);
     } else {
-        target->drawNonIndexed(&drawState, gp, primitiveType, 0, vertexCount);
+        target->drawNonIndexed(&pipelineBuilder, gp, primitiveType, 0, vertexCount);
     }
 }
 
@@ -918,8 +919,8 @@
     }
 
     AutoCheckFlush acf(this);
-    GrDrawState drawState;
-    GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &acf);
+    GrPipelineBuilder pipelineBuilder;
+    GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, &paint, &acf);
     if (NULL == target) {
         return;
     }
@@ -929,12 +930,12 @@
     const SkStrokeRec& strokeRec = strokeInfo.getStrokeRec();
 
     GrColor color = paint.getColor();
-    if (!fOvalRenderer->drawRRect(target, &drawState, color, viewMatrix, paint.isAntiAlias(), rrect,
-                                  strokeRec)) {
+    if (!fOvalRenderer->drawRRect(target, &pipelineBuilder, color, viewMatrix, paint.isAntiAlias(),
+                                  rrect, strokeRec)) {
         SkPath path;
         path.addRRect(rrect);
-        this->internalDrawPath(target, &drawState, viewMatrix, color, paint.isAntiAlias(), path,
-                               strokeInfo);
+        this->internalDrawPath(target, &pipelineBuilder, viewMatrix, color, paint.isAntiAlias(),
+                               path, strokeInfo);
     }
 }
 
@@ -949,21 +950,22 @@
     }
 
     AutoCheckFlush acf(this);
-    GrDrawState drawState;
-    GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &acf);
+    GrPipelineBuilder pipelineBuilder;
+    GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, &paint, &acf);
 
     GR_CREATE_TRACE_MARKER("GrContext::drawDRRect", target);
 
     GrColor color = paint.getColor();
-    if (!fOvalRenderer->drawDRRect(target, &drawState, color, viewMatrix, paint.isAntiAlias(), outer, inner)) {
+    if (!fOvalRenderer->drawDRRect(target, &pipelineBuilder, color, viewMatrix, paint.isAntiAlias(),
+                                   outer, inner)) {
         SkPath path;
         path.addRRect(inner);
         path.addRRect(outer);
         path.setFillType(SkPath::kEvenOdd_FillType);
 
         GrStrokeInfo fillRec(SkStrokeRec::kFill_InitStyle);
-        this->internalDrawPath(target, &drawState, viewMatrix, color, paint.isAntiAlias(), path,
-                               fillRec);
+        this->internalDrawPath(target, &pipelineBuilder, viewMatrix, color, paint.isAntiAlias(),
+                               path, fillRec);
     }
 }
 
@@ -985,8 +987,8 @@
     }
 
     AutoCheckFlush acf(this);
-    GrDrawState drawState;
-    GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &acf);
+    GrPipelineBuilder pipelineBuilder;
+    GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, &paint, &acf);
     if (NULL == target) {
         return;
     }
@@ -996,18 +998,18 @@
     const SkStrokeRec& strokeRec = strokeInfo.getStrokeRec();
 
     GrColor color = paint.getColor();
-    if (!fOvalRenderer->drawOval(target, &drawState, color, viewMatrix, paint.isAntiAlias(), oval,
-                                 strokeRec)) {
+    if (!fOvalRenderer->drawOval(target, &pipelineBuilder, color, viewMatrix, paint.isAntiAlias(),
+                                 oval, strokeRec)) {
         SkPath path;
         path.addOval(oval);
-        this->internalDrawPath(target, &drawState, viewMatrix, color, paint.isAntiAlias(), path,
-                               strokeInfo);
+        this->internalDrawPath(target, &pipelineBuilder, viewMatrix, color, paint.isAntiAlias(),
+                               path, strokeInfo);
     }
 }
 
 // Can 'path' be drawn as a pair of filled nested rectangles?
 static bool is_nested_rects(GrDrawTarget* target,
-                            GrDrawState* drawState,
+                            GrPipelineBuilder* pipelineBuilder,
                             GrColor color,
                             const SkMatrix& viewMatrix,
                             const SkPath& path,
@@ -1025,8 +1027,8 @@
         return false;
     }
 
-    if (!drawState->canTweakAlphaForCoverage() &&
-        !drawState->canUseFracCoveragePrimProc(color, *target->caps())) {
+    if (!pipelineBuilder->canTweakAlphaForCoverage() &&
+        !pipelineBuilder->canUseFracCoveragePrimProc(color, *target->caps())) {
         return false;
     }
 
@@ -1080,14 +1082,14 @@
         SkPoint pts[2];
         if (path.isLine(pts)) {
             AutoCheckFlush acf(this);
-            GrDrawState drawState;
-            GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &acf);
+            GrPipelineBuilder pipelineBuilder;
+            GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, &paint, &acf);
             if (NULL == target) {
                 return;
             }
 
-            if (GrDashingEffect::DrawDashLine(fGpu, target, &drawState, color, viewMatrix, pts,
-                                              paint, strokeInfo)) {
+            if (GrDashingEffect::DrawDashLine(fGpu, target, &pipelineBuilder, color, viewMatrix,
+                                              pts, paint, strokeInfo)) {
                 return;
             }
         }
@@ -1112,8 +1114,8 @@
     // the writePixels that uploads to the scratch will perform a flush so we're
     // OK.
     AutoCheckFlush acf(this);
-    GrDrawState drawState;
-    GrDrawTarget* target = this->prepareToDraw(&drawState, &paint, &acf);
+    GrPipelineBuilder pipelineBuilder;
+    GrDrawTarget* target = this->prepareToDraw(&pipelineBuilder, &paint, &acf);
     if (NULL == target) {
         return;
     }
@@ -1122,14 +1124,15 @@
 
     const SkStrokeRec& strokeRec = strokeInfo.getStrokeRec();
 
-    bool useCoverageAA = paint.isAntiAlias() && !drawState.getRenderTarget()->isMultisampled();
+    bool useCoverageAA = paint.isAntiAlias() &&
+        !pipelineBuilder.getRenderTarget()->isMultisampled();
 
     if (useCoverageAA && strokeRec.getWidth() < 0 && !path.isConvex()) {
         // Concave AA paths are expensive - try to avoid them for special cases
         SkRect rects[2];
 
-        if (is_nested_rects(target, &drawState, color, viewMatrix, path, strokeRec, rects)) {
-            fAARectRenderer->fillAANestedRects(target, &drawState, color, viewMatrix,rects);
+        if (is_nested_rects(target, &pipelineBuilder, color, viewMatrix, path, strokeRec, rects)) {
+            fAARectRenderer->fillAANestedRects(target, &pipelineBuilder, color, viewMatrix,rects);
             return;
         }
     }
@@ -1138,15 +1141,15 @@
     bool isOval = path.isOval(&ovalRect);
 
     if (!isOval || path.isInverseFillType() ||
-        !fOvalRenderer->drawOval(target, &drawState, color, viewMatrix, paint.isAntiAlias(),
+        !fOvalRenderer->drawOval(target, &pipelineBuilder, color, viewMatrix, paint.isAntiAlias(),
                                  ovalRect, strokeRec)) {
-        this->internalDrawPath(target, &drawState, viewMatrix, color, paint.isAntiAlias(), path,
-                               strokeInfo);
+        this->internalDrawPath(target, &pipelineBuilder, viewMatrix, color, paint.isAntiAlias(),
+                               path, strokeInfo);
     }
 }
 
 void GrContext::internalDrawPath(GrDrawTarget* target,
-                                 GrDrawState* drawState,
+                                 GrPipelineBuilder* pipelineBuilder,
                                  const SkMatrix& viewMatrix,
                                  GrColor color,
                                  bool useAA,
@@ -1162,8 +1165,8 @@
     // aa. If we have some future driver-mojo path AA that can do the right
     // thing WRT to the blend then we'll need some query on the PR.
     bool useCoverageAA = useAA &&
-        !drawState->getRenderTarget()->isMultisampled() &&
-        drawState->canUseFracCoveragePrimProc(color, *target->caps());
+        !pipelineBuilder->getRenderTarget()->isMultisampled() &&
+        pipelineBuilder->canUseFracCoveragePrimProc(color, *target->caps());
 
 
     GrPathRendererChain::DrawType type =
@@ -1175,8 +1178,8 @@
     SkTCopyOnFirstWrite<SkStrokeRec> stroke(strokeInfo.getStrokeRec());
 
     // Try a 1st time without stroking the path and without allowing the SW renderer
-    GrPathRenderer* pr = this->getPathRenderer(target, drawState, viewMatrix, *pathPtr, *stroke,
-                                               false, type);
+    GrPathRenderer* pr = this->getPathRenderer(target, pipelineBuilder, viewMatrix, *pathPtr,
+                                               *stroke, false, type);
 
     if (NULL == pr) {
         if (!GrPathRenderer::IsStrokeHairlineOrEquivalent(*stroke, viewMatrix, NULL)) {
@@ -1191,7 +1194,8 @@
         }
 
         // This time, allow SW renderer
-        pr = this->getPathRenderer(target, drawState, viewMatrix, *pathPtr, *stroke, true, type);
+        pr = this->getPathRenderer(target, pipelineBuilder, viewMatrix, *pathPtr, *stroke, true,
+                                   type);
     }
 
     if (NULL == pr) {
@@ -1201,7 +1205,7 @@
         return;
     }
 
-    pr->drawPath(target, drawState, color, viewMatrix, *pathPtr, *stroke, useCoverageAA);
+    pr->drawPath(target, pipelineBuilder, color, viewMatrix, *pathPtr, *stroke, useCoverageAA);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1339,10 +1343,10 @@
         GrDrawTarget* drawTarget = this->prepareToDraw(NULL, NULL, NULL);
         GrDrawTarget::AutoGeometryPush agp(drawTarget);
 
-        GrDrawState drawState;
-        drawState.addColorProcessor(fp);
-        drawState.setRenderTarget(renderTarget);
-        drawTarget->drawSimpleRect(&drawState, GrColor_WHITE, matrix,
+        GrPipelineBuilder pipelineBuilder;
+        pipelineBuilder.addColorProcessor(fp);
+        pipelineBuilder.setRenderTarget(renderTarget);
+        drawTarget->drawSimpleRect(&pipelineBuilder, GrColor_WHITE, matrix,
                                    SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)));
     }
 
@@ -1458,13 +1462,14 @@
                 // can be invoked in this method
                 {
                     GrDrawTarget::AutoGeometryPush agp(fDrawBuffer);
-                    GrDrawState drawState;
+                    GrPipelineBuilder pipelineBuilder;
                     SkASSERT(fp);
-                    drawState.addColorProcessor(fp);
+                    pipelineBuilder.addColorProcessor(fp);
 
-                    drawState.setRenderTarget(tempTexture->asRenderTarget());
+                    pipelineBuilder.setRenderTarget(tempTexture->asRenderTarget());
                     SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
-                    fDrawBuffer->drawSimpleRect(&drawState, GrColor_WHITE, SkMatrix::I(), rect);
+                    fDrawBuffer->drawSimpleRect(&pipelineBuilder, GrColor_WHITE, SkMatrix::I(),
+                                                rect);
                     // we want to read back from the scratch's origin
                     left = 0;
                     top = 0;
@@ -1552,7 +1557,7 @@
     }
 }
 
-GrDrawTarget* GrContext::prepareToDraw(GrDrawState* ds,
+GrDrawTarget* GrContext::prepareToDraw(GrPipelineBuilder* pipelineBuilder,
                                        const GrPaint* paint,
                                        const AutoCheckFlush* acf) {
     if (NULL == fGpu) {
@@ -1560,10 +1565,11 @@
     }
 
     ASSERT_OWNED_RESOURCE(fRenderTarget.get());
-    if (ds) {
+    if (pipelineBuilder) {
         SkASSERT(paint && acf);
-        ds->setFromPaint(*paint, fRenderTarget.get());
-        ds->setState(GrDrawState::kClip_StateBit, fClip && !fClip->fClipStack->isWideOpen());
+        pipelineBuilder->setFromPaint(*paint, fRenderTarget.get());
+        pipelineBuilder->setState(GrPipelineBuilder::kClip_StateBit,
+                                  fClip && !fClip->fClipStack->isWideOpen());
     }
     fDrawBuffer->setClip(fClip);
     return fDrawBuffer;
@@ -1576,7 +1582,7 @@
  * can be individually allowed/disallowed via the "allowSW" boolean.
  */
 GrPathRenderer* GrContext::getPathRenderer(const GrDrawTarget* target,
-                                           const GrDrawState* drawState,
+                                           const GrPipelineBuilder* pipelineBuilder,
                                            const SkMatrix& viewMatrix,
                                            const SkPath& path,
                                            const SkStrokeRec& stroke,
@@ -1589,7 +1595,7 @@
     }
 
     GrPathRenderer* pr = fPathRendererChain->getPathRenderer(target,
-                                                             drawState,
+                                                             pipelineBuilder,
                                                              viewMatrix,
                                                              path,
                                                              stroke,
diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp
index 3e32e65..20ec665 100644
--- a/src/gpu/GrDefaultGeoProcFactory.cpp
+++ b/src/gpu/GrDefaultGeoProcFactory.cpp
@@ -7,7 +7,6 @@
 
 #include "GrDefaultGeoProcFactory.h"
 
-#include "GrDrawState.h"
 #include "GrInvariantOutput.h"
 #include "gl/GrGLGeometryProcessor.h"
 #include "gl/builders/GrGLProgramBuilder.h"
diff --git a/src/gpu/GrDefaultPathRenderer.cpp b/src/gpu/GrDefaultPathRenderer.cpp
index af0404a..7b98174 100644
--- a/src/gpu/GrDefaultPathRenderer.cpp
+++ b/src/gpu/GrDefaultPathRenderer.cpp
@@ -9,8 +9,8 @@
 
 #include "GrContext.h"
 #include "GrDefaultGeoProcFactory.h"
-#include "GrDrawState.h"
 #include "GrPathUtils.h"
+#include "GrPipelineBuilder.h"
 #include "SkGeometry.h"
 #include "SkString.h"
 #include "SkStrokeRec.h"
@@ -165,7 +165,7 @@
 
 GrPathRenderer::StencilSupport
 GrDefaultPathRenderer::onGetStencilSupport(const GrDrawTarget*,
-                                           const GrDrawState*,
+                                           const GrPipelineBuilder*,
                                            const SkPath& path,
                                            const SkStrokeRec& stroke) const {
     if (single_pass_path(path, stroke)) {
@@ -208,7 +208,7 @@
 }
 
 bool GrDefaultPathRenderer::createGeom(GrDrawTarget* target,
-                                       GrDrawState* drawState,
+                                       GrPipelineBuilder* pipelineBuilder,
                                        GrPrimitiveType* primType,
                                        int* vertexCnt,
                                        int* indexCnt,
@@ -342,7 +342,7 @@
 }
 
 bool GrDefaultPathRenderer::internalDrawPath(GrDrawTarget* target,
-                                             GrDrawState* drawState,
+                                             GrPipelineBuilder* pipelineBuilder,
                                              GrColor color,
                                              const SkMatrix& viewMatrix,
                                              const SkPath& path,
@@ -368,7 +368,7 @@
     GrPrimitiveType primType;
     GrDrawTarget::AutoReleaseGeometry arg;
     if (!this->createGeom(target,
-                          drawState,
+                          pipelineBuilder,
                           &primType,
                           &vertexCnt,
                           &indexCnt,
@@ -379,13 +379,13 @@
         return false;
     }
     // Save the current xp on the draw state so we can reset it if needed
-    SkAutoTUnref<const GrXPFactory> backupXPFactory(SkRef(drawState->getXPFactory()));
+    SkAutoTUnref<const GrXPFactory> backupXPFactory(SkRef(pipelineBuilder->getXPFactory()));
     // face culling doesn't make sense here
-    SkASSERT(GrDrawState::kBoth_DrawFace == drawState->getDrawFace());
+    SkASSERT(GrPipelineBuilder::kBoth_DrawFace == pipelineBuilder->getDrawFace());
 
     int                         passCount = 0;
     const GrStencilSettings*    passes[3];
-    GrDrawState::DrawFace       drawFace[3];
+    GrPipelineBuilder::DrawFace       drawFace[3];
     bool                        reverse = false;
     bool                        lastPassIsBounds;
 
@@ -397,7 +397,7 @@
             passes[0] = NULL;
         }
         lastPassIsBounds = false;
-        drawFace[0] = GrDrawState::kBoth_DrawFace;
+        drawFace[0] = GrPipelineBuilder::kBoth_DrawFace;
     } else {
         if (single_pass_path(path, *stroke)) {
             passCount = 1;
@@ -406,7 +406,7 @@
             } else {
                 passes[0] = NULL;
             }
-            drawFace[0] = GrDrawState::kBoth_DrawFace;
+            drawFace[0] = GrPipelineBuilder::kBoth_DrawFace;
             lastPassIsBounds = false;
         } else {
             switch (path.getFillType()) {
@@ -427,7 +427,7 @@
                             passes[1] = &gEOColorPass;
                         }
                     }
-                    drawFace[0] = drawFace[1] = GrDrawState::kBoth_DrawFace;
+                    drawFace[0] = drawFace[1] = GrPipelineBuilder::kBoth_DrawFace;
                     break;
 
                 case SkPath::kInverseWinding_FillType:
@@ -441,7 +441,7 @@
                             passes[0] = &gWindStencilSeparateNoWrap;
                         }
                         passCount = 2;
-                        drawFace[0] = GrDrawState::kBoth_DrawFace;
+                        drawFace[0] = GrPipelineBuilder::kBoth_DrawFace;
                     } else {
                         if (fStencilWrapOps) {
                             passes[0] = &gWindSingleStencilWithWrapInc;
@@ -451,8 +451,8 @@
                             passes[1] = &gWindSingleStencilNoWrapDec;
                         }
                         // which is cw and which is ccw is arbitrary.
-                        drawFace[0] = GrDrawState::kCW_DrawFace;
-                        drawFace[1] = GrDrawState::kCCW_DrawFace;
+                        drawFace[0] = GrPipelineBuilder::kCW_DrawFace;
+                        drawFace[1] = GrPipelineBuilder::kCCW_DrawFace;
                         passCount = 3;
                     }
                     if (stencilOnly) {
@@ -460,7 +460,7 @@
                         --passCount;
                     } else {
                         lastPassIsBounds = true;
-                        drawFace[passCount-1] = GrDrawState::kBoth_DrawFace;
+                        drawFace[passCount-1] = GrPipelineBuilder::kBoth_DrawFace;
                         if (reverse) {
                             passes[passCount-1] = &gInvWindColorPass;
                         } else {
@@ -476,21 +476,21 @@
     }
 
     SkRect devBounds;
-    GetPathDevBounds(path, drawState->getRenderTarget(), viewMatrix, &devBounds);
+    GetPathDevBounds(path, pipelineBuilder->getRenderTarget(), viewMatrix, &devBounds);
 
     for (int p = 0; p < passCount; ++p) {
-        drawState->setDrawFace(drawFace[p]);
+        pipelineBuilder->setDrawFace(drawFace[p]);
         if (passes[p]) {
-            *drawState->stencil() = *passes[p];
+            *pipelineBuilder->stencil() = *passes[p];
         }
 
         if (lastPassIsBounds && (p == passCount-1)) {
-            // Reset the XP Factory on drawState
-            drawState->setXPFactory(backupXPFactory);
+            // Reset the XP Factory on pipelineBuilder
+            pipelineBuilder->setXPFactory(backupXPFactory);
             SkRect bounds;
             SkMatrix localMatrix = SkMatrix::I();
             if (reverse) {
-                SkASSERT(drawState->getRenderTarget());
+                SkASSERT(pipelineBuilder->getRenderTarget());
                 // draw over the dev bounds (which will be the whole dst surface for inv fill).
                 bounds = devBounds;
                 SkMatrix vmi;
@@ -508,12 +508,12 @@
             GrDrawTarget::AutoGeometryPush agp(target);
             const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? SkMatrix::I() :
                                                                                viewMatrix;
-            target->drawRect(drawState, color, viewM, bounds, NULL, &localMatrix);
+            target->drawRect(pipelineBuilder, color, viewM, bounds, NULL, &localMatrix);
         } else {
             if (passCount > 1) {
-                drawState->setDisableColorXPFactory();
+                pipelineBuilder->setDisableColorXPFactory();
             }
-            GrDrawState::AutoRestoreEffects are(drawState);
+            GrPipelineBuilder::AutoRestoreEffects are(pipelineBuilder);
             SkAutoTUnref<const GrGeometryProcessor> gp(
                     GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPosition_GPType,
                                                     color,
@@ -522,7 +522,7 @@
                                                     false,
                                                     newCoverage));
             if (indexCnt) {
-                target->drawIndexed(drawState,
+                target->drawIndexed(pipelineBuilder,
                                     gp,
                                     primType,
                                     0,
@@ -531,7 +531,7 @@
                                     indexCnt,
                                     &devBounds);
             } else {
-                target->drawNonIndexed(drawState, gp, primType, 0, vertexCnt, &devBounds);
+                target->drawNonIndexed(pipelineBuilder, gp, primType, 0, vertexCnt, &devBounds);
             }
         }
     }
@@ -539,7 +539,7 @@
 }
 
 bool GrDefaultPathRenderer::canDrawPath(const GrDrawTarget* target,
-                                        const GrDrawState* drawState,
+                                        const GrPipelineBuilder* pipelineBuilder,
                                         const SkMatrix& viewMatrix,
                                         const SkPath& path,
                                         const SkStrokeRec& stroke,
@@ -551,14 +551,14 @@
 }
 
 bool GrDefaultPathRenderer::onDrawPath(GrDrawTarget* target,
-                                       GrDrawState* drawState,
+                                       GrPipelineBuilder* pipelineBuilder,
                                        GrColor color,
                                        const SkMatrix& viewMatrix,
                                        const SkPath& path,
                                        const SkStrokeRec& stroke,
                                        bool antiAlias) {
     return this->internalDrawPath(target,
-                                  drawState,
+                                  pipelineBuilder,
                                   color,
                                   viewMatrix,
                                   path,
@@ -567,11 +567,11 @@
 }
 
 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target,
-                                          GrDrawState* drawState,
+                                          GrPipelineBuilder* pipelineBuilder,
                                           const SkMatrix& viewMatrix,
                                           const SkPath& path,
                                           const SkStrokeRec& stroke) {
     SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType());
     SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType());
-    this->internalDrawPath(target, drawState, GrColor_WHITE, viewMatrix, path, stroke, true);
+    this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, path, stroke, true);
 }
diff --git a/src/gpu/GrDefaultPathRenderer.h b/src/gpu/GrDefaultPathRenderer.h
index e1eea88..5a805e5 100644
--- a/src/gpu/GrDefaultPathRenderer.h
+++ b/src/gpu/GrDefaultPathRenderer.h
@@ -20,7 +20,7 @@
     GrDefaultPathRenderer(bool separateStencilSupport, bool stencilWrapOpsSupport);
 
     virtual bool canDrawPath(const GrDrawTarget*,
-                             const GrDrawState*,
+                             const GrPipelineBuilder*,
                              const SkMatrix& viewMatrix,
                              const SkPath&,
                              const SkStrokeRec&,
@@ -29,12 +29,12 @@
 private:
 
     virtual StencilSupport onGetStencilSupport(const GrDrawTarget*,
-                                               const GrDrawState*,
+                                               const GrPipelineBuilder*,
                                                const SkPath&,
                                                const SkStrokeRec&) const SK_OVERRIDE;
 
     virtual bool onDrawPath(GrDrawTarget*,
-                            GrDrawState*,
+                            GrPipelineBuilder*,
                             GrColor,
                             const SkMatrix& viewMatrix,
                             const SkPath&,
@@ -42,13 +42,13 @@
                             bool antiAlias) SK_OVERRIDE;
 
     virtual void onStencilPath(GrDrawTarget*,
-                               GrDrawState*,
+                               GrPipelineBuilder*,
                                const SkMatrix& viewMatrix,
                                const SkPath&,
                                const SkStrokeRec&) SK_OVERRIDE;
 
     bool internalDrawPath(GrDrawTarget*,
-                          GrDrawState*,
+                          GrPipelineBuilder*,
                           GrColor,
                           const SkMatrix& viewMatrix,
                           const SkPath&,
@@ -56,7 +56,7 @@
                           bool stencilOnly);
 
     bool createGeom(GrDrawTarget*,
-                    GrDrawState*,
+                    GrPipelineBuilder*,
                     GrPrimitiveType*,
                     int* vertexCnt,
                     int* indexCnt,
diff --git a/src/gpu/GrDistanceFieldTextContext.cpp b/src/gpu/GrDistanceFieldTextContext.cpp
index 1480975..425c56c 100755
--- a/src/gpu/GrDistanceFieldTextContext.cpp
+++ b/src/gpu/GrDistanceFieldTextContext.cpp
@@ -636,8 +636,8 @@
     }
 
     if (fCurrVertex > 0) {
-        GrDrawState drawState;
-        drawState.setFromPaint(fPaint, fContext->getRenderTarget());
+        GrPipelineBuilder pipelineBuilder;
+        pipelineBuilder.setFromPaint(fPaint, fContext->getRenderTarget());
 
         // setup our sampler state for our text texture/atlas
         SkASSERT(SkIsAlign4(fCurrVertex));
@@ -657,7 +657,8 @@
             // TODO: move supportsRGBCoverage check to setupCoverageEffect and only add LCD
             // processor if the xp can support it. For now we will simply assume that if
             // fUseLCDText is true, then we have a known color output.
-            if (!drawState.getXPFactory()->supportsRGBCoverage(0, kRGBA_GrColorComponentFlags)) {
+            const GrXPFactory* xpFactory = pipelineBuilder.getXPFactory();
+            if (!xpFactory->supportsRGBCoverage(0, kRGBA_GrColorComponentFlags)) {
                 SkDebugf("LCD Text will not draw correctly.\n");
             }
             SkASSERT(!fCachedGeometryProcessor->hasVertexColor());
@@ -667,7 +668,7 @@
         }
         int nGlyphs = fCurrVertex / kVerticesPerGlyph;
         fDrawTarget->setIndexSourceToBuffer(fContext->getQuadIndexBuffer());
-        fDrawTarget->drawIndexedInstances(&drawState,
+        fDrawTarget->drawIndexedInstances(&pipelineBuilder,
                                           fCachedGeometryProcessor.get(),
                                           kTriangles_GrPrimitiveType,
                                           nGlyphs,
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index f145154..e8a758d 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -306,7 +306,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 
-bool GrDrawTarget::checkDraw(const GrDrawState& drawState,
+bool GrDrawTarget::checkDraw(const GrPipelineBuilder& pipelineBuilder,
                              const GrGeometryProcessor* gp,
                              GrPrimitiveType type,
                              int startVertex,
@@ -324,7 +324,8 @@
             maxValidVertex = geoSrc.fVertexCount;
             break;
         case kBuffer_GeometrySrcType:
-            maxValidVertex = static_cast<int>(geoSrc.fVertexBuffer->gpuMemorySize() / geoSrc.fVertexSize);
+            maxValidVertex = static_cast<int>(geoSrc.fVertexBuffer->gpuMemorySize() /
+                                              geoSrc.fVertexSize);
             break;
     }
     if (maxVertex > maxValidVertex) {
@@ -340,7 +341,8 @@
                 maxValidIndex = geoSrc.fIndexCount;
                 break;
             case kBuffer_GeometrySrcType:
-                maxValidIndex = static_cast<int>(geoSrc.fIndexBuffer->gpuMemorySize() / sizeof(uint16_t));
+                maxValidIndex = static_cast<int>(geoSrc.fIndexBuffer->gpuMemorySize() /
+                                                 sizeof(uint16_t));
                 break;
         }
         if (maxIndex > maxValidIndex) {
@@ -348,49 +350,49 @@
         }
     }
 
-    SkASSERT(drawState.getRenderTarget());
+    SkASSERT(pipelineBuilder.getRenderTarget());
 
     if (gp) {
         int numTextures = gp->numTextures();
         for (int t = 0; t < numTextures; ++t) {
             GrTexture* texture = gp->texture(t);
-            SkASSERT(texture->asRenderTarget() != drawState.getRenderTarget());
+            SkASSERT(texture->asRenderTarget() != pipelineBuilder.getRenderTarget());
         }
     }
 
-    for (int s = 0; s < drawState.numColorStages(); ++s) {
-        const GrProcessor* effect = drawState.getColorStage(s).processor();
+    for (int s = 0; s < pipelineBuilder.numColorStages(); ++s) {
+        const GrProcessor* effect = pipelineBuilder.getColorStage(s).processor();
         int numTextures = effect->numTextures();
         for (int t = 0; t < numTextures; ++t) {
             GrTexture* texture = effect->texture(t);
-            SkASSERT(texture->asRenderTarget() != drawState.getRenderTarget());
+            SkASSERT(texture->asRenderTarget() != pipelineBuilder.getRenderTarget());
         }
     }
-    for (int s = 0; s < drawState.numCoverageStages(); ++s) {
-        const GrProcessor* effect = drawState.getCoverageStage(s).processor();
+    for (int s = 0; s < pipelineBuilder.numCoverageStages(); ++s) {
+        const GrProcessor* effect = pipelineBuilder.getCoverageStage(s).processor();
         int numTextures = effect->numTextures();
         for (int t = 0; t < numTextures; ++t) {
             GrTexture* texture = effect->texture(t);
-            SkASSERT(texture->asRenderTarget() != drawState.getRenderTarget());
+            SkASSERT(texture->asRenderTarget() != pipelineBuilder.getRenderTarget());
         }
     }
 
 #endif
-    if (NULL == drawState.getRenderTarget()) {
+    if (NULL == pipelineBuilder.getRenderTarget()) {
         return false;
     }
     return true;
 }
 
-bool GrDrawTarget::setupDstReadIfNecessary(GrDrawState* ds,
+bool GrDrawTarget::setupDstReadIfNecessary(GrPipelineBuilder* pipelineBuilder,
                                            GrDeviceCoordTexture* dstCopy,
                                            const SkRect* drawBounds) {
-    if (this->caps()->dstReadInShaderSupport() || !ds->willEffectReadDstColor()) {
+    if (this->caps()->dstReadInShaderSupport() || !pipelineBuilder->willEffectReadDstColor()) {
         return true;
     }
     SkIRect copyRect;
     const GrClipData* clip = this->getClip();
-    GrRenderTarget* rt = ds->getRenderTarget();
+    GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
     clip->getConservativeBounds(rt, &copyRect);
 
     if (drawBounds) {
@@ -432,7 +434,7 @@
     }
 }
 
-void GrDrawTarget::drawIndexed(GrDrawState* ds,
+void GrDrawTarget::drawIndexed(GrPipelineBuilder* pipelineBuilder,
                                const GrGeometryProcessor* gp,
                                GrPrimitiveType type,
                                int startVertex,
@@ -440,15 +442,16 @@
                                int vertexCount,
                                int indexCount,
                                const SkRect* devBounds) {
-    SkASSERT(ds);
+    SkASSERT(pipelineBuilder);
     if (indexCount > 0 &&
-        this->checkDraw(*ds, gp, type, startVertex, startIndex, vertexCount, indexCount)) {
+        this->checkDraw(*pipelineBuilder, gp, type, startVertex, startIndex, vertexCount,
+                        indexCount)) {
 
         // Setup clip
         GrScissorState scissorState;
-        GrDrawState::AutoRestoreEffects are;
-        GrDrawState::AutoRestoreStencil ars;
-        if (!this->setupClip(ds, &are, &ars, &scissorState, devBounds)) {
+        GrPipelineBuilder::AutoRestoreEffects are;
+        GrPipelineBuilder::AutoRestoreStencil ars;
+        if (!this->setupClip(pipelineBuilder, &are, &ars, &scissorState, devBounds)) {
             return;
         }
 
@@ -469,29 +472,30 @@
 
         // TODO: We should continue with incorrect blending.
         GrDeviceCoordTexture dstCopy;
-        if (!this->setupDstReadIfNecessary(ds, &dstCopy, devBounds)) {
+        if (!this->setupDstReadIfNecessary(pipelineBuilder, &dstCopy, devBounds)) {
             return;
         }
         this->setDrawBuffers(&info, gp->getVertexStride());
 
-        this->onDraw(*ds, gp, info, scissorState, dstCopy.texture() ? &dstCopy : NULL);
+        this->onDraw(*pipelineBuilder, gp, info, scissorState, dstCopy.texture() ? &dstCopy : NULL);
     }
 }
 
-void GrDrawTarget::drawNonIndexed(GrDrawState* ds,
+void GrDrawTarget::drawNonIndexed(GrPipelineBuilder* pipelineBuilder,
                                   const GrGeometryProcessor* gp,
                                   GrPrimitiveType type,
                                   int startVertex,
                                   int vertexCount,
                                   const SkRect* devBounds) {
-    SkASSERT(ds);
-    if (vertexCount > 0 && this->checkDraw(*ds, gp, type, startVertex, -1, vertexCount, -1)) {
+    SkASSERT(pipelineBuilder);
+    if (vertexCount > 0 && this->checkDraw(*pipelineBuilder, gp, type, startVertex, -1, vertexCount,
+                                           -1)) {
 
         // Setup clip
         GrScissorState scissorState;
-        GrDrawState::AutoRestoreEffects are;
-        GrDrawState::AutoRestoreStencil ars;
-        if (!this->setupClip(ds, &are, &ars, &scissorState, devBounds)) {
+        GrPipelineBuilder::AutoRestoreEffects are;
+        GrPipelineBuilder::AutoRestoreStencil ars;
+        if (!this->setupClip(pipelineBuilder, &are, &ars, &scissorState, devBounds)) {
             return;
         }
 
@@ -512,13 +516,13 @@
 
         // TODO: We should continue with incorrect blending.
         GrDeviceCoordTexture dstCopy;
-        if (!this->setupDstReadIfNecessary(ds, &dstCopy, devBounds)) {
+        if (!this->setupDstReadIfNecessary(pipelineBuilder, &dstCopy, devBounds)) {
             return;
         }
 
         this->setDrawBuffers(&info, gp->getVertexStride());
 
-        this->onDraw(*ds, gp, info, scissorState, dstCopy.texture() ? &dstCopy : NULL);
+        this->onDraw(*pipelineBuilder, gp, info, scissorState, dstCopy.texture() ? &dstCopy : NULL);
     }
 }
 
@@ -557,68 +561,68 @@
     this->clipMaskManager()->adjustPathStencilParams(sb, outStencilSettings);
 }
 
-void GrDrawTarget::stencilPath(GrDrawState* ds,
+void GrDrawTarget::stencilPath(GrPipelineBuilder* pipelineBuilder,
                                const GrPathProcessor* pathProc,
                                const GrPath* path,
                                GrPathRendering::FillType fill) {
     // TODO: extract portions of checkDraw that are relevant to path stenciling.
     SkASSERT(path);
     SkASSERT(this->caps()->pathRenderingSupport());
-    SkASSERT(ds);
+    SkASSERT(pipelineBuilder);
 
     // Setup clip
     GrScissorState scissorState;
-    GrDrawState::AutoRestoreEffects are;
-    GrDrawState::AutoRestoreStencil ars;
-    if (!this->setupClip(ds, &are, &ars, &scissorState, NULL)) {
+    GrPipelineBuilder::AutoRestoreEffects are;
+    GrPipelineBuilder::AutoRestoreStencil ars;
+    if (!this->setupClip(pipelineBuilder, &are, &ars, &scissorState, NULL)) {
         return;
     }
 
     // set stencil settings for path
     GrStencilSettings stencilSettings;
     this->getPathStencilSettingsForFilltype(fill,
-                                            ds->getRenderTarget()->getStencilBuffer(),
+                                            pipelineBuilder->getRenderTarget()->getStencilBuffer(),
                                             &stencilSettings);
 
-    this->onStencilPath(*ds, pathProc, path, scissorState, stencilSettings);
+    this->onStencilPath(*pipelineBuilder, pathProc, path, scissorState, stencilSettings);
 }
 
-void GrDrawTarget::drawPath(GrDrawState* ds,
+void GrDrawTarget::drawPath(GrPipelineBuilder* pipelineBuilder,
                             const GrPathProcessor* pathProc,
                             const GrPath* path,
                             GrPathRendering::FillType fill) {
     // TODO: extract portions of checkDraw that are relevant to path rendering.
     SkASSERT(path);
     SkASSERT(this->caps()->pathRenderingSupport());
-    SkASSERT(ds);
+    SkASSERT(pipelineBuilder);
 
     SkRect devBounds = path->getBounds();
     pathProc->viewMatrix().mapRect(&devBounds);
 
     // Setup clip
     GrScissorState scissorState;
-    GrDrawState::AutoRestoreEffects are;
-    GrDrawState::AutoRestoreStencil ars;
-    if (!this->setupClip(ds, &are, &ars, &scissorState, &devBounds)) {
+    GrPipelineBuilder::AutoRestoreEffects are;
+    GrPipelineBuilder::AutoRestoreStencil ars;
+    if (!this->setupClip(pipelineBuilder, &are, &ars, &scissorState, &devBounds)) {
        return;
     }
 
     // set stencil settings for path
     GrStencilSettings stencilSettings;
     this->getPathStencilSettingsForFilltype(fill,
-                                            ds->getRenderTarget()->getStencilBuffer(),
+                                            pipelineBuilder->getRenderTarget()->getStencilBuffer(),
                                             &stencilSettings);
 
     GrDeviceCoordTexture dstCopy;
-    if (!this->setupDstReadIfNecessary(ds, &dstCopy, &devBounds)) {
+    if (!this->setupDstReadIfNecessary(pipelineBuilder, &dstCopy, &devBounds)) {
         return;
     }
 
-    this->onDrawPath(*ds, pathProc, path, scissorState, stencilSettings, dstCopy.texture() ? &dstCopy :
-                                                                                       NULL);
+    this->onDrawPath(*pipelineBuilder, pathProc, path, scissorState, stencilSettings,
+                     dstCopy.texture() ? &dstCopy : NULL);
 }
 
-void GrDrawTarget::drawPaths(GrDrawState* ds,
+void GrDrawTarget::drawPaths(GrPipelineBuilder* pipelineBuilder,
                              const GrPathProcessor* pathProc,
                              const GrPathRange* pathRange,
                              const void* indices,
@@ -632,21 +636,21 @@
     SkASSERT(indices);
     SkASSERT(0 == reinterpret_cast<long>(indices) % GrPathRange::PathIndexSizeInBytes(indexType));
     SkASSERT(transformValues);
-    SkASSERT(ds);
+    SkASSERT(pipelineBuilder);
 
     // Setup clip
     GrScissorState scissorState;
-    GrDrawState::AutoRestoreEffects are;
-    GrDrawState::AutoRestoreStencil ars;
+    GrPipelineBuilder::AutoRestoreEffects are;
+    GrPipelineBuilder::AutoRestoreStencil ars;
 
-    if (!this->setupClip(ds, &are, &ars, &scissorState, NULL)) {
+    if (!this->setupClip(pipelineBuilder, &are, &ars, &scissorState, NULL)) {
         return;
     }
 
     // set stencil settings for path
     GrStencilSettings stencilSettings;
     this->getPathStencilSettingsForFilltype(fill,
-                                            ds->getRenderTarget()->getStencilBuffer(),
+                                            pipelineBuilder->getRenderTarget()->getStencilBuffer(),
                                             &stencilSettings);
 
     // Don't compute a bounding box for setupDstReadIfNecessary(), we'll opt
@@ -654,12 +658,13 @@
     // point, because any context that supports NV_path_rendering will also
     // support NV_blend_equation_advanced.
     GrDeviceCoordTexture dstCopy;
-    if (!this->setupDstReadIfNecessary(ds, &dstCopy, NULL)) {
+    if (!this->setupDstReadIfNecessary(pipelineBuilder, &dstCopy, NULL)) {
         return;
     }
 
-    this->onDrawPaths(*ds, pathProc, pathRange, indices, indexType, transformValues, transformType,
-                      count, scissorState, stencilSettings, dstCopy.texture() ? &dstCopy : NULL);
+    this->onDrawPaths(*pipelineBuilder, pathProc, pathRange, indices, indexType, transformValues,
+                      transformType, count, scissorState, stencilSettings,
+                      dstCopy.texture() ? &dstCopy : NULL);
 }
 
 void GrDrawTarget::clear(const SkIRect* rect,
@@ -677,10 +682,10 @@
             this->discard(renderTarget);
         }
 
-        GrDrawState drawState;
-        drawState.setRenderTarget(renderTarget);
+        GrPipelineBuilder pipelineBuilder;
+        pipelineBuilder.setRenderTarget(renderTarget);
 
-        this->drawSimpleRect(&drawState, color, SkMatrix::I(), *rect);
+        this->drawSimpleRect(&pipelineBuilder, color, SkMatrix::I(), *rect);
     } else {       
         this->onClear(rect, color, canIgnoreRect, renderTarget);
     }
@@ -727,14 +732,14 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 
-void GrDrawTarget::drawIndexedInstances(GrDrawState* ds,
+void GrDrawTarget::drawIndexedInstances(GrPipelineBuilder* pipelineBuilder,
                                         const GrGeometryProcessor* gp,
                                         GrPrimitiveType type,
                                         int instanceCount,
                                         int verticesPerInstance,
                                         int indicesPerInstance,
                                         const SkRect* devBounds) {
-    SkASSERT(ds);
+    SkASSERT(pipelineBuilder);
 
     if (!verticesPerInstance || !indicesPerInstance) {
         return;
@@ -747,9 +752,9 @@
 
     // Setup clip
     GrScissorState scissorState;
-    GrDrawState::AutoRestoreEffects are;
-    GrDrawState::AutoRestoreStencil ars;
-    if (!this->setupClip(ds, &are, &ars, &scissorState, devBounds)) {
+    GrPipelineBuilder::AutoRestoreEffects are;
+    GrPipelineBuilder::AutoRestoreStencil ars;
+    if (!this->setupClip(pipelineBuilder, &are, &ars, &scissorState, devBounds)) {
         return;
     }
 
@@ -767,7 +772,7 @@
 
     // TODO: We should continue with incorrect blending.
     GrDeviceCoordTexture dstCopy;
-    if (!this->setupDstReadIfNecessary(ds, &dstCopy, devBounds)) {
+    if (!this->setupDstReadIfNecessary(pipelineBuilder, &dstCopy, devBounds)) {
         return;
     }
 
@@ -776,7 +781,7 @@
         info.fVertexCount = info.fInstanceCount * verticesPerInstance;
         info.fIndexCount = info.fInstanceCount * indicesPerInstance;
 
-        if (this->checkDraw(*ds,
+        if (this->checkDraw(*pipelineBuilder,
                             gp,
                             type,
                             info.fStartVertex,
@@ -784,7 +789,8 @@
                             info.fVertexCount,
                             info.fIndexCount)) {
             this->setDrawBuffers(&info, gp->getVertexStride());
-            this->onDraw(*ds, gp, info, scissorState, dstCopy.texture() ? &dstCopy : NULL);
+            this->onDraw(*pipelineBuilder, gp, info, scissorState,
+                         dstCopy.texture() ? &dstCopy : NULL);
         }
         info.fStartVertex += info.fVertexCount;
         instanceCount -= info.fInstanceCount;
@@ -938,18 +944,18 @@
         return false;
     }
 
-    GrDrawState drawState;
-    drawState.setRenderTarget(rt);
+    GrPipelineBuilder pipelineBuilder;
+    pipelineBuilder.setRenderTarget(rt);
     SkMatrix matrix;
     matrix.setTranslate(SkIntToScalar(clippedSrcRect.fLeft - clippedDstPoint.fX),
                         SkIntToScalar(clippedSrcRect.fTop - clippedDstPoint.fY));
     matrix.postIDiv(tex->width(), tex->height());
-    drawState.addColorTextureProcessor(tex, matrix);
+    pipelineBuilder.addColorTextureProcessor(tex, matrix);
     SkIRect dstRect = SkIRect::MakeXYWH(clippedDstPoint.fX,
                                         clippedDstPoint.fY,
                                         clippedSrcRect.width(),
                                         clippedSrcRect.height());
-    this->drawSimpleRect(&drawState, GrColor_WHITE, SkMatrix::I(), dstRect);
+    this->drawSimpleRect(&pipelineBuilder, GrColor_WHITE, SkMatrix::I(), dstRect);
     return true;
 }
 
@@ -1210,12 +1216,12 @@
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-bool GrClipTarget::setupClip(GrDrawState* ds,
-                             GrDrawState::AutoRestoreEffects* are,
-                             GrDrawState::AutoRestoreStencil* ars,
+bool GrClipTarget::setupClip(GrPipelineBuilder* pipelineBuilder,
+                             GrPipelineBuilder::AutoRestoreEffects* are,
+                             GrPipelineBuilder::AutoRestoreStencil* ars,
                              GrScissorState* scissorState,
                              const SkRect* devBounds) {
-    return fClipMaskManager.setupClipping(ds,
+    return fClipMaskManager.setupClipping(pipelineBuilder,
                                           are,
                                           ars,
                                           scissorState,
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 6628e37..b66f1c6 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -11,9 +11,9 @@
 #include "GrClipData.h"
 #include "GrClipMaskManager.h"
 #include "GrContext.h"
-#include "GrDrawState.h"
 #include "GrIndexBuffer.h"
 #include "GrPathRendering.h"
+#include "GrPipelineBuilder.h"
 #include "GrTraceMarker.h"
 #include "GrVertexBuffer.h"
 
@@ -125,7 +125,7 @@
      * snapshot of the data is made and the pointers are invalid.
      *
      * @param vertexCount  the number of vertices to reserve space for. Can be
-     *                     0. Vertex size is queried from the current GrDrawState.
+     *                     0. Vertex size is queried from the current GrPipelineBuilder.
      * @param indexCount   the number of indices to reserve space for. Can be 0.
      * @param vertices     will point to reserved vertex space if vertexCount is
      *                     non-zero. Illegal to pass NULL if vertexCount > 0.
@@ -148,7 +148,7 @@
      *
      * @param vertexCount  in: hint about how many vertices the caller would
      *                     like to allocate. Vertex size is queried from the
-     *                     current GrDrawState.
+     *                     current GrPipelineBuilder.
      *                     out: a hint about the number of vertices that can be
      *                     allocated cheaply. Negative means no hint.
      *                     Ignored if NULL.
@@ -168,7 +168,7 @@
      *
      * @param buffer        vertex buffer containing vertex data. Must be
      *                      unlocked before draw call. Vertex size is queried
-     *                      from current GrDrawState.
+     *                      from current GrPipelineBuilder.
      */
     void setVertexSourceToBuffer(const GrVertexBuffer* buffer, size_t vertexStride);
 
@@ -232,7 +232,7 @@
      * @param devBounds    optional bounds hint. This is a promise from the caller,
      *                     not a request for clipping.
      */
-    void drawIndexed(GrDrawState*,
+    void drawIndexed(GrPipelineBuilder*,
                      const GrGeometryProcessor*,
                      GrPrimitiveType type,
                      int startVertex,
@@ -252,7 +252,7 @@
      * @param devBounds    optional bounds hint. This is a promise from the caller,
      *                     not a request for clipping.
      */
-    void drawNonIndexed(GrDrawState*,
+    void drawNonIndexed(GrPipelineBuilder*,
                         const GrGeometryProcessor*,
                         GrPrimitiveType type,
                         int startVertex,
@@ -262,21 +262,23 @@
     /**
      * Draws path into the stencil buffer. The fill must be either even/odd or
      * winding (not inverse or hairline). It will respect the HW antialias flag
-     * on the draw state (if possible in the 3D API).  Note, we will never have an inverse fill
-     * with stencil path
+     * on the GrPipelineBuilder (if possible in the 3D API).  Note, we will never have an inverse
+     * fill with stencil path
      */
-    void stencilPath(GrDrawState*, const GrPathProcessor*, const GrPath*,GrPathRendering::FillType);
+    void stencilPath(GrPipelineBuilder*, const GrPathProcessor*, const GrPath*,
+                     GrPathRendering::FillType);
 
     /**
      * Draws a path. Fill must not be a hairline. It will respect the HW
-     * antialias flag on the draw state (if possible in the 3D API).
+     * antialias flag on the GrPipelineBuilder (if possible in the 3D API).
      */
-    void drawPath(GrDrawState*, const GrPathProcessor*, const GrPath*, GrPathRendering::FillType);
+    void drawPath(GrPipelineBuilder*, const GrPathProcessor*, const GrPath*,
+                  GrPathRendering::FillType);
 
     /**
      * Draws the aggregate path from combining multiple. Note that this will not
      * always be equivalent to back-to-back calls to drawPath(). It will respect
-     * the HW antialias flag on the draw state (if possible in the 3D API).
+     * the HW antialias flag on the GrPipelineBuilder (if possible in the 3D API).
      *
      * @param pathRange       Source paths to draw from
      * @param indices         Array of path indices to draw
@@ -286,7 +288,7 @@
      * @param count           Number of paths to draw
      * @param fill            Fill type for drawing all the paths
      */
-    void drawPaths(GrDrawState*,
+    void drawPaths(GrPipelineBuilder*,
                    const GrPathProcessor*,
                    const GrPathRange* pathRange,
                    const void* indices,
@@ -308,7 +310,7 @@
      *                    that rectangle before it is input to GrCoordTransforms that read local
      *                    coordinates
      */
-    void drawRect(GrDrawState* ds,
+    void drawRect(GrPipelineBuilder* ds,
                   GrColor color,
                   const SkMatrix& viewMatrix,
                   const SkRect& rect,
@@ -321,10 +323,11 @@
     /**
      * Helper for drawRect when the caller doesn't need separate local rects or matrices.
      */
-    void drawSimpleRect(GrDrawState* ds, GrColor color, const SkMatrix& viewM, const SkRect& rect) {
+    void drawSimpleRect(GrPipelineBuilder* ds, GrColor color, const SkMatrix& viewM,
+                        const SkRect& rect) {
         this->drawRect(ds, color, viewM, rect, NULL, NULL);
     }
-    void drawSimpleRect(GrDrawState* ds, GrColor color, const SkMatrix& viewM,
+    void drawSimpleRect(GrPipelineBuilder* ds, GrColor color, const SkMatrix& viewM,
                         const SkIRect& irect) {
         SkRect rect = SkRect::Make(irect);
         this->drawRect(ds, color, viewM, rect, NULL, NULL);
@@ -360,7 +363,7 @@
      * @param devBounds    optional bounds hint. This is a promise from the caller,
      *                     not a request for clipping.
      */
-    void drawIndexedInstances(GrDrawState*,
+    void drawIndexedInstances(GrPipelineBuilder*,
                               const GrGeometryProcessor*,
                               GrPrimitiveType type,
                               int instanceCount,
@@ -369,9 +372,9 @@
                               const SkRect* devBounds = NULL);
 
     /**
-     * Clear the passed in render target. Ignores the draw state and clip. Clears the whole thing if
-     * rect is NULL, otherwise just the rect. If canIgnoreRect is set then the entire render target
-     * can be optionally cleared.
+     * Clear the passed in render target. Ignores the GrPipelineBuilder and clip. Clears the whole
+     * thing if rect is NULL, otherwise just the rect. If canIgnoreRect is set then the entire
+     * render target can be optionally cleared.
      */
     void clear(const SkIRect* rect,
                GrColor color,
@@ -660,7 +663,7 @@
     // Makes a copy of the dst if it is necessary for the draw. Returns false if a copy is required
     // but couldn't be made. Otherwise, returns true.  This method needs to be protected because it
     // needs to be accessed by GLPrograms to setup a correct drawstate
-    bool setupDstReadIfNecessary(GrDrawState*,
+    bool setupDstReadIfNecessary(GrPipelineBuilder*,
                                  GrDeviceCoordTexture* dstCopy,
                                  const SkRect* drawBounds);
 
@@ -700,31 +703,31 @@
     virtual void geometrySourceWillPush() = 0;
     virtual void geometrySourceWillPop(const GeometrySrcState& restoredState) = 0;
     // subclass called to perform drawing
-    virtual void onDraw(const GrDrawState&,
+    virtual void onDraw(const GrPipelineBuilder&,
                         const GrGeometryProcessor*,
                         const DrawInfo&,
                         const GrScissorState&,
                         const GrDeviceCoordTexture* dstCopy) = 0;
     // TODO copy in order drawbuffer onDrawRect to here
-    virtual void onDrawRect(GrDrawState*,
+    virtual void onDrawRect(GrPipelineBuilder*,
                             GrColor color,
                             const SkMatrix& viewMatrix,
                             const SkRect& rect,
                             const SkRect* localRect,
                             const SkMatrix* localMatrix) = 0;
 
-    virtual void onStencilPath(const GrDrawState&,
+    virtual void onStencilPath(const GrPipelineBuilder&,
                                const GrPathProcessor*,
                                const GrPath*,
                                const GrScissorState&,
                                const GrStencilSettings&) = 0;
-    virtual void onDrawPath(const GrDrawState&,
+    virtual void onDrawPath(const GrPipelineBuilder&,
                             const GrPathProcessor*,
                             const GrPath*,
                             const GrScissorState&,
                             const GrStencilSettings&,
                             const GrDeviceCoordTexture* dstCopy) = 0;
-    virtual void onDrawPaths(const GrDrawState&,
+    virtual void onDrawPaths(const GrPipelineBuilder&,
                              const GrPathProcessor*,
                              const GrPathRange*,
                              const void* indices,
@@ -771,7 +774,7 @@
 
     // called by drawIndexed and drawNonIndexed. Use a negative indexCount to
     // indicate non-indexed drawing.
-    bool checkDraw(const GrDrawState&,
+    bool checkDraw(const GrPipelineBuilder&,
                    const GrGeometryProcessor*,
                    GrPrimitiveType type,
                    int startVertex,
@@ -788,9 +791,9 @@
                                            const GrStencilBuffer*,
                                            GrStencilSettings*);
     virtual GrClipMaskManager* clipMaskManager() = 0;
-    virtual bool setupClip(GrDrawState*,
-                           GrDrawState::AutoRestoreEffects* are,
-                           GrDrawState::AutoRestoreStencil* ars,
+    virtual bool setupClip(GrPipelineBuilder*,
+                           GrPipelineBuilder::AutoRestoreEffects* are,
+                           GrPipelineBuilder::AutoRestoreStencil* ars,
                            GrScissorState* scissorState,
                            const SkRect* devBounds) = 0;
 
@@ -848,9 +851,9 @@
 private:
     GrClipMaskManager* clipMaskManager() SK_OVERRIDE { return &fClipMaskManager; }
 
-    virtual bool setupClip(GrDrawState*,
-                           GrDrawState::AutoRestoreEffects* are,
-                           GrDrawState::AutoRestoreStencil* ars,
+    virtual bool setupClip(GrPipelineBuilder*,
+                           GrPipelineBuilder::AutoRestoreEffects* are,
+                           GrPipelineBuilder::AutoRestoreStencil* ars,
                            GrScissorState* scissorState,
                            const SkRect* devBounds) SK_OVERRIDE;
 
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 5bbc3dc..17bed8b 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -15,11 +15,11 @@
 
 class GrContext;
 class GrIndexBufferAllocPool;
-class GrOptDrawState;
 class GrPath;
 class GrPathRange;
 class GrPathRenderer;
 class GrPathRendererChain;
+class GrPipeline;
 class GrPrimitiveProcessor;
 class GrStencilBuffer;
 class GrVertexBufferAllocPool;
@@ -306,7 +306,7 @@
 
     virtual void buildProgramDesc(GrProgramDesc*,
                                   const GrPrimitiveProcessor&,
-                                  const GrOptDrawState&,
+                                  const GrPipeline&,
                                   const GrProgramDesc::DescInfo&,
                                   const GrBatchTracker&) const = 0;
 
@@ -351,17 +351,17 @@
     struct DrawArgs {
         typedef GrDrawTarget::DrawInfo DrawInfo;
         DrawArgs(const GrPrimitiveProcessor* primProc,
-                 const GrOptDrawState* optState,
+                 const GrPipeline* pipeline,
                  const GrProgramDesc* desc,
                  const GrBatchTracker* batchTracker)
             : fPrimitiveProcessor(primProc)
-            , fOptState(optState)
+            , fPipeline(pipeline)
             , fDesc(desc)
             , fBatchTracker(batchTracker) {
-            SkASSERT(primProc && optState && desc && batchTracker);
+            SkASSERT(primProc && pipeline && desc && batchTracker);
         }
         const GrPrimitiveProcessor* fPrimitiveProcessor;
-        const GrOptDrawState* fOptState;
+        const GrPipeline* fPipeline;
         const GrProgramDesc* fDesc;
         const GrBatchTracker* fBatchTracker;
     };
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 5b1f008..70d61ec 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -114,13 +114,13 @@
 
 static inline bool cmd_has_trace_marker(uint8_t cmd) { return SkToBool(cmd & kTraceCmdBit); }
 
-void GrInOrderDrawBuffer::onDrawRect(GrDrawState* ds,
+void GrInOrderDrawBuffer::onDrawRect(GrPipelineBuilder* pipelineBuilder,
                                      GrColor color,
                                      const SkMatrix& viewMatrix,
                                      const SkRect& rect,
                                      const SkRect* localRect,
                                      const SkMatrix* localMatrix) {
-    GrDrawState::AutoRestoreEffects are(ds);
+    GrPipelineBuilder::AutoRestoreEffects are(pipelineBuilder);
 
     // Go to device coords to allow batching across matrix changes
     SkMatrix invert = SkMatrix::I();
@@ -183,10 +183,12 @@
     }
 
     this->setIndexSourceToBuffer(this->getContext()->getQuadIndexBuffer());
-    this->drawIndexedInstances(ds, gp, kTriangles_GrPrimitiveType, 1, 4, 6, &devBounds);
+    this->drawIndexedInstances(pipelineBuilder, gp, kTriangles_GrPrimitiveType, 1, 4, 6,
+                               &devBounds);
 }
 
-int GrInOrderDrawBuffer::concatInstancedDraw(const GrDrawState& ds, const DrawInfo& info) {
+int GrInOrderDrawBuffer::concatInstancedDraw(const GrPipelineBuilder& pipelineBuilder,
+                                             const DrawInfo& info) {
     SkASSERT(!fCmdBuffer.empty());
     SkASSERT(info.isInstanced());
 
@@ -238,20 +240,20 @@
     return instancesToConcat;
 }
 
-void GrInOrderDrawBuffer::onDraw(const GrDrawState& ds,
+void GrInOrderDrawBuffer::onDraw(const GrPipelineBuilder& pipelineBuilder,
                                  const GrGeometryProcessor* gp,
                                  const DrawInfo& info,
                                  const GrScissorState& scissorState,
                                  const GrDeviceCoordTexture* dstCopy) {
     SkASSERT(info.vertexBuffer() && (!info.isIndexed() || info.indexBuffer()));
 
-    if (!this->recordStateAndShouldDraw(ds, gp, scissorState, dstCopy)) {
+    if (!this->recordStateAndShouldDraw(pipelineBuilder, gp, scissorState, dstCopy)) {
         return;
     }
 
     Draw* draw;
     if (info.isInstanced()) {
-        int instancesConcated = this->concatInstancedDraw(ds, info);
+        int instancesConcated = this->concatInstancedDraw(pipelineBuilder, info);
         if (info.instanceCount() > instancesConcated) {
             draw = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, Draw, (info));
             draw->fInfo.adjustInstanceCount(-instancesConcated);
@@ -264,28 +266,28 @@
     this->recordTraceMarkersIfNecessary();
 }
 
-void GrInOrderDrawBuffer::onStencilPath(const GrDrawState& ds,
+void GrInOrderDrawBuffer::onStencilPath(const GrPipelineBuilder& pipelineBuilder,
                                         const GrPathProcessor* pathProc,
                                         const GrPath* path,
                                         const GrScissorState& scissorState,
                                         const GrStencilSettings& stencilSettings) {
     StencilPath* sp = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, StencilPath,
-                                               (path, ds.getRenderTarget()));
+                                               (path, pipelineBuilder.getRenderTarget()));
     sp->fScissor = scissorState;
-    sp->fUseHWAA = ds.isHWAntialias();
+    sp->fUseHWAA = pipelineBuilder.isHWAntialias();
     sp->fViewMatrix = pathProc->viewMatrix();
     sp->fStencil = stencilSettings;
     this->recordTraceMarkersIfNecessary();
 }
 
-void GrInOrderDrawBuffer::onDrawPath(const GrDrawState& ds,
+void GrInOrderDrawBuffer::onDrawPath(const GrPipelineBuilder& pipelineBuilder,
                                      const GrPathProcessor* pathProc,
                                      const GrPath* path,
                                      const GrScissorState& scissorState,
                                      const GrStencilSettings& stencilSettings,
                                      const GrDeviceCoordTexture* dstCopy) {
-    // TODO: Only compare the subset of GrDrawState relevant to path covering?
-    if (!this->recordStateAndShouldDraw(ds, pathProc, scissorState, dstCopy)) {
+    // TODO: Only compare the subset of GrPipelineBuilder relevant to path covering?
+    if (!this->recordStateAndShouldDraw(pipelineBuilder, pathProc, scissorState, dstCopy)) {
         return;
     }
     DrawPath* dp = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, DrawPath, (path));
@@ -293,7 +295,7 @@
     this->recordTraceMarkersIfNecessary();
 }
 
-void GrInOrderDrawBuffer::onDrawPaths(const GrDrawState& ds,
+void GrInOrderDrawBuffer::onDrawPaths(const GrPipelineBuilder& pipelineBuilder,
                                       const GrPathProcessor* pathProc,
                                       const GrPathRange* pathRange,
                                       const void* indices,
@@ -308,7 +310,7 @@
     SkASSERT(indices);
     SkASSERT(transformValues);
 
-    if (!this->recordStateAndShouldDraw(ds, pathProc, scissorState, dstCopy)) {
+    if (!this->recordStateAndShouldDraw(pipelineBuilder, pathProc, scissorState, dstCopy)) {
         return;
     }
 
@@ -338,7 +340,7 @@
             transformType == previous->fTransformType &&
             stencilSettings == previous->fStencilSettings &&
             path_fill_type_is_winding(stencilSettings) &&
-            !ds.willBlendWithDst(pathProc)) {
+            !pipelineBuilder.willBlendWithDst(pathProc)) {
             // Fold this DrawPaths call into the one previous.
             previous->fCount += count;
             return;
@@ -430,8 +432,8 @@
         if (kSetState_Cmd == strip_trace_bit(iter->fType)) {
             SetState* ss = reinterpret_cast<SetState*>(iter.get());
 
-            this->getGpu()->buildProgramDesc(&ss->fDesc, *ss->fPrimitiveProcessor, ss->fState,
-                                             ss->fState.descInfo(), ss->fBatchTracker);
+            this->getGpu()->buildProgramDesc(&ss->fDesc, *ss->fPrimitiveProcessor, ss->fPipeline,
+                                             ss->fPipeline.descInfo(), ss->fBatchTracker);
             currentState = ss;
 
         } else {
@@ -449,7 +451,7 @@
 
 void GrInOrderDrawBuffer::Draw::execute(GrInOrderDrawBuffer* buf, const SetState* state) {
     SkASSERT(state);
-    DrawArgs args(state->fPrimitiveProcessor.get(), &state->fState, &state->fDesc,
+    DrawArgs args(state->fPrimitiveProcessor.get(), &state->fPipeline, &state->fDesc,
                   &state->fBatchTracker);
     buf->getGpu()->draw(args, fInfo);
 }
@@ -467,14 +469,14 @@
 
 void GrInOrderDrawBuffer::DrawPath::execute(GrInOrderDrawBuffer* buf, const SetState* state) {
     SkASSERT(state);
-    DrawArgs args(state->fPrimitiveProcessor.get(), &state->fState, &state->fDesc,
+    DrawArgs args(state->fPrimitiveProcessor.get(), &state->fPipeline, &state->fDesc,
                   &state->fBatchTracker);
     buf->getGpu()->drawPath(args, this->path(), fStencilSettings);
 }
 
 void GrInOrderDrawBuffer::DrawPaths::execute(GrInOrderDrawBuffer* buf, const SetState* state) {
     SkASSERT(state);
-    DrawArgs args(state->fPrimitiveProcessor.get(), &state->fState, &state->fDesc,
+    DrawArgs args(state->fPrimitiveProcessor.get(), &state->fPipeline, &state->fDesc,
                   &state->fBatchTracker);
     buf->getGpu()->drawPaths(args, this->pathRange(),
                             &buf->fPathIndexBuffer[fIndicesLocation], fIndexType,
@@ -514,26 +516,26 @@
     return false;
 }
 
-bool GrInOrderDrawBuffer::recordStateAndShouldDraw(const GrDrawState& ds,
+bool GrInOrderDrawBuffer::recordStateAndShouldDraw(const GrPipelineBuilder& pipelineBuilder,
                                                    const GrPrimitiveProcessor* primProc,
                                                    const GrScissorState& scissor,
                                                    const GrDeviceCoordTexture* dstCopy) {
     SetState* ss = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, SetState,
-                                            (ds, primProc, *this->getGpu()->caps(), scissor,
-                                             dstCopy));
-    if (ss->fState.mustSkip()) {
+                                            (pipelineBuilder, primProc, *this->getGpu()->caps(),
+                                             scissor, dstCopy));
+    if (ss->fPipeline.mustSkip()) {
         fCmdBuffer.pop_back();
         return false;
     }
 
     ss->fPrimitiveProcessor->initBatchTracker(&ss->fBatchTracker,
-                                              ss->fState.getInitBatchTracker());
+                                              ss->fPipeline.getInitBatchTracker());
 
     if (fPrevState &&
         fPrevState->fPrimitiveProcessor->canMakeEqual(fPrevState->fBatchTracker,
                                                       *ss->fPrimitiveProcessor,
                                                       ss->fBatchTracker) &&
-        fPrevState->fState.isEqual(ss->fState)) {
+        fPrevState->fPipeline.isEqual(ss->fPipeline)) {
         fCmdBuffer.pop_back();
     } else {
         fPrevState = ss;
diff --git a/src/gpu/GrInOrderDrawBuffer.h b/src/gpu/GrInOrderDrawBuffer.h
index ea1279b..afa7d27 100644
--- a/src/gpu/GrInOrderDrawBuffer.h
+++ b/src/gpu/GrInOrderDrawBuffer.h
@@ -9,7 +9,7 @@
 #define GrInOrderDrawBuffer_DEFINED
 
 #include "GrFlushToGpuDrawTarget.h"
-#include "GrOptDrawState.h"
+#include "GrPipeline.h"
 #include "GrPath.h"
 #include "GrTRecorder.h"
 
@@ -178,19 +178,20 @@
         GrPendingIOResource<GrSurface, kRead_GrIOType> fSrc;
     };
 
+    // TODO: rename to SetPipeline once pp, batch tracker, and desc are removed
     struct SetState : public Cmd {
-        SetState(const GrDrawState& drawState, const GrPrimitiveProcessor* primProc,
+        SetState(const GrPipelineBuilder& pipelineBuilder, const GrPrimitiveProcessor* primProc,
                  const GrDrawTargetCaps& caps,
                  const GrScissorState& scissor, const GrDeviceCoordTexture* dstCopy)
         : Cmd(kSetState_Cmd)
         , fPrimitiveProcessor(primProc)
-        , fState(drawState, primProc, caps, scissor, dstCopy) {}
+        , fPipeline(pipelineBuilder, primProc, caps, scissor, dstCopy) {}
 
         void execute(GrInOrderDrawBuffer*, const SetState*) SK_OVERRIDE;
 
         typedef GrPendingProgramElement<const GrPrimitiveProcessor> ProgramPrimitiveProcessor;
         ProgramPrimitiveProcessor   fPrimitiveProcessor;
-        const GrOptDrawState        fState;
+        const GrPipeline            fPipeline;
         GrProgramDesc               fDesc;
         GrBatchTracker              fBatchTracker;
     };
@@ -202,30 +203,30 @@
     void onFlush() SK_OVERRIDE;
 
     // overrides from GrDrawTarget
-    void onDraw(const GrDrawState&,
+    void onDraw(const GrPipelineBuilder&,
                 const GrGeometryProcessor*,
                 const DrawInfo&,
                 const GrScissorState&,
                 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE;
-    void onDrawRect(GrDrawState*,
+    void onDrawRect(GrPipelineBuilder*,
                     GrColor,
                     const SkMatrix& viewMatrix,
                     const SkRect& rect,
                     const SkRect* localRect,
                     const SkMatrix* localMatrix) SK_OVERRIDE;
 
-    void onStencilPath(const GrDrawState&,
+    void onStencilPath(const GrPipelineBuilder&,
                        const GrPathProcessor*,
                        const GrPath*,
                        const GrScissorState&,
                        const GrStencilSettings&) SK_OVERRIDE;
-    void onDrawPath(const GrDrawState&,
+    void onDrawPath(const GrPipelineBuilder&,
                     const GrPathProcessor*,
                     const GrPath*,
                     const GrScissorState&,
                     const GrStencilSettings&,
                     const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE;
-    void onDrawPaths(const GrDrawState&,
+    void onDrawPaths(const GrPipelineBuilder&,
                      const GrPathProcessor*,
                      const GrPathRange*,
                      const void* indices,
@@ -247,12 +248,12 @@
 
     // Attempts to concat instances from info onto the previous draw. info must represent an
     // instanced draw. The caller must have already recorded a new draw state and clip if necessary.
-    int concatInstancedDraw(const GrDrawState&, const DrawInfo&);
+    int concatInstancedDraw(const GrPipelineBuilder&, const DrawInfo&);
 
-    // Determines whether the current draw operation requires a new GrOptDrawState and if so
-    // records it. If the draw can be skipped false is returned and no new GrOptDrawState is
+    // Determines whether the current draw operation requires a new GrPipeline and if so
+    // records it. If the draw can be skipped false is returned and no new GrPipeline is
     // recorded.
-    bool SK_WARN_UNUSED_RESULT recordStateAndShouldDraw(const GrDrawState&,
+    bool SK_WARN_UNUSED_RESULT recordStateAndShouldDraw(const GrPipelineBuilder&,
                                                         const GrPrimitiveProcessor*,
                                                         const GrScissorState&,
                                                         const GrDeviceCoordTexture*);
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index a35d708..4b24e45 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -8,11 +8,11 @@
 #include "GrOvalRenderer.h"
 
 #include "GrProcessor.h"
-#include "GrDrawState.h"
 #include "GrDrawTarget.h"
 #include "GrGeometryProcessor.h"
 #include "GrGpu.h"
 #include "GrInvariantOutput.h"
+#include "GrPipelineBuilder.h"
 #include "SkRRect.h"
 #include "SkStrokeRec.h"
 #include "SkTLazy.h"
@@ -657,7 +657,7 @@
 }
 
 bool GrOvalRenderer::drawOval(GrDrawTarget* target,
-                              GrDrawState* drawState,
+                              GrPipelineBuilder* pipelineBuilder,
                               GrColor color,
                               const SkMatrix& viewMatrix,
                               bool useAA,
@@ -665,8 +665,8 @@
                               const SkStrokeRec& stroke)
 {
     bool useCoverageAA = useAA &&
-        !drawState->getRenderTarget()->isMultisampled() &&
-        drawState->canUseFracCoveragePrimProc(color, *target->caps());
+        !pipelineBuilder->getRenderTarget()->isMultisampled() &&
+        pipelineBuilder->canUseFracCoveragePrimProc(color, *target->caps());
 
     if (!useCoverageAA) {
         return false;
@@ -674,14 +674,15 @@
 
     // we can draw circles
     if (SkScalarNearlyEqual(oval.width(), oval.height()) && circle_stays_circle(viewMatrix)) {
-        this->drawCircle(target, drawState, color, viewMatrix, useCoverageAA, oval, stroke);
+        this->drawCircle(target, pipelineBuilder, color, viewMatrix, useCoverageAA, oval, stroke);
     // if we have shader derivative support, render as device-independent
     } else if (target->caps()->shaderDerivativeSupport()) {
-        return this->drawDIEllipse(target, drawState, color, viewMatrix, useCoverageAA, oval,
+        return this->drawDIEllipse(target, pipelineBuilder, color, viewMatrix, useCoverageAA, oval,
                                    stroke);
     // otherwise axis-aligned ellipses only
     } else if (viewMatrix.rectStaysRect()) {
-        return this->drawEllipse(target, drawState, color, viewMatrix, useCoverageAA, oval, stroke);
+        return this->drawEllipse(target, pipelineBuilder, color, viewMatrix, useCoverageAA, oval,
+                                 stroke);
     } else {
         return false;
     }
@@ -692,7 +693,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 void GrOvalRenderer::drawCircle(GrDrawTarget* target,
-                                GrDrawState* drawState,
+                                GrPipelineBuilder* pipelineBuilder,
                                 GrColor color,
                                 const SkMatrix& viewMatrix,
                                 bool useCoverageAA,
@@ -778,14 +779,14 @@
     verts[3].fInnerRadius = innerRadius;
 
     target->setIndexSourceToBuffer(fGpu->getQuadIndexBuffer());
-    target->drawIndexedInstances(drawState, gp, kTriangles_GrPrimitiveType, 1, 4, 6, &bounds);
+    target->drawIndexedInstances(pipelineBuilder, gp, kTriangles_GrPrimitiveType, 1, 4, 6, &bounds);
     target->resetIndexSource();
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 
 bool GrOvalRenderer::drawEllipse(GrDrawTarget* target,
-                                 GrDrawState* drawState,
+                                 GrPipelineBuilder* pipelineBuilder,
                                  GrColor color,
                                  const SkMatrix& viewMatrix,
                                  bool useCoverageAA,
@@ -912,14 +913,14 @@
     verts[3].fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadRecip);
 
     target->setIndexSourceToBuffer(fGpu->getQuadIndexBuffer());
-    target->drawIndexedInstances(drawState, gp, kTriangles_GrPrimitiveType, 1, 4, 6, &bounds);
+    target->drawIndexedInstances(pipelineBuilder, gp, kTriangles_GrPrimitiveType, 1, 4, 6, &bounds);
     target->resetIndexSource();
 
     return true;
 }
 
 bool GrOvalRenderer::drawDIEllipse(GrDrawTarget* target,
-                                   GrDrawState* drawState,
+                                   GrPipelineBuilder* pipelineBuilder,
                                    GrColor color,
                                    const SkMatrix& viewMatrix,
                                    bool useCoverageAA,
@@ -1020,7 +1021,7 @@
     verts[3].fInnerOffset = SkPoint::Make(innerRatioX + offsetDx, -innerRatioY - offsetDy);
 
     target->setIndexSourceToBuffer(fGpu->getQuadIndexBuffer());
-    target->drawIndexedInstances(drawState, gp, kTriangles_GrPrimitiveType, 1, 4, 6, &bounds);
+    target->drawIndexedInstances(pipelineBuilder, gp, kTriangles_GrPrimitiveType, 1, 4, 6, &bounds);
     target->resetIndexSource();
 
     return true;
@@ -1072,16 +1073,16 @@
 }
 
 bool GrOvalRenderer::drawDRRect(GrDrawTarget* target,
-                                GrDrawState* drawState,
+                                GrPipelineBuilder* pipelineBuilder,
                                 GrColor color,
                                 const SkMatrix& viewMatrix,
                                 bool useAA,
                                 const SkRRect& origOuter,
                                 const SkRRect& origInner) {
     bool applyAA = useAA &&
-                   !drawState->getRenderTarget()->isMultisampled() &&
-                   drawState->canUseFracCoveragePrimProc(color, *target->caps());
-    GrDrawState::AutoRestoreEffects are;
+                   !pipelineBuilder->getRenderTarget()->isMultisampled() &&
+                   pipelineBuilder->canUseFracCoveragePrimProc(color, *target->caps());
+    GrPipelineBuilder::AutoRestoreEffects are;
     if (!origInner.isEmpty()) {
         SkTCopyOnFirstWrite<SkRRect> inner(origInner);
         if (!viewMatrix.isIdentity()) {
@@ -1097,12 +1098,12 @@
         if (NULL == fp) {
             return false;
         }
-        are.set(drawState);
-        drawState->addCoverageProcessor(fp)->unref();
+        are.set(pipelineBuilder);
+        pipelineBuilder->addCoverageProcessor(fp)->unref();
     }
 
     SkStrokeRec fillRec(SkStrokeRec::kFill_InitStyle);
-    if (this->drawRRect(target, drawState, color, viewMatrix, useAA, origOuter, fillRec)) {
+    if (this->drawRRect(target, pipelineBuilder, color, viewMatrix, useAA, origOuter, fillRec)) {
         return true;
     }
 
@@ -1120,7 +1121,7 @@
         return false;
     }
     if (!are.isSet()) {
-        are.set(drawState);
+        are.set(pipelineBuilder);
     }
 
     SkMatrix invert;
@@ -1128,30 +1129,30 @@
         return false;
     }
 
-    drawState->addCoverageProcessor(effect)->unref();
+    pipelineBuilder->addCoverageProcessor(effect)->unref();
     SkRect bounds = outer->getBounds();
     if (applyAA) {
         bounds.outset(SK_ScalarHalf, SK_ScalarHalf);
     }
-    target->drawRect(drawState, color, SkMatrix::I(), bounds, NULL, &invert);
+    target->drawRect(pipelineBuilder, color, SkMatrix::I(), bounds, NULL, &invert);
     return true;
 }
 
 bool GrOvalRenderer::drawRRect(GrDrawTarget* target,
-                               GrDrawState* drawState,
+                               GrPipelineBuilder* pipelineBuilder,
                                GrColor color,
                                const SkMatrix& viewMatrix,
                                bool useAA,
                                const SkRRect& rrect,
                                const SkStrokeRec& stroke) {
     if (rrect.isOval()) {
-        return this->drawOval(target, drawState, color, viewMatrix, useAA, rrect.getBounds(),
+        return this->drawOval(target, pipelineBuilder, color, viewMatrix, useAA, rrect.getBounds(),
                               stroke);
     }
 
     bool useCoverageAA = useAA &&
-        !drawState->getRenderTarget()->isMultisampled() &&
-        drawState->canUseFracCoveragePrimProc(color, *target->caps());
+        !pipelineBuilder->getRenderTarget()->isMultisampled() &&
+        pipelineBuilder->canUseFracCoveragePrimProc(color, *target->caps());
 
     // only anti-aliased rrects for now
     if (!useCoverageAA) {
@@ -1304,8 +1305,8 @@
         int indexCnt = isStrokeOnly ? SK_ARRAY_COUNT(gRRectIndices) - 6 :
                                       SK_ARRAY_COUNT(gRRectIndices);
         target->setIndexSourceToBuffer(indexBuffer);
-        target->drawIndexedInstances(drawState, effect, kTriangles_GrPrimitiveType, 1, 16, indexCnt,
-                                     &bounds);
+        target->drawIndexedInstances(pipelineBuilder, effect, kTriangles_GrPrimitiveType, 1, 16,
+                                     indexCnt, &bounds);
 
     // otherwise we use the ellipse renderer
     } else {
@@ -1412,8 +1413,8 @@
         int indexCnt = isStrokeOnly ? SK_ARRAY_COUNT(gRRectIndices) - 6 :
                                       SK_ARRAY_COUNT(gRRectIndices);
         target->setIndexSourceToBuffer(indexBuffer);
-        target->drawIndexedInstances(drawState, effect, kTriangles_GrPrimitiveType, 1, 16, indexCnt,
-                                     &bounds);
+        target->drawIndexedInstances(pipelineBuilder, effect, kTriangles_GrPrimitiveType, 1, 16,
+                                     indexCnt, &bounds);
     }
 
     target->resetIndexSource();
diff --git a/src/gpu/GrOvalRenderer.h b/src/gpu/GrOvalRenderer.h
index 16c1248..9d861c5 100644
--- a/src/gpu/GrOvalRenderer.h
+++ b/src/gpu/GrOvalRenderer.h
@@ -35,21 +35,21 @@
     void reset();
 
     bool drawOval(GrDrawTarget*,
-                  GrDrawState*,
+                  GrPipelineBuilder*,
                   GrColor,
                   const SkMatrix& viewMatrix,
                   bool useAA,
                   const SkRect& oval,
                   const SkStrokeRec& stroke);
     bool drawRRect(GrDrawTarget*,
-                   GrDrawState*,
+                   GrPipelineBuilder*,
                    GrColor,
                    const SkMatrix& viewMatrix,
                    bool useAA,
                    const SkRRect& rrect,
                    const SkStrokeRec& stroke);
     bool drawDRRect(GrDrawTarget* target,
-                    GrDrawState*,
+                    GrPipelineBuilder*,
                     GrColor,
                     const SkMatrix& viewMatrix,
                     bool useAA,
@@ -58,21 +58,21 @@
 
 private:
     bool drawEllipse(GrDrawTarget* target,
-                     GrDrawState*,
+                     GrPipelineBuilder*,
                      GrColor,
                      const SkMatrix& viewMatrix,
                      bool useCoverageAA,
                      const SkRect& ellipse,
                      const SkStrokeRec& stroke);
     bool drawDIEllipse(GrDrawTarget* target,
-                       GrDrawState*,
+                       GrPipelineBuilder*,
                        GrColor,
                        const SkMatrix& viewMatrix,
                        bool useCoverageAA,
                        const SkRect& ellipse,
                        const SkStrokeRec& stroke);
     void drawCircle(GrDrawTarget* target,
-                    GrDrawState*,
+                    GrPipelineBuilder*,
                     GrColor,
                     const SkMatrix& viewMatrix,
                     bool useCoverageAA,
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h
index 6f087b4..5144597 100644
--- a/src/gpu/GrPathRenderer.h
+++ b/src/gpu/GrPathRenderer.h
@@ -24,8 +24,8 @@
 /**
  *  Base class for drawing paths into a GrDrawTarget.
  *
- *  Derived classes can use stages GrPaint::kTotalStages through GrDrawState::kNumStages-1. The
- *  stages before GrPaint::kTotalStages are reserved for setting up the draw (i.e., textures and
+ *  Derived classes can use stages GrPaint::kTotalStages through GrPipelineBuilder::kNumStages-1.
+ *  The stages before GrPaint::kTotalStages are reserved for setting up the draw (i.e., textures and
  *  filter masks).
  */
 class SK_API GrPathRenderer : public SkRefCnt {
@@ -54,7 +54,7 @@
      * rendered into the stencil.
      *
      * A GrPathRenderer can provide three levels of support for stenciling paths:
-     * 1) kNoRestriction: This is the most general. The caller sets up the GrDrawState on the target
+     * 1) kNoRestriction: This is the most general. The caller sets up the GrPipelineBuilder on the target
      *                    and calls drawPath(). The path is rendered exactly as the draw state
      *                    indicates including support for simultaneous color and stenciling with
      *                    arbitrary stenciling rules. Pixels partially covered by AA paths are
@@ -82,11 +82,11 @@
      * @param stroke    the stroke information (width, join, cap).
      */
     StencilSupport getStencilSupport(const GrDrawTarget* target,
-                                     const GrDrawState* drawState,
+                                     const GrPipelineBuilder* pipelineBuilder,
                                      const SkPath& path,
                                      const SkStrokeRec& stroke) const {
         SkASSERT(!path.isInverseFillType());
-        return this->onGetStencilSupport(target, drawState, path, stroke);
+        return this->onGetStencilSupport(target, pipelineBuilder, path, stroke);
     }
 
     /**
@@ -94,17 +94,17 @@
      * caller to fallback to another path renderer This function is called when searching for a path
      * renderer capable of rendering a path.
      *
-     * @param target     The target that the path will be rendered to
-     * @param drawState  The drawState
-     * @param viewMatrix The viewMatrix
-     * @param path       The path to draw
-     * @param stroke     The stroke information (width, join, cap)
-     * @param antiAlias  True if anti-aliasing is required.
+     * @param target           The target that the path will be rendered to
+     * @param pipelineBuilder  The pipelineBuilder
+     * @param viewMatrix       The viewMatrix
+     * @param path             The path to draw
+     * @param stroke           The stroke information (width, join, cap)
+     * @param antiAlias        True if anti-aliasing is required.
      *
      * @return  true if the path can be drawn by this object, false otherwise.
      */
     virtual bool canDrawPath(const GrDrawTarget* target,
-                             const GrDrawState* drawState,
+                             const GrPipelineBuilder* pipelineBuilder,
                              const SkMatrix& viewMatrix,
                              const SkPath& path,
                              const SkStrokeRec& rec,
@@ -114,14 +114,14 @@
      * the subclass must respect the stencil settings of the target's draw state.
      *
      * @param target                The target that the path will be rendered to
-     * @param drawState             The drawState
+     * @param pipelineBuilder       The pipelineBuilder
      * @param viewMatrix            The viewMatrix
      * @param path                  the path to draw.
      * @param stroke                the stroke information (width, join, cap)
      * @param antiAlias             true if anti-aliasing is required.
      */
     bool drawPath(GrDrawTarget* target,
-                  GrDrawState* ds,
+                  GrPipelineBuilder* ds,
                   GrColor color,
                   const SkMatrix& viewMatrix,
                   const SkPath& path,
@@ -144,7 +144,7 @@
      * @param target                target that the path will be rendered to
      */
     void stencilPath(GrDrawTarget* target,
-                     GrDrawState* ds,
+                     GrPipelineBuilder* ds,
                      const SkMatrix& viewMatrix,
                      const SkPath& path,
                      const SkStrokeRec& stroke) {
@@ -172,7 +172,7 @@
      * Subclass overrides if it has any limitations of stenciling support.
      */
     virtual StencilSupport onGetStencilSupport(const GrDrawTarget*,
-                                               const GrDrawState*,
+                                               const GrPipelineBuilder*,
                                                const SkPath&,
                                                const SkStrokeRec&) const {
         return kNoRestriction_StencilSupport;
@@ -182,7 +182,7 @@
      * Subclass implementation of drawPath()
      */
     virtual bool onDrawPath(GrDrawTarget*,
-                            GrDrawState*,
+                            GrPipelineBuilder*,
                             GrColor,
                             const SkMatrix& viewMatrix,
                             const SkPath&,
@@ -194,7 +194,7 @@
      * kStencilOnly in onGetStencilSupport().
      */
     virtual void onStencilPath(GrDrawTarget* target,
-                               GrDrawState* drawState,
+                               GrPipelineBuilder* pipelineBuilder,
                                const SkMatrix& viewMatrix,
                                const SkPath& path,
                                const SkStrokeRec& stroke) {
@@ -205,9 +205,9 @@
                                      0xffff,
                                      0xffff,
                                      0xffff);
-        drawState->setStencil(kIncrementStencil);
-        drawState->setDisableColorXPFactory();
-        this->drawPath(target, drawState, GrColor_WHITE, viewMatrix, path, stroke, false);
+        pipelineBuilder->setStencil(kIncrementStencil);
+        pipelineBuilder->setDisableColorXPFactory();
+        this->drawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, path, stroke, false);
     }
 
     // Helper for getting the device bounds of a path. Inverse filled paths will have bounds set
diff --git a/src/gpu/GrPathRendererChain.cpp b/src/gpu/GrPathRendererChain.cpp
index 0ba9364..d11763b 100644
--- a/src/gpu/GrPathRendererChain.cpp
+++ b/src/gpu/GrPathRendererChain.cpp
@@ -32,7 +32,7 @@
 }
 
 GrPathRenderer* GrPathRendererChain::getPathRenderer(const GrDrawTarget* target,
-                                                     const GrDrawState* drawState,
+                                                     const GrPipelineBuilder* pipelineBuilder,
                                                      const SkMatrix& viewMatrix,
                                                      const SkPath& path,
                                                      const SkStrokeRec& stroke,
@@ -60,12 +60,10 @@
 
 
     for (int i = 0; i < fChain.count(); ++i) {
-        if (fChain[i]->canDrawPath(target, drawState, viewMatrix, path, stroke, antiAlias)) {
+        if (fChain[i]->canDrawPath(target, pipelineBuilder, viewMatrix, path, stroke, antiAlias)) {
             if (GrPathRenderer::kNoSupport_StencilSupport != minStencilSupport) {
-                GrPathRenderer::StencilSupport support = fChain[i]->getStencilSupport(target,
-                                                                                      drawState,
-                                                                                      path,
-                                                                                      stroke);
+                GrPathRenderer::StencilSupport support =
+                    fChain[i]->getStencilSupport(target, pipelineBuilder, path, stroke);
                 if (support < minStencilSupport) {
                     continue;
                 } else if (stencilSupport) {
diff --git a/src/gpu/GrOptDrawState.cpp b/src/gpu/GrPipeline.cpp
similarity index 66%
rename from src/gpu/GrOptDrawState.cpp
rename to src/gpu/GrPipeline.cpp
index a111007..c35808e 100644
--- a/src/gpu/GrOptDrawState.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -1,29 +1,29 @@
 /*
- * Copyright 2014 Google Inc.
+ * Copyright 2015 Google Inc.
  *
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
 
-#include "GrOptDrawState.h"
+#include "GrPipeline.h"
 
-#include "GrDrawState.h"
 #include "GrDrawTargetCaps.h"
 #include "GrGpu.h"
+#include "GrPipelineBuilder.h"
 #include "GrProcOptInfo.h"
 #include "GrXferProcessor.h"
 
-GrOptDrawState::GrOptDrawState(const GrDrawState& drawState,
+GrPipeline::GrPipeline(const GrPipelineBuilder& pipelineBuilder,
                                const GrPrimitiveProcessor* primProc,
                                const GrDrawTargetCaps& caps,
                                const GrScissorState& scissorState,
                                const GrDeviceCoordTexture* dstCopy) {
-    const GrProcOptInfo& colorPOI = drawState.colorProcInfo(primProc);
-    const GrProcOptInfo& coveragePOI = drawState.coverageProcInfo(primProc);
+    const GrProcOptInfo& colorPOI = pipelineBuilder.colorProcInfo(primProc);
+    const GrProcOptInfo& coveragePOI = pipelineBuilder.coverageProcInfo(primProc);
 
     // Create XferProcessor from DS's XPFactory
     SkAutoTUnref<GrXferProcessor> xferProcessor(
-        drawState.getXPFactory()->createXferProcessor(colorPOI, coveragePOI));
+        pipelineBuilder.getXPFactory()->createXferProcessor(colorPOI, coveragePOI));
 
     GrColor overrideColor = GrColor_ILLEGAL;
     if (colorPOI.firstEffectiveStageIndex() != 0) {
@@ -36,72 +36,72 @@
 
         optFlags = xferProcessor->getOptimizations(colorPOI,
                                                    coveragePOI,
-                                                   drawState.getStencil().doesWrite(),
+                                                   pipelineBuilder.getStencil().doesWrite(),
                                                    &overrideColor,
                                                    caps);
     }
 
-    // When path rendering the stencil settings are not always set on the draw state
+    // When path rendering the stencil settings are not always set on the GrPipelineBuilder
     // so we must check the draw type. In cases where we will skip drawing we simply return a
-    // null GrOptDrawState.
+    // null GrPipeline.
     if (!xferProcessor || (GrXferProcessor::kSkipDraw_OptFlag & optFlags)) {
         // Set the fields that don't default init and return. The lack of a render target will
         // indicate that this can be skipped.
         fFlags = 0;
-        fDrawFace = GrDrawState::kInvalid_DrawFace;
+        fDrawFace = GrPipelineBuilder::kInvalid_DrawFace;
         return;
     }
 
-    fRenderTarget.reset(drawState.fRenderTarget.get());
+    fRenderTarget.reset(pipelineBuilder.fRenderTarget.get());
     SkASSERT(fRenderTarget);
     fScissorState = scissorState;
-    fStencilSettings = drawState.getStencil();
-    fDrawFace = drawState.getDrawFace();
-    // TODO move this out of optDrawState
+    fStencilSettings = pipelineBuilder.getStencil();
+    fDrawFace = pipelineBuilder.getDrawFace();
+    // TODO move this out of GrPipeline
     if (dstCopy) {
         fDstCopy = *dstCopy;
     }
 
     fFlags = 0;
-    if (drawState.isHWAntialias()) {
+    if (pipelineBuilder.isHWAntialias()) {
         fFlags |= kHWAA_Flag;
     }
-    if (drawState.isDither()) {
+    if (pipelineBuilder.isDither()) {
         fFlags |= kDither_Flag;
     }
 
     int firstColorStageIdx = colorPOI.firstEffectiveStageIndex();
 
     // TODO: Once we can handle single or four channel input into coverage stages then we can use
-    // drawState's coverageProcInfo (like color above) to set this initial information.
+    // GrPipelineBuilder's coverageProcInfo (like color above) to set this initial information.
     int firstCoverageStageIdx = 0;
 
     GrXferProcessor::BlendInfo blendInfo;
     fXferProcessor->getBlendInfo(&blendInfo);
 
-    this->adjustProgramFromOptimizations(drawState, optFlags, colorPOI, coveragePOI,
+    this->adjustProgramFromOptimizations(pipelineBuilder, optFlags, colorPOI, coveragePOI,
                                          &firstColorStageIdx, &firstCoverageStageIdx);
 
     fDescInfo.fReadsDst = fXferProcessor->willReadDstColor();
 
     bool usesLocalCoords = false;
 
-    // Copy Stages from DS to ODS
-    for (int i = firstColorStageIdx; i < drawState.numColorStages(); ++i) {
+    // Copy Stages from PipelineBuilder to Pipeline
+    for (int i = firstColorStageIdx; i < pipelineBuilder.numColorStages(); ++i) {
         SkNEW_APPEND_TO_TARRAY(&fFragmentStages,
                                GrPendingFragmentStage,
-                               (drawState.fColorStages[i]));
+                               (pipelineBuilder.fColorStages[i]));
         usesLocalCoords = usesLocalCoords ||
-                          drawState.fColorStages[i].processor()->usesLocalCoords();
+                          pipelineBuilder.fColorStages[i].processor()->usesLocalCoords();
     }
 
     fNumColorStages = fFragmentStages.count();
-    for (int i = firstCoverageStageIdx; i < drawState.numCoverageStages(); ++i) {
+    for (int i = firstCoverageStageIdx; i < pipelineBuilder.numCoverageStages(); ++i) {
         SkNEW_APPEND_TO_TARRAY(&fFragmentStages,
                                GrPendingFragmentStage,
-                               (drawState.fCoverageStages[i]));
+                               (pipelineBuilder.fCoverageStages[i]));
         usesLocalCoords = usesLocalCoords ||
-                          drawState.fCoverageStages[i].processor()->usesLocalCoords();
+                          pipelineBuilder.fCoverageStages[i].processor()->usesLocalCoords();
     }
 
     // let the GP init the batch tracker
@@ -111,23 +111,23 @@
     fInitBT.fUsesLocalCoords = usesLocalCoords;
 }
 
-void GrOptDrawState::adjustProgramFromOptimizations(const GrDrawState& ds,
-                                                    GrXferProcessor::OptFlags flags,
-                                                    const GrProcOptInfo& colorPOI,
-                                                    const GrProcOptInfo& coveragePOI,
-                                                    int* firstColorStageIdx,
-                                                    int* firstCoverageStageIdx) {
+void GrPipeline::adjustProgramFromOptimizations(const GrPipelineBuilder& pipelineBuilder,
+                                                GrXferProcessor::OptFlags flags,
+                                                const GrProcOptInfo& colorPOI,
+                                                const GrProcOptInfo& coveragePOI,
+                                                int* firstColorStageIdx,
+                                                int* firstCoverageStageIdx) {
     fDescInfo.fReadsFragPosition = false;
 
     if ((flags & GrXferProcessor::kIgnoreColor_OptFlag) ||
         (flags & GrXferProcessor::kOverrideColor_OptFlag)) {
-        *firstColorStageIdx = ds.numColorStages();
+        *firstColorStageIdx = pipelineBuilder.numColorStages();
     } else {
         fDescInfo.fReadsFragPosition = colorPOI.readsFragPosition();
     }
 
     if (flags & GrXferProcessor::kIgnoreCoverage_OptFlag) {
-        *firstCoverageStageIdx = ds.numCoverageStages();
+        *firstCoverageStageIdx = pipelineBuilder.numCoverageStages();
     } else {
         if (coveragePOI.readsFragPosition()) {
             fDescInfo.fReadsFragPosition = true;
@@ -137,7 +137,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 
-bool GrOptDrawState::isEqual(const GrOptDrawState& that) const {
+bool GrPipeline::isEqual(const GrPipeline& that) const {
     if (this->getRenderTarget() != that.getRenderTarget() ||
         this->fFragmentStages.count() != that.fFragmentStages.count() ||
         this->fNumColorStages != that.fNumColorStages ||
diff --git a/src/gpu/GrOptDrawState.h b/src/gpu/GrPipeline.h
similarity index 85%
rename from src/gpu/GrOptDrawState.h
rename to src/gpu/GrPipeline.h
index 626e6d7..df654ba 100644
--- a/src/gpu/GrOptDrawState.h
+++ b/src/gpu/GrPipeline.h
@@ -1,12 +1,12 @@
 /*
- * Copyright 2014 Google Inc.
+ * Copyright 2015 Google Inc.
  *
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
 
-#ifndef GrOptDrawState_DEFINED
-#define GrOptDrawState_DEFINED
+#ifndef GrPipeline_DEFINED
+#define GrPipeline_DEFINED
 
 #include "GrColor.h"
 #include "GrGpu.h"
@@ -18,26 +18,26 @@
 #include "SkRefCnt.h"
 
 class GrDeviceCoordTexture;
-class GrDrawState;
 class GrPathProcessor;
+class GrPipelineBuilder;
 
 /**
- * Class that holds an optimized version of a GrDrawState. It is meant to be an immutable class,
- * and contains all data needed to set the state for a gpu draw.
+ * Class that holds an optimized version of a GrPipelineBuilder. It is meant to be an immutable
+ * class, and contains all data needed to set the state for a gpu draw.
  */
-class GrOptDrawState {
+class GrPipeline {
 public:
-    SK_DECLARE_INST_COUNT(GrOptDrawState)
+    SK_DECLARE_INST_COUNT(GrPipeline)
 
-    GrOptDrawState(const GrDrawState& drawState, const GrPrimitiveProcessor*,
-                   const GrDrawTargetCaps&, const GrScissorState&,
-                   const GrDeviceCoordTexture* dstCopy);
+    GrPipeline(const GrPipelineBuilder& pipelineBuilder, const GrPrimitiveProcessor*,
+               const GrDrawTargetCaps&, const GrScissorState&,
+               const GrDeviceCoordTexture* dstCopy);
 
     /*
-     * Returns true if it is possible to combine the two GrOptDrawStates and it will update 'this'
+     * Returns true if it is possible to combine the two GrPipelines and it will update 'this'
      * to subsume 'that''s draw.
      */
-    bool isEqual(const GrOptDrawState& that) const;
+    bool isEqual(const GrPipeline& that) const;
 
     /// @}
 
@@ -122,7 +122,7 @@
      * or both faces.
      * @return the current draw face(s).
      */
-    GrDrawState::DrawFace getDrawFace() const { return fDrawFace; }
+    GrPipelineBuilder::DrawFace getDrawFace() const { return fDrawFace; }
 
     /// @}
 
@@ -138,7 +138,7 @@
     /**
      * Alter the program desc and inputs (attribs and processors) based on the blend optimization.
      */
-    void adjustProgramFromOptimizations(const GrDrawState& ds,
+    void adjustProgramFromOptimizations(const GrPipelineBuilder& ds,
                                         GrXferProcessor::OptFlags,
                                         const GrProcOptInfo& colorPOI,
                                         const GrProcOptInfo& coveragePOI,
@@ -150,7 +150,7 @@
      * the function may adjust the blend coefficients. After this function is called the src and dst
      * blend coeffs will represent those used by backend API.
      */
-    void setOutputStateInfo(const GrDrawState& ds, GrXferProcessor::OptFlags,
+    void setOutputStateInfo(const GrPipelineBuilder& ds, GrXferProcessor::OptFlags,
                             const GrDrawTargetCaps&);
 
     enum Flags {
@@ -164,7 +164,7 @@
     RenderTarget                        fRenderTarget;
     GrScissorState                      fScissorState;
     GrStencilSettings                   fStencilSettings;
-    GrDrawState::DrawFace               fDrawFace;
+    GrPipelineBuilder::DrawFace               fDrawFace;
     GrDeviceCoordTexture                fDstCopy;
     uint32_t                            fFlags;
     ProgramXferProcessor                fXferProcessor;
diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrPipelineBuilder.cpp
similarity index 71%
rename from src/gpu/GrDrawState.cpp
rename to src/gpu/GrPipelineBuilder.cpp
index db70393..f329c05 100644
--- a/src/gpu/GrDrawState.cpp
+++ b/src/gpu/GrPipelineBuilder.cpp
@@ -1,20 +1,20 @@
 /*
- * Copyright 2012 Google Inc.
+ * Copyright 2015 Google Inc.
  *
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
 
-#include "GrDrawState.h"
+#include "GrPipelineBuilder.h"
 
 #include "GrBlend.h"
-#include "GrOptDrawState.h"
 #include "GrPaint.h"
+#include "GrPipeline.h"
 #include "GrProcOptInfo.h"
 #include "GrXferProcessor.h"
 #include "effects/GrPorterDuffXferProcessor.h"
 
-GrDrawState::GrDrawState()
+GrPipelineBuilder::GrPipelineBuilder()
     : fFlagBits(0x0)
     , fDrawFace(kBoth_DrawFace)
     , fColorProcInfoValid(false)
@@ -26,7 +26,7 @@
     SkDEBUGCODE(fBlockEffectRemovalCnt = 0;)
 }
 
-GrDrawState& GrDrawState::operator=(const GrDrawState& that) {
+GrPipelineBuilder& GrPipelineBuilder::operator=(const GrPipelineBuilder& that) {
     fRenderTarget.reset(SkSafeRef(that.fRenderTarget.get()));
     fFlagBits = that.fFlagBits;
     fStencilSettings = that.fStencilSettings;
@@ -50,7 +50,7 @@
     return *this;
 }
 
-void GrDrawState::setFromPaint(const GrPaint& paint, GrRenderTarget* rt) {
+void GrPipelineBuilder::setFromPaint(const GrPaint& paint, GrRenderTarget* rt) {
     SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->numFragmentStages());
 
     fColorStages.reset();
@@ -74,10 +74,10 @@
     fFlagBits = 0;
 
     // Enable the clip bit
-    this->enableState(GrDrawState::kClip_StateBit);
+    this->enableState(GrPipelineBuilder::kClip_StateBit);
 
-    this->setState(GrDrawState::kDither_StateBit, paint.isDither());
-    this->setState(GrDrawState::kHWAntialias_StateBit, paint.isAntiAlias());
+    this->setState(GrPipelineBuilder::kDither_StateBit, paint.isDither());
+    this->setState(GrPipelineBuilder::kHWAntialias_StateBit, paint.isAntiAlias());
 
     fColorProcInfoValid = false;
     fCoverageProcInfoValid = false;
@@ -91,7 +91,8 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 
-bool GrDrawState::canUseFracCoveragePrimProc(GrColor color, const GrDrawTargetCaps& caps) const {
+bool GrPipelineBuilder::canUseFracCoveragePrimProc(GrColor color,
+                                                   const GrDrawTargetCaps& caps) const {
     if (caps.dualSourceBlendingSupport()) {
         return true;
     }
@@ -107,30 +108,30 @@
 
 //////////////////////////////////////////////////////////////////////////////s
 
-bool GrDrawState::willEffectReadDstColor() const {
+bool GrPipelineBuilder::willEffectReadDstColor() const {
     return this->getXPFactory()->willReadDst();
 }
 
-void GrDrawState::AutoRestoreEffects::set(GrDrawState* ds) {
-    if (fDrawState) {
-        int m = fDrawState->numColorStages() - fColorEffectCnt;
+void GrPipelineBuilder::AutoRestoreEffects::set(GrPipelineBuilder* pipelineBuilder) {
+    if (fPipelineBuilder) {
+        int m = fPipelineBuilder->numColorStages() - fColorEffectCnt;
         SkASSERT(m >= 0);
-        fDrawState->fColorStages.pop_back_n(m);
+        fPipelineBuilder->fColorStages.pop_back_n(m);
 
-        int n = fDrawState->numCoverageStages() - fCoverageEffectCnt;
+        int n = fPipelineBuilder->numCoverageStages() - fCoverageEffectCnt;
         SkASSERT(n >= 0);
-        fDrawState->fCoverageStages.pop_back_n(n);
+        fPipelineBuilder->fCoverageStages.pop_back_n(n);
         if (m + n > 0) {
-            fDrawState->fColorProcInfoValid = false;
-            fDrawState->fCoverageProcInfoValid = false;
+            fPipelineBuilder->fColorProcInfoValid = false;
+            fPipelineBuilder->fCoverageProcInfoValid = false;
         }
-        SkDEBUGCODE(--fDrawState->fBlockEffectRemovalCnt;)
+        SkDEBUGCODE(--fPipelineBuilder->fBlockEffectRemovalCnt;)
     }
-    fDrawState = ds;
-    if (NULL != ds) {
-        fColorEffectCnt = ds->numColorStages();
-        fCoverageEffectCnt = ds->numCoverageStages();
-        SkDEBUGCODE(++ds->fBlockEffectRemovalCnt;)
+    fPipelineBuilder = pipelineBuilder;
+    if (NULL != pipelineBuilder) {
+        fColorEffectCnt = pipelineBuilder->numColorStages();
+        fCoverageEffectCnt = pipelineBuilder->numCoverageStages();
+        SkDEBUGCODE(++pipelineBuilder->fBlockEffectRemovalCnt;)
     }
 }
 
@@ -138,19 +139,19 @@
 
 // Some blend modes allow folding a fractional coverage value into the color's alpha channel, while
 // others will blend incorrectly.
-bool GrDrawState::canTweakAlphaForCoverage() const {
+bool GrPipelineBuilder::canTweakAlphaForCoverage() const {
     return this->getXPFactory()->canTweakAlphaForCoverage();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 
-GrDrawState::~GrDrawState() {
+GrPipelineBuilder::~GrPipelineBuilder() {
     SkASSERT(0 == fBlockEffectRemovalCnt);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 
-bool GrDrawState::willBlendWithDst(const GrPrimitiveProcessor* pp) const {
+bool GrPipelineBuilder::willBlendWithDst(const GrPrimitiveProcessor* pp) const {
     this->calcColorInvariantOutput(pp);
     this->calcCoverageInvariantOutput(pp);
     
@@ -159,7 +160,7 @@
     return output.fWillBlendWithDst;
 }
 
-void GrDrawState::calcColorInvariantOutput(const GrPrimitiveProcessor* pp) const {
+void GrPipelineBuilder::calcColorInvariantOutput(const GrPrimitiveProcessor* pp) const {
     if (!fColorProcInfoValid || fColorPrimProc != pp) {
         fColorProcInfo.calcColorWithPrimProc(pp, fColorStages.begin(), this->numColorStages());
         fColorProcInfoValid = true;
@@ -167,7 +168,7 @@
     }
 }
 
-void GrDrawState::calcCoverageInvariantOutput(const GrPrimitiveProcessor* pp) const {
+void GrPipelineBuilder::calcCoverageInvariantOutput(const GrPrimitiveProcessor* pp) const {
     if (!fCoverageProcInfoValid ||  fCoveragePrimProc != pp) {
         fCoverageProcInfo.calcCoverageWithPrimProc(pp, fCoverageStages.begin(),
                                                    this->numCoverageStages());
@@ -176,7 +177,7 @@
     }
 }
 
-void GrDrawState::calcColorInvariantOutput(GrColor color) const {
+void GrPipelineBuilder::calcColorInvariantOutput(GrColor color) const {
     if (!fColorProcInfoValid || color != fColorCache) {
         GrColorComponentFlags flags = kRGBA_GrColorComponentFlags;
         fColorProcInfo.calcWithInitialValues(fColorStages.begin(), this->numColorStages(), color,
@@ -186,7 +187,7 @@
     }
 }
 
-void GrDrawState::calcCoverageInvariantOutput(GrColor coverage) const {
+void GrPipelineBuilder::calcCoverageInvariantOutput(GrColor coverage) const {
     if (!fCoverageProcInfoValid || coverage != fCoverageCache) {
         GrColorComponentFlags flags = kRGBA_GrColorComponentFlags;
         fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(),
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrPipelineBuilder.h
similarity index 85%
rename from src/gpu/GrDrawState.h
rename to src/gpu/GrPipelineBuilder.h
index 45fc574..9579024 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrPipelineBuilder.h
@@ -1,12 +1,12 @@
 /*
- * Copyright 2011 Google Inc.
+ * Copyright 2015 Google Inc.
  *
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
 
-#ifndef GrDrawState_DEFINED
-#define GrDrawState_DEFINED
+#ifndef GrPipelineBuilder_DEFINED
+#define GrPipelineBuilder_DEFINED
 
 
 #include "GrBlend.h"
@@ -28,24 +28,22 @@
 class GrPaint;
 class GrTexture;
 
-class GrDrawState {
+class GrPipelineBuilder {
 public:
-    GrDrawState();
-    /**
-     * Copies another draw state.
-     **/
-    GrDrawState(const GrDrawState& state) {
+    GrPipelineBuilder();
+
+    GrPipelineBuilder(const GrPipelineBuilder& pipelineBuilder) {
         SkDEBUGCODE(fBlockEffectRemovalCnt = 0;)
-        *this = state;
+        *this = pipelineBuilder;
     }
 
-    virtual ~GrDrawState();
+    virtual ~GrPipelineBuilder();
 
     /**
-     * Initializes the GrDrawState based on a GrPaint, view matrix and render target. Note that
-     * GrDrawState encompasses more than GrPaint. Aspects of GrDrawState that have no GrPaint
-     * equivalents are set to default values with the exception of vertex attribute state which
-     * is unmodified by this function and clipping which will be enabled.
+     * Initializes the GrPipelineBuilder based on a GrPaint, view matrix and render target. Note
+     * that GrPipelineBuilder encompasses more than GrPaint. Aspects of GrPipelineBuilder that have
+     * no GrPaint equivalents are set to default values with the exception of vertex attribute state
+     * which is unmodified by this function and clipping which will be enabled.
      */
     void setFromPaint(const GrPaint&, GrRenderTarget*);
 
@@ -56,7 +54,7 @@
      * it may or may not be possible to correctly blend with fractional pixel coverage generated by
      * the fragment shader.
      *
-     * This function considers the current draw state and the draw target's capabilities to
+     * This function considers the current GrPipelineBuilder and the draw target's capabilities to
      * determine whether coverage can be handled correctly. This function assumes that the caller
      * intends to specify fractional pixel coverage via a primitive processor but may not have
      * specified it yet.
@@ -171,30 +169,23 @@
     }
 
     /**
-     * When this object is destroyed it will remove any color/coverage effects from the draw state
-     * that were added after its constructor.
+     * When this object is destroyed it will remove any color/coverage effects from the pipeline
+     * builder that were added after its constructor.
      *
-     * This class has strange behavior around geometry processor. If there is a GP on the draw state
-     * it will assert that the GP is not modified until after the destructor of the ARE. If the
-     * draw state has a NULL GP when the ARE is constructed then it will reset it to null in the
-     * destructor.
-     *
-     * TODO: We'd prefer for the ARE to just save and restore the GP. However, this would add
-     * significant complexity to the multi-ref architecture for deferred drawing. Once GrDrawState
-     * and GrOptDrawState are fully separated then GrDrawState will never be in the deferred
-     * execution state and GrOptDrawState always will be (and will be immutable and therefore
-     * unable to have an ARE). At this point we can restore sanity and have the ARE save and restore
-     * the GP.
+     * This class has strange behavior around geometry processor. If there is a GP on the
+     * GrPipelineBuilder it will assert that the GP is not modified until after the destructor of
+     * the ARE. If the GrPipelineBuilder has a NULL GP when the ARE is constructed then it will reset
+     * it to null in the destructor.
      */
     class AutoRestoreEffects : public ::SkNoncopyable {
     public:
         AutoRestoreEffects() 
-            : fDrawState(NULL)
+            : fPipelineBuilder(NULL)
             , fColorEffectCnt(0)
             , fCoverageEffectCnt(0) {}
 
-        AutoRestoreEffects(GrDrawState* ds)
-            : fDrawState(NULL)
+        AutoRestoreEffects(GrPipelineBuilder* ds)
+            : fPipelineBuilder(NULL)
             , fColorEffectCnt(0)
             , fCoverageEffectCnt(0) {
             this->set(ds);
@@ -202,12 +193,12 @@
 
         ~AutoRestoreEffects() { this->set(NULL); }
 
-        void set(GrDrawState* ds);
+        void set(GrPipelineBuilder* ds);
 
-        bool isSet() const { return SkToBool(fDrawState); }
+        bool isSet() const { return SkToBool(fPipelineBuilder); }
 
     private:
-        GrDrawState*    fDrawState;
+        GrPipelineBuilder*    fPipelineBuilder;
         int             fColorEffectCnt;
         int             fCoverageEffectCnt;
     };
@@ -219,27 +210,27 @@
      */
     class AutoRestoreStencil : public ::SkNoncopyable {
     public:
-        AutoRestoreStencil() : fDrawState(NULL) {}
+        AutoRestoreStencil() : fPipelineBuilder(NULL) {}
 
-        AutoRestoreStencil(GrDrawState* ds) : fDrawState(NULL) { this->set(ds); }
+        AutoRestoreStencil(GrPipelineBuilder* ds) : fPipelineBuilder(NULL) { this->set(ds); }
 
         ~AutoRestoreStencil() { this->set(NULL); }
 
-        void set(GrDrawState* ds) {
-            if (fDrawState) {
-                fDrawState->setStencil(fStencilSettings);
+        void set(GrPipelineBuilder* ds) {
+            if (fPipelineBuilder) {
+                fPipelineBuilder->setStencil(fStencilSettings);
             }
-            fDrawState = ds;
+            fPipelineBuilder = ds;
             if (ds) {
                 fStencilSettings = ds->getStencil();
             }
         }
 
-        bool isSet() const { return SkToBool(fDrawState); }
+        bool isSet() const { return SkToBool(fPipelineBuilder); }
 
     private:
-        GrDrawState*       fDrawState;
-        GrStencilSettings  fStencilSettings;
+        GrPipelineBuilder*  fPipelineBuilder;
+        GrStencilSettings   fStencilSettings;
     };
 
     /// @}
@@ -397,7 +388,7 @@
 
     ///////////////////////////////////////////////////////////////////////////
 
-    GrDrawState& operator= (const GrDrawState& that);
+    GrPipelineBuilder& operator= (const GrPipelineBuilder& that);
 
 private:
     const GrProcOptInfo& colorProcInfo(const GrPrimitiveProcessor* pp) const {
@@ -457,7 +448,7 @@
     mutable const GrPrimitiveProcessor* fColorPrimProc;
     mutable const GrPrimitiveProcessor* fCoveragePrimProc;
 
-    friend class GrOptDrawState;
+    friend class GrPipeline;
 };
 
 #endif
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index 21c9352..2345eda 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -7,7 +7,7 @@
 
 #include "GrSWMaskHelper.h"
 
-#include "GrDrawState.h"
+#include "GrPipelineBuilder.h"
 #include "GrDrawTargetCaps.h"
 #include "GrGpu.h"
 
@@ -347,7 +347,7 @@
 
 void GrSWMaskHelper::DrawToTargetWithPathMask(GrTexture* texture,
                                               GrDrawTarget* target,
-                                              GrDrawState* drawState,
+                                              GrPipelineBuilder* pipelineBuilder,
                                               GrColor color,
                                               const SkMatrix& viewMatrix,
                                               const SkIRect& rect) {
@@ -355,7 +355,7 @@
     if (!viewMatrix.invert(&invert)) {
         return;
     }
-    GrDrawState::AutoRestoreEffects are(drawState);
+    GrPipelineBuilder::AutoRestoreEffects are(pipelineBuilder);
 
     SkRect dstRect = SkRect::MakeLTRB(SK_Scalar1 * rect.fLeft,
                                       SK_Scalar1 * rect.fTop,
@@ -369,11 +369,11 @@
     maskMatrix.setIDiv(texture->width(), texture->height());
     maskMatrix.preTranslate(SkIntToScalar(-rect.fLeft), SkIntToScalar(-rect.fTop));
 
-    drawState->addCoverageProcessor(
+    pipelineBuilder->addCoverageProcessor(
                          GrSimpleTextureEffect::Create(texture,
                                                        maskMatrix,
                                                        GrTextureParams::kNone_FilterMode,
                                                        kDevice_GrCoordSet))->unref();
 
-    target->drawRect(drawState, color, SkMatrix::I(), dstRect, NULL, &invert);
+    target->drawRect(pipelineBuilder, color, SkMatrix::I(), dstRect, NULL, &invert);
 }
diff --git a/src/gpu/GrSWMaskHelper.h b/src/gpu/GrSWMaskHelper.h
index 71dec63..c180971 100644
--- a/src/gpu/GrSWMaskHelper.h
+++ b/src/gpu/GrSWMaskHelper.h
@@ -9,7 +9,7 @@
 #define GrSWMaskHelper_DEFINED
 
 #include "GrColor.h"
-#include "GrDrawState.h"
+#include "GrPipelineBuilder.h"
 #include "SkBitmap.h"
 #include "SkDraw.h"
 #include "SkMatrix.h"
@@ -92,7 +92,7 @@
     // output of DrawPathMaskToTexture.
     static void DrawToTargetWithPathMask(GrTexture* texture,
                                          GrDrawTarget* target,
-                                         GrDrawState* drawState,
+                                         GrPipelineBuilder* pipelineBuilder,
                                          GrColor,
                                          const SkMatrix& viewMatrix,
                                          const SkIRect& rect);
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index 90b35f7..4fb7538 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -12,7 +12,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 bool GrSoftwarePathRenderer::canDrawPath(const GrDrawTarget*,
-                                         const GrDrawState*,
+                                         const GrPipelineBuilder*,
                                          const SkMatrix& viewMatrix,
                                          const SkPath&,
                                          const SkStrokeRec&,
@@ -26,7 +26,7 @@
 
 GrPathRenderer::StencilSupport
 GrSoftwarePathRenderer::onGetStencilSupport(const GrDrawTarget*,
-                                            const GrDrawState*,
+                                            const GrPipelineBuilder*,
                                             const SkPath&,
                                             const SkStrokeRec&) const {
     return GrPathRenderer::kNoSupport_StencilSupport;
@@ -39,13 +39,13 @@
 // path bounds will be a subset of the clip bounds. returns false if
 // path bounds would be empty.
 bool get_path_and_clip_bounds(const GrDrawTarget* target,
-                              const GrDrawState* drawState,
+                              const GrPipelineBuilder* pipelineBuilder,
                               const SkPath& path,
                               const SkMatrix& matrix,
                               SkIRect* devPathBounds,
                               SkIRect* devClipBounds) {
     // compute bounds as intersection of rt size, clip, and path
-    const GrRenderTarget* rt = drawState->getRenderTarget();
+    const GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
     if (NULL == rt) {
         return false;
     }
@@ -78,7 +78,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 void draw_around_inv_path(GrDrawTarget* target,
-                          GrDrawState* drawState,
+                          GrPipelineBuilder* pipelineBuilder,
                           GrColor color,
                           const SkMatrix& viewMatrix,
                           const SkIRect& devClipBounds,
@@ -92,22 +92,22 @@
     if (devClipBounds.fTop < devPathBounds.fTop) {
         rect.iset(devClipBounds.fLeft, devClipBounds.fTop,
                   devClipBounds.fRight, devPathBounds.fTop);
-        target->drawRect(drawState, color, SkMatrix::I(), rect, NULL, &invert);
+        target->drawRect(pipelineBuilder, color, SkMatrix::I(), rect, NULL, &invert);
     }
     if (devClipBounds.fLeft < devPathBounds.fLeft) {
         rect.iset(devClipBounds.fLeft, devPathBounds.fTop,
                   devPathBounds.fLeft, devPathBounds.fBottom);
-        target->drawRect(drawState, color, SkMatrix::I(), rect, NULL, &invert);
+        target->drawRect(pipelineBuilder, color, SkMatrix::I(), rect, NULL, &invert);
     }
     if (devClipBounds.fRight > devPathBounds.fRight) {
         rect.iset(devPathBounds.fRight, devPathBounds.fTop,
                   devClipBounds.fRight, devPathBounds.fBottom);
-        target->drawRect(drawState, color, SkMatrix::I(), rect, NULL, &invert);
+        target->drawRect(pipelineBuilder, color, SkMatrix::I(), rect, NULL, &invert);
     }
     if (devClipBounds.fBottom > devPathBounds.fBottom) {
         rect.iset(devClipBounds.fLeft, devPathBounds.fBottom,
                   devClipBounds.fRight, devClipBounds.fBottom);
-        target->drawRect(drawState, color, SkMatrix::I(), rect, NULL, &invert);
+        target->drawRect(pipelineBuilder, color, SkMatrix::I(), rect, NULL, &invert);
     }
 }
 
@@ -116,7 +116,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 // return true on success; false on failure
 bool GrSoftwarePathRenderer::onDrawPath(GrDrawTarget* target,
-                                        GrDrawState* drawState,
+                                        GrPipelineBuilder* pipelineBuilder,
                                         GrColor color,
                                         const SkMatrix& viewMatrix,
                                         const SkPath& path,
@@ -128,10 +128,11 @@
     }
 
     SkIRect devPathBounds, devClipBounds;
-    if (!get_path_and_clip_bounds(target, drawState, path, viewMatrix,
+    if (!get_path_and_clip_bounds(target, pipelineBuilder, path, viewMatrix,
                                   &devPathBounds, &devClipBounds)) {
         if (path.isInverseFillType()) {
-            draw_around_inv_path(target, drawState, color, viewMatrix, devClipBounds,devPathBounds);
+            draw_around_inv_path(target, pipelineBuilder, color, viewMatrix, devClipBounds,
+                                 devPathBounds);
         }
         return true;
     }
@@ -144,12 +145,13 @@
         return false;
     }
 
-    GrDrawState copy = *drawState;
+    GrPipelineBuilder copy = *pipelineBuilder;
     GrSWMaskHelper::DrawToTargetWithPathMask(texture, target, &copy, color, viewMatrix,
                                              devPathBounds);
 
     if (path.isInverseFillType()) {
-        draw_around_inv_path(target, drawState, color, viewMatrix, devClipBounds, devPathBounds);
+        draw_around_inv_path(target, pipelineBuilder, color, viewMatrix, devClipBounds,
+                             devPathBounds);
     }
 
     return true;
diff --git a/src/gpu/GrSoftwarePathRenderer.h b/src/gpu/GrSoftwarePathRenderer.h
index 43d5e55..ed897cc 100644
--- a/src/gpu/GrSoftwarePathRenderer.h
+++ b/src/gpu/GrSoftwarePathRenderer.h
@@ -24,19 +24,19 @@
     }
 
     virtual bool canDrawPath(const GrDrawTarget*,
-                             const GrDrawState*,
+                             const GrPipelineBuilder*,
                              const SkMatrix& viewMatrix,
                              const SkPath&,
                              const SkStrokeRec&,
                              bool antiAlias) const SK_OVERRIDE;
 protected:
     virtual StencilSupport onGetStencilSupport(const GrDrawTarget*,
-                                               const GrDrawState*,
+                                               const GrPipelineBuilder*,
                                                const SkPath&,
                                                const SkStrokeRec&) const SK_OVERRIDE;
 
     virtual bool onDrawPath(GrDrawTarget*,
-                            GrDrawState*,
+                            GrPipelineBuilder*,
                             GrColor,
                             const SkMatrix& viewMatrix,
                             const SkPath&,
diff --git a/src/gpu/GrStencilAndCoverPathRenderer.cpp b/src/gpu/GrStencilAndCoverPathRenderer.cpp
index 207194d..1a3856c 100644
--- a/src/gpu/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/GrStencilAndCoverPathRenderer.cpp
@@ -51,20 +51,20 @@
 }
 
 bool GrStencilAndCoverPathRenderer::canDrawPath(const GrDrawTarget* target,
-                                                const GrDrawState* drawState,
+                                                const GrPipelineBuilder* pipelineBuilder,
                                                 const SkMatrix& viewMatrix,
                                                 const SkPath& path,
                                                 const SkStrokeRec& stroke,
                                                 bool antiAlias) const {
     return !stroke.isHairlineStyle() &&
            !antiAlias && // doesn't do per-path AA, relies on the target having MSAA
-           drawState->getRenderTarget()->getStencilBuffer() &&
-           drawState->getStencil().isDisabled();
+           pipelineBuilder->getRenderTarget()->getStencilBuffer() &&
+           pipelineBuilder->getStencil().isDisabled();
 }
 
 GrPathRenderer::StencilSupport
 GrStencilAndCoverPathRenderer::onGetStencilSupport(const GrDrawTarget*,
-                                                   const GrDrawState*,
+                                                   const GrPipelineBuilder*,
                                                    const SkPath&,
                                                    const SkStrokeRec&) const {
     return GrPathRenderer::kStencilOnly_StencilSupport;
@@ -82,18 +82,18 @@
 }
 
 void GrStencilAndCoverPathRenderer::onStencilPath(GrDrawTarget* target,
-                                                  GrDrawState* drawState,
+                                                  GrPipelineBuilder* pipelineBuilder,
                                                   const SkMatrix& viewMatrix,
                                                   const SkPath& path,
                                                   const SkStrokeRec& stroke) {
     SkASSERT(!path.isInverseFillType());
     SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(GrColor_WHITE, viewMatrix));
     SkAutoTUnref<GrPath> p(get_gr_path(fGpu, path, stroke));
-    target->stencilPath(drawState, pp, p, convert_skpath_filltype(path.getFillType()));
+    target->stencilPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.getFillType()));
 }
 
 bool GrStencilAndCoverPathRenderer::onDrawPath(GrDrawTarget* target,
-                                               GrDrawState* drawState,
+                                               GrPipelineBuilder* pipelineBuilder,
                                                GrColor color,
                                                const SkMatrix& viewMatrix,
                                                const SkPath& path,
@@ -102,7 +102,7 @@
     SkASSERT(!antiAlias);
     SkASSERT(!stroke.isHairlineStyle());
 
-    SkASSERT(drawState->getStencil().isDisabled());
+    SkASSERT(pipelineBuilder->getStencil().isDisabled());
 
     SkAutoTUnref<GrPath> p(get_gr_path(fGpu, path, stroke));
 
@@ -118,16 +118,16 @@
             0x0000,
             0xffff);
 
-        drawState->setStencil(kInvertedStencilPass);
+        pipelineBuilder->setStencil(kInvertedStencilPass);
 
         // fake inverse with a stencil and cover
         SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(GrColor_WHITE, viewMatrix));
-        target->stencilPath(drawState, pp, p, convert_skpath_filltype(path.getFillType()));
+        target->stencilPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.getFillType()));
 
         SkMatrix invert = SkMatrix::I();
-        SkRect bounds = SkRect::MakeLTRB(0, 0,
-                                         SkIntToScalar(drawState->getRenderTarget()->width()),
-                                         SkIntToScalar(drawState->getRenderTarget()->height()));
+        SkRect bounds =
+            SkRect::MakeLTRB(0, 0, SkIntToScalar(pipelineBuilder->getRenderTarget()->width()),
+                             SkIntToScalar(pipelineBuilder->getRenderTarget()->height()));
         SkMatrix vmi;
         // mapRect through persp matrix may not be correct
         if (!viewMatrix.hasPerspective() && viewMatrix.invert(&vmi)) {
@@ -142,7 +142,7 @@
             }
         }
         const SkMatrix& viewM = viewMatrix.hasPerspective() ? SkMatrix::I() : viewMatrix;
-        target->drawRect(drawState, color, viewM, bounds, NULL, &invert);
+        target->drawRect(pipelineBuilder, color, viewM, bounds, NULL, &invert);
     } else {
         GR_STATIC_CONST_SAME_STENCIL(kStencilPass,
             kZero_StencilOp,
@@ -152,11 +152,11 @@
             0x0000,
             0xffff);
 
-        drawState->setStencil(kStencilPass);
+        pipelineBuilder->setStencil(kStencilPass);
         SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(color, viewMatrix));
-        target->drawPath(drawState, pp, p, convert_skpath_filltype(path.getFillType()));
+        target->drawPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.getFillType()));
     }
 
-    drawState->stencil()->setDisabled();
+    pipelineBuilder->stencil()->setDisabled();
     return true;
 }
diff --git a/src/gpu/GrStencilAndCoverPathRenderer.h b/src/gpu/GrStencilAndCoverPathRenderer.h
index 1ea26c4..cb4012f 100644
--- a/src/gpu/GrStencilAndCoverPathRenderer.h
+++ b/src/gpu/GrStencilAndCoverPathRenderer.h
@@ -26,7 +26,7 @@
     virtual ~GrStencilAndCoverPathRenderer();
 
     virtual bool canDrawPath(const GrDrawTarget*,
-                             const GrDrawState*,
+                             const GrPipelineBuilder*,
                              const SkMatrix& viewMatrix,
                              const SkPath&,
                              const SkStrokeRec&,
@@ -34,12 +34,12 @@
 
 protected:
     virtual StencilSupport onGetStencilSupport(const GrDrawTarget*,
-                                               const GrDrawState*,
+                                               const GrPipelineBuilder*,
                                                const SkPath&,
                                                const SkStrokeRec&) const SK_OVERRIDE;
 
     virtual bool onDrawPath(GrDrawTarget*,
-                            GrDrawState*,
+                            GrPipelineBuilder*,
                             GrColor,
                             const SkMatrix& viewMatrix,
                             const SkPath&,
@@ -47,7 +47,7 @@
                             bool antiAlias) SK_OVERRIDE;
 
     virtual void onStencilPath(GrDrawTarget*,
-                               GrDrawState*,
+                               GrPipelineBuilder*,
                                const SkMatrix& viewMatrix,
                                const SkPath&,
                                const SkStrokeRec&) SK_OVERRIDE;
diff --git a/src/gpu/GrStencilAndCoverTextContext.cpp b/src/gpu/GrStencilAndCoverTextContext.cpp
index 6447ca5..c29dca6 100644
--- a/src/gpu/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/GrStencilAndCoverTextContext.cpp
@@ -344,9 +344,9 @@
                                     &fGlyphCache->getDescriptor(), fStroke);
     }
 
-    fStateRestore.set(&fDrawState);
+    fStateRestore.set(&fPipelineBuilder);
 
-    fDrawState.setFromPaint(fPaint, fContext->getRenderTarget());
+    fPipelineBuilder.setFromPaint(fPaint, fContext->getRenderTarget());
 
     GR_STATIC_CONST_SAME_STENCIL(kStencilPass,
                                  kZero_StencilOp,
@@ -356,7 +356,7 @@
                                  0x0000,
                                  0xffff);
 
-    *fDrawState.stencil() = kStencilPass;
+    *fPipelineBuilder.stencil() = kStencilPass;
 
     SkASSERT(0 == fQueuedGlyphCount);
     SkASSERT(kGlyphBufferSize == fFallbackGlyphsIdx);
@@ -408,7 +408,7 @@
         SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(fPaint.getColor(),
                                                                  fViewMatrix,
                                                                  fLocalMatrix));
-        fDrawTarget->drawPaths(&fDrawState, pp, fGlyphs,
+        fDrawTarget->drawPaths(&fPipelineBuilder, pp, fGlyphs,
                                fGlyphIndices, GrPathRange::kU16_PathIndexType,
                                get_xy_scalar_array(fGlyphPositions),
                                GrPathRendering::kTranslate_PathTransformType,
@@ -453,7 +453,7 @@
     SkGlyphCache::AttachCache(fGlyphCache);
     fGlyphCache = NULL;
 
-    fDrawState.stencil()->setDisabled();
+    fPipelineBuilder.stencil()->setDisabled();
     fStateRestore.set(NULL);
     fViewMatrix = fContextInitialMatrix;
     GrTextContext::finish();
diff --git a/src/gpu/GrStencilAndCoverTextContext.h b/src/gpu/GrStencilAndCoverTextContext.h
index c7b06cc..345b3a5 100644
--- a/src/gpu/GrStencilAndCoverTextContext.h
+++ b/src/gpu/GrStencilAndCoverTextContext.h
@@ -51,8 +51,8 @@
         kMaxPerformance_RenderMode,
     };
 
-    GrDrawState                     fDrawState;
-    GrDrawState::AutoRestoreEffects fStateRestore;
+    GrPipelineBuilder                     fPipelineBuilder;
+    GrPipelineBuilder::AutoRestoreEffects fStateRestore;
     SkScalar                        fTextRatio;
     float                           fTextInverseRatio;
     SkGlyphCache*                   fGlyphCache;
diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp
index 5ec4dcf..ef2517d 100644
--- a/src/gpu/GrTest.cpp
+++ b/src/gpu/GrTest.cpp
@@ -48,7 +48,7 @@
 #include "GrInOrderDrawBuffer.h"
 #include "GrGpu.h"
 
-class GrOptDrawState;
+class GrPipeline;
 
 class MockGpu : public GrGpu {
 public:
@@ -64,7 +64,7 @@
                                    GrPixelConfig config,
                                    size_t rowBytes) const SK_OVERRIDE { return false; }
     void buildProgramDesc(GrProgramDesc*,const GrPrimitiveProcessor&,
-                          const GrOptDrawState&,
+                          const GrPipeline&,
                           const GrProgramDesc::DescInfo&,
                           const GrBatchTracker&) const SK_OVERRIDE {}
 
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp
index 88ffad0..4a03406 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -28,9 +28,9 @@
 
 // Returns whether or not the gpu can fast path the dash line effect.
 static bool can_fast_path_dash(const SkPoint pts[2], const GrStrokeInfo& strokeInfo,
-                               const GrDrawTarget& target, const GrDrawState& ds,
+                               const GrDrawTarget& target, const GrPipelineBuilder& pipelineBuilder,
                                const SkMatrix& viewMatrix) {
-    if (ds.getRenderTarget()->isMultisampled()) {
+    if (pipelineBuilder.getRenderTarget()->isMultisampled()) {
         return false;
     }
 
@@ -164,10 +164,11 @@
     matrix.mapPoints(&verts[idx], 4);
 }
 
-bool GrDashingEffect::DrawDashLine(GrGpu* gpu, GrDrawTarget* target, GrDrawState* drawState,
-                                   GrColor color, const SkMatrix& viewMatrix, const SkPoint pts[2],
+bool GrDashingEffect::DrawDashLine(GrGpu* gpu, GrDrawTarget* target,
+                                   GrPipelineBuilder* pipelineBuilder, GrColor color,
+                                   const SkMatrix& viewMatrix, const SkPoint pts[2],
                                    const GrPaint& paint, const GrStrokeInfo& strokeInfo) {
-    if (!can_fast_path_dash(pts, strokeInfo, *target, *drawState, viewMatrix)) {
+    if (!can_fast_path_dash(pts, strokeInfo, *target, *pipelineBuilder, viewMatrix)) {
         return false;
     }
 
@@ -442,7 +443,8 @@
     }
 
     target->setIndexSourceToBuffer(gpu->getContext()->getQuadIndexBuffer());
-    target->drawIndexedInstances(drawState, gp, kTriangles_GrPrimitiveType, totalRectCnt, 4, 6);
+    target->drawIndexedInstances(pipelineBuilder, gp, kTriangles_GrPrimitiveType,
+                                 totalRectCnt, 4, 6);
     target->resetIndexSource();
     return true;
 }
diff --git a/src/gpu/effects/GrDashingEffect.h b/src/gpu/effects/GrDashingEffect.h
index 651a240..5552f1d 100644
--- a/src/gpu/effects/GrDashingEffect.h
+++ b/src/gpu/effects/GrDashingEffect.h
@@ -14,18 +14,19 @@
 #include "SkPathEffect.h"
 
 class GrGpu;
-class GrDrawState;
 class GrDrawTarget;
 class GrGeometryProcessor;
 class GrPaint;
+class GrPipelineBuilder;
 class GrStrokeInfo;
 
 class GrGLDashingEffect;
 class SkPath;
 
 namespace GrDashingEffect {
-    bool DrawDashLine(GrGpu*, GrDrawTarget*, GrDrawState*, GrColor, const SkMatrix& viewMatrix,
-                      const SkPoint pts[2], const GrPaint& paint, const GrStrokeInfo& strokeInfo);
+    bool DrawDashLine(GrGpu*, GrDrawTarget*, GrPipelineBuilder*, GrColor,
+                      const SkMatrix& viewMatrix, const SkPoint pts[2], const GrPaint& paint,
+                      const GrStrokeInfo& strokeInfo);
 
     enum DashCap {
         kRound_DashCap,
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index b28c32e..f3aef13 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -10,7 +10,7 @@
 #include "GrGLStencilBuffer.h"
 #include "GrGLTextureRenderTarget.h"
 #include "GrGpuResourceCacheAccess.h"
-#include "GrOptDrawState.h"
+#include "GrPipeline.h"
 #include "GrSurfacePriv.h"
 #include "GrTemplates.h"
 #include "GrTexturePriv.h"
@@ -242,7 +242,7 @@
         GL_CALL(Disable(GR_GL_DEPTH_TEST));
         GL_CALL(DepthMask(GR_GL_FALSE));
 
-        fHWDrawFace = GrDrawState::kInvalid_DrawFace;
+        fHWDrawFace = GrPipelineBuilder::kInvalid_DrawFace;
         fHWDitherEnabled = kUnknown_TriState;
 
         if (kGL_GrGLStandard == this->glStandard()) {
@@ -1338,12 +1338,12 @@
 
 bool GrGLGpu::flushGLState(const DrawArgs& args, bool isLineDraw) {
     GrXferProcessor::BlendInfo blendInfo;
-    const GrOptDrawState& optState = *args.fOptState;
-    args.fOptState->getXferProcessor()->getBlendInfo(&blendInfo);
+    const GrPipeline& pipeline = *args.fPipeline;
+    args.fPipeline->getXferProcessor()->getBlendInfo(&blendInfo);
 
-    this->flushDither(optState.isDitherState());
+    this->flushDither(pipeline.isDitherState());
     this->flushColorWrite(blendInfo.fWriteColor);
-    this->flushDrawFace(optState.getDrawFace());
+    this->flushDrawFace(pipeline.getDrawFace());
 
     fCurrentProgram.reset(fProgramCache->getProgram(args));
     if (NULL == fCurrentProgram.get()) {
@@ -1363,12 +1363,12 @@
         this->flushBlend(blendInfo);
     }
 
-    fCurrentProgram->setData(*args.fPrimitiveProcessor, optState, *args.fBatchTracker);
+    fCurrentProgram->setData(*args.fPrimitiveProcessor, pipeline, *args.fBatchTracker);
 
-    GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(optState.getRenderTarget());
-    this->flushStencil(optState.getStencil());
-    this->flushScissor(optState.getScissorState(), glRT->getViewport(), glRT->origin());
-    this->flushHWAAState(glRT, optState.isHWAntialiasState(), isLineDraw);
+    GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(pipeline.getRenderTarget());
+    this->flushStencil(pipeline.getStencil());
+    this->flushScissor(pipeline.getScissorState(), glRT->getViewport(), glRT->origin());
+    this->flushHWAAState(glRT, pipeline.isHWAntialiasState(), isLineDraw);
 
     // This must come after textures are flushed because a texture may need
     // to be msaa-resolved (which will modify bound FBO state).
@@ -1432,10 +1432,10 @@
 
 void GrGLGpu::buildProgramDesc(GrProgramDesc* desc,
                                const GrPrimitiveProcessor& primProc,
-                               const GrOptDrawState& optState,
+                               const GrPipeline& pipeline,
                                const GrProgramDesc::DescInfo& descInfo,
                                const GrBatchTracker& batchTracker) const {
-    if (!GrGLProgramDescBuilder::Build(desc, primProc, optState, descInfo, this,
+    if (!GrGLProgramDescBuilder::Build(desc, primProc, pipeline, descInfo, this,
                                        batchTracker)) {
         SkDEBUGFAIL("Failed to generate GL program descriptor");
     }
@@ -1864,7 +1864,7 @@
 
 void GrGLGpu::onStencilPath(const GrPath* path, const StencilPathState& state) {
     this->flushColorWrite(false);
-    this->flushDrawFace(GrDrawState::kBoth_DrawFace);
+    this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace);
 
     GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(state.fRenderTarget);
     SkISize size = SkISize::Make(rt->width(), rt->height());
@@ -2234,18 +2234,18 @@
     }
 }
 
-void GrGLGpu::flushDrawFace(GrDrawState::DrawFace face) {
+void GrGLGpu::flushDrawFace(GrPipelineBuilder::DrawFace face) {
     if (fHWDrawFace != face) {
         switch (face) {
-            case GrDrawState::kCCW_DrawFace:
+            case GrPipelineBuilder::kCCW_DrawFace:
                 GL_CALL(Enable(GR_GL_CULL_FACE));
                 GL_CALL(CullFace(GR_GL_BACK));
                 break;
-            case GrDrawState::kCW_DrawFace:
+            case GrPipelineBuilder::kCW_DrawFace:
                 GL_CALL(Enable(GR_GL_CULL_FACE));
                 GL_CALL(CullFace(GR_GL_FRONT));
                 break;
-            case GrDrawState::kBoth_DrawFace:
+            case GrPipelineBuilder::kBoth_DrawFace:
                 GL_CALL(Disable(GR_GL_CULL_FACE));
                 break;
             default:
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index 0173a23..9b4f067 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -8,7 +8,6 @@
 #ifndef GrGLGpu_DEFINED
 #define GrGLGpu_DEFINED
 
-#include "GrDrawState.h"
 #include "GrGLContext.h"
 #include "GrGLIRect.h"
 #include "GrGLIndexBuffer.h"
@@ -20,10 +19,12 @@
 #include "GrGLVertexArray.h"
 #include "GrGLVertexBuffer.h"
 #include "GrGpu.h"
-#include "GrOptDrawState.h"
+#include "GrPipelineBuilder.h"
 #include "GrXferProcessor.h"
 #include "SkTypes.h"
 
+class GrPipeline;
+
 #ifdef SK_DEVELOPER
 #define PROGRAM_CACHE_STATS
 #endif
@@ -106,7 +107,7 @@
 
     void buildProgramDesc(GrProgramDesc*,
                           const GrPrimitiveProcessor&,
-                          const GrOptDrawState&,
+                          const GrPipeline&,
                           const GrProgramDesc::DescInfo&,
                           const GrBatchTracker&) const SK_OVERRIDE;
 
@@ -166,7 +167,7 @@
     // binds texture unit in GL
     void setTextureUnit(int unitIdx);
 
-    // Flushes state from GrOptDrawState to GL. Returns false if the state couldn't be set.
+    // Flushes state from GrPipeline to GL. Returns false if the state couldn't be set.
     // TODO we only have need to know if this is a line draw for flushing AA state on some buggy
     // hardware.  Evaluate if this is really necessary anymore
     bool flushGLState(const DrawArgs&, bool isLineDraw);
@@ -227,7 +228,7 @@
 
     void flushDither(bool dither);
     void flushColorWrite(bool writeColor);
-    void flushDrawFace(GrDrawState::DrawFace face);
+    void flushDrawFace(GrPipelineBuilder::DrawFace face);
 
     // flushes the scissor. see the note on flushBoundTextureAndParams about
     // flushing the scissor after that function is called.
@@ -443,7 +444,7 @@
     TriState                    fHWStencilTestEnabled;
 
 
-    GrDrawState::DrawFace       fHWDrawFace;
+    GrPipelineBuilder::DrawFace fHWDrawFace;
     TriState                    fHWWriteToColor;
     TriState                    fHWDitherEnabled;
     uint32_t                    fHWBoundRenderTargetUniqueID;
diff --git a/src/gpu/gl/GrGLGpuProgramCache.cpp b/src/gpu/gl/GrGLGpuProgramCache.cpp
index 3e20047..911fd93 100644
--- a/src/gpu/gl/GrGLGpuProgramCache.cpp
+++ b/src/gpu/gl/GrGLGpuProgramCache.cpp
@@ -11,7 +11,6 @@
 #include "GrProcessor.h"
 #include "GrGLProcessor.h"
 #include "GrGLPathRendering.h"
-#include "GrOptDrawState.h"
 #include "SkRTConf.h"
 #include "SkTSearch.h"
 
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index c018cfe..ad63dc4 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -17,7 +17,7 @@
 #include "GrGLPathRendering.h"
 #include "GrGLShaderVar.h"
 #include "GrGLSL.h"
-#include "GrOptDrawState.h"
+#include "GrPipeline.h"
 #include "GrXferProcessor.h"
 #include "SkXfermode.h"
 
@@ -103,11 +103,11 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-void GrGLProgram::setData(const GrPrimitiveProcessor& primProc, const GrOptDrawState& optState,
+void GrGLProgram::setData(const GrPrimitiveProcessor& primProc, const GrPipeline& pipeline,
                           const GrBatchTracker& batchTracker) {
-    this->setRenderTargetState(primProc, optState);
+    this->setRenderTargetState(primProc, pipeline);
 
-    const GrDeviceCoordTexture* dstCopy = optState.getDstCopy();
+    const GrDeviceCoordTexture* dstCopy = pipeline.getDstCopy();
     if (dstCopy) {
         if (fBuiltinUniformHandles.fDstCopyTopLeftUni.isValid()) {
             fProgramDataManager.set2f(fBuiltinUniformHandles.fDstCopyTopLeftUni,
@@ -135,21 +135,21 @@
     this->bindTextures(fGeometryProcessor.get(), primProc);
 
     if (fXferProcessor.get()) {
-        const GrXferProcessor& xp = *optState.getXferProcessor();
+        const GrXferProcessor& xp = *pipeline.getXferProcessor();
         fXferProcessor->fGLProc->setData(fProgramDataManager, xp);
         this->bindTextures(fXferProcessor.get(), xp);
     }
-    this->setFragmentData(primProc, optState);
+    this->setFragmentData(primProc, pipeline);
 
     // Some of GrGLProgram subclasses need to update state here
     this->didSetData();
 }
 
 void GrGLProgram::setFragmentData(const GrPrimitiveProcessor& primProc,
-                                  const GrOptDrawState& optState) {
+                                  const GrPipeline& pipeline) {
     int numProcessors = fFragmentProcessors->fProcs.count();
     for (int e = 0; e < numProcessors; ++e) {
-        const GrPendingFragmentStage& stage = optState.getFragmentStage(e);
+        const GrPendingFragmentStage& stage = pipeline.getFragmentStage(e);
         const GrProcessor& processor = *stage.processor();
         fFragmentProcessors->fProcs[e]->fGLProc->setData(fProgramDataManager, processor);
         this->setTransformData(primProc,
@@ -170,21 +170,21 @@
 }
 
 void GrGLProgram::setRenderTargetState(const GrPrimitiveProcessor& primProc,
-                                       const GrOptDrawState& optState) {
+                                       const GrPipeline& pipeline) {
     // Load the RT height uniform if it is needed to y-flip gl_FragCoord.
     if (fBuiltinUniformHandles.fRTHeightUni.isValid() &&
-        fRenderTargetState.fRenderTargetSize.fHeight != optState.getRenderTarget()->height()) {
+        fRenderTargetState.fRenderTargetSize.fHeight != pipeline.getRenderTarget()->height()) {
         fProgramDataManager.set1f(fBuiltinUniformHandles.fRTHeightUni,
-                                   SkIntToScalar(optState.getRenderTarget()->height()));
+                                   SkIntToScalar(pipeline.getRenderTarget()->height()));
     }
 
     // call subclasses to set the actual view matrix
-    this->onSetRenderTargetState(primProc, optState);
+    this->onSetRenderTargetState(primProc, pipeline);
 }
 
 void GrGLProgram::onSetRenderTargetState(const GrPrimitiveProcessor&,
-                                         const GrOptDrawState& optState) {
-    const GrRenderTarget* rt = optState.getRenderTarget();
+                                         const GrPipeline& pipeline) {
+    const GrRenderTarget* rt = pipeline.getRenderTarget();
     SkISize size;
     size.set(rt->width(), rt->height());
     if (fRenderTargetState.fRenderTargetOrigin != rt->origin() ||
@@ -228,9 +228,9 @@
 }
 
 void GrGLNvprProgram::onSetRenderTargetState(const GrPrimitiveProcessor& primProc,
-                                             const GrOptDrawState& optState) {
+                                             const GrPipeline& pipeline) {
     SkASSERT(!primProc.willUseGeoShader() && primProc.numAttribs() == 0);
-    const GrRenderTarget* rt = optState.getRenderTarget();
+    const GrRenderTarget* rt = pipeline.getRenderTarget();
     SkISize size;
     size.set(rt->width(), rt->height());
     fGpu->glPathRendering()->setProjectionMatrix(primProc.viewMatrix(),
diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h
index cce6c2a..e49fbab 100644
--- a/src/gpu/gl/GrGLProgram.h
+++ b/src/gpu/gl/GrGLProgram.h
@@ -10,7 +10,6 @@
 #define GrGLProgram_DEFINED
 
 #include "builders/GrGLProgramBuilder.h"
-#include "GrDrawState.h"
 #include "GrGLContext.h"
 #include "GrGLProgramDesc.h"
 #include "GrGLSL.h"
@@ -23,6 +22,7 @@
 class GrGLProcessor;
 class GrGLInstalledProcessors;
 class GrGLProgramBuilder;
+class GrPipeline;
 
 /**
  * This class manages a GPU program and records per-program information.
@@ -95,7 +95,7 @@
      * GrGLGpu object to bind the textures required by the GrGLProcessors. The color and coverage
      * stages come from GrGLProgramDesc::Build().
      */
-    void setData(const GrPrimitiveProcessor&, const GrOptDrawState&, const GrBatchTracker&);
+    void setData(const GrPrimitiveProcessor&, const GrPipeline&, const GrBatchTracker&);
 
 protected:
     typedef GrGLProgramDataManager::UniformHandle UniformHandle;
@@ -116,7 +116,7 @@
     void initSamplers(Proc*, int* texUnitIdx);
 
     // A templated helper to loop over effects, set the transforms(via subclass) and bind textures
-    void setFragmentData(const GrPrimitiveProcessor&, const GrOptDrawState&);
+    void setFragmentData(const GrPrimitiveProcessor&, const GrPipeline&);
     virtual void setTransformData(const GrPrimitiveProcessor&,
                                   const GrPendingFragmentStage&,
                                   int index,
@@ -131,8 +131,8 @@
     virtual void didSetData() {}
 
     // Helper for setData() that sets the view matrix and loads the render target height uniform
-    void setRenderTargetState(const GrPrimitiveProcessor&, const GrOptDrawState&);
-    virtual void onSetRenderTargetState(const GrPrimitiveProcessor&, const GrOptDrawState&);
+    void setRenderTargetState(const GrPrimitiveProcessor&, const GrPipeline&);
+    virtual void onSetRenderTargetState(const GrPrimitiveProcessor&, const GrPipeline&);
 
     // these reflect the current values of uniforms (GL uniform values travel with program)
     RenderTargetState fRenderTargetState;
@@ -180,7 +180,7 @@
                                   const GrPendingFragmentStage&,
                                   int index,
                                   GrGLInstalledFragProc*) SK_OVERRIDE;
-    virtual void onSetRenderTargetState(const GrPrimitiveProcessor&, const GrOptDrawState&);
+    virtual void onSetRenderTargetState(const GrPrimitiveProcessor&, const GrPipeline&);
 
     friend class GrGLNvprProgramBuilder;
 
diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp
index a89941c..32f831e 100644
--- a/src/gpu/gl/GrGLProgramDesc.cpp
+++ b/src/gpu/gl/GrGLProgramDesc.cpp
@@ -9,7 +9,7 @@
 #include "GrGLProcessor.h"
 #include "GrProcessor.h"
 #include "GrGLGpu.h"
-#include "GrOptDrawState.h"
+#include "GrPipeline.h"
 #include "SkChecksum.h"
 #include "gl/builders/GrGLFragmentShaderBuilder.h"
 
@@ -88,7 +88,7 @@
 
 bool GrGLProgramDescBuilder::Build(GrProgramDesc* desc,
                                    const GrPrimitiveProcessor& primProc,
-                                   const GrOptDrawState& optState,
+                                   const GrPipeline& pipeline,
                                    const GrProgramDesc::DescInfo& descInfo,
                                    const GrGLGpu* gpu,
                                    const GrBatchTracker& batchTracker) {
@@ -110,8 +110,8 @@
         return false;
     }
 
-    for (int s = 0; s < optState.numFragmentStages(); ++s) {
-        const GrPendingFragmentStage& fps = optState.getFragmentStage(s);
+    for (int s = 0; s < pipeline.numFragmentStages(); ++s) {
+        const GrPendingFragmentStage& fps = pipeline.getFragmentStage(s);
         const GrFragmentProcessor& fp = *fps.processor();
         fp.getGLProcessorKey(gpu->glCaps(), &b);
         if (!get_meta_key(fp, gpu->glCaps(), primProc.getTransformKey(fp.coordTransforms()), &b)) {
@@ -120,7 +120,7 @@
         }
     }
 
-    const GrXferProcessor& xp = *optState.getXferProcessor();
+    const GrXferProcessor& xp = *pipeline.getXferProcessor();
     xp.getGLProcessorKey(gpu->glCaps(), &b);
     if (!get_meta_key(xp, gpu->glCaps(), 0, &b)) {
         desc->fKey.reset();
@@ -136,7 +136,7 @@
     memset(header, 0, kHeaderSize);
 
     if (descInfo.fReadsDst) {
-        const GrDeviceCoordTexture* dstCopy = optState.getDstCopy();
+        const GrDeviceCoordTexture* dstCopy = pipeline.getDstCopy();
         SkASSERT(dstCopy || gpu->caps()->dstReadInShaderSupport());
         const GrTexture* dstCopyTexture = NULL;
         if (dstCopy) {
@@ -151,14 +151,14 @@
 
     if (descInfo.fReadsFragPosition) {
         header->fFragPosKey =
-                GrGLFragmentShaderBuilder::KeyForFragmentPosition(optState.getRenderTarget(),
+                GrGLFragmentShaderBuilder::KeyForFragmentPosition(pipeline.getRenderTarget(),
                                                                   gpu->glCaps());
     } else {
         header->fFragPosKey = 0;
     }
 
-    header->fColorEffectCnt = optState.numColorStages();
-    header->fCoverageEffectCnt = optState.numCoverageStages();
+    header->fColorEffectCnt = pipeline.numColorStages();
+    header->fCoverageEffectCnt = pipeline.numCoverageStages();
     desc->finalize();
     return true;
 }
diff --git a/src/gpu/gl/GrGLProgramDesc.h b/src/gpu/gl/GrGLProgramDesc.h
index 0584082..e4db4c3 100644
--- a/src/gpu/gl/GrGLProgramDesc.h
+++ b/src/gpu/gl/GrGLProgramDesc.h
@@ -42,7 +42,7 @@
      * Builds a GL specific program descriptor
      *
      * @param GrPrimitiveProcessor The geometry
-     * @param GrOptDrawState  The optimized drawstate.  The descriptor will represent a program
+     * @param GrPipeline  The optimized drawstate.  The descriptor will represent a program
      *                        which this optstate can use to draw with.  The optstate contains
      *                        general draw information, as well as the specific color, geometry,
      *                        and coverage stages which will be used to generate the GL Program for
@@ -57,7 +57,7 @@
      **/
     static bool Build(GrProgramDesc*,
                       const GrPrimitiveProcessor&,
-                      const GrOptDrawState&,
+                      const GrPipeline&,
                       const GrProgramDesc::DescInfo&,
                       const GrGLGpu*,
                       const GrBatchTracker&);
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index 9fbb4c1..0881696 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -193,8 +193,8 @@
     // First we loop over all of the installed processors and collect coord transforms.  These will
     // be sent to the GrGLPrimitiveProcessor in its emitCode function
     SkSTArray<8, GrGLProcessor::TransformedCoordsArray> outCoords;
-    for (int i = 0; i < this->optState().numFragmentStages(); i++) {
-        const GrFragmentProcessor* processor = this->optState().getFragmentStage(i).processor();
+    for (int i = 0; i < this->pipeline().numFragmentStages(); i++) {
+        const GrFragmentProcessor* processor = this->pipeline().getFragmentStage(i).processor();
         SkSTArray<2, const GrCoordTransform*, true>& procCoords = fCoordTransforms.push_back();
         for (int t = 0; t < processor->numTransforms(); t++) {
             procCoords.push_back(&processor->coordTransform(t));
@@ -205,10 +205,10 @@
     this->emitAndInstallProc(primProc, inputColor, inputCoverage);
 
     fFragmentProcessors.reset(SkNEW(GrGLInstalledFragProcs));
-    int numProcs = this->optState().numFragmentStages();
-    this->emitAndInstallFragProcs(0, this->optState().numColorStages(), inputColor);
-    this->emitAndInstallFragProcs(this->optState().numColorStages(), numProcs,  inputCoverage);
-    this->emitAndInstallXferProc(*this->optState().getXferProcessor(), *inputColor, *inputCoverage);
+    int numProcs = this->pipeline().numFragmentStages();
+    this->emitAndInstallFragProcs(0, this->pipeline().numColorStages(), inputColor);
+    this->emitAndInstallFragProcs(this->pipeline().numColorStages(), numProcs,  inputCoverage);
+    this->emitAndInstallXferProc(*this->pipeline().getXferProcessor(), *inputColor, *inputCoverage);
 }
 
 void GrGLProgramBuilder::emitAndInstallFragProcs(int procOffset,
@@ -216,7 +216,7 @@
                                                  GrGLSLExpr4* inOut) {
     for (int e = procOffset; e < numProcs; ++e) {
         GrGLSLExpr4 output;
-        const GrPendingFragmentStage& stage = this->optState().getFragmentStage(e);
+        const GrPendingFragmentStage& stage = this->pipeline().getFragmentStage(e);
         this->emitAndInstallProc(stage, e, *inOut, &output);
         *inOut = output;
     }
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.h b/src/gpu/gl/builders/GrGLProgramBuilder.h
index 612791e..4b40cef 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.h
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.h
@@ -15,8 +15,8 @@
 #include "../GrGLUniformHandle.h"
 #include "../GrGLGeometryProcessor.h"
 #include "../GrGLXferProcessor.h"
-#include "../../GrOptDrawState.h"
 #include "../../GrPendingFragmentStage.h"
+#include "../../GrPipeline.h"
 
 /*
  * This is the base class for a series of interfaces.  This base class *MUST* remain abstract with
@@ -283,7 +283,7 @@
     GrGLProgramBuilder(GrGLGpu*, const DrawArgs&);
 
     const GrPrimitiveProcessor& primitiveProcessor() const { return *fArgs.fPrimitiveProcessor; }
-    const GrOptDrawState& optState() const { return *fArgs.fOptState; }
+    const GrPipeline& pipeline() const { return *fArgs.fPipeline; }
     const GrProgramDesc& desc() const { return *fArgs.fDesc; }
     const GrBatchTracker& batchTracker() const { return *fArgs.fBatchTracker; }
     const GrProgramDesc::KeyHeader& header() const { return fArgs.fDesc->header(); }
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 638e229..c43d757 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -14,7 +14,7 @@
 
 #include "GrContextFactory.h"
 #include "GrInvariantOutput.h"
-#include "GrOptDrawState.h"
+#include "GrPipeline.h"
 #include "GrTest.h"
 #include "GrXferProcessor.h"
 #include "SkChecksum.h"
@@ -121,12 +121,13 @@
     return SkRef(texture->asRenderTarget());
 }
 
-static void set_random_xpf(GrContext* context, const GrDrawTargetCaps& caps, GrDrawState* ds,
-                           SkRandom* random, GrTexture* dummyTextures[]) {
+static void set_random_xpf(GrContext* context, const GrDrawTargetCaps& caps,
+                           GrPipelineBuilder* pipelineBuilder, SkRandom* random,
+                           GrTexture* dummyTextures[]) {
     SkAutoTUnref<const GrXPFactory> xpf(
         GrProcessorTestFactory<GrXPFactory>::CreateStage(random, context, caps, dummyTextures));
     SkASSERT(xpf);
-    ds->setXPFactory(xpf.get());
+    pipelineBuilder->setXPFactory(xpf.get());
 }
 
 static const GrGeometryProcessor* get_random_gp(GrContext* context,
@@ -140,7 +141,7 @@
 }
 
 static void set_random_color_coverage_stages(GrGLGpu* gpu,
-                                             GrDrawState* ds,
+                                             GrPipelineBuilder* pipelineBuilder,
                                              int maxStages,
                                              bool usePathRendering,
                                              SkRandom* random,
@@ -171,24 +172,24 @@
 
         // finally add the stage to the correct pipeline in the drawstate
         if (s < numColorProcs) {
-            ds->addColorProcessor(fp);
+            pipelineBuilder->addColorProcessor(fp);
         } else {
-            ds->addCoverageProcessor(fp);
+            pipelineBuilder->addCoverageProcessor(fp);
         }
         ++s;
     }
 }
 
-static void set_random_state(GrDrawState* ds, SkRandom* random) {
+static void set_random_state(GrPipelineBuilder* pipelineBuilder, SkRandom* random) {
     int state = 0;
-    for (int i = 1; i <= GrDrawState::kLast_StateBit; i <<= 1) {
+    for (int i = 1; i <= GrPipelineBuilder::kLast_StateBit; i <<= 1) {
         state |= random->nextBool() * i;
     }
-    ds->enableState(state);
+    pipelineBuilder->enableState(state);
 }
 
 // right now, the only thing we seem to care about in drawState's stencil is 'doesWrite()'
-static void set_random_stencil(GrDrawState* ds, SkRandom* random) {
+static void set_random_stencil(GrPipelineBuilder* pipelineBuilder, SkRandom* random) {
     GR_STATIC_CONST_SAME_STENCIL(kDoesWriteStencil,
                                  kReplace_StencilOp,
                                  kReplace_StencilOp,
@@ -205,9 +206,9 @@
                                  0xffff);
 
     if (random->nextBool()) {
-        ds->setStencil(kDoesWriteStencil);
+        pipelineBuilder->setStencil(kDoesWriteStencil);
     } else {
-        ds->setStencil(kDoesNotWriteStencil);
+        pipelineBuilder->setStencil(kDoesNotWriteStencil);
     }
 }
 
@@ -266,8 +267,8 @@
             return false;
         }
 
-        GrDrawState ds;
-        ds.setRenderTarget(rt.get());
+        GrPipelineBuilder pipelineBuilder;
+        pipelineBuilder.setRenderTarget(rt.get());
 
         // if path rendering we have to setup a couple of things like the draw type
         bool usePathRendering = gpu->glCaps().pathRenderingSupport() && random.nextBool();
@@ -282,17 +283,17 @@
             pathProc.reset(GrPathProcessor::Create(GrColor_WHITE));
         }
         set_random_color_coverage_stages(gpu,
-                                         &ds,
+                                         &pipelineBuilder,
                                          maxStages - hasGeometryProcessor,
                                          usePathRendering,
                                          &random,
                                          dummyTextures);
 
         // creates a random xfer processor factory on the draw state 
-        set_random_xpf(fContext, gpu->glCaps(), &ds, &random, dummyTextures);
+        set_random_xpf(fContext, gpu->glCaps(), &pipelineBuilder, &random, dummyTextures);
 
-        set_random_state(&ds, &random);
-        set_random_stencil(&ds, &random);
+        set_random_state(&pipelineBuilder, &random);
+        set_random_stencil(&pipelineBuilder, &random);
 
         GrDeviceCoordTexture dstCopy;
 
@@ -302,24 +303,24 @@
         } else {
             primProc = pathProc.get();
         }
-        if (!this->setupDstReadIfNecessary(&ds, &dstCopy, NULL)) {
+        if (!this->setupDstReadIfNecessary(&pipelineBuilder, &dstCopy, NULL)) {
             SkDebugf("Couldn't setup dst read texture");
             return false;
         }
 
         // create optimized draw state, setup readDst texture if required, and build a descriptor
         // and program.  ODS creation can fail, so we have to check
-        GrOptDrawState ods(ds, primProc, *gpu->caps(), scissor, &dstCopy);
-        if (ods.mustSkip()) {
+        GrPipeline pipeline(pipelineBuilder, primProc, *gpu->caps(), scissor, &dstCopy);
+        if (pipeline.mustSkip()) {
             continue;
         }
         GrBatchTracker bt;
-        primProc->initBatchTracker(&bt, ods.getInitBatchTracker());
+        primProc->initBatchTracker(&bt, pipeline.getInitBatchTracker());
 
         GrProgramDesc desc;
-        gpu->buildProgramDesc(&desc, *primProc, ods, ods.descInfo(), bt);
+        gpu->buildProgramDesc(&desc, *primProc, pipeline, pipeline.descInfo(), bt);
 
-        GrGpu::DrawArgs args(primProc, &ods, &desc, &bt);
+        GrGpu::DrawArgs args(primProc, &pipeline, &desc, &bt);
         SkAutoTUnref<GrGLProgram> program(GrGLProgramBuilder::CreateProgram(args, gpu));
 
         if (NULL == program.get()) {