1 
2 
3 /**************************************************************************************************
4  *** This file was autogenerated from GrRecursion.fp; do not modify.
5  **************************************************************************************************/
6 #include "GrRecursion.h"
7 
8 #include "src/core/SkUtils.h"
9 #include "src/gpu/GrTexture.h"
10 #include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
11 #include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
12 #include "src/gpu/glsl/GrGLSLProgramBuilder.h"
13 #include "src/sksl/SkSLCPP.h"
14 #include "src/sksl/SkSLUtil.h"
15 class GrGLSLRecursion : public GrGLSLFragmentProcessor {
16 public:
GrGLSLRecursion()17     GrGLSLRecursion() {}
emitCode(EmitArgs & args)18     void emitCode(EmitArgs& args) override {
19         GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
20         const GrRecursion& _outer = args.fFp.cast<GrRecursion>();
21         (void) _outer;
22         SkString factorial_name = fragBuilder->getMangledFunctionName("factorial");
23         const GrShaderVar factorial_args[] = { GrShaderVar("x", kInt_GrSLType) };
24         const String factorial_impl = String::printf(R"SkSL(return x <= 1 ? 1 : x * %s(x - 1);
25 )SkSL"
26 , factorial_name.c_str());
27         fragBuilder->emitFunction(kInt_GrSLType, factorial_name.c_str(), {factorial_args, 1}, factorial_impl.c_str());
28         fragBuilder->codeAppendf(
29 R"SkSL(return half4(half(%s(7)));
30 )SkSL"
31 , factorial_name.c_str());
32     }
33 private:
onSetData(const GrGLSLProgramDataManager & pdman,const GrFragmentProcessor & _proc)34     void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
35     }
36 };
onMakeProgramImpl() const37 std::unique_ptr<GrGLSLFragmentProcessor> GrRecursion::onMakeProgramImpl() const {
38     return std::make_unique<GrGLSLRecursion>();
39 }
onGetGLSLProcessorKey(const GrShaderCaps & caps,GrProcessorKeyBuilder * b) const40 void GrRecursion::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
41 }
onIsEqual(const GrFragmentProcessor & other) const42 bool GrRecursion::onIsEqual(const GrFragmentProcessor& other) const {
43     const GrRecursion& that = other.cast<GrRecursion>();
44     (void) that;
45     return true;
46 }
GrRecursion(const GrRecursion & src)47 GrRecursion::GrRecursion(const GrRecursion& src)
48 : INHERITED(kGrRecursion_ClassID, src.optimizationFlags()) {
49         this->cloneAndRegisterAllChildProcessors(src);
50 }
clone() const51 std::unique_ptr<GrFragmentProcessor> GrRecursion::clone() const {
52     return std::make_unique<GrRecursion>(*this);
53 }
54 #if GR_TEST_UTILS
onDumpInfo() const55 SkString GrRecursion::onDumpInfo() const {
56     return SkString();
57 }
58 #endif
59