1 
2 
3 /**************************************************************************************************
4  *** This file was autogenerated from GrDSLFPTest_WhileStatement.fp; do not modify.
5  **************************************************************************************************/
6 /* TODO(skia:11854): DSLCPPCodeGenerator is currently a work in progress. */
7 #include "GrDSLFPTest_WhileStatement.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_WhileStatement : public GrGLSLFragmentProcessor {
20 public:
GrGLSLDSLFPTest_WhileStatement()21     GrGLSLDSLFPTest_WhileStatement() {}
emitCode(EmitArgs & args)22     void emitCode(EmitArgs& args) override {
23         [[maybe_unused]] const GrDSLFPTest_WhileStatement& _outer = args.fFp.cast<GrDSLFPTest_WhileStatement>();
24 
25         using namespace SkSL::dsl;
26         StartFragmentProcessor(this, &args);
27 Var _color(kNo_Modifier, DSLType(kHalf4_Type), "color", Half4(1.0f));
28 Declare(_color);
29 While(_color.x() > 0.5f, _color.x() -= 0.25f);
30 While(_color.w() == 1.0f, Block(_color.x() -= 0.25f, If(_color.x() <= 0.0f, /*Then:*/ Break())));
31 While(_color.z() > 0.0f, Block(_color.z() -= 0.25f, If(_color.w() == 1.0f, /*Then:*/ Continue()), _color.y() = 0.0f));
32 Return(_color);
33         EndFragmentProcessor();
34     }
35 private:
onSetData(const GrGLSLProgramDataManager & pdman,const GrFragmentProcessor & _proc)36     void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
37     }
38 };
onMakeProgramImpl() const39 std::unique_ptr<GrGLSLFragmentProcessor> GrDSLFPTest_WhileStatement::onMakeProgramImpl() const {
40     return std::make_unique<GrGLSLDSLFPTest_WhileStatement>();
41 }
onGetGLSLProcessorKey(const GrShaderCaps & caps,GrProcessorKeyBuilder * b) const42 void GrDSLFPTest_WhileStatement::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
43 }
onIsEqual(const GrFragmentProcessor & other) const44 bool GrDSLFPTest_WhileStatement::onIsEqual(const GrFragmentProcessor& other) const {
45     const GrDSLFPTest_WhileStatement& that = other.cast<GrDSLFPTest_WhileStatement>();
46     (void) that;
47     return true;
48 }
GrDSLFPTest_WhileStatement(const GrDSLFPTest_WhileStatement & src)49 GrDSLFPTest_WhileStatement::GrDSLFPTest_WhileStatement(const GrDSLFPTest_WhileStatement& src)
50 : INHERITED(kGrDSLFPTest_WhileStatement_ClassID, src.optimizationFlags()) {
51         this->cloneAndRegisterAllChildProcessors(src);
52 }
clone() const53 std::unique_ptr<GrFragmentProcessor> GrDSLFPTest_WhileStatement::clone() const {
54     return std::make_unique<GrDSLFPTest_WhileStatement>(*this);
55 }
56 #if GR_TEST_UTILS
onDumpInfo() const57 SkString GrDSLFPTest_WhileStatement::onDumpInfo() const {
58     return SkString();
59 }
60 #endif
61