1dcf46359c
This was almost right, but was missing the trailing () to make a function call. Change-Id: I1215a97bb0ac39aceca8ff6bea70af8ff572ef84 Bug: skia:11854 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/400541 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
71 lines
2.9 KiB
C++
71 lines
2.9 KiB
C++
|
|
|
|
/**************************************************************************************************
|
|
*** This file was autogenerated from GrDSLFPTest_DoStatement.fp; do not modify.
|
|
**************************************************************************************************/
|
|
/* TODO(skia:11854): DSLCPPCodeGenerator is currently a work in progress. */
|
|
#include "GrDSLFPTest_DoStatement.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"
|
|
#include "src/sksl/dsl/priv/DSLFPs.h"
|
|
#include "src/sksl/dsl/priv/DSLWriter.h"
|
|
|
|
#if defined(__clang__)
|
|
#pragma clang diagnostic ignored "-Wcomma"
|
|
#endif
|
|
|
|
class GrGLSLDSLFPTest_DoStatement : public GrGLSLFragmentProcessor {
|
|
public:
|
|
GrGLSLDSLFPTest_DoStatement() {}
|
|
void emitCode(EmitArgs& args) override {
|
|
const GrDSLFPTest_DoStatement& _outer = args.fFp.cast<GrDSLFPTest_DoStatement>();
|
|
(void) _outer;
|
|
|
|
using namespace SkSL::dsl;
|
|
StartFragmentProcessor(this, &args);
|
|
Var shouldLoop(kConst_Modifier, DSLType(kBool_Type), "shouldLoop", Bool(!!(_outer.shouldLoop)));
|
|
Declare(shouldLoop);
|
|
Var color(kNo_Modifier, DSLType(kHalf4_Type), "color", Half4(1.0, 1.0, 1.0, 1.0));
|
|
Declare(color);
|
|
Do(color.x() -= 0.25, /*While:*/ shouldLoop);
|
|
Do(Block(color.x() -= 0.25, If(color.x() <= 0.0, /*Then:*/ Break())), /*While:*/ color.w() == 1.0);
|
|
Do(Block(color.z() -= 0.25, If(color.w() == 1.0 || sk_Caps.builtinFMASupport(), /*Then:*/ Continue()), color.y() = 0.0), /*While:*/ color.z() > 0.0);
|
|
Return(color);
|
|
EndFragmentProcessor();
|
|
}
|
|
private:
|
|
void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
|
|
}
|
|
};
|
|
std::unique_ptr<GrGLSLFragmentProcessor> GrDSLFPTest_DoStatement::onMakeProgramImpl() const {
|
|
return std::make_unique<GrGLSLDSLFPTest_DoStatement>();
|
|
}
|
|
void GrDSLFPTest_DoStatement::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
|
|
b->addBool(shouldLoop, "shouldLoop");
|
|
}
|
|
bool GrDSLFPTest_DoStatement::onIsEqual(const GrFragmentProcessor& other) const {
|
|
const GrDSLFPTest_DoStatement& that = other.cast<GrDSLFPTest_DoStatement>();
|
|
(void) that;
|
|
if (shouldLoop != that.shouldLoop) return false;
|
|
return true;
|
|
}
|
|
GrDSLFPTest_DoStatement::GrDSLFPTest_DoStatement(const GrDSLFPTest_DoStatement& src)
|
|
: INHERITED(kGrDSLFPTest_DoStatement_ClassID, src.optimizationFlags())
|
|
, shouldLoop(src.shouldLoop) {
|
|
this->cloneAndRegisterAllChildProcessors(src);
|
|
}
|
|
std::unique_ptr<GrFragmentProcessor> GrDSLFPTest_DoStatement::clone() const {
|
|
return std::make_unique<GrDSLFPTest_DoStatement>(*this);
|
|
}
|
|
#if GR_TEST_UTILS
|
|
SkString GrDSLFPTest_DoStatement::onDumpInfo() const {
|
|
return SkStringPrintf("(shouldLoop=%d)", !!(shouldLoop));
|
|
}
|
|
#endif
|