Revert "Delete GrPathTessellationShader::MakeSimpleTriangleShader"

This reverts commit 09bc8af2827008b8259406998e701afa5d1ee21c.

Reason for revert:

The GrDefaultGeoProcFactory handles view matrices differently,
including injecting different code based on the matrix type. This can
introduce LSB differences between the points generated by the curve
shader and the fan shader, leading to gaps and jogs in seaming.

Original change's description:
> Delete GrPathTessellationShader::MakeSimpleTriangleShader
>
> We should have always used the default GP here. It makes for better
> reuse, and shader that draws raw triangles isn't a "tessellation"
> shader anyway.
>
> Bug: skia:10419
> Change-Id: Ia2ef2a83f5ed8917005e12b9f9a52c1d9f877575
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/429956
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: skia:10419
Change-Id: Ifce8204f23066e9c85af458a7d15abd8551fe965
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/432742
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/src/gpu/GrProcessor.h b/src/gpu/GrProcessor.h
index a77ba53..023c4f0 100644
--- a/src/gpu/GrProcessor.h
+++ b/src/gpu/GrProcessor.h
@@ -103,6 +103,7 @@
         kTessellate_HardwareWedgeShader_ClassID,
         kTessellate_HullShader_ClassID,
         kTessellate_MiddleOutShader_ClassID,
+        kTessellate_SimpleTriangleShader_ClassID,
         kTessellationTestTriShader_ClassID,
         kTestFP_ClassID,
         kTestRectOp_ClassID,
diff --git a/src/gpu/tessellate/GrPathInnerTriangulateOp.cpp b/src/gpu/tessellate/GrPathInnerTriangulateOp.cpp
index 63466ce..be9875a 100644
--- a/src/gpu/tessellate/GrPathInnerTriangulateOp.cpp
+++ b/src/gpu/tessellate/GrPathInnerTriangulateOp.cpp
@@ -7,7 +7,6 @@
 
 #include "src/gpu/tessellate/GrPathInnerTriangulateOp.h"
 
-#include "src/gpu/GrDefaultGeoProcFactory.h"
 #include "src/gpu/GrEagerVertexAllocator.h"
 #include "src/gpu/GrGpu.h"
 #include "src/gpu/GrInnerFanTriangulator.h"
@@ -185,24 +184,22 @@
                                 clampType, &fColor);
 }
 
-void GrPathInnerTriangulateOp::pushFanProgram(const GrTessellationShader::ProgramArgs& args,
-                                              const GrPipeline* pipeline,
-                                              const SkPMColor4f& color,
-                                              const GrUserStencilSettings* stencil) {
-    auto triangleGP = GrDefaultGeoProcFactory::Make(
-            args.fArena,
-            GrDefaultGeoProcFactory::Color(color),
-            GrDefaultGeoProcFactory::Coverage::kSolid_Type,
-            GrDefaultGeoProcFactory::LocalCoords::kUsePosition_Type,
-            fViewMatrix);
-    fFanPrograms.push_back(GrSimpleMeshDrawOpHelper::CreateProgramInfo(args.fArena,
-                                                                       pipeline,
-                                                                       args.fWriteView,
-                                                                       triangleGP,
-                                                                       GrPrimitiveType::kTriangles,
-                                                                       args.fXferBarrierFlags,
-                                                                       args.fColorLoadOp,
-                                                                       stencil));
+void GrPathInnerTriangulateOp::pushFanStencilProgram(const GrTessellationShader::ProgramArgs& args,
+                                                     const GrPipeline* pipelineForStencils,
+                                                     const GrUserStencilSettings* stencil) {
+    SkASSERT(pipelineForStencils);
+    auto shader = GrPathTessellationShader::MakeSimpleTriangleShader(args.fArena, fViewMatrix,
+                                                                     SK_PMColor4fTRANSPARENT);
+    fFanPrograms.push_back(GrTessellationShader::MakeProgram(args, shader, pipelineForStencils,
+                                                             stencil)); }
+
+void GrPathInnerTriangulateOp::pushFanFillProgram(const GrTessellationShader::ProgramArgs& args,
+                                                  const GrUserStencilSettings* stencil) {
+    SkASSERT(fPipelineForFills);
+    auto shader = GrPathTessellationShader::MakeSimpleTriangleShader(args.fArena, fViewMatrix,
+                                                                     fColor);
+    fFanPrograms.push_back(GrTessellationShader::MakeProgram(args, shader, fPipelineForFills,
+                                                             stencil));
 }
 
 void GrPathInnerTriangulateOp::prePreparePrograms(const GrTessellationShader::ProgramArgs& args,
@@ -263,16 +260,15 @@
             // stencil buffer to fill the fan directly.
             const GrUserStencilSettings* stencilPathSettings =
                     GrPathTessellationShader::StencilPathSettings(GrFillRuleForSkPath(fPath));
-            this->pushFanProgram(args, pipelineForStencils, SK_PMColor4fTRANSPARENT,
-                                 stencilPathSettings);
+            this->pushFanStencilProgram(args, pipelineForStencils, stencilPathSettings);
             if (doFill) {
-                this->pushFanProgram(args, fPipelineForFills, fColor,
-                                     GrPathTessellationShader::TestAndResetStencilSettings());
+                this->pushFanFillProgram(args,
+                                         GrPathTessellationShader::TestAndResetStencilSettings());
             }
         } else if (isLinear) {
             // There are no outer curves! Ignore stencil and fill the path directly.
             SkASSERT(!pipelineForStencils);
-            this->pushFanProgram(args, fPipelineForFills, fColor, &GrUserStencilSettings::kUnused);
+            this->pushFanFillProgram(args, &GrUserStencilSettings::kUnused);
         } else if (!fPipelineForFills->hasStencilClip()) {
             // These are a twist on the standard Redbook stencil settings that allow us to fill the
             // inner polygon directly to the final render target. By the time these programs
@@ -302,7 +298,7 @@
             auto* stencil = (fPath.getFillType() == SkPathFillType::kWinding)
                     ? &kFillOrIncrDecrStencil
                     : &kFillOrInvertStencil;
-            this->pushFanProgram(args, fPipelineForFills, fColor, stencil);
+            this->pushFanFillProgram(args, stencil);
         } else {
             // This is the same idea as above, but we use two passes instead of one because there is
             // a stencil clip. The stencil test isn't expressive enough to do the above tests and
@@ -340,13 +336,13 @@
                     0xffff>());
 
             // Pass 2a: Directly fill fan samples whose stencil values (from curves) are zero.
-            this->pushFanProgram(args, fPipelineForFills, fColor, &kFillIfZeroAndInClip);
+            this->pushFanFillProgram(args, &kFillIfZeroAndInClip);
 
             // Pass 2b: Redbook counting on fan samples whose stencil values (from curves) != 0.
             auto* stencil = (fPath.getFillType() == SkPathFillType::kWinding)
                     ? &kIncrDecrStencilIfNonzero
                     : &kInvertStencilIfNonZero;
-            this->pushFanProgram(args, pipelineForStencils, SK_PMColor4fTRANSPARENT, stencil);
+            this->pushFanStencilProgram(args, pipelineForStencils, stencil);
         }
     }
 
diff --git a/src/gpu/tessellate/GrPathInnerTriangulateOp.h b/src/gpu/tessellate/GrPathInnerTriangulateOp.h
index 9a4c77d..3495858 100644
--- a/src/gpu/tessellate/GrPathInnerTriangulateOp.h
+++ b/src/gpu/tessellate/GrPathInnerTriangulateOp.h
@@ -47,10 +47,9 @@
     GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*, GrClampType) override;
 
     // These calls set up the stencil & fill programs we will use prior to preparing and executing.
-    void pushFanProgram(const GrTessellationShader::ProgramArgs&,
-                        const GrPipeline* pipeline,
-                        const SkPMColor4f& color,
-                        const GrUserStencilSettings*);
+    void pushFanStencilProgram(const GrTessellationShader::ProgramArgs&,
+                               const GrPipeline* pipelineForStencils, const GrUserStencilSettings*);
+    void pushFanFillProgram(const GrTessellationShader::ProgramArgs&, const GrUserStencilSettings*);
     void prePreparePrograms(const GrTessellationShader::ProgramArgs&, GrAppliedClip&&);
 
     void onPrePrepare(GrRecordingContext*, const GrSurfaceProxyView&, GrAppliedClip*,
diff --git a/src/gpu/tessellate/GrPathStencilCoverOp.cpp b/src/gpu/tessellate/GrPathStencilCoverOp.cpp
index 9671213..2b56078 100644
--- a/src/gpu/tessellate/GrPathStencilCoverOp.cpp
+++ b/src/gpu/tessellate/GrPathStencilCoverOp.cpp
@@ -7,7 +7,6 @@
 
 #include "src/gpu/tessellate/GrPathStencilCoverOp.h"
 
-#include "src/gpu/GrDefaultGeoProcFactory.h"
 #include "src/gpu/GrEagerVertexAllocator.h"
 #include "src/gpu/GrGpu.h"
 #include "src/gpu/GrOpFlushState.h"
@@ -149,21 +148,10 @@
         // Large complex paths do better with a dedicated triangle shader for the inner fan.
         // This takes less PCI bus bandwidth (6 floats per triangle instead of 8) and allows us
         // to make sure it has an efficient middle-out topology.
-        auto triangleGP = GrDefaultGeoProcFactory::Make(
-                args.fArena,
-                GrDefaultGeoProcFactory::Color(SK_PMColor4fTRANSPARENT),
-                GrDefaultGeoProcFactory::Coverage::kSolid_Type,
-                GrDefaultGeoProcFactory::LocalCoords::kUnused_Type,
-                fViewMatrix);
-        fStencilFanProgram = GrSimpleMeshDrawOpHelper::CreateProgramInfo(
-                args.fArena,
-                stencilPipeline,
-                args.fWriteView,
-                triangleGP,
-                GrPrimitiveType::kTriangles,
-                args.fXferBarrierFlags,
-                args.fColorLoadOp,
-                stencilPathSettings);
+        auto shader = GrPathTessellationShader::MakeSimpleTriangleShader(
+                args.fArena, fViewMatrix, SK_PMColor4fTRANSPARENT);
+        fStencilFanProgram = GrTessellationShader::MakeProgram(args, shader, stencilPipeline,
+                                                               stencilPathSettings);
         fTessellator = GrPathCurveTessellator::Make(args.fArena, fViewMatrix,
                                                     SK_PMColor4fTRANSPARENT,
                                                     GrPathCurveTessellator::DrawInnerFan::kNo,
diff --git a/src/gpu/tessellate/shaders/GrPathTessellationShader.cpp b/src/gpu/tessellate/shaders/GrPathTessellationShader.cpp
index 0eb89e4..30f3816 100644
--- a/src/gpu/tessellate/shaders/GrPathTessellationShader.cpp
+++ b/src/gpu/tessellate/shaders/GrPathTessellationShader.cpp
@@ -12,6 +12,46 @@
 #include "src/gpu/glsl/GrGLSLVarying.h"
 #include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
 
+namespace {
+
+// Draws a simple array of triangles.
+class SimpleTriangleShader : public GrPathTessellationShader {
+public:
+    SimpleTriangleShader(const SkMatrix& viewMatrix, SkPMColor4f color)
+            : GrPathTessellationShader(kTessellate_SimpleTriangleShader_ClassID,
+                                       GrPrimitiveType::kTriangles, 0, viewMatrix, color) {
+        constexpr static Attribute kInputPointAttrib{"inputPoint", kFloat2_GrVertexAttribType,
+                                                     kFloat2_GrSLType};
+        this->setVertexAttributes(&kInputPointAttrib, 1);
+    }
+
+private:
+    const char* name() const final { return "tessellate_SimpleTriangleShader"; }
+    void getGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const final {}
+    GrGLSLGeometryProcessor* createGLSLInstance(const GrShaderCaps&) const final;
+};
+
+GrGLSLGeometryProcessor* SimpleTriangleShader::createGLSLInstance(const GrShaderCaps&) const {
+    class Impl : public GrPathTessellationShader::Impl {
+        void emitVertexCode(const GrShaderCaps&, const GrPathTessellationShader&,
+                            GrGLSLVertexBuilder* v, GrGPArgs* gpArgs) override {
+            v->codeAppend(R"(
+            float2 localcoord = inputPoint;
+            float2 vertexpos = AFFINE_MATRIX * localcoord + TRANSLATE;)");
+            gpArgs->fLocalCoordVar.set(kFloat2_GrSLType, "localcoord");
+            gpArgs->fPositionVar.set(kFloat2_GrSLType, "vertexpos");
+        }
+    };
+    return new Impl;
+}
+
+}  // namespace
+
+GrPathTessellationShader* GrPathTessellationShader::MakeSimpleTriangleShader(
+        SkArenaAlloc* arena, const SkMatrix& viewMatrix, const SkPMColor4f& color) {
+    return arena->make<SimpleTriangleShader>(viewMatrix, color);
+}
+
 const GrPipeline* GrPathTessellationShader::MakeStencilOnlyPipeline(
         const ProgramArgs& args,
         GrAAType aaType,
diff --git a/src/gpu/tessellate/shaders/GrPathTessellationShader.h b/src/gpu/tessellate/shaders/GrPathTessellationShader.h
index 370f58c..a2000b0 100644
--- a/src/gpu/tessellate/shaders/GrPathTessellationShader.h
+++ b/src/gpu/tessellate/shaders/GrPathTessellationShader.h
@@ -15,6 +15,11 @@
 // This is the base class for shaders in the GPU tessellator that fill paths.
 class GrPathTessellationShader : public GrTessellationShader {
 public:
+    // Draws a simple array of triangles.
+    static GrPathTessellationShader* MakeSimpleTriangleShader(SkArenaAlloc*,
+                                                              const SkMatrix& viewMatrix,
+                                                              const SkPMColor4f&);
+
     // How many triangles are in a curve with 2^resolveLevel line segments?
     constexpr static int NumCurveTrianglesAtResolveLevel(int resolveLevel) {
         // resolveLevel=0 -> 0 line segments -> 0 triangles