Brian Salomon | 6422722 | 2020-02-26 13:28:42 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2020 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 GrDeviceSpaceEffect.fp; do not modify. |
| 10 | **************************************************************************************************/ |
| 11 | #include "GrDeviceSpaceEffect.h" |
| 12 | |
Greg Daniel | 456f9b5 | 2020-03-05 19:14:18 +0000 | [diff] [blame] | 13 | #include "src/gpu/GrTexture.h" |
Brian Salomon | 6422722 | 2020-02-26 13:28:42 -0500 | [diff] [blame] | 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 GrGLSLDeviceSpaceEffect : public GrGLSLFragmentProcessor { |
| 20 | public: |
| 21 | GrGLSLDeviceSpaceEffect() {} |
| 22 | void emitCode(EmitArgs& args) override { |
| 23 | GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; |
| 24 | const GrDeviceSpaceEffect& _outer = args.fFp.cast<GrDeviceSpaceEffect>(); |
| 25 | (void)_outer; |
Michael Ludwig | e2d67ce | 2020-06-26 10:11:43 -0400 | [diff] [blame] | 26 | SkString _input203(args.fInputColor); |
| 27 | SkString _coords203("sk_FragCoord.xy"); |
| 28 | SkString _sample203; |
| 29 | _sample203 = |
| 30 | this->invokeChild(_outer.fp_index, _input203.c_str(), args, _coords203.c_str()); |
John Stiles | 5081942 | 2020-06-18 13:00:38 -0400 | [diff] [blame] | 31 | fragBuilder->codeAppendf( |
Michael Ludwig | e2d67ce | 2020-06-26 10:11:43 -0400 | [diff] [blame] | 32 | R"SkSL(%s = %s; |
John Stiles | 5081942 | 2020-06-18 13:00:38 -0400 | [diff] [blame] | 33 | )SkSL", |
Michael Ludwig | e2d67ce | 2020-06-26 10:11:43 -0400 | [diff] [blame] | 34 | args.fOutputColor, _sample203.c_str()); |
Brian Salomon | 6422722 | 2020-02-26 13:28:42 -0500 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | private: |
| 38 | void onSetData(const GrGLSLProgramDataManager& pdman, |
Michael Ludwig | e2d67ce | 2020-06-26 10:11:43 -0400 | [diff] [blame] | 39 | const GrFragmentProcessor& _proc) override {} |
Brian Salomon | 6422722 | 2020-02-26 13:28:42 -0500 | [diff] [blame] | 40 | }; |
| 41 | GrGLSLFragmentProcessor* GrDeviceSpaceEffect::onCreateGLSLInstance() const { |
| 42 | return new GrGLSLDeviceSpaceEffect(); |
| 43 | } |
| 44 | void GrDeviceSpaceEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, |
| 45 | GrProcessorKeyBuilder* b) const {} |
| 46 | bool GrDeviceSpaceEffect::onIsEqual(const GrFragmentProcessor& other) const { |
| 47 | const GrDeviceSpaceEffect& that = other.cast<GrDeviceSpaceEffect>(); |
| 48 | (void)that; |
| 49 | return true; |
| 50 | } |
| 51 | GrDeviceSpaceEffect::GrDeviceSpaceEffect(const GrDeviceSpaceEffect& src) |
Michael Ludwig | e2d67ce | 2020-06-26 10:11:43 -0400 | [diff] [blame] | 52 | : INHERITED(kGrDeviceSpaceEffect_ClassID, src.optimizationFlags()) { |
John Stiles | 3779f44 | 2020-06-15 10:48:49 -0400 | [diff] [blame] | 53 | { fp_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.fp_index)); } |
Brian Salomon | 6422722 | 2020-02-26 13:28:42 -0500 | [diff] [blame] | 54 | } |
| 55 | std::unique_ptr<GrFragmentProcessor> GrDeviceSpaceEffect::clone() const { |
| 56 | return std::unique_ptr<GrFragmentProcessor>(new GrDeviceSpaceEffect(*this)); |
| 57 | } |
| 58 | GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDeviceSpaceEffect); |
| 59 | #if GR_TEST_UTILS |
| 60 | std::unique_ptr<GrFragmentProcessor> GrDeviceSpaceEffect::TestCreate(GrProcessorTestData* d) { |
Brian Osman | 609f159 | 2020-07-01 15:14:39 -0400 | [diff] [blame^] | 61 | return GrDeviceSpaceEffect::Make(GrProcessorUnitTest::MakeChildFP(d)); |
Brian Salomon | 6422722 | 2020-02-26 13:28:42 -0500 | [diff] [blame] | 62 | } |
| 63 | #endif |