| 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 | |
| 13 | #include "src/core/SkUtils.h" |
| 14 | #include "src/gpu/GrTexture.h" |
| 15 | #include "src/gpu/glsl/GrGLSLFragmentProcessor.h" |
| 16 | #include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h" |
| 17 | #include "src/gpu/glsl/GrGLSLProgramBuilder.h" |
| 18 | #include "src/sksl/SkSLCPP.h" |
| 19 | #include "src/sksl/SkSLUtil.h" |
| 20 | class GrGLSLDeviceSpaceEffect : public GrGLSLFragmentProcessor { |
| 21 | public: |
| 22 | GrGLSLDeviceSpaceEffect() {} |
| 23 | void emitCode(EmitArgs& args) override { |
| 24 | GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; |
| 25 | const GrDeviceSpaceEffect& _outer = args.fFp.cast<GrDeviceSpaceEffect>(); |
| 26 | (void)_outer; |
| 27 | SkString _coords203("sk_FragCoord.xy"); |
| 28 | SkString _sample203 = this->invokeChild(0, args, _coords203.c_str()); |
| 29 | fragBuilder->codeAppendf( |
| 30 | R"SkSL(%s = %s; |
| 31 | )SkSL", |
| 32 | args.fOutputColor, _sample203.c_str()); |
| 33 | } |
| 34 | |
| 35 | private: |
| 36 | void onSetData(const GrGLSLProgramDataManager& pdman, |
| 37 | const GrFragmentProcessor& _proc) override {} |
| 38 | }; |
| 39 | GrGLSLFragmentProcessor* GrDeviceSpaceEffect::onCreateGLSLInstance() const { |
| 40 | return new GrGLSLDeviceSpaceEffect(); |
| 41 | } |
| 42 | void GrDeviceSpaceEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, |
| 43 | GrProcessorKeyBuilder* b) const {} |
| 44 | bool GrDeviceSpaceEffect::onIsEqual(const GrFragmentProcessor& other) const { |
| 45 | const GrDeviceSpaceEffect& that = other.cast<GrDeviceSpaceEffect>(); |
| 46 | (void)that; |
| 47 | return true; |
| 48 | } |
| 49 | GrDeviceSpaceEffect::GrDeviceSpaceEffect(const GrDeviceSpaceEffect& src) |
| 50 | : INHERITED(kGrDeviceSpaceEffect_ClassID, src.optimizationFlags()) { |
| 51 | this->cloneAndRegisterAllChildProcessors(src); |
| 52 | } |
| 53 | std::unique_ptr<GrFragmentProcessor> GrDeviceSpaceEffect::clone() const { |
| 54 | return std::make_unique<GrDeviceSpaceEffect>(*this); |
| 55 | } |
| 56 | #if GR_TEST_UTILS |
| 57 | SkString GrDeviceSpaceEffect::onDumpInfo() const { return SkString(); } |
| 58 | #endif |
| 59 | GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDeviceSpaceEffect); |
| 60 | #if GR_TEST_UTILS |
| 61 | std::unique_ptr<GrFragmentProcessor> GrDeviceSpaceEffect::TestCreate(GrProcessorTestData* d) { |
| 62 | return GrDeviceSpaceEffect::Make(GrProcessorUnitTest::MakeChildFP(d)); |
| 63 | } |
| 64 | #endif |
| 65 |