1 
2 
3 /**************************************************************************************************
4  *** This file was autogenerated from GrChildProcessorAndGlobal.fp; do not modify.
5  **************************************************************************************************/
6 #include "GrChildProcessorAndGlobal.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 GrGLSLChildProcessorAndGlobal : public GrGLSLFragmentProcessor {
16 public:
GrGLSLChildProcessorAndGlobal()17     GrGLSLChildProcessorAndGlobal() {}
emitCode(EmitArgs & args)18     void emitCode(EmitArgs& args) override {
19         GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
20         const GrChildProcessorAndGlobal& _outer = args.fFp.cast<GrChildProcessorAndGlobal>();
21         (void) _outer;
22 hasCap = sk_Caps.externalTextureSupport;
23         fragBuilder->codeAppendf(
24 R"SkSL(bool hasCap = %s;
25 if (hasCap) {)SkSL"
26 , (hasCap ? "true" : "false"));
27         SkString _sample0 = this->invokeChild(0, args);
28         fragBuilder->codeAppendf(
29 R"SkSL(
30     return %s;
31 } else {
32     return half4(1.0);
33 }
34 )SkSL"
35 , _sample0.c_str());
36     }
37 private:
onSetData(const GrGLSLProgramDataManager & pdman,const GrFragmentProcessor & _proc)38     void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
39     }
40 bool hasCap = false;
41 };
onMakeProgramImpl() const42 std::unique_ptr<GrGLSLFragmentProcessor> GrChildProcessorAndGlobal::onMakeProgramImpl() const {
43     return std::make_unique<GrGLSLChildProcessorAndGlobal>();
44 }
onGetGLSLProcessorKey(const GrShaderCaps & caps,GrProcessorKeyBuilder * b) const45 void GrChildProcessorAndGlobal::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
46 }
onIsEqual(const GrFragmentProcessor & other) const47 bool GrChildProcessorAndGlobal::onIsEqual(const GrFragmentProcessor& other) const {
48     const GrChildProcessorAndGlobal& that = other.cast<GrChildProcessorAndGlobal>();
49     (void) that;
50     return true;
51 }
GrChildProcessorAndGlobal(const GrChildProcessorAndGlobal & src)52 GrChildProcessorAndGlobal::GrChildProcessorAndGlobal(const GrChildProcessorAndGlobal& src)
53 : INHERITED(kGrChildProcessorAndGlobal_ClassID, src.optimizationFlags()) {
54         this->cloneAndRegisterAllChildProcessors(src);
55 }
clone() const56 std::unique_ptr<GrFragmentProcessor> GrChildProcessorAndGlobal::clone() const {
57     return std::make_unique<GrChildProcessorAndGlobal>(*this);
58 }
59 #if GR_TEST_UTILS
onDumpInfo() const60 SkString GrChildProcessorAndGlobal::onDumpInfo() const {
61     return SkString();
62 }
63 #endif
64