Remove GrRuntimeFPBuilder, SkRuntimeEffect::makeFP
All callsites moved to the new templated GrSkSLFP factory
Change-Id: If8d0419379c96b5a52b2576a5da1b0a3da8cccbf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/415916
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/include/effects/SkRuntimeEffect.h b/include/effects/SkRuntimeEffect.h
index 5e7ac57..7e7bc466 100644
--- a/include/effects/SkRuntimeEffect.h
+++ b/include/effects/SkRuntimeEffect.h
@@ -18,7 +18,6 @@
#include <vector>
-class GrFragmentProcessor;
class GrRecordingContext;
class SkColorFilter;
class SkFilterColorProgram;
@@ -184,13 +183,6 @@
static void RegisterFlattenables();
~SkRuntimeEffect() override;
-#if SK_SUPPORT_GPU
- // For internal use.
- std::unique_ptr<GrFragmentProcessor> makeFP(sk_sp<SkData> uniforms,
- std::unique_ptr<GrFragmentProcessor> children[],
- size_t childCount) const;
-#endif
-
private:
enum Flags {
kUsesSampleCoords_Flag = 0x1,
diff --git a/src/core/SkRuntimeEffect.cpp b/src/core/SkRuntimeEffect.cpp
index 25d81eb..e314d17 100644
--- a/src/core/SkRuntimeEffect.cpp
+++ b/src/core/SkRuntimeEffect.cpp
@@ -923,22 +923,6 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
-#if SK_SUPPORT_GPU
-std::unique_ptr<GrFragmentProcessor> SkRuntimeEffect::makeFP(
- sk_sp<SkData> uniforms,
- std::unique_ptr<GrFragmentProcessor> children[],
- size_t childCount) const {
- if (!uniforms) {
- uniforms = SkData::MakeEmpty();
- }
- auto fp = GrSkSLFP::Make(sk_ref_sp(this), "make_fp", std::move(uniforms));
- for (size_t i = 0; i < childCount; ++i) {
- fp->addChild(std::move(children[i]));
- }
- return std::move(fp);
-}
-#endif
-
sk_sp<SkShader> SkRuntimeEffect::makeShader(sk_sp<SkData> uniforms,
sk_sp<SkShader> children[],
size_t childCount,
diff --git a/src/gpu/effects/GrSkSLFP.cpp b/src/gpu/effects/GrSkSLFP.cpp
index 6733908..2ff99a2 100644
--- a/src/gpu/effects/GrSkSLFP.cpp
+++ b/src/gpu/effects/GrSkSLFP.cpp
@@ -304,16 +304,3 @@
}
#endif
-
-/**************************************************************************************************/
-
-GrRuntimeFPBuilder::GrRuntimeFPBuilder(sk_sp<SkRuntimeEffect> effect)
- : INHERITED(std::move(effect)) {}
-
-GrRuntimeFPBuilder::~GrRuntimeFPBuilder() = default;
-
-std::unique_ptr<GrFragmentProcessor> GrRuntimeFPBuilder::makeFP() {
- return this->effect()->makeFP(this->uniforms(),
- this->children(),
- this->numChildren());
-}
diff --git a/src/gpu/effects/GrSkSLFP.h b/src/gpu/effects/GrSkSLFP.h
index 67c3836..33a0269 100644
--- a/src/gpu/effects/GrSkSLFP.h
+++ b/src/gpu/effects/GrSkSLFP.h
@@ -175,29 +175,4 @@
friend class GrSkSLFPFactory;
};
-class GrRuntimeFPBuilder : public SkRuntimeEffectBuilder<std::unique_ptr<GrFragmentProcessor>> {
-public:
- ~GrRuntimeFPBuilder();
-
- // NOTE: We use a static variable as a cache. CODE and MAKE must remain template parameters.
- template <const char* CODE, SkRuntimeEffect::Result (*MAKE)(SkString sksl)>
- static GrRuntimeFPBuilder Make() {
- static const SkRuntimeEffect::Result gResult = MAKE(SkString(CODE));
-#ifdef SK_DEBUG
- if (!gResult.effect) {
- SK_ABORT("Code failed: %s", gResult.errorText.c_str());
- }
-#endif
- return GrRuntimeFPBuilder(gResult.effect);
- }
-
- std::unique_ptr<GrFragmentProcessor> makeFP();
-
-private:
- explicit GrRuntimeFPBuilder(sk_sp<SkRuntimeEffect>);
- GrRuntimeFPBuilder(GrRuntimeFPBuilder&& that) = default;
-
- using INHERITED = SkRuntimeEffectBuilder<std::unique_ptr<GrFragmentProcessor>>;
-};
-
#endif
diff --git a/tests/SkRuntimeEffectTest.cpp b/tests/SkRuntimeEffectTest.cpp
index e28a2d9..dea6c42 100644
--- a/tests/SkRuntimeEffectTest.cpp
+++ b/tests/SkRuntimeEffectTest.cpp
@@ -18,6 +18,7 @@
#include "src/core/SkTLazy.h"
#include "src/gpu/GrColor.h"
#include "src/gpu/GrFragmentProcessor.h"
+#include "src/gpu/effects/GrSkSLFP.h"
#include "tests/Test.h"
#include <algorithm>
@@ -593,7 +594,7 @@
REPORTER_ASSERT(r, effect);
auto child = GrFragmentProcessor::MakeColor({ 1, 1, 1, 1 });
- auto fp = effect->makeFP(nullptr, &child, 1);
+ auto fp = GrSkSLFP::Make(effect, "test_fp", "child", std::move(child));
REPORTER_ASSERT(r, fp);
REPORTER_ASSERT(r, fp->childProcessor(0)->isSampledWithExplicitCoords() == expectExplicit);