Consistency among GrFP::ProgramImpl subclasses

Remove GL or GLSL from names of subclasses. Make nearly all subclasses
nested either in FP class or its onMakeProgramImpl() function.

Make onSetData private rather than protected.

Remove unused INHERITED typedefs.

Embrace idea that Impl is part of FP private implementation:
direct member access rather than getters and no GenKey pattern.

Other random consistency updates, modernatizations, stylistic changes.

Bug: skia:11358
Change-Id: I0d94e00a146abdd38e094ca550fc3b9608bd433d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438056
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrColorSpaceXform.cpp b/src/gpu/GrColorSpaceXform.cpp
index 21af870..e1af8fa 100644
--- a/src/gpu/GrColorSpaceXform.cpp
+++ b/src/gpu/GrColorSpaceXform.cpp
@@ -63,36 +63,6 @@
 
 //////////////////////////////////////////////////////////////////////////////
 
-class GrGLColorSpaceXformEffect : public GrFragmentProcessor::ProgramImpl {
-public:
-    void emitCode(EmitArgs& args) override {
-        const GrColorSpaceXformEffect& proc = args.fFp.cast<GrColorSpaceXformEffect>();
-        GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
-        GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
-
-        fColorSpaceHelper.emitCode(uniformHandler, proc.colorXform());
-
-        SkString childColor = this->invokeChild(0, args);
-
-        SkString xformedColor;
-        fragBuilder->appendColorGamutXform(&xformedColor, childColor.c_str(), &fColorSpaceHelper);
-        fragBuilder->codeAppendf("return %s;", xformedColor.c_str());
-    }
-
-private:
-    void onSetData(const GrGLSLProgramDataManager& pdman,
-                   const GrFragmentProcessor& fp) override {
-        const GrColorSpaceXformEffect& proc = fp.cast<GrColorSpaceXformEffect>();
-        fColorSpaceHelper.setData(pdman, proc.colorXform());
-    }
-
-    GrGLSLColorSpaceXformHelper fColorSpaceHelper;
-
-    using INHERITED = ProgramImpl;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
 GrColorSpaceXformEffect::GrColorSpaceXformEffect(std::unique_ptr<GrFragmentProcessor> child,
                                                  sk_sp<GrColorSpaceXform> colorXform)
         : INHERITED(kGrColorSpaceXformEffect_ClassID, OptFlags(child.get()))
@@ -119,7 +89,34 @@
 
 std::unique_ptr<GrFragmentProcessor::ProgramImpl>
 GrColorSpaceXformEffect::onMakeProgramImpl() const {
-    return std::make_unique<GrGLColorSpaceXformEffect>();
+    class Impl : public ProgramImpl {
+    public:
+        void emitCode(EmitArgs& args) override {
+            const GrColorSpaceXformEffect& proc = args.fFp.cast<GrColorSpaceXformEffect>();
+            GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
+            GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
+
+            fColorSpaceHelper.emitCode(uniformHandler, proc.colorXform());
+
+            SkString childColor = this->invokeChild(0, args);
+
+            SkString xformedColor;
+            fragBuilder->appendColorGamutXform(
+                    &xformedColor, childColor.c_str(), &fColorSpaceHelper);
+            fragBuilder->codeAppendf("return %s;", xformedColor.c_str());
+        }
+
+    private:
+        void onSetData(const GrGLSLProgramDataManager& pdman,
+                       const GrFragmentProcessor& fp) override {
+            const GrColorSpaceXformEffect& proc = fp.cast<GrColorSpaceXformEffect>();
+            fColorSpaceHelper.setData(pdman, proc.colorXform());
+        }
+
+        GrGLSLColorSpaceXformHelper fColorSpaceHelper;
+    };
+
+    return std::make_unique<Impl>();
 }
 
 GrFragmentProcessor::OptimizationFlags GrColorSpaceXformEffect::OptFlags(
diff --git a/src/gpu/GrFragmentProcessor.cpp b/src/gpu/GrFragmentProcessor.cpp
index bdec6d0..edc5850 100644
--- a/src/gpu/GrFragmentProcessor.cpp
+++ b/src/gpu/GrFragmentProcessor.cpp
@@ -272,7 +272,6 @@
         }
 
         const char* name() const override { return "Swizzle"; }
-        const GrSwizzle& swizzle() const { return fSwizzle; }
 
         std::unique_ptr<GrFragmentProcessor> clone() const override {
             return Make(this->childProcessor(0)->clone(), fSwizzle);
@@ -286,20 +285,20 @@
         }
 
         std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
-            class GLFP : public ProgramImpl {
+            class Impl : public ProgramImpl {
             public:
                 void emitCode(EmitArgs& args) override {
                     SkString childColor = this->invokeChild(0, args);
 
                     const SwizzleFragmentProcessor& sfp = args.fFp.cast<SwizzleFragmentProcessor>();
-                    const GrSwizzle& swizzle = sfp.swizzle();
+                    const GrSwizzle& swizzle = sfp.fSwizzle;
                     GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
 
                     fragBuilder->codeAppendf("return %s.%s;",
                                              childColor.c_str(), swizzle.asString().c_str());
                 }
             };
-            return std::make_unique<GLFP>();
+            return std::make_unique<Impl>();
         }
 
         void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const override {
@@ -352,7 +351,7 @@
         }
 
         std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
-            class GLFP : public ProgramImpl {
+            class Impl : public ProgramImpl {
             public:
                 void emitCode(EmitArgs& args) override {
                     GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
@@ -362,7 +361,7 @@
                     fragBuilder->codeAppendf("return color * %s.a;", args.fInputColor);
                 }
             };
-            return std::make_unique<GLFP>();
+            return std::make_unique<Impl>();
         }
 
         void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
@@ -471,7 +470,7 @@
 
     private:
         std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
-            class GLFP : public ProgramImpl {
+            class Impl : public ProgramImpl {
             public:
                 void emitCode(EmitArgs& args) override {
                     SkString result = this->invokeChild(1, args);         // g(x)
@@ -479,7 +478,7 @@
                     args.fFragBuilder->codeAppendf("return %s;", result.c_str());
                 }
             };
-            return std::make_unique<GLFP>();
+            return std::make_unique<Impl>();
         }
 
         ComposeProcessor(std::unique_ptr<GrFragmentProcessor> f,
@@ -601,14 +600,14 @@
 
     private:
         std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
-            class GLFP : public ProgramImpl {
+            class Impl : public ProgramImpl {
             public:
                 void emitCode(EmitArgs& args) override {
                     const char* dstColor = args.fFragBuilder->dstColor();
                     args.fFragBuilder->codeAppendf("return %s;", dstColor);
                 }
             };
-            return std::make_unique<GLFP>();
+            return std::make_unique<Impl>();
         }
 
         SurfaceColorProcessor()
@@ -902,7 +901,7 @@
         }
 
         std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override {
-            class GLFP : public ProgramImpl {
+            class Impl : public ProgramImpl {
             public:
                 void emitCode(EmitArgs& args) override {
                     SkString childColor = this->invokeChild(0, args);
@@ -911,7 +910,7 @@
                     args.fFragBuilder->codeAppendf("return %s;", childColor.c_str());
                 }
             };
-            return std::make_unique<GLFP>();
+            return std::make_unique<Impl>();
         }
 
         void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp
index 5585ea0..609ca73 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -16,18 +16,15 @@
 #include "src/gpu/glsl/GrGLSLUniformHandler.h"
 #include <cmath>
 
-class GrBicubicEffect::Impl : public GrFragmentProcessor::ProgramImpl {
+class GrBicubicEffect::Impl : public ProgramImpl {
 public:
-    Impl() : fKernel{-1, -1} {}
     void emitCode(EmitArgs&) override;
 
-protected:
+private:
     void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
 
-private:
-    SkImage::CubicResampler fKernel;
+    SkImage::CubicResampler fKernel = {-1, -1};
     UniformHandle fCoefficientUni;
-    using INHERITED = ProgramImpl;
 };
 
 void GrBicubicEffect::Impl::emitCode(EmitArgs& args) {
diff --git a/src/gpu/effects/GrBlendFragmentProcessor.cpp b/src/gpu/effects/GrBlendFragmentProcessor.cpp
index 8604bba..833ade4 100644
--- a/src/gpu/effects/GrBlendFragmentProcessor.cpp
+++ b/src/gpu/effects/GrBlendFragmentProcessor.cpp
@@ -38,8 +38,6 @@
 
     std::unique_ptr<GrFragmentProcessor> clone() const override;
 
-    SkBlendMode getMode() const { return fMode; }
-
 private:
     BlendFragmentProcessor(std::unique_ptr<GrFragmentProcessor> src,
                            std::unique_ptr<GrFragmentProcessor> dst,
@@ -171,15 +169,6 @@
 
 /////////////////////////////////////////////////////////////////////
 
-class GLBlendFragmentProcessor : public GrFragmentProcessor::ProgramImpl {
-public:
-    void emitCode(EmitArgs&) override;
-
-private:
-    using INHERITED = ProgramImpl;
-};
-
-/////////////////////////////////////////////////////////////////////
 
 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(BlendFragmentProcessor);
 
@@ -206,25 +195,28 @@
 }
 
 std::unique_ptr<GrFragmentProcessor::ProgramImpl> BlendFragmentProcessor::onMakeProgramImpl() const {
-    return std::make_unique<GLBlendFragmentProcessor>();
-}
+    class Impl : public ProgramImpl {
+    public:
+        void emitCode(EmitArgs& args) override {
+            GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
+            const BlendFragmentProcessor& bfp = args.fFp.cast<BlendFragmentProcessor>();
+            SkBlendMode mode = bfp.fMode;
 
-/////////////////////////////////////////////////////////////////////
+            fragBuilder->codeAppendf("// Blend mode: %s\n", SkBlendMode_Name(mode));
 
-void GLBlendFragmentProcessor::emitCode(EmitArgs& args) {
-    GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
-    const BlendFragmentProcessor& cs = args.fFp.cast<BlendFragmentProcessor>();
-    SkBlendMode mode = cs.getMode();
+            // Invoke src/dst with our input color (or substitute input color if no child FP)
+            SkString srcColor = this->invokeChild(0, args);
+            SkString dstColor = this->invokeChild(1, args);
 
-    fragBuilder->codeAppendf("// Blend mode: %s\n", SkBlendMode_Name(mode));
+            // Blend src and dst colors together.
+            fragBuilder->codeAppendf("return %s(%s, %s);",
+                                     GrGLSLBlend::BlendFuncName(mode),
+                                     srcColor.c_str(),
+                                     dstColor.c_str());
+        }
+    };
 
-    // Invoke src/dst with our input color (or substitute input color if no child FP)
-    SkString srcColor = this->invokeChild(0, args);
-    SkString dstColor = this->invokeChild(1, args);
-
-    // Blend src and dst colors together.
-    fragBuilder->codeAppendf("return %s(%s, %s);", GrGLSLBlend::BlendFuncName(mode),
-                             srcColor.c_str(), dstColor.c_str());
+    return std::make_unique<Impl>();
 }
 
 //////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index 1b4acae..9e1a44f 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -15,77 +15,6 @@
 
 //////////////////////////////////////////////////////////////////////////////
 
-class GrGLConvexPolyEffect : public GrFragmentProcessor::ProgramImpl {
-public:
-    GrGLConvexPolyEffect() {
-        for (size_t i = 0; i < SK_ARRAY_COUNT(fPrevEdges); ++i) {
-            fPrevEdges[i] = SK_ScalarNaN;
-        }
-    }
-
-    void emitCode(EmitArgs&) override;
-
-    static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*);
-
-protected:
-    void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
-
-private:
-    GrGLSLProgramDataManager::UniformHandle fEdgeUniform;
-    SkScalar                                fPrevEdges[3 * GrConvexPolyEffect::kMaxEdges];
-    using INHERITED = ProgramImpl;
-};
-
-void GrGLConvexPolyEffect::emitCode(EmitArgs& args) {
-    const GrConvexPolyEffect& cpe = args.fFp.cast<GrConvexPolyEffect>();
-
-    using namespace SkSL::dsl;
-    StartFragmentProcessor(this, &args);
-    GlobalVar edgeArray(kUniform_Modifier, Array(kHalf3_Type, cpe.getEdgeCount()), "edgeArray");
-    Declare(edgeArray);
-    fEdgeUniform = VarUniformHandle(edgeArray);
-    Var alpha(kHalf_Type, "alpha", 1);
-    Declare(alpha);
-    Var edge(kHalf_Type, "edge");
-    Declare(edge);
-    for (int i = 0; i < cpe.getEdgeCount(); ++i) {
-        edge = Dot(edgeArray[i], Half3(Swizzle(sk_FragCoord(), X, Y, ONE)));
-        if (GrClipEdgeTypeIsAA(cpe.getEdgeType())) {
-            edge = Saturate(edge);
-        } else {
-            edge = Select(edge >= 0.5, 1.0, 0.0);
-        }
-        alpha *= edge;
-    }
-
-    if (GrClipEdgeTypeIsInverseFill(cpe.getEdgeType())) {
-        alpha = 1.0 - alpha;
-    }
-
-    Return(SampleChild(0) * alpha);
-    EndFragmentProcessor();
-}
-
-void GrGLConvexPolyEffect::onSetData(const GrGLSLProgramDataManager& pdman,
-                                     const GrFragmentProcessor& effect) {
-    const GrConvexPolyEffect& cpe = effect.cast<GrConvexPolyEffect>();
-    size_t byteSize = 3 * cpe.getEdgeCount() * sizeof(SkScalar);
-    if (0 != memcmp(fPrevEdges, cpe.getEdges(), byteSize)) {
-        pdman.set3fv(fEdgeUniform, cpe.getEdgeCount(), cpe.getEdges());
-        memcpy(fPrevEdges, cpe.getEdges(), byteSize);
-    }
-}
-
-void GrGLConvexPolyEffect::GenKey(const GrProcessor& processor, const GrShaderCaps&,
-                                  GrProcessorKeyBuilder* b) {
-    const GrConvexPolyEffect& cpe = processor.cast<GrConvexPolyEffect>();
-    static_assert(kGrClipEdgeTypeCnt <= 8);
-    uint32_t key = (cpe.getEdgeCount() << 3) | (int) cpe.getEdgeType();
-    b->add32(key);
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
 GrFPResult GrConvexPolyEffect::Make(std::unique_ptr<GrFragmentProcessor> inputFP,
                                     GrClipEdgeType type, const SkPath& path) {
     if (path.getSegmentMasks() != SkPath::kLine_SegmentMask || !path.isConvex()) {
@@ -158,17 +87,66 @@
 GrConvexPolyEffect::~GrConvexPolyEffect() {}
 
 void GrConvexPolyEffect::onAddToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
-    GrGLConvexPolyEffect::GenKey(*this, caps, b);
+    static_assert(kGrClipEdgeTypeCnt <= 8);
+    uint32_t key = (fEdgeCount << 3) | static_cast<int>(fEdgeType);
+    b->add32(key);
 }
 
 std::unique_ptr<GrFragmentProcessor::ProgramImpl> GrConvexPolyEffect::onMakeProgramImpl() const {
-    return std::make_unique<GrGLConvexPolyEffect>();
+    class Impl : public ProgramImpl {
+    public:
+        void emitCode(EmitArgs& args) override {
+            const GrConvexPolyEffect& cpe = args.fFp.cast<GrConvexPolyEffect>();
+
+            using namespace SkSL::dsl;
+            StartFragmentProcessor(this, &args);
+            GlobalVar edgeArray(kUniform_Modifier, Array(kHalf3_Type, cpe.fEdgeCount), "edgeArray");
+            Declare(edgeArray);
+            fEdgeUniform = VarUniformHandle(edgeArray);
+            Var alpha(kHalf_Type, "alpha", 1);
+            Declare(alpha);
+            Var edge(kHalf_Type, "edge");
+            Declare(edge);
+            for (int i = 0; i < cpe.fEdgeCount; ++i) {
+                edge = Dot(edgeArray[i], Half3(Swizzle(sk_FragCoord(), X, Y, ONE)));
+                if (GrClipEdgeTypeIsAA(cpe.fEdgeType)) {
+                    edge = Saturate(edge);
+                } else {
+                    edge = Select(edge >= 0.5, 1.0, 0.0);
+                }
+                alpha *= edge;
+            }
+
+            if (GrClipEdgeTypeIsInverseFill(cpe.fEdgeType)) {
+                alpha = 1.0 - alpha;
+            }
+
+            Return(SampleChild(0) * alpha);
+            EndFragmentProcessor();
+        }
+
+    private:
+        void onSetData(const GrGLSLProgramDataManager& pdman,
+                       const GrFragmentProcessor& fp) override {
+            const GrConvexPolyEffect& cpe = fp.cast<GrConvexPolyEffect>();
+            size_t n = 3*cpe.fEdgeCount;
+            if (!std::equal(fPrevEdges.begin(), fPrevEdges.begin() + n, cpe.fEdges.begin())) {
+                pdman.set3fv(fEdgeUniform, cpe.fEdgeCount, cpe.fEdges.data());
+                std::copy_n(cpe.fEdges.begin(), n, fPrevEdges.begin());
+            }
+        }
+
+        GrGLSLProgramDataManager::UniformHandle              fEdgeUniform;
+        std::array<float, 3 * GrConvexPolyEffect::kMaxEdges> fPrevEdges = {SK_FloatNaN};
+    };
+
+    return std::make_unique<Impl>();
 }
 
 GrConvexPolyEffect::GrConvexPolyEffect(std::unique_ptr<GrFragmentProcessor> inputFP,
                                        GrClipEdgeType edgeType,
                                        int n,
-                                       const SkScalar edges[])
+                                       const float edges[])
         : INHERITED(kGrConvexPolyEffect_ClassID,
                     ProcessorOptimizationFlags(inputFP.get()) &
                             kCompatibleWithCoverageAsAlpha_OptimizationFlag)
@@ -176,7 +154,7 @@
         , fEdgeCount(n) {
     // Factory function should have already ensured this.
     SkASSERT(n <= kMaxEdges);
-    memcpy(fEdges, edges, 3 * n * sizeof(SkScalar));
+    std::copy_n(edges, 3*n, fEdges.begin());
     // Outset the edges by 0.5 so that a pixel with center on an edge is 50% covered in the AA case
     // and 100% covered in the non-AA case.
     for (int i = 0; i < n; ++i) {
@@ -190,7 +168,7 @@
         : INHERITED(that)
         , fEdgeType(that.fEdgeType)
         , fEdgeCount(that.fEdgeCount) {
-    memcpy(fEdges, that.fEdges, 3 * that.fEdgeCount * sizeof(SkScalar));
+    std::copy_n(that.fEdges.begin(), 3*that.fEdgeCount, fEdges.begin());
 }
 
 std::unique_ptr<GrFragmentProcessor> GrConvexPolyEffect::clone() const {
@@ -199,9 +177,10 @@
 
 bool GrConvexPolyEffect::onIsEqual(const GrFragmentProcessor& other) const {
     const GrConvexPolyEffect& cpe = other.cast<GrConvexPolyEffect>();
-    // ignore the fact that 0 == -0 and just use memcmp.
-    return (cpe.fEdgeType == fEdgeType && cpe.fEdgeCount == fEdgeCount &&
-            0 == memcmp(cpe.fEdges, fEdges, 3 * fEdgeCount * sizeof(SkScalar)));
+    int n = 3*cpe.fEdgeCount;
+    return cpe.fEdgeType == fEdgeType   &&
+           cpe.fEdgeCount == fEdgeCount &&
+           std::equal(cpe.fEdges.begin(), cpe.fEdges.begin() + n, fEdges.begin());
 }
 
 //////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/effects/GrConvexPolyEffect.h b/src/gpu/effects/GrConvexPolyEffect.h
index bdc7a4f..e2bcc94 100644
--- a/src/gpu/effects/GrConvexPolyEffect.h
+++ b/src/gpu/effects/GrConvexPolyEffect.h
@@ -37,7 +37,9 @@
      * to the view matrix or untransformed positions in the fragment shader).
      */
     static GrFPResult Make(std::unique_ptr<GrFragmentProcessor> inputFP,
-                           GrClipEdgeType edgeType, int n, const SkScalar edges[]) {
+                           GrClipEdgeType edgeType,
+                           int n,
+                           const float edges[]) {
         if (n <= 0 || n > kMaxEdges) {
             return GrFPFailure(std::move(inputFP));
         }
@@ -57,12 +59,6 @@
     const char* name() const override { return "ConvexPoly"; }
     std::unique_ptr<GrFragmentProcessor> clone() const override;
 
-    GrClipEdgeType getEdgeType() const { return fEdgeType; }
-
-    int getEdgeCount() const { return fEdgeCount; }
-
-    const SkScalar* getEdges() const { return fEdges; }
-
 private:
     GrConvexPolyEffect(std::unique_ptr<GrFragmentProcessor> inputFP,
                        GrClipEdgeType edgeType,
@@ -75,9 +71,9 @@
 
     bool onIsEqual(const GrFragmentProcessor& other) const override;
 
-    GrClipEdgeType fEdgeType;
-    int            fEdgeCount;
-    SkScalar       fEdges[3 * kMaxEdges];
+    GrClipEdgeType                 fEdgeType;
+    int                            fEdgeCount;
+    std::array<float, 3*kMaxEdges> fEdges;
 
     GR_DECLARE_FRAGMENT_PROCESSOR_TEST
 
diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
index d03e9ef..755b372 100644
--- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
+++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
@@ -21,22 +21,17 @@
 using UniformHandle = GrGLSLProgramDataManager::UniformHandle;
 using Direction = GrGaussianConvolutionFragmentProcessor::Direction;
 
-class GrGaussianConvolutionFragmentProcessor::Impl : public GrFragmentProcessor::ProgramImpl {
+class GrGaussianConvolutionFragmentProcessor::Impl : public ProgramImpl {
 public:
     void emitCode(EmitArgs&) override;
 
-    static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*);
-
-protected:
+private:
     void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
 
-private:
     UniformHandle fKernelUni;
     UniformHandle fOffsetsUni;
     UniformHandle fKernelWidthUni;
     UniformHandle fIncrementUni;
-
-    using INHERITED = ProgramImpl;
 };
 
 enum class LoopType {
@@ -143,15 +138,6 @@
     }
 }
 
-void GrGaussianConvolutionFragmentProcessor::Impl::GenKey(const GrProcessor& processor,
-                                                          const GrShaderCaps& shaderCaps,
-                                                          GrProcessorKeyBuilder* b) {
-    const auto& conv = processor.cast<GrGaussianConvolutionFragmentProcessor>();
-    if (loop_type(shaderCaps) != LoopType::kVariableLength) {
-        b->add32(conv.fRadius);
-    }
-}
-
 ///////////////////////////////////////////////////////////////////////////////
 
 std::unique_ptr<GrFragmentProcessor> GrGaussianConvolutionFragmentProcessor::Make(
@@ -234,9 +220,11 @@
     memcpy(fOffsets, that.fOffsets, SkGpuBlurUtils::LinearKernelWidth(fRadius) * sizeof(float));
 }
 
-void GrGaussianConvolutionFragmentProcessor::onAddToKey(const GrShaderCaps& caps,
+void GrGaussianConvolutionFragmentProcessor::onAddToKey(const GrShaderCaps& shaderCaps,
                                                         GrProcessorKeyBuilder* b) const {
-    Impl::GenKey(*this, caps, b);
+    if (loop_type(shaderCaps) != LoopType::kVariableLength) {
+        b->add32(fRadius);
+    }
 }
 
 std::unique_ptr<GrFragmentProcessor::ProgramImpl>
diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h
index 5eff228..8bb67b2 100644
--- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h
+++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h
@@ -52,6 +52,8 @@
     static constexpr int kMaxKernelRadius = 12;
 
 private:
+    class Impl;
+
     GrGaussianConvolutionFragmentProcessor(std::unique_ptr<GrFragmentProcessor>,
                                            Direction,
                                            int halfWidth,
@@ -83,8 +85,6 @@
     int                   fRadius;
     Direction             fDirection;
 
-    class Impl;
-
     using INHERITED = GrFragmentProcessor;
 };
 
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index 82239c3..ae16a49 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -20,16 +20,13 @@
 #include "src/gpu/glsl/GrGLSLProgramDataManager.h"
 #include "src/gpu/glsl/GrGLSLUniformHandler.h"
 
-class GrGLMatrixConvolutionEffect : public GrFragmentProcessor::ProgramImpl {
+class GrMatrixConvolutionEffect::Impl : public ProgramImpl {
 public:
     void emitCode(EmitArgs&) override;
 
-    static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*);
-
-protected:
+private:
     void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
 
-private:
     typedef GrGLSLProgramDataManager::UniformHandle UniformHandle;
 
     void emitKernelBlock(EmitArgs&, SkIPoint);
@@ -160,15 +157,15 @@
 // For sampled kernels, emit a for loop that does all the kernel accumulation.
 // For uniform kernels, emit a single iteration. Function is called repeatedly in a for loop.
 // loc is ignored for sampled kernels.
-void GrGLMatrixConvolutionEffect::emitKernelBlock(EmitArgs& args, SkIPoint loc) {
+void GrMatrixConvolutionEffect::Impl::emitKernelBlock(EmitArgs& args, SkIPoint loc) {
     const GrMatrixConvolutionEffect& mce = args.fFp.cast<GrMatrixConvolutionEffect>();
     GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
     GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
-    int kernelWidth = mce.kernelSize().width();
-    int kernelHeight = mce.kernelSize().height();
+    int kernelWidth = mce.fKernel.size().width();
+    int kernelHeight = mce.fKernel.size().height();
     int kernelArea = kernelWidth * kernelHeight;
 
-    if (mce.kernelIsSampled()) {
+    if (mce.fKernel.isSampled()) {
         fragBuilder->codeAppendf("for (int i = 0; i < %d; ++i)", (int)kernelArea);
     }
 
@@ -176,7 +173,7 @@
 
     fragBuilder->codeAppend("half k;");
     fragBuilder->codeAppend("half2 sourceOffset;");
-    if (mce.kernelIsSampled()) {
+    if (mce.fKernel.isSampled()) {
         const char* kernelBias = uniformHandler->getUniformCStr(fKernelBiasUni);
         SkString kernelSample = this->invokeChild(1, args, "float2(float(i) + 0.5, 0.5)");
         fragBuilder->codeAppendf("k = %s.w + %s;", kernelSample.c_str(), kernelBias);
@@ -191,24 +188,24 @@
 
     auto sample = this->invokeChild(0, args, "coord + sourceOffset");
     fragBuilder->codeAppendf("half4 c = %s;", sample.c_str());
-    if (!mce.convolveAlpha()) {
+    if (!mce.fConvolveAlpha) {
         fragBuilder->codeAppend("c = unpremul(c);");
         fragBuilder->codeAppend("c.rgb = saturate(c.rgb);");
     }
     fragBuilder->codeAppend("sum += c * k;");
 }
 
-void GrGLMatrixConvolutionEffect::emitCode(EmitArgs& args) {
+void GrMatrixConvolutionEffect::Impl::emitCode(EmitArgs& args) {
     const GrMatrixConvolutionEffect& mce = args.fFp.cast<GrMatrixConvolutionEffect>();
 
-    int kernelWidth = mce.kernelSize().width();
-    int kernelHeight = mce.kernelSize().height();
+    int kernelWidth = mce.fKernel.size().width();
+    int kernelHeight = mce.fKernel.size().height();
 
     int arrayCount = (kernelWidth * kernelHeight + 3) / 4;
     SkASSERT(4 * arrayCount >= kernelWidth * kernelHeight);
 
     GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
-    if (mce.kernelIsSampled()) {
+    if (mce.fKernel.isSampled()) {
         fKernelBiasUni = uniformHandler->addUniform(&mce, kFragment_GrShaderFlag,
                                                     kHalf_GrSLType, "KernelBias");
     } else {
@@ -228,7 +225,7 @@
     fragBuilder->codeAppend("half4 sum = half4(0);");
     fragBuilder->codeAppendf("float2 coord = %s - %s;", args.fSampleCoord, kernelOffset);
 
-    if (mce.kernelIsSampled()) {
+    if (mce.fKernel.isSampled()) {
         this->emitKernelBlock(args, {});
     } else {
         for (int x = 0; x < kernelWidth; ++x) {
@@ -239,7 +236,7 @@
     }
 
     fragBuilder->codeAppendf("half4 color;");
-    if (mce.convolveAlpha()) {
+    if (mce.fConvolveAlpha) {
         fragBuilder->codeAppendf("color = sum * %s + %s;", gain, bias);
         fragBuilder->codeAppendf("color.a = saturate(color.a);");
         fragBuilder->codeAppendf("color.rgb = clamp(color.rgb, 0.0, color.a);");
@@ -253,30 +250,21 @@
     fragBuilder->codeAppendf("return color;");
 }
 
-void GrGLMatrixConvolutionEffect::GenKey(const GrProcessor& processor,
-                                         const GrShaderCaps&, GrProcessorKeyBuilder* b) {
-    const GrMatrixConvolutionEffect& m = processor.cast<GrMatrixConvolutionEffect>();
-    SkASSERT(m.kernelSize().width() <= 0x7FFF && m.kernelSize().height() <= 0xFFFF);
-    uint32_t key = m.kernelSize().width() << 16 | m.kernelSize().height();
-    key |= m.convolveAlpha() ? 1U << 31 : 0;
-    b->add32(key);
-}
-
-void GrGLMatrixConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
-                                            const GrFragmentProcessor& processor) {
+void GrMatrixConvolutionEffect::Impl::onSetData(const GrGLSLProgramDataManager& pdman,
+                                                const GrFragmentProcessor& processor) {
     const GrMatrixConvolutionEffect& conv = processor.cast<GrMatrixConvolutionEffect>();
-    pdman.set2f(fKernelOffsetUni, conv.kernelOffset().fX, conv.kernelOffset().fY);
-    float totalGain = conv.gain();
-    if (conv.kernelIsSampled()) {
-        totalGain *= conv.kernelSampleGain();
-        pdman.set1f(fKernelBiasUni, conv.kernelSampleBias());
+    pdman.set2f(fKernelOffsetUni, conv.fKernelOffset.fX, conv.fKernelOffset.fY);
+    float totalGain = conv.fGain;
+    if (conv.fKernel.isSampled()) {
+        totalGain *= conv.fKernel.biasAndGain().fGain;
+        pdman.set1f(fKernelBiasUni, conv.fKernel.biasAndGain().fBias);
     } else {
-        int kernelCount = conv.kernelSize().area();
+        int kernelCount = conv.fKernel.size().area();
         int arrayCount = (kernelCount + 3) / 4;
         SkASSERT(4 * arrayCount >= kernelCount);
-        pdman.set4fv(fKernelUni, arrayCount, conv.kernel());
+        pdman.set4fv(fKernelUni, arrayCount, conv.fKernel.array().data());
     }
-    pdman.set1f(fBiasUni, conv.bias());
+    pdman.set1f(fBiasUni, conv.fBias);
     pdman.set1f(fGainUni, totalGain);
 }
 
@@ -315,21 +303,24 @@
 
 void GrMatrixConvolutionEffect::onAddToKey(const GrShaderCaps& caps,
                                            GrProcessorKeyBuilder* b) const {
-    GrGLMatrixConvolutionEffect::GenKey(*this, caps, b);
+    SkASSERT(this->fKernel.size().width() <= 0x7FFF && this->fKernel.size().height() <= 0xFFFF);
+    uint32_t key = this->fKernel.size().width() << 16 | this->fKernel.size().height();
+    key |= fConvolveAlpha ? 1U << 31 : 0;
+    b->add32(key);
 }
 
 std::unique_ptr<GrFragmentProcessor::ProgramImpl>
 GrMatrixConvolutionEffect::onMakeProgramImpl() const {
-    return std::make_unique<GrGLMatrixConvolutionEffect>();
+    return std::make_unique<Impl>();
 }
 
 bool GrMatrixConvolutionEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
     const GrMatrixConvolutionEffect& s = sBase.cast<GrMatrixConvolutionEffect>();
-    return fKernel == s.fKernel &&
-           fGain == s.gain() &&
-           fBias == s.bias() &&
-           fKernelOffset == s.kernelOffset() &&
-           fConvolveAlpha == s.convolveAlpha();
+    return fKernel == s.fKernel             &&
+           fGain == s.fGain                 &&
+           fBias == s.fBias                 &&
+           fKernelOffset == s.fKernelOffset &&
+           fConvolveAlpha == s.fConvolveAlpha;
 }
 
 std::unique_ptr<GrFragmentProcessor> GrMatrixConvolutionEffect::Make(GrRecordingContext* context,
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.h b/src/gpu/effects/GrMatrixConvolutionEffect.h
index 2e29c2e..eb09746 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.h
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.h
@@ -31,22 +31,13 @@
                                                      bool convolveAlpha,
                                                      const GrCaps&);
 
-    const SkIRect& bounds() const { return fBounds; }
-    SkISize kernelSize() const { return fKernel.size(); }
-    SkVector kernelOffset() const { return fKernelOffset; }
-    bool kernelIsSampled() const { return fKernel.isSampled(); }
-    const float *kernel() const { return fKernel.array().data(); }
-    float kernelSampleGain() const { return fKernel.biasAndGain().fGain; }
-    float kernelSampleBias() const { return fKernel.biasAndGain().fBias; }
-    float gain() const { return fGain; }
-    float bias() const { return fBias; }
-    bool convolveAlpha() const { return fConvolveAlpha; }
-
     const char* name() const override { return "MatrixConvolution"; }
 
     std::unique_ptr<GrFragmentProcessor> clone() const override;
 
 private:
+    class Impl;
+
     /**
      * Small kernels are represented as float-arrays and uploaded as uniforms.
      * Large kernels go over the uniform limit and are uploaded as textures and sampled.
@@ -116,7 +107,6 @@
 
     bool onIsEqual(const GrFragmentProcessor&) const override;
 
-    SkIRect          fBounds;
     KernelWrapper    fKernel;
     float            fGain;
     float            fBias;
diff --git a/src/gpu/effects/GrMatrixEffect.cpp b/src/gpu/effects/GrMatrixEffect.cpp
index 3411930..8d2ad7b 100644
--- a/src/gpu/effects/GrMatrixEffect.cpp
+++ b/src/gpu/effects/GrMatrixEffect.cpp
@@ -14,42 +14,13 @@
 #include "src/gpu/glsl/GrGLSLProgramBuilder.h"
 #include "src/sksl/SkSLUtil.h"
 
-class GrGLSLMatrixEffect : public GrFragmentProcessor::ProgramImpl {
-public:
-    GrGLSLMatrixEffect() {}
-
-    void emitCode(EmitArgs& args) override {
-        fMatrixVar = args.fUniformHandler->addUniform(&args.fFp,
-                                                      kFragment_GrShaderFlag,
-                                                      kFloat3x3_GrSLType,
-                                                      SkSL::SampleUsage::MatrixUniformName());
-        args.fFragBuilder->codeAppendf("return %s;\n",
-                                       this->invokeChildWithMatrix(0, args).c_str());
-    }
-
-private:
-    void onSetData(const GrGLSLProgramDataManager& pdman,
-                   const GrFragmentProcessor& proc) override {
-        const GrMatrixEffect& mtx = proc.cast<GrMatrixEffect>();
-        if (auto te = mtx.childProcessor(0)->asTextureEffect()) {
-            SkMatrix m = te->coordAdjustmentMatrix();
-            m.preConcat(mtx.matrix());
-            pdman.setSkMatrix(fMatrixVar, m);
-        } else {
-            pdman.setSkMatrix(fMatrixVar, mtx.matrix());
-        }
-    }
-
-    UniformHandle fMatrixVar;
-};
-
 std::unique_ptr<GrFragmentProcessor> GrMatrixEffect::Make(
         const SkMatrix& matrix, std::unique_ptr<GrFragmentProcessor> child) {
     if (child->classID() == kGrMatrixEffect_ClassID) {
         auto me = static_cast<GrMatrixEffect*>(child.get());
         // registerChild's sample usage records whether the matrix used has perspective or not,
         // so we can't add perspective to 'me' if it doesn't already have it.
-        if (me->matrix().hasPerspective() || !matrix.hasPerspective()) {
+        if (me->fMatrix.hasPerspective() || !matrix.hasPerspective()) {
             me->fMatrix.preConcat(matrix);
             return child;
         }
@@ -58,7 +29,34 @@
 }
 
 std::unique_ptr<GrFragmentProcessor::ProgramImpl> GrMatrixEffect::onMakeProgramImpl() const {
-    return std::make_unique<GrGLSLMatrixEffect>();
+    class Impl : public ProgramImpl {
+    public:
+        void emitCode(EmitArgs& args) override {
+            fMatrixVar = args.fUniformHandler->addUniform(&args.fFp,
+                                                          kFragment_GrShaderFlag,
+                                                          kFloat3x3_GrSLType,
+                                                          SkSL::SampleUsage::MatrixUniformName());
+            args.fFragBuilder->codeAppendf("return %s;\n",
+                                           this->invokeChildWithMatrix(0, args).c_str());
+        }
+
+    private:
+        void onSetData(const GrGLSLProgramDataManager& pdman,
+                       const GrFragmentProcessor& proc) override {
+            const GrMatrixEffect& mtx = proc.cast<GrMatrixEffect>();
+            if (auto te = mtx.childProcessor(0)->asTextureEffect()) {
+                SkMatrix m = te->coordAdjustmentMatrix();
+                m.preConcat(mtx.fMatrix);
+                pdman.setSkMatrix(fMatrixVar, m);
+            } else {
+                pdman.setSkMatrix(fMatrixVar, mtx.fMatrix);
+            }
+        }
+
+        UniformHandle fMatrixVar;
+    };
+
+    return std::make_unique<Impl>();
 }
 
 void GrMatrixEffect::onAddToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {}
diff --git a/src/gpu/effects/GrMatrixEffect.h b/src/gpu/effects/GrMatrixEffect.h
index 8016b4f..b738d70 100644
--- a/src/gpu/effects/GrMatrixEffect.h
+++ b/src/gpu/effects/GrMatrixEffect.h
@@ -20,7 +20,6 @@
 
     std::unique_ptr<GrFragmentProcessor> clone() const override;
     const char* name() const override { return "MatrixEffect"; }
-    const SkMatrix& matrix() const { return fMatrix; }
 
 private:
     GrMatrixEffect(const GrMatrixEffect& src);
diff --git a/src/gpu/effects/GrModulateAtlasCoverageEffect.cpp b/src/gpu/effects/GrModulateAtlasCoverageEffect.cpp
index e42fc8f..815d8b8 100644
--- a/src/gpu/effects/GrModulateAtlasCoverageEffect.cpp
+++ b/src/gpu/effects/GrModulateAtlasCoverageEffect.cpp
@@ -63,6 +63,8 @@
                            coverageMaybeInvertName, coverageMaybeInvertName);
             f->codeAppendf("return %s * coverage;", inputColor.c_str());
         }
+
+    private:
         void onSetData(const GrGLSLProgramDataManager& pdman,
                        const GrFragmentProcessor& processor) override {
             auto fp = processor.cast<GrModulateAtlasCoverageEffect>();
@@ -78,5 +80,6 @@
         UniformHandle fBoundsUniform;
         UniformHandle fCoverageMaybeInvertUniform;
     };
+
     return std::make_unique<Impl>();
 }
diff --git a/src/gpu/effects/GrModulateAtlasCoverageEffect.h b/src/gpu/effects/GrModulateAtlasCoverageEffect.h
index 5a12b28..ef8e26d 100644
--- a/src/gpu/effects/GrModulateAtlasCoverageEffect.h
+++ b/src/gpu/effects/GrModulateAtlasCoverageEffect.h
@@ -30,19 +30,21 @@
     const char* name() const override {
         return "GrModulateAtlasCoverageFP";
     }
-    void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const override {
-        b->add32(fFlags & Flags::kCheckBounds);
-    }
+
     std::unique_ptr<GrFragmentProcessor> clone() const override {
         return std::make_unique<GrModulateAtlasCoverageEffect>(*this);
     }
+
+private:
+    void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const override {
+        b->add32(fFlags & Flags::kCheckBounds);
+    }
     bool onIsEqual(const GrFragmentProcessor& that) const override {
         auto fp = that.cast<GrModulateAtlasCoverageEffect>();
         return fFlags == fp.fFlags && fBounds == fp.fBounds;
     }
     std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
 
-private:
     const Flags fFlags;
     const SkIRect fBounds;
 };
diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp
index 09dd82f..03a651b 100644
--- a/src/gpu/effects/GrRRectEffect.cpp
+++ b/src/gpu/effects/GrRRectEffect.cpp
@@ -23,9 +23,9 @@
 
 //////////////////////////////////////////////////////////////////////////////
 
+namespace {
 class CircularRRectEffect : public GrFragmentProcessor {
 public:
-
     enum CornerFlags {
         kTopLeft_CornerFlag     = (1 << SkRRect::kUpperLeft_Corner),
         kTopRight_CornerFlag    = (1 << SkRRect::kUpperRight_Corner),
@@ -54,13 +54,9 @@
 
     std::unique_ptr<GrFragmentProcessor> clone() const override;
 
-    const SkRRect& getRRect() const { return fRRect; }
-
-    uint32_t getCircularCornerFlags() const { return fCircularCornerFlags; }
-
-    GrClipEdgeType getEdgeType() const { return fEdgeType; }
-
 private:
+    class Impl;
+
     CircularRRectEffect(std::unique_ptr<GrFragmentProcessor> inputFP,
                         GrClipEdgeType, uint32_t circularCornerFlags, const SkRRect&);
     CircularRRectEffect(const CircularRRectEffect& that);
@@ -79,6 +75,7 @@
 
     using INHERITED = GrFragmentProcessor;
 };
+}  // anonymous namespace
 
 GrFPResult CircularRRectEffect::Make(std::unique_ptr<GrFragmentProcessor> inputFP,
                                      GrClipEdgeType edgeType,
@@ -144,25 +141,19 @@
 
 //////////////////////////////////////////////////////////////////////////////
 
-class GLCircularRRectEffect : public GrFragmentProcessor::ProgramImpl {
+class CircularRRectEffect::Impl : public ProgramImpl {
 public:
-    GLCircularRRectEffect() = default;
-
     void emitCode(EmitArgs&) override;
 
-    static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*);
-
-protected:
+private:
     void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
 
-private:
     GrGLSLProgramDataManager::UniformHandle fInnerRectUniform;
     GrGLSLProgramDataManager::UniformHandle fRadiusPlusHalfUniform;
     SkRRect                                 fPrevRRect;
-    using INHERITED = ProgramImpl;
 };
 
-void GLCircularRRectEffect::emitCode(EmitArgs& args) {
+void CircularRRectEffect::Impl::emitCode(EmitArgs& args) {
     const CircularRRectEffect& crre = args.fFp.cast<CircularRRectEffect>();
     GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
     const char *rectName;
@@ -203,7 +194,7 @@
     // For the cases where one half of the rrect is rectangular we drop one of the x or y
     // computations, compute a separate rect edge alpha for the rect side, and mul the two computed
     // alphas together.
-    switch (crre.getCircularCornerFlags()) {
+    switch (crre.fCircularCornerFlags) {
         case CircularRRectEffect::kAll_CornerFlags:
             fragBuilder->codeAppendf("float2 dxy0 = %s.LT - sk_FragCoord.xy;", rectName);
             fragBuilder->codeAppendf("float2 dxy1 = sk_FragCoord.xy - %s.RB;", rectName);
@@ -290,7 +281,7 @@
             break;
     }
 
-    if (GrClipEdgeType::kInverseFillAA == crre.getEdgeType()) {
+    if (GrClipEdgeType::kInverseFillAA == crre.fEdgeType) {
         fragBuilder->codeAppend("alpha = 1.0 - alpha;");
     }
 
@@ -299,21 +290,14 @@
     fragBuilder->codeAppendf("return %s * alpha;", inputSample.c_str());
 }
 
-void GLCircularRRectEffect::GenKey(const GrProcessor& processor, const GrShaderCaps&,
-                                   GrProcessorKeyBuilder* b) {
+void CircularRRectEffect::Impl::onSetData(const GrGLSLProgramDataManager& pdman,
+                                          const GrFragmentProcessor& processor) {
     const CircularRRectEffect& crre = processor.cast<CircularRRectEffect>();
-    static_assert(kGrClipEdgeTypeCnt <= 8);
-    b->add32((crre.getCircularCornerFlags() << 3) | (int) crre.getEdgeType());
-}
-
-void GLCircularRRectEffect::onSetData(const GrGLSLProgramDataManager& pdman,
-                                      const GrFragmentProcessor& processor) {
-    const CircularRRectEffect& crre = processor.cast<CircularRRectEffect>();
-    const SkRRect& rrect = crre.getRRect();
+    const SkRRect& rrect = crre.fRRect;
     if (rrect != fPrevRRect) {
         SkRect rect = rrect.getBounds();
         SkScalar radius = 0;
-        switch (crre.getCircularCornerFlags()) {
+        switch (crre.fCircularCornerFlags) {
             case CircularRRectEffect::kAll_CornerFlags:
                 SkASSERT(SkRRectPriv::IsSimpleCircular(rrect));
                 radius = SkRRectPriv::GetSimpleRadii(rrect).fX;
@@ -389,15 +373,17 @@
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 
 void CircularRRectEffect::onAddToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
-    GLCircularRRectEffect::GenKey(*this, caps, b);
+    static_assert(kGrClipEdgeTypeCnt <= 8);
+    b->add32((fCircularCornerFlags << 3) | static_cast<int>(fEdgeType));
 }
 
 std::unique_ptr<GrFragmentProcessor::ProgramImpl> CircularRRectEffect::onMakeProgramImpl() const {
-    return std::make_unique<GLCircularRRectEffect>();
+    return std::make_unique<Impl>();
 }
 
 //////////////////////////////////////////////////////////////////////////////
 
+namespace {
 class EllipticalRRectEffect : public GrFragmentProcessor {
 public:
     static GrFPResult Make(std::unique_ptr<GrFragmentProcessor>, GrClipEdgeType, const SkRRect&);
@@ -408,11 +394,9 @@
 
     std::unique_ptr<GrFragmentProcessor> clone() const override;
 
-    const SkRRect& getRRect() const { return fRRect; }
-
-    GrClipEdgeType getEdgeType() const { return fEdgeType; }
-
 private:
+    class Impl;
+
     EllipticalRRectEffect(std::unique_ptr<GrFragmentProcessor>, GrClipEdgeType, const SkRRect&);
     EllipticalRRectEffect(const EllipticalRRectEffect& that);
 
@@ -431,12 +415,13 @@
 };
 
 GrFPResult EllipticalRRectEffect::Make(std::unique_ptr<GrFragmentProcessor> inputFP,
-                                       GrClipEdgeType edgeType, const SkRRect& rrect) {
+                                       GrClipEdgeType edgeType,
+                                       const SkRRect& rrect) {
     if (GrClipEdgeType::kFillAA != edgeType && GrClipEdgeType::kInverseFillAA != edgeType) {
         return GrFPFailure(std::move(inputFP));
     }
     return GrFPSuccess(std::unique_ptr<GrFragmentProcessor>(
-                new EllipticalRRectEffect(std::move(inputFP), edgeType, rrect)));
+            new EllipticalRRectEffect(std::move(inputFP), edgeType, rrect)));
 }
 
 EllipticalRRectEffect::EllipticalRRectEffect(std::unique_ptr<GrFragmentProcessor> inputFP,
@@ -463,6 +448,7 @@
     const EllipticalRRectEffect& erre = other.cast<EllipticalRRectEffect>();
     return fEdgeType == erre.fEdgeType && fRRect == erre.fRRect;
 }
+}  // anonymous namespace
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -509,26 +495,20 @@
 
 //////////////////////////////////////////////////////////////////////////////
 
-class GLEllipticalRRectEffect : public GrFragmentProcessor::ProgramImpl {
+class EllipticalRRectEffect::Impl : public ProgramImpl {
 public:
-    GLEllipticalRRectEffect() = default;
-
     void emitCode(EmitArgs&) override;
 
-    static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*);
-
-protected:
+private:
     void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
 
-private:
     GrGLSLProgramDataManager::UniformHandle fInnerRectUniform;
     GrGLSLProgramDataManager::UniformHandle fInvRadiiSqdUniform;
     GrGLSLProgramDataManager::UniformHandle fScaleUniform;
     SkRRect                                 fPrevRRect;
-    using INHERITED = ProgramImpl;
 };
 
-void GLEllipticalRRectEffect::emitCode(EmitArgs& args) {
+void EllipticalRRectEffect::Impl::emitCode(EmitArgs& args) {
     const EllipticalRRectEffect& erre = args.fFp.cast<EllipticalRRectEffect>();
     GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
     const char *rectName;
@@ -562,7 +542,7 @@
     }
 
     // The uniforms with the inv squared radii are highp to prevent underflow.
-    switch (erre.getRRect().getType()) {
+    switch (erre.fRRect.getType()) {
         case SkRRect::kSimple_Type: {
             const char *invRadiiXYSqdName;
             fInvRadiiSqdUniform = uniformHandler->addUniform(&erre,
@@ -612,7 +592,7 @@
         fragBuilder->codeAppendf("approx_dist *= %s.x;", scaleName);
     }
 
-    if (GrClipEdgeType::kFillAA == erre.getEdgeType()) {
+    if (erre.fEdgeType == GrClipEdgeType::kFillAA) {
         fragBuilder->codeAppend("half alpha = clamp(0.5 - approx_dist, 0.0, 1.0);");
     } else {
         fragBuilder->codeAppend("half alpha = clamp(0.5 + approx_dist, 0.0, 1.0);");
@@ -623,17 +603,10 @@
     fragBuilder->codeAppendf("return %s * alpha;", inputSample.c_str());
 }
 
-void GLEllipticalRRectEffect::GenKey(const GrProcessor& effect, const GrShaderCaps&,
-                                     GrProcessorKeyBuilder* b) {
+void EllipticalRRectEffect::Impl::onSetData(const GrGLSLProgramDataManager& pdman,
+                                            const GrFragmentProcessor& effect) {
     const EllipticalRRectEffect& erre = effect.cast<EllipticalRRectEffect>();
-    static_assert((int)GrClipEdgeType::kLast < (1 << 3));
-    b->add32(erre.getRRect().getType() | (int) erre.getEdgeType() << 3);
-}
-
-void GLEllipticalRRectEffect::onSetData(const GrGLSLProgramDataManager& pdman,
-                                        const GrFragmentProcessor& effect) {
-    const EllipticalRRectEffect& erre = effect.cast<EllipticalRRectEffect>();
-    const SkRRect& rrect = erre.getRRect();
+    const SkRRect& rrect = erre.fRRect;
     // If we're using a scale factor to work around precision issues, choose the largest radius
     // as the scale factor. The inv radii need to be pre-adjusted by the scale factor.
     if (rrect != fPrevRRect) {
@@ -641,7 +614,7 @@
         const SkVector& r0 = rrect.radii(SkRRect::kUpperLeft_Corner);
         SkASSERT(r0.fX >= kRadiusMin);
         SkASSERT(r0.fY >= kRadiusMin);
-        switch (erre.getRRect().getType()) {
+        switch (rrect.getType()) {
             case SkRRect::kSimple_Type:
                 rect.inset(r0.fX, r0.fY);
                 if (fScaleUniform.isValid()) {
@@ -692,11 +665,12 @@
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 
 void EllipticalRRectEffect::onAddToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
-    GLEllipticalRRectEffect::GenKey(*this, caps, b);
+    static_assert((int)GrClipEdgeType::kLast < (1 << 3));
+    b->add32(fRRect.getType() | static_cast<int>(fEdgeType) << 3);
 }
 
 std::unique_ptr<GrFragmentProcessor::ProgramImpl> EllipticalRRectEffect::onMakeProgramImpl() const {
-    return std::make_unique<GLEllipticalRRectEffect>();
+    return std::make_unique<Impl>();
 }
 
 //////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/effects/GrSkSLFP.cpp b/src/gpu/effects/GrSkSLFP.cpp
index e6b1f26..3db9740 100644
--- a/src/gpu/effects/GrSkSLFP.cpp
+++ b/src/gpu/effects/GrSkSLFP.cpp
@@ -23,7 +23,7 @@
 #include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
 #include "src/gpu/glsl/GrGLSLProgramBuilder.h"
 
-class GrGLSLSkSLFP : public GrFragmentProcessor::ProgramImpl {
+class GrSkSLFP::Impl : public ProgramImpl {
 public:
     void emitCode(EmitArgs& args) override {
         const GrSkSLFP& fp            = args.fFp.cast<GrSkSLFP>();
@@ -31,7 +31,7 @@
 
         class FPCallbacks : public SkSL::PipelineStage::Callbacks {
         public:
-            FPCallbacks(GrGLSLSkSLFP* self,
+            FPCallbacks(Impl* self,
                         EmitArgs& args,
                         const char* inputColor,
                         const SkSL::Context& context,
@@ -152,7 +152,7 @@
                 return String(fSelf->invokeChild(index, src.c_str(), dst.c_str(), fArgs).c_str());
             }
 
-            GrGLSLSkSLFP*                 fSelf;
+            Impl*                         fSelf;
             EmitArgs&                     fArgs;
             const char*                   fInputColor;
             const SkSL::Context&          fContext;
@@ -220,6 +220,7 @@
                 program, coords, args.fInputColor, args.fDestColor, &callbacks);
     }
 
+private:
     void onSetData(const GrGLSLProgramDataManager& pdman,
                    const GrFragmentProcessor& _proc) override {
         using Type = SkRuntimeEffect::Uniform::Type;
@@ -345,7 +346,7 @@
 }
 
 std::unique_ptr<GrFragmentProcessor::ProgramImpl> GrSkSLFP::onMakeProgramImpl() const {
-    return std::make_unique<GrGLSLSkSLFP>();
+    return std::make_unique<Impl>();
 }
 
 void GrSkSLFP::onAddToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
diff --git a/src/gpu/effects/GrSkSLFP.h b/src/gpu/effects/GrSkSLFP.h
index 31b6769..24f3987 100644
--- a/src/gpu/effects/GrSkSLFP.h
+++ b/src/gpu/effects/GrSkSLFP.h
@@ -160,6 +160,8 @@
     std::unique_ptr<GrFragmentProcessor> clone() const override;
 
 private:
+    class Impl;
+
     GrSkSLFP(sk_sp<SkRuntimeEffect> effect, const char* name, OptFlags optFlags);
     GrSkSLFP(const GrSkSLFP& other);
 
@@ -373,8 +375,6 @@
 
     using INHERITED = GrFragmentProcessor;
 
-    friend class GrGLSLSkSLFP;
-
     friend class GrSkSLFPFactory;
 };
 
diff --git a/src/gpu/effects/GrTextureEffect.h b/src/gpu/effects/GrTextureEffect.h
index 072f22c..5b1c2d5 100644
--- a/src/gpu/effects/GrTextureEffect.h
+++ b/src/gpu/effects/GrTextureEffect.h
@@ -113,13 +113,14 @@
     class Impl : public ProgramImpl {
     public:
         void emitCode(EmitArgs&) override;
-        void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
 
         void setSamplerHandle(GrGLSLShaderBuilder::SamplerHandle handle) {
             fSamplerHandle = handle;
         }
 
     private:
+        void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) override;
+
         UniformHandle fSubsetUni;
         UniformHandle fClampUni;
         UniformHandle fIDimsUni;
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp
index 16aff67..69bb1ec 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.cpp
+++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp
@@ -239,10 +239,8 @@
 #endif
 
 std::unique_ptr<GrFragmentProcessor::ProgramImpl> GrYUVtoRGBEffect::onMakeProgramImpl() const {
-    class GrGLSLYUVtoRGBEffect : public ProgramImpl {
+    class Impl : public ProgramImpl {
     public:
-        GrGLSLYUVtoRGBEffect() {}
-
         void emitCode(EmitArgs& args) override {
             GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
             const GrYUVtoRGBEffect& yuvEffect = args.fFp.cast<GrYUVtoRGBEffect>();
@@ -336,8 +334,9 @@
         UniformHandle fColorSpaceTranslateVar;
     };
 
-    return std::make_unique<GrGLSLYUVtoRGBEffect>();
+    return std::make_unique<Impl>();
 }
+
 void GrYUVtoRGBEffect::onAddToKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
     uint32_t packed = 0;
     int i = 0;
diff --git a/src/gpu/glsl/GrGLSLFragmentProcessor.h b/src/gpu/glsl/GrGLSLFragmentProcessor.h
index 56f9e67..8839702 100644
--- a/src/gpu/glsl/GrGLSLFragmentProcessor.h
+++ b/src/gpu/glsl/GrGLSLFragmentProcessor.h
@@ -163,7 +163,7 @@
         SkSTArray<4, ProgramImpl*, true> fFPStack;
     };
 
-protected:
+private:
     /**
      * A ProgramImpl instance can be reused with any GrFragmentProcessor that produces the same
      * the same key; this function reads data from a GrFragmentProcessor and uploads any
@@ -173,7 +173,6 @@
      */
     virtual void onSetData(const GrGLSLProgramDataManager&, const GrFragmentProcessor&) {}
 
-private:
     // The (mangled) name of our entry-point function
     SkString fFunctionName;