68 lines
3.2 KiB
C++
68 lines
3.2 KiB
C++
|
|
||
|
|
||
|
/**************************************************************************************************
|
||
|
*** This file was autogenerated from GrDSLFPTest_IfStatement.fp; do not modify.
|
||
|
**************************************************************************************************/
|
||
|
/* TODO(skia:11854): DSLCPPCodeGenerator is currently a work in progress. */
|
||
|
#include "GrDSLFPTest_IfStatement.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_IfStatement : public GrGLSLFragmentProcessor {
|
||
|
public:
|
||
|
GrGLSLDSLFPTest_IfStatement() {}
|
||
|
void emitCode(EmitArgs& args) override {
|
||
|
const GrDSLFPTest_IfStatement& _outer = args.fFp.cast<GrDSLFPTest_IfStatement>();
|
||
|
(void) _outer;
|
||
|
|
||
|
using namespace SkSL::dsl;
|
||
|
StartFragmentProcessor(this, &args);
|
||
|
Var color(kNo_Modifier, DSLType(kHalf4_Type), "color", Half4(0.0));
|
||
|
Declare(color);
|
||
|
If(Swizzle(color, X, Y) == Swizzle(color, Z, W), /*Then:*/ color.w() = 1.0);
|
||
|
If(Swizzle(color, X, Y) == Swizzle(color, Z, W), /*Then:*/ Block(color.x() = color.w()));
|
||
|
If(color.x() == color.y(), /*Then:*/ color = Swizzle(color, W, X, W, W), /*Else:*/ color = Swizzle(color, X, X, X, W));
|
||
|
If(((color.x() + color.y()) + color.z()) + color.w() == 1.0, /*Then:*/ Block(color = Half4(-1.0)), /*Else:*/ If(((color.x() + color.y()) + color.z()) + color.w() == 2.0, /*Then:*/ Block(color = Half4(-2.0)), /*Else:*/ Block(color = Swizzle(color, Y, Y, W, W))));
|
||
|
If(color.x() == 1.0, /*Then:*/ Block(If(color.x() == 2.0, /*Then:*/ Block(color = Swizzle(color, X, X, X, X)), /*Else:*/ Block(color = Swizzle(color, Y, Y, Y, Y)))), /*Else:*/ Block(If(color.z() * color.w() == 1.0, /*Then:*/ Block(color = Swizzle(color, X, Z, Y, W)), /*Else:*/ Block(color = Swizzle(color, W, W, W, W)))));
|
||
|
Return(color);
|
||
|
EndFragmentProcessor();
|
||
|
}
|
||
|
private:
|
||
|
void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
|
||
|
}
|
||
|
};
|
||
|
std::unique_ptr<GrGLSLFragmentProcessor> GrDSLFPTest_IfStatement::onMakeProgramImpl() const {
|
||
|
return std::make_unique<GrGLSLDSLFPTest_IfStatement>();
|
||
|
}
|
||
|
void GrDSLFPTest_IfStatement::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
|
||
|
}
|
||
|
bool GrDSLFPTest_IfStatement::onIsEqual(const GrFragmentProcessor& other) const {
|
||
|
const GrDSLFPTest_IfStatement& that = other.cast<GrDSLFPTest_IfStatement>();
|
||
|
(void) that;
|
||
|
return true;
|
||
|
}
|
||
|
GrDSLFPTest_IfStatement::GrDSLFPTest_IfStatement(const GrDSLFPTest_IfStatement& src)
|
||
|
: INHERITED(kGrDSLFPTest_IfStatement_ClassID, src.optimizationFlags()) {
|
||
|
this->cloneAndRegisterAllChildProcessors(src);
|
||
|
}
|
||
|
std::unique_ptr<GrFragmentProcessor> GrDSLFPTest_IfStatement::clone() const {
|
||
|
return std::make_unique<GrDSLFPTest_IfStatement>(*this);
|
||
|
}
|
||
|
#if GR_TEST_UTILS
|
||
|
SkString GrDSLFPTest_IfStatement::onDumpInfo() const {
|
||
|
return SkString();
|
||
|
}
|
||
|
#endif
|