Remove layout(tracked) from SkSL

Change-Id: I6019418526def09c6c9f4b22567a2c76542d043c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/409876
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/gn/sksl_tests.gni b/gn/sksl_tests.gni
index 193bb6e..8ece2b8 100644
--- a/gn/sksl_tests.gni
+++ b/gn/sksl_tests.gni
@@ -63,7 +63,6 @@
   "/sksl/fp/GrSectionMake.fp",
   "/sksl/fp/GrSectionSetData.fp",
   "/sksl/fp/GrSectionTest.fp",
-  "/sksl/fp/GrTrackedInUniform.fp",
   "/sksl/fp/GrUniform.fp",
   "/sksl/fp/GrUniformArrays.fp",
   "/sksl/fp/GrUseExplicitReturn.fp",
diff --git a/include/private/SkSLLayout.h b/include/private/SkSLLayout.h
index 8886b3c..92056f6 100644
--- a/include/private/SkSLLayout.h
+++ b/include/private/SkSLLayout.h
@@ -23,9 +23,8 @@
         kOverrideCoverage_Flag           = 1 <<  1,
         kPushConstant_Flag               = 1 <<  2,
         kBlendSupportAllEquations_Flag   = 1 <<  3,
-        kTracked_Flag                    = 1 <<  4,
-        kSRGBUnpremul_Flag               = 1 <<  5,
-        kKey_Flag                        = 1 <<  6,
+        kSRGBUnpremul_Flag               = 1 <<  4,
+        kKey_Flag                        = 1 <<  5,
 
         // These flags indicate if the qualifier appeared, regardless of the accompanying value.
         kLocation_Flag                   = 1 <<  7,
@@ -189,9 +188,6 @@
         if (fFlags & kPushConstant_Flag) {
             result += separator() + "push_constant";
         }
-        if (fFlags & kTracked_Flag) {
-            result += separator() + "tracked";
-        }
         if (fFlags & kSRGBUnpremul_Flag) {
             result += separator() + "srgb_unpremul";
         }
diff --git a/resources/sksl/errors/LayoutInFunctions.sksl b/resources/sksl/errors/LayoutInFunctions.sksl
index be96aa4..faedc12 100644
--- a/resources/sksl/errors/LayoutInFunctions.sksl
+++ b/resources/sksl/errors/LayoutInFunctions.sksl
@@ -3,7 +3,6 @@
     override_coverage,
     push_constant,
     blend_support_all_equations,
-    tracked,
     srgb_unpremul,
     key,
     location = 1,
@@ -25,7 +24,6 @@
     override_coverage,
     push_constant,
     blend_support_all_equations,
-    tracked,
     srgb_unpremul,
     key,
     location = 1,
diff --git a/resources/sksl/errors/LayoutRepeatedQualifiers.sksl b/resources/sksl/errors/LayoutRepeatedQualifiers.sksl
index cae4867..2df318e 100644
--- a/resources/sksl/errors/LayoutRepeatedQualifiers.sksl
+++ b/resources/sksl/errors/LayoutRepeatedQualifiers.sksl
@@ -3,7 +3,6 @@
     override_coverage,
     push_constant,
     blend_support_all_equations,
-    tracked,
     srgb_unpremul,
     key,
     location = 1,
@@ -22,7 +21,6 @@
     override_coverage,
     push_constant,
     blend_support_all_equations,
-    tracked,
     srgb_unpremul,
     key,
     location = 2,
diff --git a/resources/sksl/fp/GrConditionalInUniform.fp b/resources/sksl/fp/GrConditionalInUniform.fp
index f89e8f9..f0b7b30 100644
--- a/resources/sksl/fp/GrConditionalInUniform.fp
+++ b/resources/sksl/fp/GrConditionalInUniform.fp
@@ -1,5 +1,5 @@
 layout(key) in bool test;
-layout(ctype=SkPMColor4f, tracked, when=test) in uniform half4 color;
+layout(ctype=SkPMColor4f, when=test) in uniform half4 color;
 half4 main() {
   if (test) {
     return color;
diff --git a/resources/sksl/fp/GrTrackedInUniform.fp b/resources/sksl/fp/GrTrackedInUniform.fp
deleted file mode 100644
index b949ba6..0000000
--- a/resources/sksl/fp/GrTrackedInUniform.fp
+++ /dev/null
@@ -1,4 +0,0 @@
-layout(tracked) in uniform half4 color;
-half4 main() {
-    return color;
-}
diff --git a/src/sksl/SkSLCPPUniformCTypes.cpp b/src/sksl/SkSLCPPUniformCTypes.cpp
index b96d80b..ce26c65 100644
--- a/src/sksl/SkSLCPPUniformCTypes.cpp
+++ b/src/sksl/SkSLCPPUniformCTypes.cpp
@@ -66,14 +66,6 @@
 // UniformCTypeMapper implementation //
 ///////////////////////////////////////
 
-String UniformCTypeMapper::dirtyExpression(const String& newVar, const String& oldVar) const {
-    return eval_template(fDirtyExpressionTemplate, {"${newVar}", "${oldVar}"}, {newVar, oldVar});
-}
-
-String UniformCTypeMapper::saveState(const String& newVar, const String& oldVar) const {
-    return eval_template(fSaveStateTemplate, {"${newVar}", "${oldVar}"}, {newVar, oldVar});
-}
-
 String UniformCTypeMapper::setUniform(const String& pdman, const String& uniform,
                                       const String& var) const {
     String count;
@@ -94,20 +86,16 @@
                          {pdman, uniform, finalVar, count});
 }
 
-UniformCTypeMapper::UniformCTypeMapper(
-        Layout::CType ctype, const std::vector<String>& skslTypes,
-        const String& setUniformSingleFormat, const String& setUniformArrayFormat,
-        const String& defaultValue, const String& dirtyExpressionFormat,
-        const String& saveStateFormat)
-    : fCType(ctype)
-    , fSKSLTypes(skslTypes)
-    , fUniformSingleTemplate(setUniformSingleFormat)
-    , fUniformArrayTemplate(setUniformArrayFormat)
-    , fInlineValue(determine_inline_from_template(setUniformSingleFormat) &&
-                   determine_inline_from_template(setUniformArrayFormat))
-    , fDefaultValue(defaultValue)
-    , fDirtyExpressionTemplate(dirtyExpressionFormat)
-    , fSaveStateTemplate(saveStateFormat) {}
+UniformCTypeMapper::UniformCTypeMapper(Layout::CType ctype,
+                                       const std::vector<String>& skslTypes,
+                                       const String& setUniformSingleFormat,
+                                       const String& setUniformArrayFormat)
+        : fCType(ctype)
+        , fSKSLTypes(skslTypes)
+        , fUniformSingleTemplate(setUniformSingleFormat)
+        , fUniformArrayTemplate(setUniformArrayFormat)
+        , fInlineValue(determine_inline_from_template(setUniformSingleFormat) &&
+                       determine_inline_from_template(setUniformArrayFormat)) {}
 
 const UniformCTypeMapper* UniformCTypeMapper::arrayMapper(int count) const {
     static SkMutex& mutex = *(new SkMutex);
@@ -126,31 +114,17 @@
     return &result->second;
 }
 
-
-static UniformCTypeMapper register_array(Layout::CType ctype, const std::vector<String>& skslTypes,
-                                   const char* singleSet, const char* arraySet,
-                                   const char* defaultValue, const char* dirtyExpression) {
-    return UniformCTypeMapper(ctype, skslTypes, singleSet, arraySet, defaultValue, dirtyExpression,
-                              "${oldVar} = ${newVar}");
+static UniformCTypeMapper register_array(Layout::CType ctype,
+                                         const std::vector<String>& skslTypes,
+                                         const char* singleSet,
+                                         const char* arraySet) {
+    return UniformCTypeMapper(ctype, skslTypes, singleSet, arraySet);
 }
 
-static UniformCTypeMapper register_array(Layout::CType ctype, const std::vector<String>& skslTypes,
-                                         const char* singleSet, const char* arraySet,
-                                         const char* defaultValue) {
-    return register_array(ctype, skslTypes, singleSet, arraySet, defaultValue,
-                              "${oldVar} != ${newVar}");
-}
-
-static UniformCTypeMapper register_type(Layout::CType ctype, const std::vector<String>& skslTypes,
-                                   const char* uniformFormat, const char* defaultValue,
-                                   const char* dirtyExpression) {
-    return register_array(ctype, skslTypes, uniformFormat, uniformFormat, defaultValue,
-                          dirtyExpression);
-}
-
-static UniformCTypeMapper register_type(Layout::CType ctype, const std::vector<String>& skslTypes,
-                                   const char* uniformFormat, const char* defaultValue) {
-    return register_array(ctype, skslTypes, uniformFormat, uniformFormat, defaultValue);
+static UniformCTypeMapper register_type(Layout::CType ctype,
+                                        const std::vector<String>& skslTypes,
+                                        const char* uniformFormat) {
+    return register_array(ctype, skslTypes, uniformFormat, uniformFormat);
 }
 
 //////////////////////////////
@@ -158,55 +132,40 @@
 //////////////////////////////
 
 static const std::vector<UniformCTypeMapper>& get_mappers() {
-    static const auto& kRegisteredMappers = *new std::vector<UniformCTypeMapper>{
+    static const std::vector<UniformCTypeMapper> kRegisteredMappers = {
     register_type(Layout::CType::kSkRect, { "half4", "float4", "double4" },
-        "${pdman}.set4fv(${uniform}, ${count}, reinterpret_cast<const float*>(&${var}))", // to gpu
-        "SkRect::MakeEmpty()",                                                     // default value
-        "${oldVar}.isEmpty() || ${oldVar} != ${newVar}"),                          // dirty check
+        "${pdman}.set4fv(${uniform}, ${count}, reinterpret_cast<const float*>(&${var}))"), // to gpu
 
     register_type(Layout::CType::kSkIRect, { "int4", "short4", "byte4" },
-        "${pdman}.set4iv(${uniform}, ${count}, reinterpret_cast<const int*>(&${var}))", // to gpu
-        "SkIRect::MakeEmpty()",                                                    // default value
-        "${oldVar}.isEmpty() || ${oldVar} != ${newVar}"),                          // dirty check
+        "${pdman}.set4iv(${uniform}, ${count}, reinterpret_cast<const int*>(&${var}))"), // to gpu
 
     register_type(Layout::CType::kSkPMColor4f, { "half4", "float4", "double4" },
-        "${pdman}.set4fv(${uniform}, ${count}, ${var}.vec())",                     // to gpu
-        "{SK_FloatNaN, SK_FloatNaN, SK_FloatNaN, SK_FloatNaN}"),                   // default value
+        "${pdman}.set4fv(${uniform}, ${count}, ${var}.vec())"),                     // to gpu
 
     register_type(Layout::CType::kSkV4, { "half4", "float4", "double4" },
-        "${pdman}.set4fv(${uniform}, ${count}, ${var}.ptr())",                     // to gpu
-        "SkV4{SK_FloatNaN, SK_FloatNaN, SK_FloatNaN, SK_FloatNaN}",                // default value
-        "${oldVar} != (${newVar})"),                                               // dirty check
+        "${pdman}.set4fv(${uniform}, ${count}, ${var}.ptr())"),                     // to gpu
 
     register_array(Layout::CType::kSkPoint, { "half2", "float2", "double2" } ,
         "${pdman}.set2f(${uniform}, ${var}.fX, ${var}.fY)",                        // single
-        "${pdman}.set2fv(${uniform}, ${count}, &${var}.fX)",                       // array
-        "SkPoint::Make(SK_FloatNaN, SK_FloatNaN)"),                                // default value
+        "${pdman}.set2fv(${uniform}, ${count}, &${var}.fX)"),                      // array
 
     register_array(Layout::CType::kSkIPoint, { "int2", "short2", "byte2" },
         "${pdman}.set2i(${uniform}, ${var}.fX, ${var}.fY)",                        // single
-        "${pdman}.set2iv(${uniform}, ${count}, ${var}.fX, ${var}.fY)",             // array
-        "SkIPoint::Make(SK_NaN32, SK_NaN32)"),                                     // default value
+        "${pdman}.set2iv(${uniform}, ${count}, ${var}.fX, ${var}.fY)"),            // array
 
     register_type(Layout::CType::kSkMatrix, { "half3x3", "float3x3", "double3x3" },
-        "static_assert(${count} == 1); ${pdman}.setSkMatrix(${uniform}, ${var})",  // to gpu
-        "SkMatrix::Scale(SK_FloatNaN, SK_FloatNaN)",                               // default value
-        "!${oldVar}.cheapEqualTo(${newVar})"),                                     // dirty check
+        "static_assert(${count} == 1); ${pdman}.setSkMatrix(${uniform}, ${var})"), // to gpu
 
     register_type(Layout::CType::kSkM44, { "half4x4", "float4x4", "double4x4" },
-        "static_assert(${count} == 1); ${pdman}.setSkM44(${uniform}, ${var})",     // to gpu
-        "SkM44(SkM44::kNaN_Constructor)",                                          // default value
-        "${oldVar} != (${newVar})"),                                               // dirty check
+        "static_assert(${count} == 1); ${pdman}.setSkM44(${uniform}, ${var})"),    // to gpu
 
     register_array(Layout::CType::kFloat, { "half", "float", "double" },
         "${pdman}.set1f(${uniform}, ${var})",                                      // single
-        "${pdman}.set1fv(${uniform}, ${count}, &${var})",                          // array
-        "SK_FloatNaN"),                                                            // default value
+        "${pdman}.set1fv(${uniform}, ${count}, &${var})"),                         // array
 
     register_array(Layout::CType::kInt32, { "int", "short", "byte" },
         "${pdman}.set1i(${uniform}, ${var})",                                      // single
-        "${pdman}.set1iv(${uniform}, ${count}, &${var})",                          // array
-        "SK_NaN32"),                                                               // default value
+        "${pdman}.set1iv(${uniform}, ${count}, &${var})"),                         // array
     };
 
     return kRegisteredMappers;
diff --git a/src/sksl/SkSLCPPUniformCTypes.h b/src/sksl/SkSLCPPUniformCTypes.h
index 0e30819..a358a38 100644
--- a/src/sksl/SkSLCPPUniformCTypes.h
+++ b/src/sksl/SkSLCPPUniformCTypes.h
@@ -17,13 +17,8 @@
 
 namespace SkSL {
 
-// This uses templates to define dirtyExpression(), saveState() and setUniform(). Each template can
-// reference token names formatted ${name} that are replaced with the actual values passed into the
-// functions.
-//
-// dirtyExpression() and saveState() support the following tokens:
-//  - ${newVar} replaced with value of newValueVarName (1st argument)
-//  - ${oldVar} replaced with value of oldValueVarName (2nd argument)
+// This uses templates to define setUniform(). The template can reference token names formatted
+// ${name} that are replaced with the actual values passed into the function.
 //
 // setUniform() supports these tokens:
 //  - ${pdman} replaced with value of pdmanName (1st argument)
@@ -34,10 +29,10 @@
 // semicolons or newlines, which will be handled by the code generation itself.
 class UniformCTypeMapper {
 public:
-    UniformCTypeMapper(Layout::CType ctype, const std::vector<String>& skslTypes,
-            const String& setUniformSingleFormat, const String& setUniformArrayFormat,
-            const String& defaultValue = "", const String& dirtyExpressionFormat = "",
-            const String& saveStateFormat = "");
+    UniformCTypeMapper(Layout::CType ctype,
+                       const std::vector<String>& skslTypes,
+                       const String& setUniformSingleFormat,
+                       const String& setUniformArrayFormat);
 
     // Returns nullptr if the type and layout are not supported; the returned pointer's ownership
     // is not transfered to the caller.
@@ -61,27 +56,6 @@
         return fSKSLTypes;
     }
 
-    // What the C++ class fields are initialized to in the GLSLFragmentProcessor The empty string
-    // implies the no-arg constructor is suitable.
-    //
-    // The returned snippet will be a valid as the lhs of an assignment.
-    const String& defaultValue() const {
-        return fDefaultValue;
-    }
-
-    // Return a boolean expression that returns true if the variables specified by newValueVarName
-    // and oldValueVarName have different values.
-    //
-    // The returned snippet will be a valid expression to be inserted into the condition of an 'if'
-    // statement.
-    String dirtyExpression(const String& newValueVarName, const String& oldValueVarName) const;
-
-    // Return a statement that stores the value of newValueVarName into the variable specified by
-    // oldValueVarName.
-    //
-    // The returned snippet will be a valid expression.
-    String saveState(const String& newValueVarName, const String& oldValueVarName) const;
-
     // Return a statement that invokes the appropriate setX method on the GrGLSLProgramDataManager
     // specified by pdmanName, where the uniform is provided by the expression stored in
     // uniformHandleName, and valueVarName is the variable name pointing to the ctype instance
@@ -107,10 +81,6 @@
     String fUniformSingleTemplate;
     String fUniformArrayTemplate;
     bool fInlineValue; // Cached value calculated from fUniformTemplate
-
-    String fDefaultValue;
-    String fDirtyExpressionTemplate;
-    String fSaveStateTemplate;
 };
 
 }  // namespace SkSL
diff --git a/src/sksl/SkSLIRGenerator.cpp b/src/sksl/SkSLIRGenerator.cpp
index 5f1d537..355a5ba 100644
--- a/src/sksl/SkSLIRGenerator.cpp
+++ b/src/sksl/SkSLIRGenerator.cpp
@@ -273,10 +273,6 @@
             this->errorReporter().error(offset,
                                         "'when' is only permitted within fragment processors");
         }
-        if (modifiers.fLayout.fFlags & Layout::kTracked_Flag) {
-            this->errorReporter().error(offset,
-                                        "'tracked' is only permitted within fragment processors");
-        }
         if (modifiers.fLayout.fCType != Layout::CType::kDefault) {
             this->errorReporter().error(offset,
                                         "'ctype' is only permitted within fragment processors");
@@ -830,7 +826,6 @@
     checkLayout(Layout::kOverrideCoverage_Flag,         "override_coverage");
     checkLayout(Layout::kPushConstant_Flag,             "push_constant");
     checkLayout(Layout::kBlendSupportAllEquations_Flag, "blend_support_all_equations");
-    checkLayout(Layout::kTracked_Flag,                  "tracked");
     checkLayout(Layout::kSRGBUnpremul_Flag,             "srgb_unpremul");
     checkLayout(Layout::kKey_Flag,                      "key");
     checkLayout(Layout::kLocation_Flag,                 "location");
diff --git a/src/sksl/SkSLParser.cpp b/src/sksl/SkSLParser.cpp
index 0df3619..2cb2d9f 100644
--- a/src/sksl/SkSLParser.cpp
+++ b/src/sksl/SkSLParser.cpp
@@ -108,7 +108,6 @@
     TOKEN(INVOCATIONS,                  "invocations");
     TOKEN(WHEN,                         "when");
     TOKEN(KEY,                          "key");
-    TOKEN(TRACKED,                      "tracked");
     TOKEN(SRGB_UNPREMUL,                "srgb_unpremul");
     TOKEN(CTYPE,                        "ctype");
     TOKEN(SKPMCOLOR4F,                  "SkPMColor4f");
@@ -925,9 +924,6 @@
                     case LayoutToken::BLEND_SUPPORT_ALL_EQUATIONS:
                         setFlag(Layout::kBlendSupportAllEquations_Flag);
                         break;
-                    case LayoutToken::TRACKED:
-                        setFlag(Layout::kTracked_Flag);
-                        break;
                     case LayoutToken::SRGB_UNPREMUL:
                         setFlag(Layout::kSRGBUnpremul_Flag);
                         break;
diff --git a/src/sksl/SkSLParser.h b/src/sksl/SkSLParser.h
index 701e4a7..fce6854 100644
--- a/src/sksl/SkSLParser.h
+++ b/src/sksl/SkSLParser.h
@@ -51,7 +51,6 @@
         INVOCATIONS,
         WHEN,
         KEY,
-        TRACKED,
         SRGB_UNPREMUL,
         CTYPE,
         SKPMCOLOR4F,
diff --git a/src/sksl/codegen/SkSLCPPCodeGenerator.cpp b/src/sksl/codegen/SkSLCPPCodeGenerator.cpp
index 792d02a..6911814 100644
--- a/src/sksl/codegen/SkSLCPPCodeGenerator.cpp
+++ b/src/sksl/codegen/SkSLCPPCodeGenerator.cpp
@@ -654,23 +654,6 @@
                                                        var.modifiers().fLayout).c_str(),
                              String(var.name()).c_str(),
                              default_value(var).c_str());
-            } else if (var.modifiers().fLayout.fFlags & Layout::kTracked_Flag) {
-                // An auto-tracked uniform in variable, so add a field to hold onto the prior
-                // state. Note that tracked variables must be uniform in's and that is validated
-                // before writePrivateVars() is called.
-                const UniformCTypeMapper* mapper = UniformCTypeMapper::Get(fContext, var);
-                SkASSERT(mapper);
-
-                String name = HCodeGenerator::FieldName(String(var.name()).c_str());
-                // The member statement is different if the mapper reports a default value
-                if (mapper->defaultValue().size() > 0) {
-                    this->writef("%s %sPrev = %s;\n",
-                                    Layout::CTypeToStr(mapper->ctype()), name.c_str(),
-                                    mapper->defaultValue().c_str());
-                } else {
-                    this->writef("%s %sPrev;\n",
-                                    Layout::CTypeToStr(mapper->ctype()), name.c_str());
-                }
             }
         }
     }
@@ -991,8 +974,7 @@
 
             // Switches for setData behavior in the generated code
             bool conditionalUniform = u->modifiers().fLayout.fWhen != "";
-            bool isTracked = u->modifiers().fLayout.fFlags & Layout::kTracked_Flag;
-            bool needsValueDeclaration = isTracked || !mapper->canInlineUniformValue();
+            bool needsValueDeclaration = !mapper->canInlineUniformValue();
 
             String uniformName = HCodeGenerator::FieldName(name) + "Var";
 
@@ -1013,24 +995,13 @@
                 this->writef("%s%s %s = _outer.%s;\n",
                              indent.c_str(), valueType.c_str(), valueVar.c_str(), name);
             } else {
-                // Not tracked and the mapper only needs to use the value once
-                // so send it a safe expression instead of the variable name
+                // The mapper only needs to use the value once so send it a safe expression instead
+                // of the variable name
                 valueVar.appendf("(_outer.%s)", name);
             }
 
-            if (isTracked) {
-                String prevVar = HCodeGenerator::FieldName(name) + "Prev";
-                this->writef("%sif (%s) {\n"
-                             "%s    %s;\n"
-                             "%s    %s;\n"
-                             "%s}\n", indent.c_str(),
-                        mapper->dirtyExpression(valueVar, prevVar).c_str(), indent.c_str(),
-                        mapper->saveState(valueVar, prevVar).c_str(), indent.c_str(),
-                        mapper->setUniform(pdman, uniformName, valueVar).c_str(), indent.c_str());
-            } else {
-                this->writef("%s%s;\n", indent.c_str(),
-                        mapper->setUniform(pdman, uniformName, valueVar).c_str());
-            }
+            this->writef("%s%s;\n",
+                         indent.c_str(), mapper->setUniform(pdman, uniformName, valueVar).c_str());
 
             if (conditionalUniform) {
                 // Close the earlier precheck block
@@ -1337,12 +1308,6 @@
                             + "'s type is not supported for use as a 'uniform in'");
                     return false;
                 }
-            } else {
-                // If it's not a uniform_in, it's an error to be tracked
-                if (decl.var().modifiers().fLayout.fFlags & Layout::kTracked_Flag) {
-                    fErrors.error(decl.fOffset, "Non-'in uniforms' cannot be tracked");
-                    return false;
-                }
             }
         }
     }
diff --git a/src/sksl/codegen/SkSLDSLCPPCodeGenerator.cpp b/src/sksl/codegen/SkSLDSLCPPCodeGenerator.cpp
index f1646d0..00ea6bc 100644
--- a/src/sksl/codegen/SkSLDSLCPPCodeGenerator.cpp
+++ b/src/sksl/codegen/SkSLDSLCPPCodeGenerator.cpp
@@ -946,23 +946,6 @@
                                                        var.modifiers().fLayout).c_str(),
                              (int)var.name().size(), var.name().data(),
                              default_value(var).c_str());
-            } else if (var.modifiers().fLayout.fFlags & Layout::kTracked_Flag) {
-                // An auto-tracked uniform in variable, so add a field to hold onto the prior
-                // state. Note that tracked variables must be uniform in's and that is validated
-                // before writePrivateVars() is called.
-                const UniformCTypeMapper* mapper = UniformCTypeMapper::Get(fContext, var);
-                SkASSERT(mapper);
-
-                String name = HCodeGenerator::FieldName(String(var.name()).c_str());
-                // The member statement is different if the mapper reports a default value
-                if (mapper->defaultValue().size() > 0) {
-                    this->writef("%s %sPrev = %s;\n",
-                                    Layout::CTypeToStr(mapper->ctype()), name.c_str(),
-                                    mapper->defaultValue().c_str());
-                } else {
-                    this->writef("%s %sPrev;\n",
-                                    Layout::CTypeToStr(mapper->ctype()), name.c_str());
-                }
             }
         }
     }
@@ -1081,8 +1064,7 @@
 
             // Switches for setData behavior in the generated code
             bool conditionalUniform = u->modifiers().fLayout.fWhen != "";
-            bool isTracked = u->modifiers().fLayout.fFlags & Layout::kTracked_Flag;
-            bool needsValueDeclaration = isTracked || !mapper->canInlineUniformValue();
+            bool needsValueDeclaration = !mapper->canInlineUniformValue();
 
             String uniformName = HCodeGenerator::FieldName(name) + "Var";
 
@@ -1103,24 +1085,13 @@
                 this->writef("%s%s %s = _outer.%s;\n",
                              indent.c_str(), valueType.c_str(), valueVar.c_str(), name);
             } else {
-                // Not tracked and the mapper only needs to use the value once
-                // so send it a safe expression instead of the variable name
+                // The mapper only needs to use the value once so send it a safe expression instead
+                // of the variable name
                 valueVar.appendf("(_outer.%s)", name);
             }
 
-            if (isTracked) {
-                String prevVar = HCodeGenerator::FieldName(name) + "Prev";
-                this->writef("%sif (%s) {\n"
-                             "%s    %s;\n"
-                             "%s    %s;\n"
-                             "%s}\n", indent.c_str(),
-                        mapper->dirtyExpression(valueVar, prevVar).c_str(), indent.c_str(),
-                        mapper->saveState(valueVar, prevVar).c_str(), indent.c_str(),
-                        mapper->setUniform(pdman, uniformName, valueVar).c_str(), indent.c_str());
-            } else {
-                this->writef("%s%s;\n", indent.c_str(),
-                        mapper->setUniform(pdman, uniformName, valueVar).c_str());
-            }
+            this->writef("%s%s;\n",
+                         indent.c_str(), mapper->setUniform(pdman, uniformName, valueVar).c_str());
 
             if (conditionalUniform) {
                 // Close the earlier precheck block
@@ -1384,12 +1355,6 @@
                             + "'s type is not supported for use as a 'uniform in'");
                     return false;
                 }
-            } else {
-                // If it's not a uniform_in, it's an error to be tracked
-                if (decl.var().modifiers().fLayout.fFlags & Layout::kTracked_Flag) {
-                    fErrors.error(decl.fOffset, "Non-'in uniforms' cannot be tracked");
-                    return false;
-                }
             }
         }
     }
diff --git a/tests/SkRuntimeEffectTest.cpp b/tests/SkRuntimeEffectTest.cpp
index 88fce0b..2c4861b 100644
--- a/tests/SkRuntimeEffectTest.cpp
+++ b/tests/SkRuntimeEffectTest.cpp
@@ -34,14 +34,13 @@
 #define EMPTY_MAIN "half4 main(float2 p) { return half4(0); }"
 
 DEF_TEST(SkRuntimeEffectInvalid_FPOnly, r) {
-    // Features that are only allowed in .fp files (key, in uniform, ctype, when, tracked).
+    // Features that are only allowed in .fp files (key, in uniform, ctype, when).
     // Ensure that these fail, and the error messages contain the relevant keyword.
     test_invalid_effect(r, "layout(key) in bool Input;"             EMPTY_MAIN, "key");
     test_invalid_effect(r, "in uniform float Input;"                EMPTY_MAIN, "in uniform");
     test_invalid_effect(r, "layout(ctype=SkRect) float4 Input;"     EMPTY_MAIN, "ctype");
     test_invalid_effect(r, "in bool Flag; "
                            "layout(when=Flag) uniform float Input;" EMPTY_MAIN, "when");
-    test_invalid_effect(r, "layout(tracked) uniform float Input;"   EMPTY_MAIN, "tracked");
 }
 
 DEF_TEST(SkRuntimeEffectInvalid_LimitedUniformTypes, r) {
diff --git a/tests/sksl/errors/LayoutInFunctions.glsl b/tests/sksl/errors/LayoutInFunctions.glsl
index 7322121..f248385 100644
--- a/tests/sksl/errors/LayoutInFunctions.glsl
+++ b/tests/sksl/errors/LayoutInFunctions.glsl
@@ -1,39 +1,37 @@
 ### Compilation failed:
 
-error: 20: layout qualifier 'origin_upper_left' is not permitted here
-error: 20: layout qualifier 'override_coverage' is not permitted here
-error: 20: layout qualifier 'push_constant' is not permitted here
-error: 20: layout qualifier 'blend_support_all_equations' is not permitted here
-error: 20: layout qualifier 'tracked' is not permitted here
-error: 20: layout qualifier 'srgb_unpremul' is not permitted here
-error: 20: layout qualifier 'key' is not permitted here
-error: 20: layout qualifier 'location' is not permitted here
-error: 20: layout qualifier 'offset' is not permitted here
-error: 20: layout qualifier 'binding' is not permitted here
-error: 20: layout qualifier 'index' is not permitted here
-error: 20: layout qualifier 'set' is not permitted here
-error: 20: layout qualifier 'builtin' is not permitted here
-error: 20: layout qualifier 'input_attachment_index' is not permitted here
-error: 20: layout qualifier 'max_vertices' is not permitted here
-error: 20: layout qualifier 'invocations' is not permitted here
-error: 20: layout qualifier 'when' is not permitted here
-error: 20: layout qualifier 'ctype' is not permitted here
-error: 41: layout qualifier 'origin_upper_left' is not permitted here
-error: 41: layout qualifier 'override_coverage' is not permitted here
-error: 41: layout qualifier 'push_constant' is not permitted here
-error: 41: layout qualifier 'blend_support_all_equations' is not permitted here
-error: 41: layout qualifier 'tracked' is not permitted here
-error: 41: layout qualifier 'srgb_unpremul' is not permitted here
-error: 41: layout qualifier 'key' is not permitted here
-error: 41: layout qualifier 'location' is not permitted here
-error: 41: layout qualifier 'offset' is not permitted here
-error: 41: layout qualifier 'binding' is not permitted here
-error: 41: layout qualifier 'index' is not permitted here
-error: 41: layout qualifier 'set' is not permitted here
-error: 41: layout qualifier 'builtin' is not permitted here
-error: 41: layout qualifier 'input_attachment_index' is not permitted here
-error: 41: layout qualifier 'max_vertices' is not permitted here
-error: 41: layout qualifier 'invocations' is not permitted here
-error: 41: layout qualifier 'when' is not permitted here
-error: 41: layout qualifier 'ctype' is not permitted here
-36 errors
+error: 19: layout qualifier 'origin_upper_left' is not permitted here
+error: 19: layout qualifier 'override_coverage' is not permitted here
+error: 19: layout qualifier 'push_constant' is not permitted here
+error: 19: layout qualifier 'blend_support_all_equations' is not permitted here
+error: 19: layout qualifier 'srgb_unpremul' is not permitted here
+error: 19: layout qualifier 'key' is not permitted here
+error: 19: layout qualifier 'location' is not permitted here
+error: 19: layout qualifier 'offset' is not permitted here
+error: 19: layout qualifier 'binding' is not permitted here
+error: 19: layout qualifier 'index' is not permitted here
+error: 19: layout qualifier 'set' is not permitted here
+error: 19: layout qualifier 'builtin' is not permitted here
+error: 19: layout qualifier 'input_attachment_index' is not permitted here
+error: 19: layout qualifier 'max_vertices' is not permitted here
+error: 19: layout qualifier 'invocations' is not permitted here
+error: 19: layout qualifier 'when' is not permitted here
+error: 19: layout qualifier 'ctype' is not permitted here
+error: 39: layout qualifier 'origin_upper_left' is not permitted here
+error: 39: layout qualifier 'override_coverage' is not permitted here
+error: 39: layout qualifier 'push_constant' is not permitted here
+error: 39: layout qualifier 'blend_support_all_equations' is not permitted here
+error: 39: layout qualifier 'srgb_unpremul' is not permitted here
+error: 39: layout qualifier 'key' is not permitted here
+error: 39: layout qualifier 'location' is not permitted here
+error: 39: layout qualifier 'offset' is not permitted here
+error: 39: layout qualifier 'binding' is not permitted here
+error: 39: layout qualifier 'index' is not permitted here
+error: 39: layout qualifier 'set' is not permitted here
+error: 39: layout qualifier 'builtin' is not permitted here
+error: 39: layout qualifier 'input_attachment_index' is not permitted here
+error: 39: layout qualifier 'max_vertices' is not permitted here
+error: 39: layout qualifier 'invocations' is not permitted here
+error: 39: layout qualifier 'when' is not permitted here
+error: 39: layout qualifier 'ctype' is not permitted here
+34 errors
diff --git a/tests/sksl/errors/LayoutRepeatedQualifiers.glsl b/tests/sksl/errors/LayoutRepeatedQualifiers.glsl
index 5ceeaed..9d99120 100644
--- a/tests/sksl/errors/LayoutRepeatedQualifiers.glsl
+++ b/tests/sksl/errors/LayoutRepeatedQualifiers.glsl
@@ -1,21 +1,20 @@
 ### Compilation failed:
 
-error: 21: layout qualifier 'origin_upper_left' appears more than once
-error: 22: layout qualifier 'override_coverage' appears more than once
-error: 23: layout qualifier 'push_constant' appears more than once
-error: 24: layout qualifier 'blend_support_all_equations' appears more than once
-error: 25: layout qualifier 'tracked' appears more than once
-error: 26: layout qualifier 'srgb_unpremul' appears more than once
-error: 27: layout qualifier 'key' appears more than once
-error: 28: layout qualifier 'location' appears more than once
-error: 29: layout qualifier 'offset' appears more than once
-error: 30: layout qualifier 'binding' appears more than once
-error: 31: layout qualifier 'index' appears more than once
-error: 32: layout qualifier 'set' appears more than once
-error: 33: layout qualifier 'builtin' appears more than once
-error: 34: layout qualifier 'input_attachment_index' appears more than once
-error: 35: layout qualifier 'max_vertices' appears more than once
-error: 36: layout qualifier 'invocations' appears more than once
-error: 37: layout qualifier 'when' appears more than once
-error: 38: layout qualifier 'ctype' appears more than once
-18 errors
+error: 20: layout qualifier 'origin_upper_left' appears more than once
+error: 21: layout qualifier 'override_coverage' appears more than once
+error: 22: layout qualifier 'push_constant' appears more than once
+error: 23: layout qualifier 'blend_support_all_equations' appears more than once
+error: 24: layout qualifier 'srgb_unpremul' appears more than once
+error: 25: layout qualifier 'key' appears more than once
+error: 26: layout qualifier 'location' appears more than once
+error: 27: layout qualifier 'offset' appears more than once
+error: 28: layout qualifier 'binding' appears more than once
+error: 29: layout qualifier 'index' appears more than once
+error: 30: layout qualifier 'set' appears more than once
+error: 31: layout qualifier 'builtin' appears more than once
+error: 32: layout qualifier 'input_attachment_index' appears more than once
+error: 33: layout qualifier 'max_vertices' appears more than once
+error: 34: layout qualifier 'invocations' appears more than once
+error: 35: layout qualifier 'when' appears more than once
+error: 36: layout qualifier 'ctype' appears more than once
+17 errors
diff --git a/tests/sksl/fp/GrConditionalInUniform.cpp b/tests/sksl/fp/GrConditionalInUniform.cpp
index dacf16c..a58a845 100644
--- a/tests/sksl/fp/GrConditionalInUniform.cpp
+++ b/tests/sksl/fp/GrConditionalInUniform.cpp
@@ -40,15 +40,10 @@
         const GrConditionalInUniform& _outer = _proc.cast<GrConditionalInUniform>();
         {
         if (colorVar.isValid()) {
-            const SkPMColor4f& colorValue = _outer.color;
-            if (colorPrev != colorValue) {
-                colorPrev = colorValue;
-                pdman.set4fv(colorVar, 1, colorValue.vec());
-            }
+            pdman.set4fv(colorVar, 1, (_outer.color).vec());
         }
         }
     }
-SkPMColor4f colorPrev = {SK_FloatNaN, SK_FloatNaN, SK_FloatNaN, SK_FloatNaN};
     UniformHandle colorVar;
 };
 std::unique_ptr<GrGLSLFragmentProcessor> GrConditionalInUniform::onMakeProgramImpl() const {
diff --git a/tests/sksl/fp/GrTrackedInUniform.cpp b/tests/sksl/fp/GrTrackedInUniform.cpp
deleted file mode 100644
index 0d6ca29..0000000
--- a/tests/sksl/fp/GrTrackedInUniform.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-/**************************************************************************************************
- *** This file was autogenerated from GrTrackedInUniform.fp; do not modify.
- **************************************************************************************************/
-#include "GrTrackedInUniform.h"
-
-#include "src/core/SkUtils.h"
-#include "src/gpu/GrTexture.h"
-#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
-#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
-#include "src/gpu/glsl/GrGLSLProgramBuilder.h"
-#include "src/sksl/SkSLCPP.h"
-#include "src/sksl/SkSLUtil.h"
-class GrGLSLTrackedInUniform : public GrGLSLFragmentProcessor {
-public:
-    GrGLSLTrackedInUniform() {}
-    void emitCode(EmitArgs& args) override {
-        GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
-        const GrTrackedInUniform& _outer = args.fFp.cast<GrTrackedInUniform>();
-        (void) _outer;
-        auto color = _outer.color;
-        (void) color;
-        colorVar = args.fUniformHandler->addUniform(&_outer, kFragment_GrShaderFlag, kHalf4_GrSLType, "color");
-        fragBuilder->codeAppendf(
-R"SkSL(return %s;
-)SkSL"
-, args.fUniformHandler->getUniformCStr(colorVar));
-    }
-private:
-    void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
-        const GrTrackedInUniform& _outer = _proc.cast<GrTrackedInUniform>();
-        {
-        const SkRect& colorValue = _outer.color;
-        if (colorPrev.isEmpty() || colorPrev != colorValue) {
-            colorPrev = colorValue;
-            pdman.set4fv(colorVar, 1, reinterpret_cast<const float*>(&colorValue));
-        }
-        }
-    }
-SkRect colorPrev = SkRect::MakeEmpty();
-    UniformHandle colorVar;
-};
-std::unique_ptr<GrGLSLFragmentProcessor> GrTrackedInUniform::onMakeProgramImpl() const {
-    return std::make_unique<GrGLSLTrackedInUniform>();
-}
-void GrTrackedInUniform::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
-}
-bool GrTrackedInUniform::onIsEqual(const GrFragmentProcessor& other) const {
-    const GrTrackedInUniform& that = other.cast<GrTrackedInUniform>();
-    (void) that;
-    if (color != that.color) return false;
-    return true;
-}
-GrTrackedInUniform::GrTrackedInUniform(const GrTrackedInUniform& src)
-: INHERITED(kGrTrackedInUniform_ClassID, src.optimizationFlags())
-, color(src.color) {
-        this->cloneAndRegisterAllChildProcessors(src);
-}
-std::unique_ptr<GrFragmentProcessor> GrTrackedInUniform::clone() const {
-    return std::make_unique<GrTrackedInUniform>(*this);
-}
-#if GR_TEST_UTILS
-SkString GrTrackedInUniform::onDumpInfo() const {
-    return SkStringPrintf("(color=half4(%f, %f, %f, %f))", color.left(), color.top(), color.right(), color.bottom());
-}
-#endif
diff --git a/tests/sksl/fp/GrTrackedInUniform.h b/tests/sksl/fp/GrTrackedInUniform.h
deleted file mode 100644
index 3fbc5e3..0000000
--- a/tests/sksl/fp/GrTrackedInUniform.h
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-/**************************************************************************************************
- *** This file was autogenerated from GrTrackedInUniform.fp; do not modify.
- **************************************************************************************************/
-#ifndef GrTrackedInUniform_DEFINED
-#define GrTrackedInUniform_DEFINED
-
-#include "include/core/SkM44.h"
-#include "include/core/SkTypes.h"
-
-
-#include "src/gpu/GrFragmentProcessor.h"
-
-class GrTrackedInUniform : public GrFragmentProcessor {
-public:
-    static std::unique_ptr<GrFragmentProcessor> Make(SkRect color) {
-        return std::unique_ptr<GrFragmentProcessor>(new GrTrackedInUniform(color));
-    }
-    GrTrackedInUniform(const GrTrackedInUniform& src);
-    std::unique_ptr<GrFragmentProcessor> clone() const override;
-    const char* name() const override { return "TrackedInUniform"; }
-    SkRect color;
-private:
-    GrTrackedInUniform(SkRect color)
-    : INHERITED(kGrTrackedInUniform_ClassID, kNone_OptimizationFlags)
-    , color(color) {
-    }
-    std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;
-    void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
-    bool onIsEqual(const GrFragmentProcessor&) const override;
-#if GR_TEST_UTILS
-    SkString onDumpInfo() const override;
-#endif
-    GR_DECLARE_FRAGMENT_PROCESSOR_TEST
-    using INHERITED = GrFragmentProcessor;
-};
-#endif