No VS specialization for identity or scale/trans in reduced shader mode

Modifies helpers on GrGLSLGeometryProcessor that insert, set, and make
keys for view/local matrix uniforms to not omit the uniform when
the matrix is identity or use a float4 when it is scale/trans. Always
uses a 3x3.

Bug: skia:11844
Change-Id: I0f25b60b46b8932d7e2cac4a50159d22b9cd84d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/395656
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp
index cc63d52..dc36fc1 100644
--- a/src/gpu/GrDefaultGeoProcFactory.cpp
+++ b/src/gpu/GrDefaultGeoProcFactory.cpp
@@ -107,21 +107,26 @@
             }
 
             // Setup position
-            this->writeOutputPosition(vertBuilder,
-                                      uniformHandler,
-                                      gpArgs,
-                                      gp.fInPosition.name(),
-                                      gp.viewMatrix(),
-                                      &fViewMatrixUniform);
+            WriteOutputPosition(vertBuilder,
+                                uniformHandler,
+                                *args.fShaderCaps,
+                                gpArgs,
+                                gp.fInPosition.name(),
+                                gp.viewMatrix(),
+                                &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);
+                WriteLocalCoord(vertBuilder,
+                                uniformHandler,
+                                *args.fShaderCaps,
+                                gpArgs,
+                                gp.fInPosition.asShaderVar(),
+                                gp.localMatrix(),
+                                &fLocalMatrixUniform);
             }
 
             // Setup coverage as pass through
@@ -144,7 +149,7 @@
         }
 
         static inline void GenKey(const GrGeometryProcessor& gp,
-                                  const GrShaderCaps&,
+                                  const GrShaderCaps& shaderCaps,
                                   GrProcessorKeyBuilder* b) {
             const DefaultGeoProc& def = gp.cast<DefaultGeoProc>();
             uint32_t key = def.fFlags;
@@ -153,17 +158,24 @@
 
             bool usesLocalMatrix = def.localCoordsWillBeRead() &&
                                    !def.fInLocalCoords.isInitialized();
-            key = AddMatrixKeys(key, def.viewMatrix(),
+            key = AddMatrixKeys(shaderCaps,
+                                key,
+                                def.viewMatrix(),
                                 usesLocalMatrix ? def.localMatrix() : SkMatrix::I());
             b->add32(key);
         }
 
         void setData(const GrGLSLProgramDataManager& pdman,
+                     const GrShaderCaps& shaderCaps,
                      const GrGeometryProcessor& geomProc) override {
             const DefaultGeoProc& dgp = geomProc.cast<DefaultGeoProc>();
 
-            this->setTransform(pdman, fViewMatrixUniform, dgp.viewMatrix(), &fViewMatrixPrev);
-            this->setTransform(pdman, fLocalMatrixUniform, dgp.localMatrix(), &fLocalMatrixPrev);
+            SetTransform(pdman, shaderCaps, fViewMatrixUniform, dgp.viewMatrix(), &fViewMatrixPrev);
+            SetTransform(pdman,
+                         shaderCaps,
+                         fLocalMatrixUniform,
+                         dgp.localMatrix(),
+                         &fLocalMatrixPrev);
 
             if (!dgp.hasVertexColor() && dgp.color() != fColor) {
                 pdman.set4fv(fColorUniform, 1, dgp.color().vec());