Revert "Centralize geometry processor vertex shader transform code"

This reverts commit 0426947243e1d6b470830c4d3b1c5704ed1f23e1.

Reason for revert: unblock chrome roller

Original change's description:
> Centralize geometry processor vertex shader transform code
> 
> GrGLSLGeometryProcessors no longer have to call emitTransforms() in
> their onEmitCode() function. Instead, the GpArgs struct allows them to
> set a GrShaderVar that holds the computed or explicitly provided local
> coordinates in the vertex shader.
> 
> The base GrGLSLGeometryProcessor now automatically uses that to collect
> all of the transforms that can then be lifted out of FPs to the vertex
> shader, and base their computation on the GP provided local coordinate.
> 
> As part of this, there is no more built-in magic concatenation of a
> local matrix / inverse view matrix to these coordinate transforms. GP
> implementations that relied on this now manage their own uniform for this
> matrix and compute the local coordinate before assigning to GpArgs.
> 
> The base GrGLSLGeometryProcessor is updated to provide helpers for this
> pattern.
> 
> Bug: skia:10396
> Change-Id: I56afb3fff4b806f6015ab13626ac1afde9ef5c2b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297027
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

TBR=bsalomon@google.com,brianosman@google.com,michaelludwig@google.com

Change-Id: I203b7c72591d39b159e0405716fe8cdc28b083af
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10396
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297917
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp
index 94ba184..4f93238 100644
--- a/src/gpu/GrDefaultGeoProcFactory.cpp
+++ b/src/gpu/GrDefaultGeoProcFactory.cpp
@@ -57,7 +57,6 @@
     public:
         GLSLProcessor()
             : fViewMatrix(SkMatrix::InvalidMatrix())
-            , fLocalMatrix(SkMatrix::InvalidMatrix())
             , fColor(SK_PMColor4fILLEGAL)
             , fCoverage(0xff) {}
 
@@ -112,14 +111,14 @@
                                       &fViewMatrixUniform);
 
             // emit transforms using either explicit local coords or positions
-            if (gp.fInLocalCoords.isInitialized()) {
-                SkASSERT(gp.localMatrix().isIdentity());
-                gpArgs->fLocalCoordVar = gp.fInLocalCoords.asShaderVar();
-            } else if (gp.fLocalCoordsWillBeRead) {
-                this->writeLocalCoord(vertBuilder, uniformHandler, gpArgs,
-                                      gp.fInPosition.asShaderVar(), gp.localMatrix(),
-                                      &fLocalMatrixUniform);
-            }
+            const auto& coordsAttr = gp.fInLocalCoords.isInitialized() ? gp.fInLocalCoords
+                                                                       : gp.fInPosition;
+            this->emitTransforms(vertBuilder,
+                                 varyingHandler,
+                                 uniformHandler,
+                                 coordsAttr.asShaderVar(),
+                                 gp.localMatrix(),
+                                 args.fFPCoordTransformHandler);
 
             // Setup coverage as pass through
             if (gp.hasVertexCoverage() && !tweakAlpha) {
@@ -145,12 +144,8 @@
             const DefaultGeoProc& def = gp.cast<DefaultGeoProc>();
             uint32_t key = def.fFlags;
             key |= (def.coverage() == 0xff) ? 0x80 : 0;
-            key |= def.localCoordsWillBeRead() ? 0x100 : 0;
-
-            bool usesLocalMatrix = def.localCoordsWillBeRead() &&
-                                   !def.fInLocalCoords.isInitialized();
-            key = AddMatrixKeys(key, def.viewMatrix(),
-                                usesLocalMatrix ? def.localMatrix() : SkMatrix::I());
+            key |= (def.localCoordsWillBeRead() && def.localMatrix().hasPerspective()) ? 0x100 : 0;
+            key |= ComputePosKey(def.viewMatrix()) << 20;
             b->add32(key);
         }
 
@@ -159,9 +154,12 @@
                      const CoordTransformRange& transformRange) override {
             const DefaultGeoProc& dgp = gp.cast<DefaultGeoProc>();
 
-            this->setTransform(pdman, fViewMatrixUniform, dgp.viewMatrix(), &fViewMatrix);
-            this->setTransform(pdman, fLocalMatrixUniform, dgp.localMatrix(), &fLocalMatrix);
-            this->setTransformDataHelper(pdman, transformRange);
+            if (!dgp.viewMatrix().isIdentity() &&
+                !SkMatrixPriv::CheapEqual(fViewMatrix, dgp.viewMatrix()))
+            {
+                fViewMatrix = dgp.viewMatrix();
+                pdman.setSkMatrix(fViewMatrixUniform, fViewMatrix);
+            }
 
             if (!dgp.hasVertexColor() && dgp.color() != fColor) {
                 pdman.set4fv(fColorUniform, 1, dgp.color().vec());
@@ -172,15 +170,14 @@
                 pdman.set1f(fCoverageUniform, GrNormalizeByteToFloat(dgp.coverage()));
                 fCoverage = dgp.coverage();
             }
+            this->setTransformDataHelper(dgp.fLocalMatrix, pdman, transformRange);
         }
 
     private:
         SkMatrix fViewMatrix;
-        SkMatrix fLocalMatrix;
         SkPMColor4f fColor;
         uint8_t fCoverage;
         UniformHandle fViewMatrixUniform;
-        UniformHandle fLocalMatrixUniform;
         UniformHandle fColorUniform;
         UniformHandle fCoverageUniform;