skia2/tests/sksl/fp/GrChildProcessorSampleMatrixMultipleUniforms.cpp

74 lines
4.0 KiB
C++
Raw Normal View History

/**************************************************************************************************
*** This file was autogenerated from GrChildProcessorSampleMatrixMultipleUniforms.fp; do not modify.
**************************************************************************************************/
#include "GrChildProcessorSampleMatrixMultipleUniforms.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 GrGLSLChildProcessorSampleMatrixMultipleUniforms : public GrGLSLFragmentProcessor {
public:
GrGLSLChildProcessorSampleMatrixMultipleUniforms() {}
void emitCode(EmitArgs& args) override {
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
const GrChildProcessorSampleMatrixMultipleUniforms& _outer = args.fFp.cast<GrChildProcessorSampleMatrixMultipleUniforms>();
(void) _outer;
auto matrixA = _outer.matrixA;
(void) matrixA;
auto matrixB = _outer.matrixB;
(void) matrixB;
matrixAVar = args.fUniformHandler->addUniform(&_outer, kFragment_GrShaderFlag, kFloat3x3_GrSLType, "matrixA");
matrixBVar = args.fUniformHandler->addUniform(&_outer, kFragment_GrShaderFlag, kFloat3x3_GrSLType, "matrixB");
SkString _matrix0(args.fUniformHandler->getUniformCStr(matrixAVar));
SkString _sample0 = this->invokeChildWithMatrix(0, args, _matrix0.c_str());
SkString _matrix1(args.fUniformHandler->getUniformCStr(matrixBVar));
SkString _sample1 = this->invokeChildWithMatrix(0, args, _matrix1.c_str());
fragBuilder->codeAppendf(
R"SkSL(return %s + %s;
)SkSL"
, _sample0.c_str(), _sample1.c_str());
}
private:
void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
const GrChildProcessorSampleMatrixMultipleUniforms& _outer = _proc.cast<GrChildProcessorSampleMatrixMultipleUniforms>();
{
static_assert(1 == 1); pdman.setSkMatrix(matrixAVar, (_outer.matrixA));
static_assert(1 == 1); pdman.setSkMatrix(matrixBVar, (_outer.matrixB));
}
}
UniformHandle matrixAVar;
UniformHandle matrixBVar;
};
std::unique_ptr<GrGLSLFragmentProcessor> GrChildProcessorSampleMatrixMultipleUniforms::onMakeProgramImpl() const {
return std::make_unique<GrGLSLChildProcessorSampleMatrixMultipleUniforms>();
}
void GrChildProcessorSampleMatrixMultipleUniforms::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
}
bool GrChildProcessorSampleMatrixMultipleUniforms::onIsEqual(const GrFragmentProcessor& other) const {
const GrChildProcessorSampleMatrixMultipleUniforms& that = other.cast<GrChildProcessorSampleMatrixMultipleUniforms>();
(void) that;
if (matrixA != that.matrixA) return false;
if (matrixB != that.matrixB) return false;
return true;
}
GrChildProcessorSampleMatrixMultipleUniforms::GrChildProcessorSampleMatrixMultipleUniforms(const GrChildProcessorSampleMatrixMultipleUniforms& src)
: INHERITED(kGrChildProcessorSampleMatrixMultipleUniforms_ClassID, src.optimizationFlags())
, matrixA(src.matrixA)
, matrixB(src.matrixB) {
this->cloneAndRegisterAllChildProcessors(src);
}
std::unique_ptr<GrFragmentProcessor> GrChildProcessorSampleMatrixMultipleUniforms::clone() const {
return std::make_unique<GrChildProcessorSampleMatrixMultipleUniforms>(*this);
}
#if GR_TEST_UTILS
SkString GrChildProcessorSampleMatrixMultipleUniforms::onDumpInfo() const {
return SkStringPrintf("(matrixA=float3x3(%f, %f, %f, %f, %f, %f, %f, %f, %f), matrixB=float3x3(%f, %f, %f, %f, %f, %f, %f, %f, %f))", matrixA.rc(0, 0), matrixA.rc(1, 0), matrixA.rc(2, 0), matrixA.rc(0, 1), matrixA.rc(1, 1), matrixA.rc(2, 1), matrixA.rc(0, 2), matrixA.rc(1, 2), matrixA.rc(2, 2), matrixB.rc(0, 0), matrixB.rc(1, 0), matrixB.rc(2, 0), matrixB.rc(0, 1), matrixB.rc(1, 1), matrixB.rc(2, 1), matrixB.rc(0, 2), matrixB.rc(1, 2), matrixB.rc(2, 2));
}
#endif