blob: af07aa4ca88accedbf414500b23640109452749f [file] [log] [blame]
Brian Salomon64227222020-02-26 13:28:42 -05001/*
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 Daniel456f9b52020-03-05 19:14:18 +000013#include "src/gpu/GrTexture.h"
Brian Salomon64227222020-02-26 13:28:42 -050014#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"
19class GrGLSLDeviceSpaceEffect : public GrGLSLFragmentProcessor {
20public:
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 Ludwige2d67ce2020-06-26 10:11:43 -040026 SkString _coords203("sk_FragCoord.xy");
Brian Osman6b5dbb42020-07-15 15:31:05 -040027 SkString _sample203 = this->invokeChild(0, args, _coords203.c_str());
John Stiles50819422020-06-18 13:00:38 -040028 fragBuilder->codeAppendf(
Michael Ludwige2d67ce2020-06-26 10:11:43 -040029 R"SkSL(%s = %s;
John Stiles50819422020-06-18 13:00:38 -040030)SkSL",
Michael Ludwige2d67ce2020-06-26 10:11:43 -040031 args.fOutputColor, _sample203.c_str());
Brian Salomon64227222020-02-26 13:28:42 -050032 }
33
34private:
35 void onSetData(const GrGLSLProgramDataManager& pdman,
Michael Ludwige2d67ce2020-06-26 10:11:43 -040036 const GrFragmentProcessor& _proc) override {}
Brian Salomon64227222020-02-26 13:28:42 -050037};
38GrGLSLFragmentProcessor* GrDeviceSpaceEffect::onCreateGLSLInstance() const {
39 return new GrGLSLDeviceSpaceEffect();
40}
41void GrDeviceSpaceEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps,
42 GrProcessorKeyBuilder* b) const {}
43bool GrDeviceSpaceEffect::onIsEqual(const GrFragmentProcessor& other) const {
44 const GrDeviceSpaceEffect& that = other.cast<GrDeviceSpaceEffect>();
45 (void)that;
46 return true;
47}
48GrDeviceSpaceEffect::GrDeviceSpaceEffect(const GrDeviceSpaceEffect& src)
Michael Ludwige2d67ce2020-06-26 10:11:43 -040049 : INHERITED(kGrDeviceSpaceEffect_ClassID, src.optimizationFlags()) {
Brian Osman12c5d292020-07-13 16:11:35 -040050 this->cloneAndRegisterAllChildProcessors(src);
Brian Salomon64227222020-02-26 13:28:42 -050051}
52std::unique_ptr<GrFragmentProcessor> GrDeviceSpaceEffect::clone() const {
53 return std::unique_ptr<GrFragmentProcessor>(new GrDeviceSpaceEffect(*this));
54}
55GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDeviceSpaceEffect);
56#if GR_TEST_UTILS
57std::unique_ptr<GrFragmentProcessor> GrDeviceSpaceEffect::TestCreate(GrProcessorTestData* d) {
Brian Osman609f1592020-07-01 15:14:39 -040058 return GrDeviceSpaceEffect::Make(GrProcessorUnitTest::MakeChildFP(d));
Brian Salomon64227222020-02-26 13:28:42 -050059}
60#endif