• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 
3 /**************************************************************************************************
4  *** This file was autogenerated from GrDSLFPTest_DoStatement.fp; do not modify.
5  **************************************************************************************************/
6 /* TODO(skia:11854): DSLCPPCodeGenerator is currently a work in progress. */
7 #include "GrDSLFPTest_DoStatement.h"
8 
9 #include "src/core/SkUtils.h"
10 #include "src/gpu/GrTexture.h"
11 #include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
12 #include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
13 #include "src/gpu/glsl/GrGLSLProgramBuilder.h"
14 #include "src/sksl/SkSLCPP.h"
15 #include "src/sksl/SkSLUtil.h"
16 #include "src/sksl/dsl/priv/DSLFPs.h"
17 #include "src/sksl/dsl/priv/DSLWriter.h"
18 
19 class GrGLSLDSLFPTest_DoStatement : public GrGLSLFragmentProcessor {
20 public:
GrGLSLDSLFPTest_DoStatement()21     GrGLSLDSLFPTest_DoStatement() {}
emitCode(EmitArgs & args)22     void emitCode(EmitArgs& args) override {
23         [[maybe_unused]] const GrDSLFPTest_DoStatement& _outer = args.fFp.cast<GrDSLFPTest_DoStatement>();
24 
25         using namespace SkSL::dsl;
26         StartFragmentProcessor(this, &args);
27 [[maybe_unused]] const auto& shouldLoop = _outer.shouldLoop;
28 Var _shouldLoop(kConst_Modifier, DSLType(kBool_Type), "shouldLoop", Bool(!!(shouldLoop)));
29 Declare(_shouldLoop);
30 Var _color(kNo_Modifier, DSLType(kHalf4_Type), "color", Half4(1.0f, 1.0f, 1.0f, 1.0f));
31 Declare(_color);
32 Do(_color.x() -= 0.25f, /*While:*/ _shouldLoop);
33 Do(Block(_color.x() -= 0.25f, If(_color.x() <= 0.0f, /*Then:*/ Break())), /*While:*/ _color.w() == 1.0f);
34 Do(Block(_color.z() -= 0.25f, If(_color.w() == 1.0f || sk_Caps.builtinFMASupport, /*Then:*/ Continue()), _color.y() = 0.0f), /*While:*/ _color.z() > 0.0f);
35 Return(_color);
36         EndFragmentProcessor();
37     }
38 private:
onSetData(const GrGLSLProgramDataManager & pdman,const GrFragmentProcessor & _proc)39     void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
40     }
41 };
onMakeProgramImpl() const42 std::unique_ptr<GrGLSLFragmentProcessor> GrDSLFPTest_DoStatement::onMakeProgramImpl() const {
43     return std::make_unique<GrGLSLDSLFPTest_DoStatement>();
44 }
onGetGLSLProcessorKey(const GrShaderCaps & caps,GrProcessorKeyBuilder * b) const45 void GrDSLFPTest_DoStatement::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
46     b->addBool(shouldLoop, "shouldLoop");
47 }
onIsEqual(const GrFragmentProcessor & other) const48 bool GrDSLFPTest_DoStatement::onIsEqual(const GrFragmentProcessor& other) const {
49     const GrDSLFPTest_DoStatement& that = other.cast<GrDSLFPTest_DoStatement>();
50     (void) that;
51     if (shouldLoop != that.shouldLoop) return false;
52     return true;
53 }
GrDSLFPTest_DoStatement(const GrDSLFPTest_DoStatement & src)54 GrDSLFPTest_DoStatement::GrDSLFPTest_DoStatement(const GrDSLFPTest_DoStatement& src)
55 : INHERITED(kGrDSLFPTest_DoStatement_ClassID, src.optimizationFlags())
56 , shouldLoop(src.shouldLoop) {
57         this->cloneAndRegisterAllChildProcessors(src);
58 }
clone() const59 std::unique_ptr<GrFragmentProcessor> GrDSLFPTest_DoStatement::clone() const {
60     return std::make_unique<GrDSLFPTest_DoStatement>(*this);
61 }
62 #if GR_TEST_UTILS
onDumpInfo() const63 SkString GrDSLFPTest_DoStatement::onDumpInfo() const {
64     return SkStringPrintf("(shouldLoop=%d)", !!(shouldLoop));
65 }
66 #endif
67