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/GrMixerEffect.cpp b/src/gpu/effects/generated/GrMixerEffect.cpp
index f48b2e6..951c8f9 100644
--- a/src/gpu/effects/generated/GrMixerEffect.cpp
+++ b/src/gpu/effects/generated/GrMixerEffect.cpp
@@ -27,30 +27,19 @@
(void)weight;
weightVar = args.fUniformHandler->addUniform(&_outer, kFragment_GrShaderFlag,
kHalf_GrSLType, "weight");
- SkString _input1335(args.fInputColor);
- SkString _sample1335;
- if (_outer.inputFP_index >= 0) {
- _sample1335 = this->invokeChild(_outer.inputFP_index, _input1335.c_str(), args);
- } else {
- _sample1335.swap(_input1335);
- }
+ SkString _input1099(args.fInputColor);
+ SkString _sample1099 = this->invokeChild(0, _input1099.c_str(), args);
fragBuilder->codeAppendf(
- R"SkSL(half4 inColor = %s;)SkSL", _sample1335.c_str());
- SkString _input1386("inColor");
- SkString _sample1386;
- _sample1386 = this->invokeChild(_outer.fp0_index, _input1386.c_str(), args);
- SkString _input1408("inColor");
- SkString _sample1408;
- if (_outer.fp1_index >= 0) {
- _sample1408 = this->invokeChild(_outer.fp1_index, _input1408.c_str(), args);
- } else {
- _sample1408.swap(_input1408);
- }
+ R"SkSL(half4 inColor = %s;)SkSL", _sample1099.c_str());
+ SkString _input1150("inColor");
+ SkString _sample1150 = this->invokeChild(1, _input1150.c_str(), args);
+ SkString _input1172("inColor");
+ SkString _sample1172 = this->invokeChild(2, _input1172.c_str(), args);
fragBuilder->codeAppendf(
R"SkSL(
%s = mix(%s, %s, %s);
)SkSL",
- args.fOutputColor, _sample1386.c_str(), _sample1408.c_str(),
+ args.fOutputColor, _sample1150.c_str(), _sample1172.c_str(),
args.fUniformHandler->getUniformCStr(weightVar));
}
@@ -75,13 +64,7 @@
}
GrMixerEffect::GrMixerEffect(const GrMixerEffect& src)
: INHERITED(kGrMixerEffect_ClassID, src.optimizationFlags()), weight(src.weight) {
- if (src.inputFP_index >= 0) {
- inputFP_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.inputFP_index));
- }
- { fp0_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.fp0_index)); }
- if (src.fp1_index >= 0) {
- fp1_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.fp1_index));
- }
+ this->cloneAndRegisterAllChildProcessors(src);
}
std::unique_ptr<GrFragmentProcessor> GrMixerEffect::clone() const {
return std::unique_ptr<GrFragmentProcessor>(new GrMixerEffect(*this));