• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2019 Google LLC.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 /**************************************************************************************************
9  *** This file was autogenerated from GrComposeLerpRedEffect.fp; do not modify.
10  **************************************************************************************************/
11 #include "GrComposeLerpRedEffect.h"
12 
13 #include "include/gpu/GrTexture.h"
14 #include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
15 #include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
16 #include "src/gpu/glsl/GrGLSLProgramBuilder.h"
17 #include "src/sksl/SkSLCPP.h"
18 #include "src/sksl/SkSLUtil.h"
19 class GrGLSLComposeLerpRedEffect : public GrGLSLFragmentProcessor {
20 public:
GrGLSLComposeLerpRedEffect()21     GrGLSLComposeLerpRedEffect() {}
emitCode(EmitArgs & args)22     void emitCode(EmitArgs& args) override {
23         GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
24         const GrComposeLerpRedEffect& _outer = args.fFp.cast<GrComposeLerpRedEffect>();
25         (void)_outer;
26         SkString _sample292("_sample292");
27         if (_outer.child1_index >= 0) {
28             this->invokeChild(_outer.child1_index, &_sample292, args);
29         } else {
30             fragBuilder->codeAppendf("half4 %s;", _sample292.c_str());
31         }
32         SkString _sample360("_sample360");
33         if (_outer.child2_index >= 0) {
34             this->invokeChild(_outer.child2_index, &_sample360, args);
35         } else {
36             fragBuilder->codeAppendf("half4 %s;", _sample360.c_str());
37         }
38         SkString _sample411("_sample411");
39         this->invokeChild(_outer.lerp_index, &_sample411, args);
40         fragBuilder->codeAppendf("%s = mix(%s ? %s : %s, %s ? %s : %s, %s.x);\n", args.fOutputColor,
41                                  _outer.child1_index >= 0 ? "true" : "false", _sample292.c_str(),
42                                  args.fInputColor, _outer.child2_index >= 0 ? "true" : "false",
43                                  _sample360.c_str(), args.fInputColor, _sample411.c_str());
44     }
45 
46 private:
onSetData(const GrGLSLProgramDataManager & pdman,const GrFragmentProcessor & _proc)47     void onSetData(const GrGLSLProgramDataManager& pdman,
48                    const GrFragmentProcessor& _proc) override {}
49 };
onCreateGLSLInstance() const50 GrGLSLFragmentProcessor* GrComposeLerpRedEffect::onCreateGLSLInstance() const {
51     return new GrGLSLComposeLerpRedEffect();
52 }
onGetGLSLProcessorKey(const GrShaderCaps & caps,GrProcessorKeyBuilder * b) const53 void GrComposeLerpRedEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps,
54                                                    GrProcessorKeyBuilder* b) const {}
onIsEqual(const GrFragmentProcessor & other) const55 bool GrComposeLerpRedEffect::onIsEqual(const GrFragmentProcessor& other) const {
56     const GrComposeLerpRedEffect& that = other.cast<GrComposeLerpRedEffect>();
57     (void)that;
58     return true;
59 }
GrComposeLerpRedEffect(const GrComposeLerpRedEffect & src)60 GrComposeLerpRedEffect::GrComposeLerpRedEffect(const GrComposeLerpRedEffect& src)
61         : INHERITED(kGrComposeLerpRedEffect_ClassID, src.optimizationFlags())
62         , child1_index(src.child1_index)
63         , child2_index(src.child2_index)
64         , lerp_index(src.lerp_index) {
65     if (child1_index >= 0) {
66         this->registerChildProcessor(src.childProcessor(child1_index).clone());
67     }
68     if (child2_index >= 0) {
69         this->registerChildProcessor(src.childProcessor(child2_index).clone());
70     }
71     this->registerChildProcessor(src.childProcessor(lerp_index).clone());
72 }
clone() const73 std::unique_ptr<GrFragmentProcessor> GrComposeLerpRedEffect::clone() const {
74     return std::unique_ptr<GrFragmentProcessor>(new GrComposeLerpRedEffect(*this));
75 }
76