Remove DrawFace enum from GrPipelineBuilder

This gets GrPipelineBuilder.h out of the headers

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2165283002

Review-Url: https://codereview.chromium.org/2165283002
diff --git a/include/gpu/GrTypesPriv.h b/include/gpu/GrTypesPriv.h
index 5168ac9..abbfdfc 100644
--- a/include/gpu/GrTypesPriv.h
+++ b/include/gpu/GrTypesPriv.h
@@ -56,6 +56,14 @@
 };
 GR_MAKE_BITFIELD_OPS(GrShaderFlags);
 
+enum class GrDrawFace {
+    kInvalid = -1,
+
+    kBoth,
+    kCCW,
+    kCW,
+};
+
 /**
  * Precisions of shader language variables. Not all shading languages support precisions or actually
  * vary the internal precision based on the qualifiers. These currently only apply to float types (
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
index 8bbf55b..40d9768 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrDrawContext.cpp
@@ -12,6 +12,7 @@
 #include "GrDrawingManager.h"
 #include "GrOvalRenderer.h"
 #include "GrPathRenderer.h"
+#include "GrPipelineBuilder.h"
 #include "GrRenderTarget.h"
 #include "GrRenderTargetPriv.h"
 #include "GrResourceProvider.h"
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 601b1b5..d03130d 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -15,6 +15,7 @@
 #include "GrPath.h"
 #include "GrPipeline.h"
 #include "GrMemoryPool.h"
+#include "GrPipelineBuilder.h"
 #include "GrRenderTarget.h"
 #include "GrResourceProvider.h"
 #include "GrRenderTargetPriv.h"
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h
index 73e8e03..6547a41 100644
--- a/src/gpu/GrPathRenderer.h
+++ b/src/gpu/GrPathRenderer.h
@@ -8,6 +8,7 @@
 #ifndef GrPathRenderer_DEFINED
 #define GrPathRenderer_DEFINED
 
+#include "GrCaps.h"
 #include "GrDrawContext.h"
 #include "GrPaint.h"
 #include "GrResourceProvider.h"
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h
index a17eb09..5ec572d 100644
--- a/src/gpu/GrPipeline.h
+++ b/src/gpu/GrPipeline.h
@@ -13,7 +13,6 @@
 #include "GrGpu.h"
 #include "GrNonAtomicRef.h"
 #include "GrPendingProgramElement.h"
-#include "GrPipelineBuilder.h"
 #include "GrPrimitiveProcessor.h"
 #include "GrProcOptInfo.h"
 #include "GrProgramDesc.h"
@@ -22,6 +21,11 @@
 #include "SkMatrix.h"
 #include "SkRefCnt.h"
 
+#include "effects/GrCoverageSetOpXP.h"
+#include "effects/GrDisableColorXP.h"
+#include "effects/GrPorterDuffXferProcessor.h"
+#include "effects/GrSimpleTextureEffect.h"
+
 class GrBatch;
 class GrDrawContext;
 class GrDeviceCoordTexture;
@@ -169,7 +173,7 @@
      * or both faces.
      * @return the current draw face(s).
      */
-    GrPipelineBuilder::DrawFace getDrawFace() const { return fDrawFace; }
+    GrDrawFace getDrawFace() const { return fDrawFace; }
 
 
     ///////////////////////////////////////////////////////////////////////////
@@ -212,7 +216,7 @@
     RenderTarget                        fRenderTarget;
     GrScissorState                      fScissorState;
     GrStencilSettings                   fStencilSettings;
-    GrPipelineBuilder::DrawFace         fDrawFace;
+    GrDrawFace                          fDrawFace;
     uint32_t                            fFlags;
     ProgramXferProcessor                fXferProcessor;
     FragmentProcessorArray              fFragmentProcessors;
diff --git a/src/gpu/GrPipelineBuilder.cpp b/src/gpu/GrPipelineBuilder.cpp
index e142de2..60cbc62 100644
--- a/src/gpu/GrPipelineBuilder.cpp
+++ b/src/gpu/GrPipelineBuilder.cpp
@@ -18,7 +18,7 @@
 GrPipelineBuilder::GrPipelineBuilder()
     : fFlags(0x0)
     , fUserStencilSettings(&GrUserStencilSettings::kUnused)
-    , fDrawFace(kBoth_DrawFace) {
+    , fDrawFace(GrDrawFace::kBoth) {
     SkDEBUGCODE(fBlockEffectRemovalCnt = 0;)
 }
 
diff --git a/src/gpu/GrPipelineBuilder.h b/src/gpu/GrPipelineBuilder.h
index 06c843f..dca7f36 100644
--- a/src/gpu/GrPipelineBuilder.h
+++ b/src/gpu/GrPipelineBuilder.h
@@ -266,27 +266,19 @@
     /// @name Face Culling
     ////
 
-    enum DrawFace {
-        kInvalid_DrawFace = -1,
-
-        kBoth_DrawFace,
-        kCCW_DrawFace,
-        kCW_DrawFace,
-    };
-
     /**
      * Gets whether the target is drawing clockwise, counterclockwise,
      * or both faces.
      * @return the current draw face(s).
      */
-    DrawFace getDrawFace() const { return fDrawFace; }
+    GrDrawFace getDrawFace() const { return fDrawFace; }
 
     /**
      * Controls whether clockwise, counterclockwise, or both faces are drawn.
      * @param face  the face(s) to draw.
      */
-    void setDrawFace(DrawFace face) {
-        SkASSERT(kInvalid_DrawFace != face);
+    void setDrawFace(GrDrawFace face) {
+        SkASSERT(GrDrawFace::kInvalid != face);
         fDrawFace = face;
     }
 
@@ -305,7 +297,7 @@
 
     uint32_t                                fFlags;
     const GrUserStencilSettings*            fUserStencilSettings;
-    DrawFace                                fDrawFace;
+    GrDrawFace                              fDrawFace;
     mutable sk_sp<GrXPFactory>              fXPFactory;
     FragmentProcessorArray                  fColorFragmentProcessors;
     FragmentProcessorArray                  fCoverageFragmentProcessors;
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index 5d3f4b8..b63a7ea 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -8,6 +8,7 @@
 #include "GrResourceProvider.h"
 
 #include "GrBuffer.h"
+#include "GrCaps.h"
 #include "GrGpu.h"
 #include "GrPathRendering.h"
 #include "GrRenderTarget.h"
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index 54d4851..b6750d4 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -8,6 +8,7 @@
 #include "GrSoftwarePathRenderer.h"
 #include "GrAuditTrail.h"
 #include "GrClip.h"
+#include "GrPipelineBuilder.h"
 #include "GrSWMaskHelper.h"
 #include "GrTextureProvider.h"
 #include "batches/GrRectBatchFactory.h"
diff --git a/src/gpu/batches/GrDashLinePathRenderer.cpp b/src/gpu/batches/GrDashLinePathRenderer.cpp
index d040e84..f2b75be 100644
--- a/src/gpu/batches/GrDashLinePathRenderer.cpp
+++ b/src/gpu/batches/GrDashLinePathRenderer.cpp
@@ -7,8 +7,9 @@
 
 #include "GrDashLinePathRenderer.h"
 
-#include "GrGpu.h"
 #include "GrAuditTrail.h"
+#include "GrGpu.h"
+#include "GrPipelineBuilder.h"
 #include "effects/GrDashingEffect.h"
 
 bool GrDashLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
diff --git a/src/gpu/batches/GrDefaultPathRenderer.cpp b/src/gpu/batches/GrDefaultPathRenderer.cpp
index dc40b7c..939c025 100644
--- a/src/gpu/batches/GrDefaultPathRenderer.cpp
+++ b/src/gpu/batches/GrDefaultPathRenderer.cpp
@@ -433,7 +433,7 @@
 
     int                          passCount = 0;
     const GrUserStencilSettings* passes[3];
-    GrPipelineBuilder::DrawFace  drawFace[3];
+    GrDrawFace                   drawFace[3];
     bool                         reverse = false;
     bool                         lastPassIsBounds;
 
@@ -445,7 +445,7 @@
             passes[0] = userStencilSettings;
         }
         lastPassIsBounds = false;
-        drawFace[0] = GrPipelineBuilder::kBoth_DrawFace;
+        drawFace[0] = GrDrawFace::kBoth;
     } else {
         if (single_pass_shape(shape)) {
             passCount = 1;
@@ -454,7 +454,7 @@
             } else {
                 passes[0] = userStencilSettings;
             }
-            drawFace[0] = GrPipelineBuilder::kBoth_DrawFace;
+            drawFace[0] = GrDrawFace::kBoth;
             lastPassIsBounds = false;
         } else {
             switch (path.getFillType()) {
@@ -475,7 +475,7 @@
                             passes[1] = &gEOColorPass;
                         }
                     }
-                    drawFace[0] = drawFace[1] = GrPipelineBuilder::kBoth_DrawFace;
+                    drawFace[0] = drawFace[1] = GrDrawFace::kBoth;
                     break;
 
                 case SkPath::kInverseWinding_FillType:
@@ -489,7 +489,7 @@
                             passes[0] = &gWindStencilSeparateNoWrap;
                         }
                         passCount = 2;
-                        drawFace[0] = GrPipelineBuilder::kBoth_DrawFace;
+                        drawFace[0] = GrDrawFace::kBoth;
                     } else {
                         if (fStencilWrapOps) {
                             passes[0] = &gWindSingleStencilWithWrapInc;
@@ -499,8 +499,8 @@
                             passes[1] = &gWindSingleStencilNoWrapDec;
                         }
                         // which is cw and which is ccw is arbitrary.
-                        drawFace[0] = GrPipelineBuilder::kCW_DrawFace;
-                        drawFace[1] = GrPipelineBuilder::kCCW_DrawFace;
+                        drawFace[0] = GrDrawFace::kCW;
+                        drawFace[1] = GrDrawFace::kCCW;
                         passCount = 3;
                     }
                     if (stencilOnly) {
@@ -508,7 +508,7 @@
                         --passCount;
                     } else {
                         lastPassIsBounds = true;
-                        drawFace[passCount-1] = GrPipelineBuilder::kBoth_DrawFace;
+                        drawFace[passCount-1] = GrDrawFace::kBoth;
                         if (reverse) {
                             passes[passCount-1] = &gInvWindColorPass;
                         } else {
@@ -554,7 +554,7 @@
                     GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewM, bounds, nullptr,
                                                         &localMatrix));
 
-            SkASSERT(GrPipelineBuilder::kBoth_DrawFace == drawFace[p]);
+            SkASSERT(GrDrawFace::kBoth == drawFace[p]);
             GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint));
             pipelineBuilder.setDrawFace(drawFace[p]);
             pipelineBuilder.setUserStencil(passes[p]);
diff --git a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
index 01193ad..02d74ff 100644
--- a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
@@ -13,6 +13,7 @@
 #include "GrDrawPathBatch.h"
 #include "GrGpu.h"
 #include "GrPath.h"
+#include "GrPipelineBuilder.h"
 #include "GrRenderTarget.h"
 #include "GrResourceProvider.h"
 #include "GrStencilPathBatch.h"
diff --git a/src/gpu/batches/GrTessellatingPathRenderer.cpp b/src/gpu/batches/GrTessellatingPathRenderer.cpp
index b022e40..6dce9f7 100644
--- a/src/gpu/batches/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/batches/GrTessellatingPathRenderer.cpp
@@ -14,6 +14,7 @@
 #include "GrDefaultGeoProcFactory.h"
 #include "GrMesh.h"
 #include "GrPathUtils.h"
+#include "GrPipelineBuilder.h"
 #include "GrResourceCache.h"
 #include "GrResourceProvider.h"
 #include "GrTessellator.h"
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 1c07291..d309dc1 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -494,7 +494,7 @@
         fHWBufferState[kXferCpuToGpu_GrBufferType].invalidate();
         fHWBufferState[kXferGpuToCpu_GrBufferType].invalidate();
 
-        fHWDrawFace = GrPipelineBuilder::kInvalid_DrawFace;
+        fHWDrawFace = GrDrawFace::kInvalid;
 
         if (kGL_GrGLStandard == this->glStandard()) {
             // Desktop-only state that we never change
@@ -2793,7 +2793,7 @@
     blendInfo.reset();
     this->flushBlend(blendInfo, GrSwizzle());
     this->flushColorWrite(true);
-    this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace);
+    this->flushDrawFace(GrDrawFace::kBoth);
     if (!fHWStencilSettings.isDisabled()) {
         GL_CALL(Disable(GR_GL_STENCIL_TEST));
     }
@@ -3359,18 +3359,18 @@
     }
 }
 
-void GrGLGpu::flushDrawFace(GrPipelineBuilder::DrawFace face) {
+void GrGLGpu::flushDrawFace(GrDrawFace face) {
     if (fHWDrawFace != face) {
         switch (face) {
-            case GrPipelineBuilder::kCCW_DrawFace:
+            case GrDrawFace::kCCW:
                 GL_CALL(Enable(GR_GL_CULL_FACE));
                 GL_CALL(CullFace(GR_GL_BACK));
                 break;
-            case GrPipelineBuilder::kCW_DrawFace:
+            case GrDrawFace::kCW:
                 GL_CALL(Enable(GR_GL_CULL_FACE));
                 GL_CALL(CullFace(GR_GL_FRONT));
                 break;
-            case GrPipelineBuilder::kBoth_DrawFace:
+            case GrDrawFace::kBoth:
                 GL_CALL(Disable(GR_GL_CULL_FACE));
                 break;
             default:
@@ -4088,7 +4088,7 @@
     blendInfo.reset();
     this->flushBlend(blendInfo, GrSwizzle::RGBA());
     this->flushColorWrite(true);
-    this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace);
+    this->flushDrawFace(GrDrawFace::kBoth);
     this->flushHWAAState(glRT, false, false);
     this->disableScissor();
     GrStencilSettings stencil;
@@ -4176,7 +4176,7 @@
     blendInfo.reset();
     this->flushBlend(blendInfo, GrSwizzle::RGBA());
     this->flushColorWrite(true);
-    this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace);
+    this->flushDrawFace(GrDrawFace::kBoth);
     this->flushHWAAState(nullptr, false, false);
     this->disableScissor();
     GrStencilSettings stencil;
@@ -4384,7 +4384,7 @@
     blendInfo.reset();
     this->flushBlend(blendInfo, GrSwizzle::RGBA());
     this->flushColorWrite(true);
-    this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace);
+    this->flushDrawFace(GrDrawFace::kBoth);
     this->flushHWAAState(nullptr, false, false);
     this->disableScissor();
     GrStencilSettings stencil;
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index 02a9c1d..df88565 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -17,7 +17,6 @@
 #include "GrGLTexture.h"
 #include "GrGLVertexArray.h"
 #include "GrGpu.h"
-#include "GrPipelineBuilder.h"
 #include "GrTypes.h"
 #include "GrXferProcessor.h"
 #include "SkTArray.h"
@@ -303,7 +302,7 @@
     };
 
     void flushColorWrite(bool writeColor);
-    void flushDrawFace(GrPipelineBuilder::DrawFace face);
+    void flushDrawFace(GrDrawFace face);
 
     // flushes the scissor. see the note on flushBoundTextureAndParams about
     // flushing the scissor after that function is called.
@@ -516,7 +515,7 @@
     TriState                    fHWStencilTestEnabled;
 
 
-    GrPipelineBuilder::DrawFace fHWDrawFace;
+    GrDrawFace                  fHWDrawFace;
     TriState                    fHWWriteToColor;
     uint32_t                    fHWBoundRenderTargetUniqueID;
     TriState                    fHWSRGBFramebuffer;
diff --git a/src/gpu/gl/GrGLPathRendering.cpp b/src/gpu/gl/GrGLPathRendering.cpp
index 35b5e9a..8508cfb 100644
--- a/src/gpu/gl/GrGLPathRendering.cpp
+++ b/src/gpu/gl/GrGLPathRendering.cpp
@@ -119,7 +119,7 @@
     GrGLGpu* gpu = this->gpu();
     SkASSERT(gpu->caps()->shaderCaps()->pathRenderingSupport());
     gpu->flushColorWrite(false);
-    gpu->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace);
+    gpu->flushDrawFace(GrDrawFace::kBoth);
 
     GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(args.fRenderTarget);
     SkISize size = SkISize::Make(rt->width(), rt->height());
diff --git a/src/gpu/instanced/InstancedRendering.cpp b/src/gpu/instanced/InstancedRendering.cpp
index af89b6c..d763b73 100644
--- a/src/gpu/instanced/InstancedRendering.cpp
+++ b/src/gpu/instanced/InstancedRendering.cpp
@@ -8,6 +8,7 @@
 #include "InstancedRendering.h"
 
 #include "GrBatchFlushState.h"
+#include "GrCaps.h"
 #include "GrPipeline.h"
 #include "GrResourceProvider.h"
 #include "instanced/InstanceProcessor.h"
diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp
index 9ab9c12..12f35a3 100644
--- a/src/gpu/text/GrAtlasTextBlob.cpp
+++ b/src/gpu/text/GrAtlasTextBlob.cpp
@@ -10,6 +10,7 @@
 #include "GrBlurUtils.h"
 #include "GrContext.h"
 #include "GrDrawContext.h"
+#include "GrPipelineBuilder.h"
 #include "GrTextUtils.h"
 #include "SkColorFilter.h"
 #include "SkDrawFilter.h"
diff --git a/src/gpu/text/GrBatchFontCache.h b/src/gpu/text/GrBatchFontCache.h
index 2aa67dd..9e08c53 100644
--- a/src/gpu/text/GrBatchFontCache.h
+++ b/src/gpu/text/GrBatchFontCache.h
@@ -9,6 +9,7 @@
 #define GrBatchFontCache_DEFINED
 
 #include "GrBatchAtlas.h"
+#include "GrCaps.h"
 #include "GrGlyph.h"
 #include "SkGlyphCache.h"
 #include "SkTDynamicHash.h"
diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp
index 381aa30..1e23477 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp
@@ -11,6 +11,7 @@
 #include "GrDrawContext.h"
 #include "GrPath.h"
 #include "GrPathRange.h"
+#include "GrPipelineBuilder.h"
 #include "GrResourceProvider.h"
 #include "GrTextUtils.h"
 #include "SkAutoKern.h"
diff --git a/src/gpu/vk/GrVkPipeline.cpp b/src/gpu/vk/GrVkPipeline.cpp
index 0ba111a..733b9c4 100644
--- a/src/gpu/vk/GrVkPipeline.cpp
+++ b/src/gpu/vk/GrVkPipeline.cpp
@@ -356,16 +356,16 @@
     // colorBlendInfo->blendConstants is set dynamically
 }
 
-VkCullModeFlags draw_face_to_vk_cull_mode(GrPipelineBuilder::DrawFace drawFace) {
+VkCullModeFlags draw_face_to_vk_cull_mode(GrDrawFace drawFace) {
     // Assumes that we've set the front face to be ccw
     static const VkCullModeFlags gTable[] = {
         VK_CULL_MODE_NONE,              // kBoth_DrawFace
         VK_CULL_MODE_BACK_BIT,          // kCCW_DrawFace, cull back face
         VK_CULL_MODE_FRONT_BIT,         // kCW_DrawFace, cull front face
     };
-    GR_STATIC_ASSERT(0 == GrPipelineBuilder::kBoth_DrawFace);
-    GR_STATIC_ASSERT(1 == GrPipelineBuilder::kCCW_DrawFace);
-    GR_STATIC_ASSERT(2 == GrPipelineBuilder::kCW_DrawFace);
+    GR_STATIC_ASSERT(0 == GrDrawFace::kBoth);
+    GR_STATIC_ASSERT(1 == GrDrawFace::kCCW);
+    GR_STATIC_ASSERT(2 == GrDrawFace::kCW);
     SkASSERT((unsigned)drawFace <= 2);
 
     return gTable[drawFace];
diff --git a/src/gpu/vk/GrVkPipelineState.cpp b/src/gpu/vk/GrVkPipelineState.cpp
index 94d6305..cb37511 100644
--- a/src/gpu/vk/GrVkPipelineState.cpp
+++ b/src/gpu/vk/GrVkPipelineState.cpp
@@ -487,8 +487,8 @@
 
     pipeline.getStencil().genKey(&b);
 
-    SkASSERT(sizeof(GrPipelineBuilder::DrawFace) <= sizeof(uint32_t));
-    b.add32(pipeline.getDrawFace());
+    SkASSERT(sizeof(GrDrawFace) <= sizeof(uint32_t));
+    b.add32((int32_t)pipeline.getDrawFace());
 
     b.add32(get_blend_info_key(pipeline));
 
diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp
index c96cb37..21761c2 100644
--- a/tools/gpu/GrTest.cpp
+++ b/tools/gpu/GrTest.cpp
@@ -12,6 +12,7 @@
 #include "GrDrawContextPriv.h"
 #include "GrDrawingManager.h"
 #include "GrGpuResourceCacheAccess.h"
+#include "GrPipelineBuilder.h"
 #include "GrResourceCache.h"
 
 #include "SkGpuDevice.h"