skia2/tests/sksl/fp/GrModuloOp.cpp
John Stiles 639e812d9f Remove usage of sqrt() as an optimization barrier in tests.
In the majority of cases, a uniform is an equally good substitute, and
replacing `sqrt(N)` with `unknownInput` actually makes the test clearer.

Change-Id: I7bcb477571972d7aa2ce8c49b3674471f7310748
Bug: skia:12034
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/411306
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-05-24 17:18:54 +00:00

55 lines
2.0 KiB
C++

/**************************************************************************************************
*** This file was autogenerated from GrModuloOp.fp; do not modify.
**************************************************************************************************/
#include "GrModuloOp.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 GrGLSLModuloOp : public GrGLSLFragmentProcessor {
public:
GrGLSLModuloOp() {}
void emitCode(EmitArgs& args) override {
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
const GrModuloOp& _outer = args.fFp.cast<GrModuloOp>();
(void) _outer;
unknownInputVar = args.fUniformHandler->addUniform(&_outer, kFragment_GrShaderFlag, kInt_GrSLType, "unknownInput");
fragBuilder->codeAppendf(
R"SkSL(return half4(half(%s %% 7));
)SkSL"
, args.fUniformHandler->getUniformCStr(unknownInputVar));
}
private:
void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
}
UniformHandle unknownInputVar;
};
std::unique_ptr<GrGLSLFragmentProcessor> GrModuloOp::onMakeProgramImpl() const {
return std::make_unique<GrGLSLModuloOp>();
}
void GrModuloOp::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
}
bool GrModuloOp::onIsEqual(const GrFragmentProcessor& other) const {
const GrModuloOp& that = other.cast<GrModuloOp>();
(void) that;
return true;
}
GrModuloOp::GrModuloOp(const GrModuloOp& src)
: INHERITED(kGrModuloOp_ClassID, src.optimizationFlags()) {
this->cloneAndRegisterAllChildProcessors(src);
}
std::unique_ptr<GrFragmentProcessor> GrModuloOp::clone() const {
return std::make_unique<GrModuloOp>(*this);
}
#if GR_TEST_UTILS
SkString GrModuloOp::onDumpInfo() const {
return SkString();
}
#endif