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/gradients/generated/GrTiledGradientEffect.cpp b/src/gpu/gradients/generated/GrTiledGradientEffect.cpp
index 3d9dc96..8fa986f 100644
--- a/src/gpu/gradients/generated/GrTiledGradientEffect.cpp
+++ b/src/gpu/gradients/generated/GrTiledGradientEffect.cpp
@@ -29,8 +29,7 @@
(void)makePremul;
auto colorsAreOpaque = _outer.colorsAreOpaque;
(void)colorsAreOpaque;
- SkString _sample453;
- _sample453 = this->invokeChild(_outer.gradLayout_index, args);
+ SkString _sample453 = this->invokeChild(1, args);
fragBuilder->codeAppendf(
R"SkSL(half4 t = %s;
if (!%s && t.y < 0.0) {
@@ -47,12 +46,10 @@
t.x = fract(t.x);
})SkSL",
_sample453.c_str(),
- (_outer.childProcessor(_outer.gradLayout_index).preservesOpaqueInput() ? "true"
- : "false"),
+ (_outer.childProcessor(1)->preservesOpaqueInput() ? "true" : "false"),
args.fOutputColor, (_outer.mirror ? "true" : "false"));
SkString _input1464("t");
- SkString _sample1464;
- _sample1464 = this->invokeChild(_outer.colorizer_index, _input1464.c_str(), args);
+ SkString _sample1464 = this->invokeChild(0, _input1464.c_str(), args);
fragBuilder->codeAppendf(
R"SkSL(
%s = %s;
@@ -90,14 +87,7 @@
, mirror(src.mirror)
, makePremul(src.makePremul)
, colorsAreOpaque(src.colorsAreOpaque) {
- {
- colorizer_index =
- this->cloneAndRegisterChildProcessor(src.childProcessor(src.colorizer_index));
- }
- {
- gradLayout_index =
- this->cloneAndRegisterChildProcessor(src.childProcessor(src.gradLayout_index));
- }
+ this->cloneAndRegisterAllChildProcessors(src);
}
std::unique_ptr<GrFragmentProcessor> GrTiledGradientEffect::clone() const {
return std::unique_ptr<GrFragmentProcessor>(new GrTiledGradientEffect(*this));