bfc9be0f77
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>
63 lines
2.3 KiB
C++
63 lines
2.3 KiB
C++
|
|
|
|
/**************************************************************************************************
|
|
*** This file was autogenerated from GrKeyIn.fp; do not modify.
|
|
**************************************************************************************************/
|
|
#include "GrKeyIn.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 GrGLSLKeyIn : public GrGLSLFragmentProcessor {
|
|
public:
|
|
GrGLSLKeyIn() {}
|
|
void emitCode(EmitArgs& args) override {
|
|
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
|
|
const GrKeyIn& _outer = args.fFp.cast<GrKeyIn>();
|
|
(void) _outer;
|
|
auto color = _outer.color;
|
|
(void) color;
|
|
fragBuilder->codeAppendf(
|
|
R"SkSL(return half4(%f, %f, %f, %f);
|
|
)SkSL"
|
|
, _outer.color.left(), _outer.color.top(), _outer.color.right(), _outer.color.bottom());
|
|
}
|
|
private:
|
|
void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
|
|
}
|
|
};
|
|
GrGLSLFragmentProcessor* GrKeyIn::onCreateGLSLInstance() const {
|
|
return new GrGLSLKeyIn();
|
|
}
|
|
void GrKeyIn::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
|
|
uint16_t red = SkFloatToHalf(color.fR);
|
|
uint16_t green = SkFloatToHalf(color.fG);
|
|
uint16_t blue = SkFloatToHalf(color.fB);
|
|
uint16_t alpha = SkFloatToHalf(color.fA);
|
|
b->add32(((uint32_t)red << 16) | green);
|
|
b->add32(((uint32_t)blue << 16) | alpha);
|
|
}
|
|
bool GrKeyIn::onIsEqual(const GrFragmentProcessor& other) const {
|
|
const GrKeyIn& that = other.cast<GrKeyIn>();
|
|
(void) that;
|
|
if (color != that.color) return false;
|
|
return true;
|
|
}
|
|
GrKeyIn::GrKeyIn(const GrKeyIn& src)
|
|
: INHERITED(kGrKeyIn_ClassID, src.optimizationFlags())
|
|
, color(src.color) {
|
|
this->cloneAndRegisterAllChildProcessors(src);
|
|
}
|
|
std::unique_ptr<GrFragmentProcessor> GrKeyIn::clone() const {
|
|
return std::make_unique<GrKeyIn>(*this);
|
|
}
|
|
#if GR_TEST_UTILS
|
|
SkString GrKeyIn::onDumpInfo() const {
|
|
return SkStringPrintf("(color=half4(%f, %f, %f, %f))", color.left(), color.top(), color.right(), color.bottom());
|
|
}
|
|
#endif
|