Put GrPrimitiveProcessor/GrGeometryProcessor before GrPipeline in param lists.

We were inconsistent about which order these were in. Having the processor first
will make the parameter order more logical for an upcoming change. Also, the primitive
processor comes logically before the pipeline.

Change-Id: I3968c5e4e6dff01f9c4ad311eb1795b3c7580ff5
Reviewed-on: https://skia-review.googlesource.com/137228
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrGpuCommandBuffer.cpp b/src/gpu/GrGpuCommandBuffer.cpp
index fa2ce07..617ed75 100644
--- a/src/gpu/GrGpuCommandBuffer.cpp
+++ b/src/gpu/GrGpuCommandBuffer.cpp
@@ -26,8 +26,8 @@
     this->onClearStencilClip(clip, insideStencilMask);
 }
 
-bool GrGpuRTCommandBuffer::draw(const GrPipeline& pipeline,
-                                const GrPrimitiveProcessor& primProc,
+bool GrGpuRTCommandBuffer::draw(const GrPrimitiveProcessor& primProc,
+                                const GrPipeline& pipeline,
                                 const GrMesh meshes[],
                                 const GrPipeline::DynamicState dynamicStates[],
                                 int meshCount,
@@ -51,7 +51,6 @@
         this->gpu()->stats()->incNumFailedDraws();
         return false;
     }
-    this->onDraw(pipeline, primProc, meshes, dynamicStates, meshCount, bounds);
+    this->onDraw(primProc, pipeline, meshes, dynamicStates, meshCount, bounds);
     return true;
 }
-
diff --git a/src/gpu/GrGpuCommandBuffer.h b/src/gpu/GrGpuCommandBuffer.h
index 6963d23..4fae620 100644
--- a/src/gpu/GrGpuCommandBuffer.h
+++ b/src/gpu/GrGpuCommandBuffer.h
@@ -97,8 +97,8 @@
     // GrMesh object and emit a draw for it. Each draw will use the same GrPipeline and
     // GrPrimitiveProcessor. This may fail if the draw would exceed any resource limits (e.g.
     // number of vertex attributes is too large).
-    bool draw(const GrPipeline&,
-              const GrPrimitiveProcessor&,
+    bool draw(const GrPrimitiveProcessor&,
+              const GrPipeline&,
               const GrMesh[],
               const GrPipeline::DynamicState[],
               int meshCount,
@@ -132,8 +132,8 @@
     virtual GrGpu* gpu() = 0;
 
     // overridden by backend-specific derived class to perform the draw call.
-    virtual void onDraw(const GrPipeline&,
-                        const GrPrimitiveProcessor&,
+    virtual void onDraw(const GrPrimitiveProcessor&,
+                        const GrPipeline&,
                         const GrMesh[],
                         const GrPipeline::DynamicState[],
                         int meshCount,
diff --git a/src/gpu/GrOpFlushState.cpp b/src/gpu/GrOpFlushState.cpp
index 09b657a..b24e89a 100644
--- a/src/gpu/GrOpFlushState.cpp
+++ b/src/gpu/GrOpFlushState.cpp
@@ -43,7 +43,7 @@
             ++fCurrUpload;
         }
         SkASSERT(fCurrDraw->fPipeline->proxy() == this->drawOpArgs().fProxy);
-        this->rtCommandBuffer()->draw(*fCurrDraw->fPipeline, *fCurrDraw->fGeometryProcessor,
+        this->rtCommandBuffer()->draw(*fCurrDraw->fGeometryProcessor, *fCurrDraw->fPipeline,
                                       fMeshes.begin() + fCurrMesh, nullptr, fCurrDraw->fMeshCnt,
                                       opBounds);
         fCurrMesh += fCurrDraw->fMeshCnt;
diff --git a/src/gpu/GrPathRendering.cpp b/src/gpu/GrPathRendering.cpp
index 2da1d2f..1af220c 100644
--- a/src/gpu/GrPathRendering.cpp
+++ b/src/gpu/GrPathRendering.cpp
@@ -49,8 +49,8 @@
     this->onStencilPath(args, path);
 }
 
-void GrPathRendering::drawPath(const GrPipeline& pipeline,
-                               const GrPrimitiveProcessor& primProc,
+void GrPathRendering::drawPath(const GrPrimitiveProcessor& primProc,
+                               const GrPipeline& pipeline,
                                // Cover pass settings in pipeline.
                                const GrStencilSettings& stencilPassSettings,
                                const GrPath* path) {
@@ -58,5 +58,5 @@
     if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*fGpu->caps())) {
         fGpu->xferBarrier(pipeline.renderTarget(), barrierType);
     }
-    this->onDrawPath(pipeline, primProc, stencilPassSettings, path);
+    this->onDrawPath(primProc, pipeline, stencilPassSettings, path);
 }
diff --git a/src/gpu/GrPathRendering.h b/src/gpu/GrPathRendering.h
index 0a1abc1..ab13674 100644
--- a/src/gpu/GrPathRendering.h
+++ b/src/gpu/GrPathRendering.h
@@ -109,17 +109,17 @@
 
     void stencilPath(const StencilPathArgs& args, const GrPath* path);
 
-    void drawPath(const GrPipeline& pipeline,
-                  const GrPrimitiveProcessor& primProc,
-                  const GrStencilSettings& stencilPassSettings, // Cover pass settings in pipeline.
+    void drawPath(const GrPrimitiveProcessor& primProc,
+                  const GrPipeline& pipeline,
+                  const GrStencilSettings& stencilPassSettings,  // Cover pass settings in pipeline.
                   const GrPath* path);
 
 protected:
     GrPathRendering(GrGpu* gpu) : fGpu(gpu) { }
 
     virtual void onStencilPath(const StencilPathArgs&, const GrPath*) = 0;
-    virtual void onDrawPath(const GrPipeline&,
-                            const GrPrimitiveProcessor&,
+    virtual void onDrawPath(const GrPrimitiveProcessor&,
+                            const GrPipeline&,
                             const GrStencilSettings&,
                             const GrPath*) = 0;
 
diff --git a/src/gpu/ccpr/GrCCCoverageProcessor.cpp b/src/gpu/ccpr/GrCCCoverageProcessor.cpp
index 75d0667..94b027a 100644
--- a/src/gpu/ccpr/GrCCCoverageProcessor.cpp
+++ b/src/gpu/ccpr/GrCCCoverageProcessor.cpp
@@ -228,12 +228,12 @@
                                  const GrPipeline::DynamicState dynamicStates[], int meshCount,
                                  const SkRect& drawBounds) const {
     GrGpuRTCommandBuffer* cmdBuff = flushState->rtCommandBuffer();
-    cmdBuff->draw(pipeline, *this, meshes, dynamicStates, meshCount, drawBounds);
+    cmdBuff->draw(*this, pipeline, meshes, dynamicStates, meshCount, drawBounds);
 
     // Geometry shader backend draws primitives in two subpasses.
     if (Impl::kGeometryShader == fImpl) {
         SkASSERT(GSSubpass::kHulls == fGSSubpass);
         GrCCCoverageProcessor cornerProc(*this, GSSubpass::kCorners);
-        cmdBuff->draw(pipeline, cornerProc, meshes, dynamicStates, meshCount, drawBounds);
+        cmdBuff->draw(cornerProc, pipeline, meshes, dynamicStates, meshCount, drawBounds);
     }
 }
diff --git a/src/gpu/ccpr/GrCCPathProcessor.cpp b/src/gpu/ccpr/GrCCPathProcessor.cpp
index e180724..e1a5086 100644
--- a/src/gpu/ccpr/GrCCPathProcessor.cpp
+++ b/src/gpu/ccpr/GrCCPathProcessor.cpp
@@ -147,7 +147,7 @@
                              enablePrimitiveRestart);
     mesh.setVertexData(resources.vertexBuffer());
 
-    flushState->rtCommandBuffer()->draw(pipeline, *this, &mesh, nullptr, 1, bounds);
+    flushState->rtCommandBuffer()->draw(*this, pipeline, &mesh, nullptr, 1, bounds);
 }
 
 void GLSLPathProcessor::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 9e73259..97dc3d1 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -1683,9 +1683,9 @@
     }
 }
 
-bool GrGLGpu::flushGLState(const GrPipeline& pipeline, const GrPrimitiveProcessor& primProc,
+bool GrGLGpu::flushGLState(const GrPrimitiveProcessor& primProc, const GrPipeline& pipeline,
                            bool willDrawPoints) {
-    sk_sp<GrGLProgram> program(fProgramCache->refProgram(this, pipeline, primProc, willDrawPoints));
+    sk_sp<GrGLProgram> program(fProgramCache->refProgram(this, primProc, pipeline, willDrawPoints));
     if (!program) {
         GrCapsDebugf(this->caps(), "Failed to create program!\n");
         return false;
@@ -2248,8 +2248,8 @@
     #endif
 #endif
 
-void GrGLGpu::draw(const GrPipeline& pipeline,
-                   const GrPrimitiveProcessor& primProc,
+void GrGLGpu::draw(const GrPrimitiveProcessor& primProc,
+                   const GrPipeline& pipeline,
                    const GrMesh meshes[],
                    const GrPipeline::DynamicState dynamicStates[],
                    int meshCount) {
@@ -2262,7 +2262,7 @@
             break;
         }
     }
-    if (!this->flushGLState(pipeline, primProc, hasPoints)) {
+    if (!this->flushGLState(primProc, pipeline, hasPoints)) {
         return;
     }
 
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index d089744..782b0b0 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -82,13 +82,12 @@
     // The GrGLGpuRTCommandBuffer does not buffer up draws before submitting them to the gpu.
     // Thus this is the implementation of the draw call for the corresponding passthrough function
     // on GrGLRTGpuCommandBuffer.
-    void draw(const GrPipeline&,
-              const GrPrimitiveProcessor&,
+    void draw(const GrPrimitiveProcessor&,
+              const GrPipeline&,
               const GrMesh[],
               const GrPipeline::DynamicState[],
               int meshCount);
 
-
     // GrMesh::SendToGpuImpl methods. These issue the actual GL draw calls.
     // Marked final as a hint to the compiler to not use virtual dispatch.
     void sendMeshToGpu(GrPrimitiveType, const GrBuffer* vertexBuffer, int vertexCount,
@@ -254,7 +253,7 @@
 
     // Flushes state from GrPipeline to GL. Returns false if the state couldn't be set.
     // willDrawPoints must be true if point primitives will be rendered after setting the GL state.
-    bool flushGLState(const GrPipeline&, const GrPrimitiveProcessor&, bool willDrawPoints);
+    bool flushGLState(const GrPrimitiveProcessor&, const GrPipeline&, bool willDrawPoints);
 
     void flushProgram(sk_sp<GrGLProgram>);
 
@@ -295,7 +294,7 @@
         ~ProgramCache();
 
         void abandon();
-        GrGLProgram* refProgram(const GrGLGpu*, const GrPipeline&, const GrPrimitiveProcessor&,
+        GrGLProgram* refProgram(const GrGLGpu*, const GrPrimitiveProcessor&, const GrPipeline&,
                                 bool hasPointSize);
 
     private:
diff --git a/src/gpu/gl/GrGLGpuCommandBuffer.h b/src/gpu/gl/GrGLGpuCommandBuffer.h
index c45bf5f..84e05a8 100644
--- a/src/gpu/gl/GrGLGpuCommandBuffer.h
+++ b/src/gpu/gl/GrGLGpuCommandBuffer.h
@@ -84,14 +84,14 @@
 private:
     GrGpu* gpu() override { return fGpu; }
 
-    void onDraw(const GrPipeline& pipeline,
-                const GrPrimitiveProcessor& primProc,
+    void onDraw(const GrPrimitiveProcessor& primProc,
+                const GrPipeline& pipeline,
                 const GrMesh mesh[],
                 const GrPipeline::DynamicState dynamicStates[],
                 int meshCount,
                 const SkRect& bounds) override {
         SkASSERT(pipeline.renderTarget() == fRenderTarget);
-        fGpu->draw(pipeline, primProc, mesh, dynamicStates, meshCount);
+        fGpu->draw(primProc, pipeline, mesh, dynamicStates, meshCount);
     }
 
     void onClear(const GrFixedClip& clip, GrColor color) override {
diff --git a/src/gpu/gl/GrGLGpuProgramCache.cpp b/src/gpu/gl/GrGLGpuProgramCache.cpp
index faa2eb8..e00ef29 100644
--- a/src/gpu/gl/GrGLGpuProgramCache.cpp
+++ b/src/gpu/gl/GrGLGpuProgramCache.cpp
@@ -69,8 +69,8 @@
 }
 
 GrGLProgram* GrGLGpu::ProgramCache::refProgram(const GrGLGpu* gpu,
-                                               const GrPipeline& pipeline,
                                                const GrPrimitiveProcessor& primProc,
+                                               const GrPipeline& pipeline,
                                                bool isPoints) {
 #ifdef PROGRAM_CACHE_STATS
     ++fTotalRequests;
@@ -96,7 +96,7 @@
 #ifdef PROGRAM_CACHE_STATS
         ++fCacheMisses;
 #endif
-        GrGLProgram* program = GrGLProgramBuilder::CreateProgram(pipeline, primProc, &desc, fGpu);
+        GrGLProgram* program = GrGLProgramBuilder::CreateProgram(primProc, pipeline, &desc, fGpu);
         if (nullptr == program) {
             return nullptr;
         }
diff --git a/src/gpu/gl/GrGLPathRendering.cpp b/src/gpu/gl/GrGLPathRendering.cpp
index 45bc018..7948129 100644
--- a/src/gpu/gl/GrGLPathRendering.cpp
+++ b/src/gpu/gl/GrGLPathRendering.cpp
@@ -111,11 +111,11 @@
     }
 }
 
-void GrGLPathRendering::onDrawPath(const GrPipeline& pipeline,
-                                   const GrPrimitiveProcessor& primProc,
+void GrGLPathRendering::onDrawPath(const GrPrimitiveProcessor& primProc,
+                                   const GrPipeline& pipeline,
                                    const GrStencilSettings& stencilPassSettings,
                                    const GrPath* path) {
-    if (!this->gpu()->flushGLState(pipeline, primProc, false)) {
+    if (!this->gpu()->flushGLState(primProc, pipeline, false)) {
         return;
     }
     const GrGLPath* glPath = static_cast<const GrGLPath*>(path);
diff --git a/src/gpu/gl/GrGLPathRendering.h b/src/gpu/gl/GrGLPathRendering.h
index 0c1d192..1dfb756 100644
--- a/src/gpu/gl/GrGLPathRendering.h
+++ b/src/gpu/gl/GrGLPathRendering.h
@@ -65,10 +65,11 @@
 
 protected:
     void onStencilPath(const StencilPathArgs&, const GrPath*) override;
-    void onDrawPath(const GrPipeline&,
-                    const GrPrimitiveProcessor&,
+    void onDrawPath(const GrPrimitiveProcessor&,
+                    const GrPipeline&,
                     const GrStencilSettings&,
                     const GrPath*) override;
+
 private:
     /**
      * Mark certain functionality as not supported.
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index 79e13d3..a883d7e 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -29,8 +29,8 @@
 #define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X)
 #define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->gpu()->glInterface(), R, X)
 
-GrGLProgram* GrGLProgramBuilder::CreateProgram(const GrPipeline& pipeline,
-                                               const GrPrimitiveProcessor& primProc,
+GrGLProgram* GrGLProgramBuilder::CreateProgram(const GrPrimitiveProcessor& primProc,
+                                               const GrPipeline& pipeline,
                                                GrProgramDesc* desc,
                                                GrGLGpu* gpu) {
 #ifdef SK_DEBUG
@@ -66,7 +66,7 @@
                                        const GrPipeline& pipeline,
                                        const GrPrimitiveProcessor& primProc,
                                        GrProgramDesc* desc)
-        : INHERITED(pipeline, primProc, desc)
+        : INHERITED(primProc, pipeline, desc)
         , fGpu(gpu)
         , fVaryingHandler(this)
         , fUniformHandler(this)
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.h b/src/gpu/gl/builders/GrGLProgramBuilder.h
index 30d5179..dd21a6d 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.h
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.h
@@ -35,8 +35,8 @@
      * the surface origin.
      * @return true if generation was successful.
      */
-    static GrGLProgram* CreateProgram(const GrPipeline&,
-                                      const GrPrimitiveProcessor&,
+    static GrGLProgram* CreateProgram(const GrPrimitiveProcessor&,
+                                      const GrPipeline&,
                                       GrProgramDesc*,
                                       GrGLGpu*);
 
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
index cae1c2a..19600a2 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
@@ -19,22 +19,21 @@
 
 const int GrGLSLProgramBuilder::kVarsPerBlock = 8;
 
-GrGLSLProgramBuilder::GrGLSLProgramBuilder(const GrPipeline& pipeline,
-                                           const GrPrimitiveProcessor& primProc,
+GrGLSLProgramBuilder::GrGLSLProgramBuilder(const GrPrimitiveProcessor& primProc,
+                                           const GrPipeline& pipeline,
                                            GrProgramDesc* desc)
-    : fVS(this)
-    , fGS(this)
-    , fFS(this)
-    , fStageIndex(-1)
-    , fPipeline(pipeline)
-    , fPrimProc(primProc)
-    , fDesc(desc)
-    , fGeometryProcessor(nullptr)
-    , fXferProcessor(nullptr)
-    , fNumVertexSamplers(0)
-    , fNumGeometrySamplers(0)
-    , fNumFragmentSamplers(0) {
-}
+        : fVS(this)
+        , fGS(this)
+        , fFS(this)
+        , fStageIndex(-1)
+        , fPipeline(pipeline)
+        , fPrimProc(primProc)
+        , fDesc(desc)
+        , fGeometryProcessor(nullptr)
+        , fXferProcessor(nullptr)
+        , fNumVertexSamplers(0)
+        , fNumGeometrySamplers(0)
+        , fNumFragmentSamplers(0) {}
 
 void GrGLSLProgramBuilder::addFeature(GrShaderFlags shaders,
                                       uint32_t featureBit,
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.h b/src/gpu/glsl/GrGLSLProgramBuilder.h
index 7d0ce74..c53cf19 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.h
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.h
@@ -93,9 +93,7 @@
     int fFragmentProcessorCnt;
 
 protected:
-    explicit GrGLSLProgramBuilder(const GrPipeline&,
-                                  const GrPrimitiveProcessor&,
-                                  GrProgramDesc*);
+    explicit GrGLSLProgramBuilder(const GrPrimitiveProcessor&, const GrPipeline&, GrProgramDesc*);
 
     void addFeature(GrShaderFlags shaders, uint32_t featureBit, const char* extensionName);
 
diff --git a/src/gpu/mock/GrMockGpuCommandBuffer.h b/src/gpu/mock/GrMockGpuCommandBuffer.h
index 2229fa3..7a94e9a 100644
--- a/src/gpu/mock/GrMockGpuCommandBuffer.h
+++ b/src/gpu/mock/GrMockGpuCommandBuffer.h
@@ -50,7 +50,7 @@
     void submit() override { fGpu->submitCommandBuffer(this); }
 
 private:
-    void onDraw(const GrPipeline&, const GrPrimitiveProcessor&, const GrMesh[],
+    void onDraw(const GrPrimitiveProcessor&, const GrPipeline&, const GrMesh[],
                 const GrPipeline::DynamicState[], int meshCount, const SkRect& bounds) override {
         ++fNumDraws;
     }
diff --git a/src/gpu/ops/GrDrawPathOp.cpp b/src/gpu/ops/GrDrawPathOp.cpp
index a8081fc..185b3c0 100644
--- a/src/gpu/ops/GrDrawPathOp.cpp
+++ b/src/gpu/ops/GrDrawPathOp.cpp
@@ -81,7 +81,7 @@
 
     GrStencilSettings stencil;
     init_stencil_pass_settings(*state, this->fillType(), &stencil);
-    state->gpu()->pathRendering()->drawPath(pipeline, *pathProc, stencil, fPath.get());
+    state->gpu()->pathRendering()->drawPath(*pathProc, pipeline, stencil, fPath.get());
 }
 
 //////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/vk/GrVkGpuCommandBuffer.cpp b/src/gpu/vk/GrVkGpuCommandBuffer.cpp
index 0058a94..95bcb13 100644
--- a/src/gpu/vk/GrVkGpuCommandBuffer.cpp
+++ b/src/gpu/vk/GrVkGpuCommandBuffer.cpp
@@ -560,8 +560,8 @@
     }
 }
 
-GrVkPipelineState* GrVkGpuRTCommandBuffer::prepareDrawState(const GrPipeline& pipeline,
-                                                            const GrPrimitiveProcessor& primProc,
+GrVkPipelineState* GrVkGpuRTCommandBuffer::prepareDrawState(const GrPrimitiveProcessor& primProc,
+                                                            const GrPipeline& pipeline,
                                                             GrPrimitiveType primitiveType,
                                                             bool hasDynamicState) {
     CommandBufferInfo& cbInfo = fCommandBufferInfos[fCurrentCmdInfo];
@@ -629,8 +629,8 @@
     }
 }
 
-void GrVkGpuRTCommandBuffer::onDraw(const GrPipeline& pipeline,
-                                    const GrPrimitiveProcessor& primProc,
+void GrVkGpuRTCommandBuffer::onDraw(const GrPrimitiveProcessor& primProc,
+                                    const GrPipeline& pipeline,
                                     const GrMesh meshes[],
                                     const GrPipeline::DynamicState dynamicStates[],
                                     int meshCount,
@@ -653,10 +653,8 @@
     }
 
     GrPrimitiveType primitiveType = meshes[0].primitiveType();
-    GrVkPipelineState* pipelineState = this->prepareDrawState(pipeline,
-                                                              primProc,
-                                                              primitiveType,
-                                                              SkToBool(dynamicStates));
+    GrVkPipelineState* pipelineState =
+            this->prepareDrawState(primProc, pipeline, primitiveType, SkToBool(dynamicStates));
     if (!pipelineState) {
         return;
     }
@@ -670,10 +668,8 @@
             pipelineState->freeTempResources(fGpu);
             SkDEBUGCODE(pipelineState = nullptr);
             primitiveType = mesh.primitiveType();
-            pipelineState = this->prepareDrawState(pipeline,
-                                                   primProc,
-                                                   primitiveType,
-                                                   SkToBool(dynamicStates));
+            pipelineState = this->prepareDrawState(
+                    primProc, pipeline, primitiveType, SkToBool(dynamicStates));
             if (!pipelineState) {
                 return;
             }
diff --git a/src/gpu/vk/GrVkGpuCommandBuffer.h b/src/gpu/vk/GrVkGpuCommandBuffer.h
index 93990be..b56d157 100644
--- a/src/gpu/vk/GrVkGpuCommandBuffer.h
+++ b/src/gpu/vk/GrVkGpuCommandBuffer.h
@@ -86,13 +86,13 @@
                       const GrBuffer* vertexBuffer,
                       const GrBuffer* instanceBuffer);
 
-    GrVkPipelineState* prepareDrawState(const GrPipeline&,
-                                        const GrPrimitiveProcessor&,
+    GrVkPipelineState* prepareDrawState(const GrPrimitiveProcessor&,
+                                        const GrPipeline&,
                                         GrPrimitiveType,
                                         bool hasDynamicState);
 
-    void onDraw(const GrPipeline& pipeline,
-                const GrPrimitiveProcessor& primProc,
+    void onDraw(const GrPrimitiveProcessor& primProc,
+                const GrPipeline& pipeline,
                 const GrMesh mesh[],
                 const GrPipeline::DynamicState[],
                 int meshCount,
diff --git a/src/gpu/vk/GrVkPipeline.cpp b/src/gpu/vk/GrVkPipeline.cpp
index c5b4592..385cc8b 100644
--- a/src/gpu/vk/GrVkPipeline.cpp
+++ b/src/gpu/vk/GrVkPipeline.cpp
@@ -258,8 +258,8 @@
     SkASSERT(viewportInfo->viewportCount == viewportInfo->scissorCount);
 }
 
-static void setup_multisample_state(const GrPipeline& pipeline,
-                                    const GrPrimitiveProcessor& primProc,
+static void setup_multisample_state(const GrPrimitiveProcessor& primProc,
+                                    const GrPipeline& pipeline,
                                     const GrCaps* caps,
                                     VkPipelineMultisampleStateCreateInfo* multisampleInfo) {
     memset(multisampleInfo, 0, sizeof(VkPipelineMultisampleStateCreateInfo));
@@ -441,9 +441,10 @@
     dynamicInfo->pDynamicStates = dynamicStates;
 }
 
-GrVkPipeline* GrVkPipeline::Create(GrVkGpu* gpu, const GrPipeline& pipeline,
-                                   const GrStencilSettings& stencil,
+GrVkPipeline* GrVkPipeline::Create(GrVkGpu* gpu,
                                    const GrPrimitiveProcessor& primProc,
+                                   const GrPipeline& pipeline,
+                                   const GrStencilSettings& stencil,
                                    VkPipelineShaderStageCreateInfo* shaderStageInfo,
                                    int shaderStageCount,
                                    GrPrimitiveType primitiveType,
@@ -468,7 +469,7 @@
     setup_viewport_scissor_state(&viewportInfo);
 
     VkPipelineMultisampleStateCreateInfo multisampleInfo;
-    setup_multisample_state(pipeline, primProc, gpu->caps(), &multisampleInfo);
+    setup_multisample_state(primProc, pipeline, gpu->caps(), &multisampleInfo);
 
     // We will only have one color attachment per pipeline.
     VkPipelineColorBlendAttachmentState attachmentStates[1];
diff --git a/src/gpu/vk/GrVkPipeline.h b/src/gpu/vk/GrVkPipeline.h
index 0b6e0da..69281ef 100644
--- a/src/gpu/vk/GrVkPipeline.h
+++ b/src/gpu/vk/GrVkPipeline.h
@@ -25,9 +25,9 @@
 class GrVkPipeline : public GrVkResource {
 public:
     static GrVkPipeline* Create(GrVkGpu* gpu,
+                                const GrPrimitiveProcessor& primProc,
                                 const GrPipeline& pipeline,
                                 const GrStencilSettings&,
-                                const GrPrimitiveProcessor& primProc,
                                 VkPipelineShaderStageCreateInfo* shaderStageInfo,
                                 int shaderStageCount,
                                 GrPrimitiveType primitiveType,
diff --git a/src/gpu/vk/GrVkPipelineStateBuilder.cpp b/src/gpu/vk/GrVkPipelineStateBuilder.cpp
index c67847c..c4c748b 100644
--- a/src/gpu/vk/GrVkPipelineStateBuilder.cpp
+++ b/src/gpu/vk/GrVkPipelineStateBuilder.cpp
@@ -17,9 +17,9 @@
 
 GrVkPipelineState* GrVkPipelineStateBuilder::CreatePipelineState(
         GrVkGpu* gpu,
+        const GrPrimitiveProcessor& primProc,
         const GrPipeline& pipeline,
         const GrStencilSettings& stencil,
-        const GrPrimitiveProcessor& primProc,
         GrPrimitiveType primitiveType,
         Desc* desc,
         const GrVkRenderPass& renderPass) {
@@ -38,11 +38,10 @@
                                                    const GrPipeline& pipeline,
                                                    const GrPrimitiveProcessor& primProc,
                                                    GrProgramDesc* desc)
-    : INHERITED(pipeline, primProc, desc)
-    , fGpu(gpu)
-    , fVaryingHandler(this)
-    , fUniformHandler(this) {
-}
+        : INHERITED(primProc, pipeline, desc)
+        , fGpu(gpu)
+        , fVaryingHandler(this)
+        , fUniformHandler(this) {}
 
 const GrCaps* GrVkPipelineStateBuilder::caps() const {
     return fGpu->caps();
@@ -169,9 +168,9 @@
         ++numShaderStages;
     }
 
-    GrVkPipeline* pipeline = resourceProvider.createPipeline(fPipeline,
+    GrVkPipeline* pipeline = resourceProvider.createPipeline(fPrimProc,
+                                                             fPipeline,
                                                              stencil,
-                                                             fPrimProc,
                                                              shaderStageInfo,
                                                              numShaderStages,
                                                              primitiveType,
diff --git a/src/gpu/vk/GrVkPipelineStateBuilder.h b/src/gpu/vk/GrVkPipelineStateBuilder.h
index 5fdb0ea..f5fb739 100644
--- a/src/gpu/vk/GrVkPipelineStateBuilder.h
+++ b/src/gpu/vk/GrVkPipelineStateBuilder.h
@@ -58,9 +58,9 @@
     * @return true if generation was successful.
     */
     static GrVkPipelineState* CreatePipelineState(GrVkGpu*,
+                                                  const GrPrimitiveProcessor&,
                                                   const GrPipeline&,
                                                   const GrStencilSettings&,
-                                                  const GrPrimitiveProcessor&,
                                                   GrPrimitiveType,
                                                   Desc*,
                                                   const GrVkRenderPass& renderPass);
diff --git a/src/gpu/vk/GrVkPipelineStateCache.cpp b/src/gpu/vk/GrVkPipelineStateCache.cpp
index f7423c7..310fa10 100644
--- a/src/gpu/vk/GrVkPipelineStateCache.cpp
+++ b/src/gpu/vk/GrVkPipelineStateCache.cpp
@@ -74,10 +74,10 @@
 }
 
 GrVkPipelineState* GrVkResourceProvider::PipelineStateCache::refPipelineState(
-                                                               const GrPipeline& pipeline,
-                                                               const GrPrimitiveProcessor& primProc,
-                                                               GrPrimitiveType primitiveType,
-                                                               const GrVkRenderPass& renderPass) {
+        const GrPrimitiveProcessor& primProc,
+        const GrPipeline& pipeline,
+        GrPrimitiveType primitiveType,
+        const GrVkRenderPass& renderPass) {
 #ifdef GR_PIPELINE_STATE_CACHE_STATS
     ++fTotalRequests;
 #endif
@@ -111,14 +111,8 @@
 #ifdef GR_PIPELINE_STATE_CACHE_STATS
         ++fCacheMisses;
 #endif
-        GrVkPipelineState* pipelineState(
-            GrVkPipelineStateBuilder::CreatePipelineState(fGpu,
-                                                          pipeline,
-                                                          stencil,
-                                                          primProc,
-                                                          primitiveType,
-                                                          &desc,
-                                                          renderPass));
+        GrVkPipelineState* pipelineState(GrVkPipelineStateBuilder::CreatePipelineState(
+                fGpu, primProc, pipeline, stencil, primitiveType, &desc, renderPass));
         if (nullptr == pipelineState) {
             return nullptr;
         }
diff --git a/src/gpu/vk/GrVkResourceProvider.cpp b/src/gpu/vk/GrVkResourceProvider.cpp
index 9a219c8..b4290ce 100644
--- a/src/gpu/vk/GrVkResourceProvider.cpp
+++ b/src/gpu/vk/GrVkResourceProvider.cpp
@@ -57,16 +57,15 @@
     fUniformDSHandle = GrVkDescriptorSetManager::Handle(0);
 }
 
-GrVkPipeline* GrVkResourceProvider::createPipeline(const GrPipeline& pipeline,
+GrVkPipeline* GrVkResourceProvider::createPipeline(const GrPrimitiveProcessor& primProc,
+                                                   const GrPipeline& pipeline,
                                                    const GrStencilSettings& stencil,
-                                                   const GrPrimitiveProcessor& primProc,
                                                    VkPipelineShaderStageCreateInfo* shaderStageInfo,
                                                    int shaderStageCount,
                                                    GrPrimitiveType primitiveType,
                                                    const GrVkRenderPass& renderPass,
                                                    VkPipelineLayout layout) {
-
-    return GrVkPipeline::Create(fGpu, pipeline, stencil, primProc, shaderStageInfo,
+    return GrVkPipeline::Create(fGpu, primProc, pipeline, stencil, shaderStageInfo,
                                 shaderStageCount, primitiveType, renderPass, layout,
                                 fPipelineCache);
 }
@@ -185,7 +184,7 @@
                                                                  const GrPrimitiveProcessor& proc,
                                                                  GrPrimitiveType primitiveType,
                                                                  const GrVkRenderPass& renderPass) {
-    return fPipelineStateCache->refPipelineState(pipeline, proc, primitiveType, renderPass);
+    return fPipelineStateCache->refPipelineState(proc, pipeline, primitiveType, renderPass);
 }
 
 void GrVkResourceProvider::getSamplerDescriptorSetHandle(VkDescriptorType type,
diff --git a/src/gpu/vk/GrVkResourceProvider.h b/src/gpu/vk/GrVkResourceProvider.h
index 00263c8..8b87983 100644
--- a/src/gpu/vk/GrVkResourceProvider.h
+++ b/src/gpu/vk/GrVkResourceProvider.h
@@ -43,9 +43,9 @@
     // Set up any initial vk objects
     void init();
 
-    GrVkPipeline* createPipeline(const GrPipeline& pipeline,
+    GrVkPipeline* createPipeline(const GrPrimitiveProcessor& primProc,
+                                 const GrPipeline& pipeline,
                                  const GrStencilSettings& stencil,
-                                 const GrPrimitiveProcessor& primProc,
                                  VkPipelineShaderStageCreateInfo* shaderStageInfo,
                                  int shaderStageCount,
                                  GrPrimitiveType primitiveType,
@@ -171,8 +171,8 @@
 
         void abandon();
         void release();
-        GrVkPipelineState* refPipelineState(const GrPipeline&,
-                                            const GrPrimitiveProcessor&,
+        GrVkPipelineState* refPipelineState(const GrPrimitiveProcessor&,
+                                            const GrPipeline&,
                                             GrPrimitiveType,
                                             const GrVkRenderPass& renderPass);