1
2
3 /**************************************************************************************************
4 *** This file was autogenerated from GrKeyIn.fp; do not modify.
5 **************************************************************************************************/
6 #include "GrKeyIn.h"
7
8 #include "src/core/SkUtils.h"
9 #include "src/gpu/GrTexture.h"
10 #include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
11 #include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
12 #include "src/gpu/glsl/GrGLSLProgramBuilder.h"
13 #include "src/sksl/SkSLCPP.h"
14 #include "src/sksl/SkSLUtil.h"
15 class GrGLSLKeyIn : public GrGLSLFragmentProcessor {
16 public:
GrGLSLKeyIn()17 GrGLSLKeyIn() {}
emitCode(EmitArgs & args)18 void emitCode(EmitArgs& args) override {
19 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
20 const GrKeyIn& _outer = args.fFp.cast<GrKeyIn>();
21 (void) _outer;
22 auto color = _outer.color;
23 (void) color;
24 fragBuilder->codeAppendf(
25 R"SkSL(return half4(%f, %f, %f, %f);
26 )SkSL"
27 , _outer.color.left(), _outer.color.top(), _outer.color.right(), _outer.color.bottom());
28 }
29 private:
onSetData(const GrGLSLProgramDataManager & pdman,const GrFragmentProcessor & _proc)30 void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
31 }
32 };
onMakeProgramImpl() const33 std::unique_ptr<GrGLSLFragmentProcessor> GrKeyIn::onMakeProgramImpl() const {
34 return std::make_unique<GrGLSLKeyIn>();
35 }
onGetGLSLProcessorKey(const GrShaderCaps & caps,GrProcessorKeyBuilder * b) const36 void GrKeyIn::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
37 uint16_t red = SkFloatToHalf(color.fR);
38 uint16_t green = SkFloatToHalf(color.fG);
39 uint16_t blue = SkFloatToHalf(color.fB);
40 uint16_t alpha = SkFloatToHalf(color.fA);
41 b->add32(((uint32_t)red << 16) | green, "color.rg");
42 b->add32(((uint32_t)blue << 16) | alpha, "color.ba");
43 }
onIsEqual(const GrFragmentProcessor & other) const44 bool GrKeyIn::onIsEqual(const GrFragmentProcessor& other) const {
45 const GrKeyIn& that = other.cast<GrKeyIn>();
46 (void) that;
47 if (color != that.color) return false;
48 return true;
49 }
GrKeyIn(const GrKeyIn & src)50 GrKeyIn::GrKeyIn(const GrKeyIn& src)
51 : INHERITED(kGrKeyIn_ClassID, src.optimizationFlags())
52 , color(src.color) {
53 this->cloneAndRegisterAllChildProcessors(src);
54 }
clone() const55 std::unique_ptr<GrFragmentProcessor> GrKeyIn::clone() const {
56 return std::make_unique<GrKeyIn>(*this);
57 }
58 #if GR_TEST_UTILS
onDumpInfo() const59 SkString GrKeyIn::onDumpInfo() const {
60 return SkStringPrintf("(color=half4(%f, %f, %f, %f))", color.left(), color.top(), color.right(), color.bottom());
61 }
62 #endif
63