blob: a2f051b8b9ed7511d5eda69e55ff9d6d21ab44b5 [file] [log] [blame]
Ethan Nicholasff4fb332019-04-09 16:28:19 -04001/*
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"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050012
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"
Ethan Nicholasff4fb332019-04-09 16:28:19 -040019class GrGLSLComposeLerpRedEffect : public GrGLSLFragmentProcessor {
20public:
21 GrGLSLComposeLerpRedEffect() {}
22 void emitCode(EmitArgs& args) override {
23 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
24 const GrComposeLerpRedEffect& _outer = args.fFp.cast<GrComposeLerpRedEffect>();
25 (void)_outer;
Ethan Nicholas0364bde2019-05-02 16:16:30 -040026 fragBuilder->codeAppendf("half4 _process286;");
Ethan Nicholasff4fb332019-04-09 16:28:19 -040027 if (_outer.child1_index >= 0) {
Ethan Nicholas0364bde2019-05-02 16:16:30 -040028 this->invokeChild(_outer.child1_index, "_process286", args);
Ethan Nicholasff4fb332019-04-09 16:28:19 -040029 }
Ethan Nicholas0364bde2019-05-02 16:16:30 -040030 fragBuilder->codeAppendf("half4 _process355;");
Ethan Nicholasff4fb332019-04-09 16:28:19 -040031 if (_outer.child2_index >= 0) {
Ethan Nicholas0364bde2019-05-02 16:16:30 -040032 this->invokeChild(_outer.child2_index, "_process355", args);
Ethan Nicholasff4fb332019-04-09 16:28:19 -040033 }
Ethan Nicholas0364bde2019-05-02 16:16:30 -040034 fragBuilder->codeAppendf("half4 _process407;");
35 this->invokeChild(_outer.lerp_index, "_process407", args);
36 fragBuilder->codeAppendf(
37 "%s = mix(%s ? _process286 : %s, %s ? _process355 : %s, _process407.x);\n",
38 args.fOutputColor, _outer.child1_index >= 0 ? "true" : "false", args.fInputColor,
39 _outer.child2_index >= 0 ? "true" : "false", args.fInputColor);
Ethan Nicholasff4fb332019-04-09 16:28:19 -040040 }
41
42private:
43 void onSetData(const GrGLSLProgramDataManager& pdman,
44 const GrFragmentProcessor& _proc) override {}
45};
46GrGLSLFragmentProcessor* GrComposeLerpRedEffect::onCreateGLSLInstance() const {
47 return new GrGLSLComposeLerpRedEffect();
48}
49void GrComposeLerpRedEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps,
50 GrProcessorKeyBuilder* b) const {}
51bool GrComposeLerpRedEffect::onIsEqual(const GrFragmentProcessor& other) const {
52 const GrComposeLerpRedEffect& that = other.cast<GrComposeLerpRedEffect>();
53 (void)that;
54 return true;
55}
56GrComposeLerpRedEffect::GrComposeLerpRedEffect(const GrComposeLerpRedEffect& src)
57 : INHERITED(kGrComposeLerpRedEffect_ClassID, src.optimizationFlags())
58 , child1_index(src.child1_index)
59 , child2_index(src.child2_index)
60 , lerp_index(src.lerp_index) {
61 if (child1_index >= 0) {
62 this->registerChildProcessor(src.childProcessor(child1_index).clone());
63 }
64 if (child2_index >= 0) {
65 this->registerChildProcessor(src.childProcessor(child2_index).clone());
66 }
67 this->registerChildProcessor(src.childProcessor(lerp_index).clone());
68}
69std::unique_ptr<GrFragmentProcessor> GrComposeLerpRedEffect::clone() const {
70 return std::unique_ptr<GrFragmentProcessor>(new GrComposeLerpRedEffect(*this));
71}