1
2
3 /**************************************************************************************************
4 *** This file was autogenerated from GrFunction.fp; do not modify.
5 **************************************************************************************************/
6 #include "GrFunction.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 GrGLSLFunction : public GrGLSLFragmentProcessor {
16 public:
GrGLSLFunction()17 GrGLSLFunction() {}
emitCode(EmitArgs & args)18 void emitCode(EmitArgs& args) override {
19 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
20 const GrFunction& _outer = args.fFp.cast<GrFunction>();
21 (void) _outer;
22 colorVar = args.fUniformHandler->addUniform(&_outer, kFragment_GrShaderFlag, kHalf4_GrSLType, "color");
23 SkString flip_name = fragBuilder->getMangledFunctionName("flip");
24 const GrShaderVar flip_args[] = { GrShaderVar("c", kHalf4_GrSLType) };
25 fragBuilder->emitFunction(kHalf4_GrSLType, flip_name.c_str(), {flip_args, 1},
26 R"SkSL(int x = 42;
27 ++x;
28 ++x;
29 ++x;
30 ++x;
31 ++x;
32 ++x;
33 ++x;
34 ++x;
35 ++x;
36 ++x;
37 ++x;
38 ++x;
39 ++x;
40 ++x;
41 ++x;
42 ++x;
43 ++x;
44 ++x;
45 ++x;
46 ++x;
47 ++x;
48 ++x;
49 ++x;
50 ++x;
51 ++x;
52 ++x;
53 ++x;
54 ++x;
55 ++x;
56 ++x;
57 return c.wzyx;
58 )SkSL");
59 fragBuilder->codeAppendf(
60 R"SkSL(return %s(%s(%s(%s)));
61 )SkSL"
62 , flip_name.c_str(), flip_name.c_str(), flip_name.c_str(), args.fUniformHandler->getUniformCStr(colorVar));
63 }
64 private:
onSetData(const GrGLSLProgramDataManager & pdman,const GrFragmentProcessor & _proc)65 void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
66 }
67 UniformHandle colorVar;
68 };
onMakeProgramImpl() const69 std::unique_ptr<GrGLSLFragmentProcessor> GrFunction::onMakeProgramImpl() const {
70 return std::make_unique<GrGLSLFunction>();
71 }
onGetGLSLProcessorKey(const GrShaderCaps & caps,GrProcessorKeyBuilder * b) const72 void GrFunction::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
73 }
onIsEqual(const GrFragmentProcessor & other) const74 bool GrFunction::onIsEqual(const GrFragmentProcessor& other) const {
75 const GrFunction& that = other.cast<GrFunction>();
76 (void) that;
77 return true;
78 }
GrFunction(const GrFunction & src)79 GrFunction::GrFunction(const GrFunction& src)
80 : INHERITED(kGrFunction_ClassID, src.optimizationFlags()) {
81 this->cloneAndRegisterAllChildProcessors(src);
82 }
clone() const83 std::unique_ptr<GrFragmentProcessor> GrFunction::clone() const {
84 return std::make_unique<GrFunction>(*this);
85 }
86 #if GR_TEST_UTILS
onDumpInfo() const87 SkString GrFunction::onDumpInfo() const {
88 return SkString();
89 }
90 #endif
91