skia2/tests/sksl/fp/GrDSLHelloWorld.dsl.cpp

54 lines
2.0 KiB
C++
Raw Normal View History

Revert "Implement statements and expressions in DSL C++ code generator." This reverts commit 16cbfb41dff107ca3388bacf34201311d3c5f14d. Reason for revert: using ES3 features, breaks on ANGLE ES2 bots Original change's description: > Implement statements and expressions in DSL C++ code generator. > > This CL removes the bulk of the existing C++ code generator, especially > all the complex format-string assembly code. It has been replaced with > actual DSL code generation. Simple IR can now be successfully translated > to a working DSL fragment processor. > > This CL also adds a simple test harness which is patterned after the > existing SkSLTest; it renders a pixel, reads it back, and fails the test > if the result isn't solid green (RGBA=0101). > > This CL doesn't implement every feature. Some obvious gaps include: > - Sampling from children > - Uniforms/inputs of any kind > - Function calls of any kind > > Change-Id: Ib80c23fe1ba4453f7c3cb43b65f93c5ea0deb709 > Bug: skia:11854 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/396757 > Reviewed-by: Ethan Nicholas <ethannicholas@google.com> > Reviewed-by: Brian Osman <brianosman@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com Change-Id: I4f3e7667bf1e3a5539d0248b6c47d9ae2296aa88 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia:11854 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/398739 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-04-20 19:59:23 +00:00
/* HELLO WORLD */
/**************************************************************************************************
*** This file was autogenerated from GrDSLHelloWorld.fp; do not modify.
**************************************************************************************************/
/* TODO(skia:11854): DSLCPPCodeGenerator is currently a work in progress. */
#include "GrDSLHelloWorld.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 GrGLSLDSLHelloWorld : public GrGLSLFragmentProcessor {
public:
GrGLSLDSLHelloWorld() {}
void emitCode(EmitArgs& args) override {
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
const GrDSLHelloWorld& _outer = args.fFp.cast<GrDSLHelloWorld>();
(void) _outer;
fragBuilder->codeAppendf(
R"SkSL(return half4(1.0);
)SkSL"
);
}
private:
void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
}
};
std::unique_ptr<GrGLSLFragmentProcessor> GrDSLHelloWorld::onMakeProgramImpl() const {
return std::make_unique<GrGLSLDSLHelloWorld>();
}
void GrDSLHelloWorld::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
}
bool GrDSLHelloWorld::onIsEqual(const GrFragmentProcessor& other) const {
const GrDSLHelloWorld& that = other.cast<GrDSLHelloWorld>();
(void) that;
return true;
}
GrDSLHelloWorld::GrDSLHelloWorld(const GrDSLHelloWorld& src)
: INHERITED(kGrDSLHelloWorld_ClassID, src.optimizationFlags()) {
this->cloneAndRegisterAllChildProcessors(src);
}
std::unique_ptr<GrFragmentProcessor> GrDSLHelloWorld::clone() const {
return std::make_unique<GrDSLHelloWorld>(*this);
}
#if GR_TEST_UTILS
SkString GrDSLHelloWorld::onDumpInfo() const {
return SkString();
}
#endif