skia2/tests/sksl/fp/GrNonInlinedInUniform.cpp
Brian Osman fa6a127310 Large simplification of the CType mapper logic in SkSL
- Arrays were unused
- Each ctype was used with exactly one mapper - remove the SkSL type
  list
- After that, the mapper was just a key + value, so make it just a value
  and use a map (rather than vector)

Change-Id: Ibc150ecc9ac9724ecd1e7056614ca5836ce99d5b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/409998
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-05-18 21:40:14 +00:00

63 lines
2.5 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>();
{
pdman.set2f(pointVar, _outer.point.fX, _outer.point.fY);
}
}
UniformHandle pointVar;
};
std::unique_ptr<GrGLSLFragmentProcessor> GrNonInlinedInUniform::onMakeProgramImpl() const {
return std::make_unique<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