skia2/tests/sksl/fp/GrNonInlinedInUniform.cpp
John Stiles bfc9be0f77 Migrate SkSL test inputs to the resources/ directory.
This will allow us to load these inputs for unit testing in `dm`.

Change-Id: Id256ba7c30d3ec94b98048e47af44cf9efe580d5
Bug: skia:11009
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357282
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-01-22 18:57:29 +00:00

64 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(return half4(%s, %s);
)SkSL"
, 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;
}
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