eliminate redundant transform in vertex shader

Change-Id: I310be90e557733d7ff5414f14735d55a7b2f21f4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/287859
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/glsl/GrGLSLGeometryProcessor.cpp b/src/gpu/glsl/GrGLSLGeometryProcessor.cpp
index a264d45..3ef36d4 100644
--- a/src/gpu/glsl/GrGLSLGeometryProcessor.cpp
+++ b/src/gpu/glsl/GrGLSLGeometryProcessor.cpp
@@ -124,11 +124,14 @@
             varyingHandler->addVarying(strVaryingName.c_str(), &v);
 
             SkASSERT(fInstalledTransforms.back().fType == kFloat3x3_GrSLType);
-            if (v.type() == kFloat2_GrSLType) {
-                vb->codeAppendf("%s = (%s * %s).xy;", v.vsOut(), matrix.c_str(),
-                                localCoordsStr.c_str());
-            } else {
-                vb->codeAppendf("%s = %s * %s;", v.vsOut(), matrix.c_str(), localCoordsStr.c_str());
+            if (fp.sampleMatrix().fKind != SkSL::SampleMatrix::Kind::kConstantOrUniform) {
+                if (v.type() == kFloat2_GrSLType) {
+                    vb->codeAppendf("%s = (%s * %s).xy;", v.vsOut(), matrix.c_str(),
+                                    localCoordsStr.c_str());
+                } else {
+                    vb->codeAppendf("%s = %s * %s;", v.vsOut(), matrix.c_str(),
+                                    localCoordsStr.c_str());
+                }
             }
             fsVar = GrShaderVar(SkString(v.fsIn()), v.type(), GrShaderVar::TypeModifier::In);
             fTransformInfos.push_back({ v.vsOut(), v.type(), matrix, localCoordsStr, &fp });