• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 
3 /**************************************************************************************************
4  *** This file was autogenerated from GrInUniform.fp; do not modify.
5  **************************************************************************************************/
6 #include "GrInUniform.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 GrGLSLInUniform : public GrGLSLFragmentProcessor {
16 public:
GrGLSLInUniform()17     GrGLSLInUniform() {}
emitCode(EmitArgs & args)18     void emitCode(EmitArgs& args) override {
19         GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
20         const GrInUniform& _outer = args.fFp.cast<GrInUniform>();
21         (void) _outer;
22         auto color = _outer.color;
23         (void) color;
24         colorVar = args.fUniformHandler->addUniform(&_outer, kFragment_GrShaderFlag, kHalf4_GrSLType, "color");
25         fragBuilder->codeAppendf(
26 R"SkSL(return %s;
27 )SkSL"
28 , args.fUniformHandler->getUniformCStr(colorVar));
29     }
30 private:
onSetData(const GrGLSLProgramDataManager & pdman,const GrFragmentProcessor & _proc)31     void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
32         const GrInUniform& _outer = _proc.cast<GrInUniform>();
33         {
34         pdman.set4fv(colorVar, 1, reinterpret_cast<const float*>(&(_outer.color)));
35         }
36     }
37     UniformHandle colorVar;
38 };
onMakeProgramImpl() const39 std::unique_ptr<GrGLSLFragmentProcessor> GrInUniform::onMakeProgramImpl() const {
40     return std::make_unique<GrGLSLInUniform>();
41 }
onGetGLSLProcessorKey(const GrShaderCaps & caps,GrProcessorKeyBuilder * b) const42 void GrInUniform::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
43 }
onIsEqual(const GrFragmentProcessor & other) const44 bool GrInUniform::onIsEqual(const GrFragmentProcessor& other) const {
45     const GrInUniform& that = other.cast<GrInUniform>();
46     (void) that;
47     if (color != that.color) return false;
48     return true;
49 }
GrInUniform(const GrInUniform & src)50 GrInUniform::GrInUniform(const GrInUniform& src)
51 : INHERITED(kGrInUniform_ClassID, src.optimizationFlags())
52 , color(src.color) {
53         this->cloneAndRegisterAllChildProcessors(src);
54 }
clone() const55 std::unique_ptr<GrFragmentProcessor> GrInUniform::clone() const {
56     return std::make_unique<GrInUniform>(*this);
57 }
58 #if GR_TEST_UTILS
onDumpInfo() const59 SkString GrInUniform::onDumpInfo() const {
60     return SkStringPrintf("(color=half4(%f, %f, %f, %f))", color.left(), color.top(), color.right(), color.bottom());
61 }
62 #endif
63