| |
| |
| /************************************************************************************************** |
| *** This file was autogenerated from GrInUniformCType.fp; do not modify. |
| **************************************************************************************************/ |
| #include "GrInUniformCType.h" |
| |
| #include "src/core/SkUtils.h" |
| #include "src/gpu/GrTexture.h" |
| #include "src/gpu/glsl/GrGLSLFragmentProcessor.h" |
| #include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h" |
| #include "src/gpu/glsl/GrGLSLProgramBuilder.h" |
| #include "src/sksl/SkSLCPP.h" |
| #include "src/sksl/SkSLUtil.h" |
| class GrGLSLInUniformCType : public GrGLSLFragmentProcessor { |
| public: |
| GrGLSLInUniformCType() {} |
| void emitCode(EmitArgs& args) override { |
| GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; |
| const GrInUniformCType& _outer = args.fFp.cast<GrInUniformCType>(); |
| (void) _outer; |
| auto color = _outer.color; |
| (void) color; |
| colorVar = args.fUniformHandler->addUniform(&_outer, kFragment_GrShaderFlag, kHalf4_GrSLType, "color"); |
| fragBuilder->codeAppendf( |
| R"SkSL(return %s; |
| )SkSL" |
| , args.fUniformHandler->getUniformCStr(colorVar)); |
| } |
| private: |
| void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override { |
| const GrInUniformCType& _outer = _proc.cast<GrInUniformCType>(); |
| { |
| pdman.set4fv(colorVar, 1, (_outer.color).vec()); |
| } |
| } |
| UniformHandle colorVar; |
| }; |
| std::unique_ptr<GrGLSLFragmentProcessor> GrInUniformCType::onMakeProgramImpl() const { |
| return std::make_unique<GrGLSLInUniformCType>(); |
| } |
| void GrInUniformCType::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { |
| } |
| bool GrInUniformCType::onIsEqual(const GrFragmentProcessor& other) const { |
| const GrInUniformCType& that = other.cast<GrInUniformCType>(); |
| (void) that; |
| if (color != that.color) return false; |
| return true; |
| } |
| GrInUniformCType::GrInUniformCType(const GrInUniformCType& src) |
| : INHERITED(kGrInUniformCType_ClassID, src.optimizationFlags()) |
| , color(src.color) { |
| this->cloneAndRegisterAllChildProcessors(src); |
| } |
| std::unique_ptr<GrFragmentProcessor> GrInUniformCType::clone() const { |
| return std::make_unique<GrInUniformCType>(*this); |
| } |
| #if GR_TEST_UTILS |
| SkString GrInUniformCType::onDumpInfo() const { |
| return SkStringPrintf("(color=half4(%f, %f, %f, %f))", color.fR, color.fG, color.fB, color.fA); |
| } |
| #endif |