skia2/tests/sksl/fp/golden/GrNonInlinedInUniform.cpp
John Stiles 6dc5265ae6 Migrate several SkSLFP tests to golden outputs.
Change-Id: I83a38f2c953a560fea3483e95e31df532b90773e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317456
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-17 16:46:18 +00:00

67 lines
2.6 KiB
C++

/**************************************************************************************************
*** This file was autogenerated from GrNonInlinedInUniform.fp; do not modify.
**************************************************************************************************/
#include "GrNonInlinedInUniform.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 GrGLSLNonInlinedInUniform : public GrGLSLFragmentProcessor {
public:
GrGLSLNonInlinedInUniform() {}
void emitCode(EmitArgs& args) override {
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
const GrNonInlinedInUniform& _outer = args.fFp.cast<GrNonInlinedInUniform>();
(void) _outer;
auto point = _outer.point;
(void) point;
pointVar = args.fUniformHandler->addUniform(&_outer, kFragment_GrShaderFlag, kHalf2_GrSLType, "point");
fragBuilder->codeAppendf(
R"SkSL(%s = half4(%s, %s);
)SkSL"
, args.fOutputColor, args.fUniformHandler->getUniformCStr(pointVar), args.fUniformHandler->getUniformCStr(pointVar));
}
private:
void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
const GrNonInlinedInUniform& _outer = _proc.cast<GrNonInlinedInUniform>();
{
const SkPoint& pointValue = _outer.point;
pdman.set2f(pointVar, pointValue.fX, pointValue.fY);
}
}
UniformHandle pointVar;
};
GrGLSLFragmentProcessor* GrNonInlinedInUniform::onCreateGLSLInstance() const {
return new GrGLSLNonInlinedInUniform();
}
void GrNonInlinedInUniform::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
}
bool GrNonInlinedInUniform::onIsEqual(const GrFragmentProcessor& other) const {
const GrNonInlinedInUniform& that = other.cast<GrNonInlinedInUniform>();
(void) that;
if (point != that.point) return false;
return true;
}
bool GrNonInlinedInUniform::usesExplicitReturn() const {
return false;
}
GrNonInlinedInUniform::GrNonInlinedInUniform(const GrNonInlinedInUniform& src)
: INHERITED(kGrNonInlinedInUniform_ClassID, src.optimizationFlags())
, point(src.point) {
this->cloneAndRegisterAllChildProcessors(src);
}
std::unique_ptr<GrFragmentProcessor> GrNonInlinedInUniform::clone() const {
return std::make_unique<GrNonInlinedInUniform>(*this);
}
#if GR_TEST_UTILS
SkString GrNonInlinedInUniform::onDumpInfo() const {
return SkStringPrintf("(point=half2(%f, %f))", point.fX, point.fY);
}
#endif