Fix two different cases with multiple chained sample matrices

1) If two sample matrices had the same kind and expression (eg, an
identical literal matrix), we'd skip applying the second one because we
didn't examine fOwner in operator==, and decided it was irrelevant.

2) If three constant sample matrices were in a chain, the outer-most
would call trigger a recursive call to setSampleMatrix, which would
update the inner-most fBase pointer a second time, causing us to skip
over the middle transform entirely.

Change-Id: I5671c6f49b627e38571a37db2bf78be9e43d0224
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295579
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/GrFragmentProcessor.cpp b/src/gpu/GrFragmentProcessor.cpp
index 4aef86a..fcae5e0 100644
--- a/src/gpu/GrFragmentProcessor.cpp
+++ b/src/gpu/GrFragmentProcessor.cpp
@@ -90,7 +90,12 @@
     if (fMatrix.fKind == SkSL::SampleMatrix::Kind::kConstantOrUniform) {
         if (newMatrix.fKind == SkSL::SampleMatrix::Kind::kConstantOrUniform) {
             // need to base this transform on the one that happened in our parent
-            fMatrix.fBase = newMatrix.fOwner;
+            // If we're already based on something, then we have to assume that parent is now
+            // based on yet another transform, so don't update our base pointer (or we'll skip
+            // the intermediate transform).
+            if (!fMatrix.fBase) {
+                fMatrix.fBase = newMatrix.fOwner;
+            }
         } else {
             SkASSERT(newMatrix.fKind == SkSL::SampleMatrix::Kind::kVariable);
             fMatrix = SkSL::SampleMatrix(SkSL::SampleMatrix::Kind::kMixed, fMatrix.fOwner,