Child fragment processors are now written as separate functions
instead of inline
Bug: skia:
Change-Id: I3c6c876fea9cfcc311fc09c0fdf0375b776004aa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/210632
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
diff --git a/src/gpu/effects/GrSkSLFP.cpp b/src/gpu/effects/GrSkSLFP.cpp
index f8fe85d..cece9c1 100644
--- a/src/gpu/effects/GrSkSLFP.cpp
+++ b/src/gpu/effects/GrSkSLFP.cpp
@@ -159,12 +159,14 @@
SkSL::String(v->fName).c_str()));
}
}
+ GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
std::vector<SkString> childNames;
for (int i = 0; i < this->numChildProcessors(); ++i) {
- childNames.push_back(SkStringPrintf("_child%d", i));
- this->emitChild(i, &childNames[i], args);
+ SkString name = SkStringPrintf("_child%d", i);
+ fragBuilder->codeAppendf("half4 %s;\n", name.c_str());
+ childNames.push_back(std::move(name));
+ this->invokeChild(i, childNames[i].c_str(), args);
}
- GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
int substringStartIndex = 0;
int formatArgIndex = 0;
for (size_t i = 0; i < fGLSL.length(); ++i) {