[graphite] Convert Precompile Blur, Displacement and MatrixConvolution IFs to new system

Additionally, this updates the PrecompileBlurMaskFilter to operate similar to the PrecompileImageFilters since the blurIF is used to implement the blurMF.

Bug: b/259548724
Change-Id: Ibe5ab52742b933da3958519886e1944b4fdce76a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/861839
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
diff --git a/src/gpu/graphite/FactoryFunctions.cpp b/src/gpu/graphite/FactoryFunctions.cpp
index ee78a9e..c495d90 100644
--- a/src/gpu/graphite/FactoryFunctions.cpp
+++ b/src/gpu/graphite/FactoryFunctions.cpp
@@ -1169,6 +1169,55 @@
 
 //--------------------------------------------------------------------------------------------------
 //--------------------------------------------------------------------------------------------------
+namespace {
+
+void create_blur_imagefilter_pipelines(const KeyContext& keyContext,
+                                       PipelineDataGatherer* gatherer,
+                                       const PaintOptions::ProcessCombination& processCombination) {
+
+    PaintOptions blurPaintOptions;
+
+    // For blur imagefilters we know we don't have alpha-only textures and don't need cubic
+    // filtering.
+    sk_sp<PrecompileShader> imageShader = PrecompileShadersPriv::Image(
+            PrecompileImageShaderFlags::kExcludeAlpha | PrecompileImageShaderFlags::kExcludeCubic);
+
+    static const SkBlendMode kBlurBlendModes[] = { SkBlendMode::kSrc };
+    blurPaintOptions.setShaders({ PrecompileShadersPriv::Blur(imageShader) });
+    blurPaintOptions.setBlendModes(kBlurBlendModes);
+
+    blurPaintOptions.priv().buildCombinations(keyContext,
+                                              gatherer,
+                                              DrawTypeFlags::kSimpleShape,
+                                              /* withPrimitiveBlender= */ false,
+                                              Coverage::kSingleChannel,
+                                              processCombination);
+}
+
+} // anonymous namespace
+
+class PrecompileBlurImageFilter : public PrecompileImageFilter {
+public:
+    PrecompileBlurImageFilter(SkSpan<sk_sp<PrecompileImageFilter>> inputs)
+            : PrecompileImageFilter(std::move(inputs)) {
+    }
+
+private:
+    void onCreatePipelines(
+            const KeyContext& keyContext,
+            PipelineDataGatherer* gatherer,
+            const PaintOptions::ProcessCombination& processCombination) const override {
+
+        create_blur_imagefilter_pipelines(keyContext, gatherer, processCombination);
+    }
+};
+
+sk_sp<PrecompileImageFilter> PrecompileImageFilters::Blur(
+            sk_sp<PrecompileImageFilter> input) {
+    return sk_make_sp<PrecompileBlurImageFilter>(SkSpan(&input, 1));
+}
+
+//--------------------------------------------------------------------------------------------------
 class PrecompileColorFilterImageFilter : public PrecompileImageFilter {
 public:
     PrecompileColorFilterImageFilter(SkSpan<const sk_sp<PrecompileColorFilter>> colorFilterOptions,
@@ -1217,6 +1266,43 @@
 }
 
 //--------------------------------------------------------------------------------------------------
+class PrecompileDisplacementMapImageFilter : public PrecompileImageFilter {
+public:
+    PrecompileDisplacementMapImageFilter(SkSpan<sk_sp<PrecompileImageFilter>> inputs)
+            : PrecompileImageFilter(std::move(inputs)) {
+    }
+
+private:
+    void onCreatePipelines(
+            const KeyContext& keyContext,
+            PipelineDataGatherer* gatherer,
+            const PaintOptions::ProcessCombination& processCombination) const override {
+
+        PaintOptions displacement;
+
+        // For displacement imagefilters we know we don't have alpha-only textures and don't need
+        // cubic filtering.
+        sk_sp<PrecompileShader> imageShader = PrecompileShadersPriv::Image(
+                PrecompileImageShaderFlags::kExcludeAlpha |
+                PrecompileImageShaderFlags::kExcludeCubic);
+
+        displacement.setShaders({ PrecompileShadersPriv::Displacement(imageShader, imageShader) });
+
+        displacement.priv().buildCombinations(keyContext,
+                                              gatherer,
+                                              DrawTypeFlags::kSimpleShape,
+                                              /* withPrimitiveBlender= */ false,
+                                              Coverage::kSingleChannel,
+                                              processCombination);
+    }
+};
+
+sk_sp<PrecompileImageFilter> PrecompileImageFilters::DisplacementMap(
+            sk_sp<PrecompileImageFilter> input) {
+    return sk_make_sp<PrecompileDisplacementMapImageFilter>(SkSpan(&input, 1));
+}
+
+//--------------------------------------------------------------------------------------------------
 class PrecompileLightingImageFilter : public PrecompileImageFilter {
 public:
     PrecompileLightingImageFilter(SkSpan<sk_sp<PrecompileImageFilter>> inputs)
@@ -1251,6 +1337,43 @@
 }
 
 //--------------------------------------------------------------------------------------------------
+class PrecompileMatrixConvolutionImageFilter : public PrecompileImageFilter {
+public:
+    PrecompileMatrixConvolutionImageFilter(SkSpan<sk_sp<PrecompileImageFilter>> inputs)
+            : PrecompileImageFilter(std::move(inputs)) {
+    }
+
+private:
+    void onCreatePipelines(
+            const KeyContext& keyContext,
+            PipelineDataGatherer* gatherer,
+            const PaintOptions::ProcessCombination& processCombination) const override {
+
+        PaintOptions matrixConv;
+
+        // For matrix convolution imagefilters we know we don't have alpha-only textures and don't
+        // need cubic filtering.
+        sk_sp<PrecompileShader> imageShader = PrecompileShadersPriv::Image(
+                PrecompileImageShaderFlags::kExcludeAlpha |
+                PrecompileImageShaderFlags::kExcludeCubic);
+
+        matrixConv.setShaders({ PrecompileShadersPriv::MatrixConvolution(imageShader) });
+
+        matrixConv.priv().buildCombinations(keyContext,
+                                            gatherer,
+                                            DrawTypeFlags::kSimpleShape,
+                                            /* withPrimitiveBlender= */ false,
+                                            Coverage::kSingleChannel,
+                                            processCombination);
+    }
+};
+
+sk_sp<PrecompileImageFilter> PrecompileImageFilters::MatrixConvolution(
+            sk_sp<PrecompileImageFilter> input) {
+    return sk_make_sp<PrecompileMatrixConvolutionImageFilter>(SkSpan(&input, 1));
+}
+
+//--------------------------------------------------------------------------------------------------
 class PrecompileMorphologyImageFilter : public PrecompileImageFilter {
 public:
     PrecompileMorphologyImageFilter(SkSpan<sk_sp<PrecompileImageFilter>> inputs)
@@ -1306,8 +1429,6 @@
 }
 
 //--------------------------------------------------------------------------------------------------
-// This class doesn't actually add any combinations to a given PaintOptions' combinatorics.
-// Its mere presence triggers the precompilation of the BlurImageFilter's Shaders.
 // TODO(b/342413572): the analytic blurmasks are triggered off of the simple DrawType thus
 // over-generate when a simple draw doesn't have a blur mask.
 class PrecompileBlurMaskFilter : public PrecompileMaskFilter {
@@ -1315,11 +1436,11 @@
     PrecompileBlurMaskFilter() {}
 
 private:
-    void addToKey(const KeyContext& keyContext,
-                  PaintParamsKeyBuilder* builder,
-                  PipelineDataGatherer* gatherer,
-                  int desiredCombination) const override {
-        SkASSERT(desiredCombination == 0);
+    void createPipelines(
+            const KeyContext& keyContext,
+            PipelineDataGatherer* gatherer,
+            const PaintOptions::ProcessCombination& processCombination) const override {
+        create_blur_imagefilter_pipelines(keyContext, gatherer, processCombination);
     }
 };
 
diff --git a/src/gpu/graphite/FactoryFunctions.h b/src/gpu/graphite/FactoryFunctions.h
index 0dd1c3c..60f1173 100644
--- a/src/gpu/graphite/FactoryFunctions.h
+++ b/src/gpu/graphite/FactoryFunctions.h
@@ -118,6 +118,9 @@
 } // namespace PrecompileShaders
 
 namespace PrecompileImageFilters {
+    // This is the Precompile correlate to the two SkImageFilters::Blur factories
+    SK_API sk_sp<PrecompileImageFilter> Blur(sk_sp<PrecompileImageFilter> input);
+
     // This is the Precompile correlate to SkImageFilters::ColorFilter.
     // Note: In order to make analysis tractable we only allow options for the internals of an
     // ImageFilter but not in the structure of the DAG.
@@ -127,11 +130,17 @@
             SkSpan<const sk_sp<PrecompileColorFilter>> colorFilterOptions,
             sk_sp<PrecompileImageFilter> input);
 
+    // This is the Precompile correlate to SkImageFilters::DisplacementMap
+    SK_API sk_sp<PrecompileImageFilter> DisplacementMap(sk_sp<PrecompileImageFilter> input);
+
     // This is the Precompile correlate to all of SkImageFilters::
     //      DistantLitDiffuse,  PointLitDiffuse,  SpotLitDiffuse
     //      DistantLitSpecular, PointLitSpecular, SpotLitSpecular
     SK_API sk_sp<PrecompileImageFilter> Lighting(sk_sp<PrecompileImageFilter> input);
 
+    // This is the Precompile correlate to SkImageFilters::MatrixConvolution
+    SK_API sk_sp<PrecompileImageFilter> MatrixConvolution(sk_sp<PrecompileImageFilter> input);
+
     // This is the Precompile correlate to SkImageFilters::Erode and SkImageFilters::Dilate
     SK_API sk_sp<PrecompileImageFilter> Morphology(sk_sp<PrecompileImageFilter> input);
 
diff --git a/src/gpu/graphite/Precompile.cpp b/src/gpu/graphite/Precompile.cpp
index 4a97fab..86c36c6 100644
--- a/src/gpu/graphite/Precompile.cpp
+++ b/src/gpu/graphite/Precompile.cpp
@@ -447,73 +447,6 @@
                                                processCombination);
 }
 
-void create_blur_imagefilter_pipelines(const KeyContext& keyContext,
-                                       PipelineDataGatherer* gatherer,
-                                       const PaintOptions::ProcessCombination& processCombination) {
-
-    PaintOptions blurPaintOptions;
-
-    // For blur imagefilters we know we don't have alpha-only textures and don't need cubic
-    // filtering.
-    sk_sp<PrecompileShader> imageShader = PrecompileShadersPriv::Image(
-            PrecompileImageShaderFlags::kExcludeAlpha | PrecompileImageShaderFlags::kExcludeCubic);
-
-    static const SkBlendMode kBlurBlendModes[] = { SkBlendMode::kSrc };
-    blurPaintOptions.setShaders({ PrecompileShadersPriv::Blur(imageShader) });
-    blurPaintOptions.setBlendModes(kBlurBlendModes);
-
-    blurPaintOptions.priv().buildCombinations(keyContext,
-                                              gatherer,
-                                              DrawTypeFlags::kSimpleShape,
-                                              /* withPrimitiveBlender= */ false,
-                                              Coverage::kSingleChannel,
-                                              processCombination);
-}
-
-void create_displacement_imagefilter_pipelines(
-        const KeyContext& keyContext,
-        PipelineDataGatherer* gatherer,
-        const PaintOptions::ProcessCombination& processCombination) {
-
-    PaintOptions displacement;
-
-    // For displacement imagefilters we know we don't have alpha-only textures and don't need cubic
-    // filtering.
-    sk_sp<PrecompileShader> imageShader = PrecompileShadersPriv::Image(
-            PrecompileImageShaderFlags::kExcludeAlpha | PrecompileImageShaderFlags::kExcludeCubic);
-
-    displacement.setShaders({ PrecompileShadersPriv::Displacement(imageShader, imageShader) });
-
-    displacement.priv().buildCombinations(keyContext,
-                                          gatherer,
-                                          DrawTypeFlags::kSimpleShape,
-                                          /* withPrimitiveBlender= */ false,
-                                          Coverage::kSingleChannel,
-                                          processCombination);
-}
-
-void create_matrix_convolution_imagefilter_pipelines(
-        const KeyContext& keyContext,
-        PipelineDataGatherer* gatherer,
-        const PaintOptions::ProcessCombination& processCombination) {
-
-    PaintOptions matrixConv;
-
-    // For matrix convolution imagefilters we know we don't have alpha-only textures and don't
-    // need cubic filtering.
-    sk_sp<PrecompileShader> imageShader = PrecompileShadersPriv::Image(
-            PrecompileImageShaderFlags::kExcludeAlpha | PrecompileImageShaderFlags::kExcludeCubic);
-
-    matrixConv.setShaders({ PrecompileShadersPriv::MatrixConvolution(imageShader) });
-
-    matrixConv.priv().buildCombinations(keyContext,
-                                        gatherer,
-                                        DrawTypeFlags::kSimpleShape,
-                                        /* withPrimitiveBlender= */ false,
-                                        Coverage::kSingleChannel,
-                                        processCombination);
-}
-
 } // anonymous namespace
 
 void PaintOptions::buildCombinations(
@@ -526,13 +459,13 @@
 
     PaintParamsKeyBuilder builder(keyContext.dict());
 
-    if (fImageFilterFlags != PrecompileImageFilterFlags::kNone || !fImageFilterOptions.empty()) {
+    if (!fImageFilterOptions.empty() || !fMaskFilterOptions.empty()) {
         // TODO: split this out into a create_restore_draw_pipelines method
         PaintOptions tmp = *this;
 
         // When image filtering, the original blend mode is taken over by the restore paint
-        tmp.setImageFilterFlags(PrecompileImageFilterFlags::kNone);
         tmp.setImageFilters({});
+        tmp.setMaskFilters({});
         tmp.addBlendMode(SkBlendMode::kSrcOver);
 
         if (!fImageFilterOptions.empty()) {
@@ -575,20 +508,12 @@
 
         create_image_drawing_pipelines(keyContext, gatherer, processCombination, *this);
 
-        if (fImageFilterFlags & PrecompileImageFilterFlags::kBlur) {
-            create_blur_imagefilter_pipelines(keyContext, gatherer, processCombination);
-        }
-        if (fImageFilterFlags & PrecompileImageFilterFlags::kDisplacement) {
-            create_displacement_imagefilter_pipelines(keyContext, gatherer, processCombination);
-        }
-        if (fImageFilterFlags & PrecompileImageFilterFlags::kMatrixConvolution) {
-            create_matrix_convolution_imagefilter_pipelines(keyContext, gatherer,
-                                                            processCombination);
-        }
-
         for (const sk_sp<PrecompileImageFilter>& o : fImageFilterOptions) {
             o->createPipelines(keyContext, gatherer, processCombination);
         }
+        for (const sk_sp<PrecompileMaskFilter>& o : fMaskFilterOptions) {
+            o->createPipelines(keyContext, gatherer, processCombination);
+        }
     } else {
         int numCombinations = this->numCombinations();
         for (int i = 0; i < numCombinations; ++i) {
diff --git a/src/gpu/graphite/Precompile.h b/src/gpu/graphite/Precompile.h
index a3a8b12..c25c4be 100644
--- a/src/gpu/graphite/Precompile.h
+++ b/src/gpu/graphite/Precompile.h
@@ -135,10 +135,7 @@
     sk_sp<PrecompileShader> makeWithWorkingColorSpace(sk_sp<SkColorSpace>);
 };
 
-class PrecompileMaskFilter : public PrecompileBase {
-public:
-    PrecompileMaskFilter() : PrecompileBase(Type::kMaskFilter) {}
-};
+
 
 class PrecompileColorFilter : public PrecompileBase {
 public:
@@ -156,17 +153,10 @@
     static sk_sp<PrecompileBlender> Mode(SkBlendMode);
 };
 
-enum class PrecompileImageFilterFlags : uint32_t {
-    kNone              = 0x0,
-    kBlur              = 0x1,
-    kDisplacement      = 0x2,
-    kMatrixConvolution = 0x4,
-};
-SK_MAKE_BITMASK_OPS(PrecompileImageFilterFlags)
-
 //--------------------------------------------------------------------------------------------------
 class PaintOptionsPriv;
 class PrecompileImageFilter;
+class PrecompileMaskFilter;
 
 class PaintOptions {
 public:
@@ -178,19 +168,8 @@
         fImageFilterOptions.assign(imageFilters.begin(), imageFilters.end());
     }
 
-    void setImageFilterFlags(SkEnumBitMask<PrecompileImageFilterFlags> flags) {
-        fImageFilterFlags = flags;
-    }
-
     void setMaskFilters(SkSpan<const sk_sp<PrecompileMaskFilter>> maskFilters) {
-        for (const sk_sp<PrecompileMaskFilter>& mf : maskFilters) {
-            if (mf) {
-                // Currently Graphite only supports BlurMaskFilters which are implemented
-                // via BlurImageFiltering
-                fImageFilterFlags |= PrecompileImageFilterFlags::kBlur;
-                break;
-            }
-        }
+        fMaskFilterOptions.assign(maskFilters.begin(), maskFilters.end());
     }
 
     void setColorFilters(SkSpan<const sk_sp<PrecompileColorFilter>> colorFilters) {
@@ -273,8 +252,8 @@
     skia_private::TArray<sk_sp<PrecompileBlender>> fBlenderOptions;
     std::vector<sk_sp<PrecompileShader>> fClipShaderOptions;
 
-    SkEnumBitMask<PrecompileImageFilterFlags> fImageFilterFlags = PrecompileImageFilterFlags::kNone;
     std::vector<sk_sp<PrecompileImageFilter>> fImageFilterOptions;
+    std::vector<sk_sp<PrecompileMaskFilter>> fMaskFilterOptions;
 
     bool fDither = false;
 };
@@ -350,6 +329,28 @@
     skia_private::AutoSTArray<2, sk_sp<PrecompileImageFilter>> fInputs;
 };
 
+class PrecompileMaskFilter : public PrecompileBase {
+public:
+    PrecompileMaskFilter() : PrecompileBase(Type::kMaskFilter) {}
+
+private:
+    friend class PaintOptions;  // for createPipelines() access
+
+    // The PrecompileMaskFilter classes do not use the PrecompileBase::addToKey virtual since
+    // they, in general, do not themselves contribute to a given SkPaint/Pipeline but, rather,
+    // create separate SkPaints/Pipelines from whole cloth (in createPipelines).
+    void addToKey(const KeyContext& keyContext,
+                  PaintParamsKeyBuilder* builder,
+                  PipelineDataGatherer* gatherer,
+                  int desiredCombination) const final {
+        SkASSERT(false);
+    }
+
+    virtual void createPipelines(const KeyContext&,
+                                 PipelineDataGatherer*,
+                                 const PaintOptions::ProcessCombination&) const = 0;
+};
+
 } // namespace skgpu::graphite
 
 #endif // skgpu_graphite_Precompile_DEFINED
diff --git a/tests/graphite/PaintParamsKeyTest.cpp b/tests/graphite/PaintParamsKeyTest.cpp
index 57aea77..04853ae 100644
--- a/tests/graphite/PaintParamsKeyTest.cpp
+++ b/tests/graphite/PaintParamsKeyTest.cpp
@@ -81,7 +81,7 @@
 std::pair<sk_sp<SkColorFilter>, sk_sp<PrecompileColorFilter>> create_random_colorfilter(SkRandom*);
 
 [[maybe_unused]] std::pair<sk_sp<SkImageFilter>, sk_sp<PrecompileImageFilter>>
-create_random_image_filter(Recorder*, SkRandom*, SkEnumBitMask<PrecompileImageFilterFlags>*);
+create_random_image_filter(Recorder*, SkRandom*);
 
 //--------------------------------------------------------------------------------------------------
 //--------------------------------------------------------------------------------------------------
@@ -1130,8 +1130,7 @@
 //--------------------------------------------------------------------------------------------------
 //--------------------------------------------------------------------------------------------------
 std::pair<sk_sp<SkImageFilter>, sk_sp<PrecompileImageFilter>> blur_imagefilter(
-        SkRandom* rand,
-        SkEnumBitMask<PrecompileImageFilterFlags>* imageFilterMask) {
+        SkRandom* rand) {
 
     int option = rand->nextULessThan(3);
 
@@ -1144,15 +1143,14 @@
     }
 
     sk_sp<SkImageFilter> blurIF = SkImageFilters::Blur(sigma, sigma, /* input= */ nullptr);
-    *imageFilterMask |= PrecompileImageFilterFlags::kBlur;
+    sk_sp<PrecompileImageFilter> blurO = PrecompileImageFilters::Blur(/* input= */ nullptr);
 
-    return { std::move(blurIF), nullptr };
+    return { std::move(blurIF), std::move(blurO) };
 }
 
 std::pair<sk_sp<SkImageFilter>, sk_sp<PrecompileImageFilter>> displacement_imagefilter(
         Recorder* recorder,
-        SkRandom* rand,
-        SkEnumBitMask<PrecompileImageFilterFlags>* imageFilterMask) {
+        SkRandom* rand) {
 
     sk_sp<SkImage> checkerboard = ToolUtils::create_checkerboard_image(16, 16,
                                                                        SK_ColorWHITE,
@@ -1171,9 +1169,10 @@
                                                      /* scale= */ 2.0f,
                                                      /* displacement= */ std::move(imageIF),
                                                      /* color= */ nullptr);
-    *imageFilterMask |= PrecompileImageFilterFlags::kDisplacement;
+    sk_sp<PrecompileImageFilter> option =
+            PrecompileImageFilters::DisplacementMap(/* input= */ nullptr);
 
-    return { std::move(displacementIF), nullptr };
+    return { std::move(displacementIF), std::move(option) };
 }
 
 std::pair<sk_sp<SkImageFilter>, sk_sp<PrecompileImageFilter>> colorfilter_imagefilter(
@@ -1250,8 +1249,7 @@
 }
 
 std::pair<sk_sp<SkImageFilter>, sk_sp<PrecompileImageFilter>>  matrix_convolution_imagefilter(
-        SkRandom* rand,
-        SkEnumBitMask<PrecompileImageFilterFlags>* imageFilterMask) {
+        SkRandom* rand) {
 
     int kernelSize = 1;
 
@@ -1276,9 +1274,10 @@
                                                      /* convolveAlpha= */ false,
                                                      /* input= */ nullptr);
     SkASSERT(matrixConvIF);
-    *imageFilterMask |= PrecompileImageFilterFlags::kMatrixConvolution;
+    sk_sp<PrecompileImageFilter> convOption = PrecompileImageFilters::MatrixConvolution(
+            /* input= */ nullptr);
 
-    return { std::move(matrixConvIF), nullptr };
+    return { std::move(matrixConvIF), std::move(convOption) };
 }
 
 std::pair<sk_sp<SkImageFilter>, sk_sp<PrecompileImageFilter>> morphology_imagefilter(
@@ -1301,22 +1300,21 @@
 std::pair<sk_sp<SkImageFilter>, sk_sp<PrecompileImageFilter>> create_image_filter(
         Recorder* recorder,
         SkRandom* rand,
-        ImageFilterType type,
-        SkEnumBitMask<PrecompileImageFilterFlags>* imageFilterMask) {
+        ImageFilterType type) {
 
     switch (type) {
         case ImageFilterType::kNone:
             return {};
         case ImageFilterType::kBlur:
-            return blur_imagefilter(rand, imageFilterMask);
+            return blur_imagefilter(rand);
         case ImageFilterType::kColorFilter:
             return colorfilter_imagefilter(rand);
         case ImageFilterType::kDisplacement:
-            return displacement_imagefilter(recorder, rand, imageFilterMask);
+            return displacement_imagefilter(recorder, rand);
         case ImageFilterType::kLighting:
             return lighting_imagefilter(rand);
         case ImageFilterType::kMatrixConvolution:
-            return matrix_convolution_imagefilter(rand, imageFilterMask);
+            return matrix_convolution_imagefilter(rand);
         case ImageFilterType::kMorphology:
             return morphology_imagefilter(rand);
     }
@@ -1326,9 +1324,8 @@
 
 std::pair<sk_sp<SkImageFilter>, sk_sp<PrecompileImageFilter>> create_random_image_filter(
         Recorder* recorder,
-        SkRandom* rand,
-        SkEnumBitMask<PrecompileImageFilterFlags>* imageFilterMask) {
-    return create_image_filter(recorder, rand, random_imagefiltertype(rand), imageFilterMask);
+        SkRandom* rand) {
+    return create_image_filter(recorder, rand, random_imagefiltertype(rand));
 }
 
 std::pair<sk_sp<SkMaskFilter>, sk_sp<PrecompileMaskFilter>> create_blur_maskfilter(SkRandom* rand) {
@@ -1418,17 +1415,11 @@
     }
 
     {
-        // For now we have a belt and suspenders system where we both collect flags and
-        // get PrecompileImageFilter objects. The flag collection system will be removed in
-        // follow-on CLs.
-        SkEnumBitMask<PrecompileImageFilterFlags> flags = PrecompileImageFilterFlags::kNone;
-
-        auto [filter, o] = create_image_filter(recorder, rand, imageFilterType, &flags);
+        auto [filter, o] = create_image_filter(recorder, rand, imageFilterType);
         SkASSERT(!filter == !o);
 
         if (filter) {
             paint.setImageFilter(std::move(filter));
-            paintOptions.setImageFilterFlags(flags);
             paintOptions.setImageFilters({o});
         }
     }