1 /*
2  * Copyright 2018 Google Inc.
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 GrPremulInputFragmentProcessor.fp; do not modify.
10  **************************************************************************************************/
11 #include "GrPremulInputFragmentProcessor.h"
12 #if SK_SUPPORT_GPU
13 #include "glsl/GrGLSLFragmentProcessor.h"
14 #include "glsl/GrGLSLFragmentShaderBuilder.h"
15 #include "glsl/GrGLSLProgramBuilder.h"
16 #include "GrTexture.h"
17 #include "SkSLCPP.h"
18 #include "SkSLUtil.h"
19 class GrGLSLPremulInputFragmentProcessor : public GrGLSLFragmentProcessor {
20 public:
21     GrGLSLPremulInputFragmentProcessor() {}
22     void emitCode(EmitArgs& args) override {
23         GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
24         const GrPremulInputFragmentProcessor& _outer =
25                 args.fFp.cast<GrPremulInputFragmentProcessor>();
26         (void)_outer;
27         fragBuilder->codeAppendf("%s = %s;\n%s.xyz *= %s.w;\n", args.fOutputColor,
28                                  args.fInputColor ? args.fInputColor : "half4(1)",
29                                  args.fOutputColor,
30                                  args.fInputColor ? args.fInputColor : "half4(1)");
31     }
32 
33 private:
34     void onSetData(const GrGLSLProgramDataManager& pdman,
35                    const GrFragmentProcessor& _proc) override {}
36 };
37 GrGLSLFragmentProcessor* GrPremulInputFragmentProcessor::onCreateGLSLInstance() const {
38     return new GrGLSLPremulInputFragmentProcessor();
39 }
40 void GrPremulInputFragmentProcessor::onGetGLSLProcessorKey(const GrShaderCaps& caps,
41                                                            GrProcessorKeyBuilder* b) const {}
42 bool GrPremulInputFragmentProcessor::onIsEqual(const GrFragmentProcessor& other) const {
43     const GrPremulInputFragmentProcessor& that = other.cast<GrPremulInputFragmentProcessor>();
44     (void)that;
45     return true;
46 }
47 GrPremulInputFragmentProcessor::GrPremulInputFragmentProcessor(
48         const GrPremulInputFragmentProcessor& src)
49         : INHERITED(kGrPremulInputFragmentProcessor_ClassID, src.optimizationFlags()) {}
50 std::unique_ptr<GrFragmentProcessor> GrPremulInputFragmentProcessor::clone() const {
51     return std::unique_ptr<GrFragmentProcessor>(new GrPremulInputFragmentProcessor(*this));
52 }
53 #endif
54