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 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 GrGLSLPremulInputFragmentProcessor : public GrGLSLFragmentProcessor { 20 public: GrGLSLPremulInputFragmentProcessor()21 GrGLSLPremulInputFragmentProcessor() {} emitCode(EmitArgs & args)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, args.fInputColor, 28 args.fOutputColor, args.fInputColor); 29 } 30 31 private: onSetData(const GrGLSLProgramDataManager & pdman,const GrFragmentProcessor & _proc)32 void onSetData(const GrGLSLProgramDataManager& pdman, 33 const GrFragmentProcessor& _proc) override {} 34 }; onCreateGLSLInstance() const35GrGLSLFragmentProcessor* GrPremulInputFragmentProcessor::onCreateGLSLInstance() const { 36 return new GrGLSLPremulInputFragmentProcessor(); 37 } onGetGLSLProcessorKey(const GrShaderCaps & caps,GrProcessorKeyBuilder * b) const38void GrPremulInputFragmentProcessor::onGetGLSLProcessorKey(const GrShaderCaps& caps, 39 GrProcessorKeyBuilder* b) const {} onIsEqual(const GrFragmentProcessor & other) const40bool GrPremulInputFragmentProcessor::onIsEqual(const GrFragmentProcessor& other) const { 41 const GrPremulInputFragmentProcessor& that = other.cast<GrPremulInputFragmentProcessor>(); 42 (void)that; 43 return true; 44 } GrPremulInputFragmentProcessor(const GrPremulInputFragmentProcessor & src)45GrPremulInputFragmentProcessor::GrPremulInputFragmentProcessor( 46 const GrPremulInputFragmentProcessor& src) 47 : INHERITED(kGrPremulInputFragmentProcessor_ClassID, src.optimizationFlags()) {} clone() const48std::unique_ptr<GrFragmentProcessor> GrPremulInputFragmentProcessor::clone() const { 49 return std::unique_ptr<GrFragmentProcessor>(new GrPremulInputFragmentProcessor(*this)); 50 } 51