In FPs, store pointers for all child slots, even nullptr
This simplifies things like ConstantOutputForConstantInput and
invokeChild. It also removes the need for child indices: generated
FPs now directly refer to their children by slot number.
Change-Id: I69bbb042d5d72d21b999256f969c467702d0774d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302436
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
diff --git a/src/gpu/effects/generated/GrRectBlurEffect.cpp b/src/gpu/effects/generated/GrRectBlurEffect.cpp
index e55c300..a8f8f85 100644
--- a/src/gpu/effects/generated/GrRectBlurEffect.cpp
+++ b/src/gpu/effects/generated/GrRectBlurEffect.cpp
@@ -54,15 +54,13 @@
rectHVar.isValid() ? args.fUniformHandler->getUniformCStr(rectHVar) : "half4(0)",
rectHVar.isValid() ? args.fUniformHandler->getUniformCStr(rectHVar) : "half4(0)");
SkString _coords7211("float2(half2(xy.x, 0.5))");
- SkString _sample7211;
- _sample7211 = this->invokeChild(_outer.integral_index, args, _coords7211.c_str());
+ SkString _sample7211 = this->invokeChild(1, args, _coords7211.c_str());
fragBuilder->codeAppendf(
R"SkSL(
xCoverage = %s.w;)SkSL",
_sample7211.c_str());
SkString _coords7269("float2(half2(xy.y, 0.5))");
- SkString _sample7269;
- _sample7269 = this->invokeChild(_outer.integral_index, args, _coords7269.c_str());
+ SkString _sample7269 = this->invokeChild(1, args, _coords7269.c_str());
fragBuilder->codeAppendf(
R"SkSL(
yCoverage = %s.w;
@@ -81,33 +79,24 @@
rectHVar.isValid() ? args.fUniformHandler->getUniformCStr(rectHVar) : "half4(0)",
rectHVar.isValid() ? args.fUniformHandler->getUniformCStr(rectHVar) : "half4(0)");
SkString _coords8636("float2(half2(rect.x, 0.5))");
- SkString _sample8636;
- _sample8636 = this->invokeChild(_outer.integral_index, args, _coords8636.c_str());
+ SkString _sample8636 = this->invokeChild(1, args, _coords8636.c_str());
SkString _coords8699("float2(half2(rect.z, 0.5))");
- SkString _sample8699;
- _sample8699 = this->invokeChild(_outer.integral_index, args, _coords8699.c_str());
+ SkString _sample8699 = this->invokeChild(1, args, _coords8699.c_str());
fragBuilder->codeAppendf(
R"SkSL(
xCoverage = (1.0 - %s.w) - %s.w;)SkSL",
_sample8636.c_str(), _sample8699.c_str());
SkString _coords8763("float2(half2(rect.y, 0.5))");
- SkString _sample8763;
- _sample8763 = this->invokeChild(_outer.integral_index, args, _coords8763.c_str());
+ SkString _sample8763 = this->invokeChild(1, args, _coords8763.c_str());
SkString _coords8826("float2(half2(rect.w, 0.5))");
- SkString _sample8826;
- _sample8826 = this->invokeChild(_outer.integral_index, args, _coords8826.c_str());
+ SkString _sample8826 = this->invokeChild(1, args, _coords8826.c_str());
fragBuilder->codeAppendf(
R"SkSL(
yCoverage = (1.0 - %s.w) - %s.w;
})SkSL",
_sample8763.c_str(), _sample8826.c_str());
SkString _input8895(args.fInputColor);
- SkString _sample8895;
- if (_outer.inputFP_index >= 0) {
- _sample8895 = this->invokeChild(_outer.inputFP_index, _input8895.c_str(), args);
- } else {
- _sample8895.swap(_input8895);
- }
+ SkString _sample8895 = this->invokeChild(0, _input8895.c_str(), args);
fragBuilder->codeAppendf(
R"SkSL(
half4 inputColor = %s;
@@ -158,13 +147,7 @@
: INHERITED(kGrRectBlurEffect_ClassID, src.optimizationFlags())
, rect(src.rect)
, isFast(src.isFast) {
- if (src.inputFP_index >= 0) {
- inputFP_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.inputFP_index));
- }
- {
- integral_index =
- this->cloneAndRegisterChildProcessor(src.childProcessor(src.integral_index));
- }
+ this->cloneAndRegisterAllChildProcessors(src);
}
std::unique_ptr<GrFragmentProcessor> GrRectBlurEffect::clone() const {
return std::unique_ptr<GrFragmentProcessor>(new GrRectBlurEffect(*this));