skia2/tests/sksl/dslfp/GrDSLFPTest_HelloWorld.dsl.cpp

56 lines
2.2 KiB
C++
Raw Normal View History

Reland "Reland "Implement statements and expressions in DSL C++ code generator."" This is a reland of c412688798e572ac8ca6414a19a48d007500f751 This CL lands the code changes but not the dm test, which is causing link errors. Tests will be relanded as a separate CL, at http://review.skia.org/400097 Original change's description: > Reland "Implement statements and expressions in DSL C++ code generator." > > This is a reland of 16cbfb41dff107ca3388bacf34201311d3c5f14d > > Tests now rely on `shaderDerivativeSupport` and `integerSupport` as > proxies to indicate ES3 support. The SwitchStatement test has been > adjusted to hopefully confuse fewer compilers. > > 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> > > Bug: skia:11854, skia:11891 > Change-Id: I91363e31f34611d15ae350b52d6fc459feeace9c > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399076 > Auto-Submit: John Stiles <johnstiles@google.com> > Commit-Queue: Ethan Nicholas <ethannicholas@google.com> > Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Bug: skia:11854 Bug: skia:11891 Change-Id: Ib1f08256c84d1da2130e0b61356f72435dc0a5a8 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399740 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
2021-04-22 19:05:20 +00:00
/* HELLO WORLD */
/**************************************************************************************************
*** This file was autogenerated from GrDSLFPTest_HelloWorld.fp; do not modify.
**************************************************************************************************/
/* TODO(skia:11854): DSLCPPCodeGenerator is currently a work in progress. */
#include "GrDSLFPTest_HelloWorld.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"
#include "src/sksl/dsl/priv/DSLFPs.h"
#include "src/sksl/dsl/priv/DSLWriter.h"
class GrGLSLDSLFPTest_HelloWorld : public GrGLSLFragmentProcessor {
public:
GrGLSLDSLFPTest_HelloWorld() {}
void emitCode(EmitArgs& args) override {
[[maybe_unused]] const GrDSLFPTest_HelloWorld& _outer = args.fFp.cast<GrDSLFPTest_HelloWorld>();
Reland "Reland "Implement statements and expressions in DSL C++ code generator."" This is a reland of c412688798e572ac8ca6414a19a48d007500f751 This CL lands the code changes but not the dm test, which is causing link errors. Tests will be relanded as a separate CL, at http://review.skia.org/400097 Original change's description: > Reland "Implement statements and expressions in DSL C++ code generator." > > This is a reland of 16cbfb41dff107ca3388bacf34201311d3c5f14d > > Tests now rely on `shaderDerivativeSupport` and `integerSupport` as > proxies to indicate ES3 support. The SwitchStatement test has been > adjusted to hopefully confuse fewer compilers. > > 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> > > Bug: skia:11854, skia:11891 > Change-Id: I91363e31f34611d15ae350b52d6fc459feeace9c > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399076 > Auto-Submit: John Stiles <johnstiles@google.com> > Commit-Queue: Ethan Nicholas <ethannicholas@google.com> > Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Bug: skia:11854 Bug: skia:11891 Change-Id: Ib1f08256c84d1da2130e0b61356f72435dc0a5a8 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399740 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
2021-04-22 19:05:20 +00:00
using namespace SkSL::dsl;
StartFragmentProcessor(this, &args);
Return(Half4(0.0f, 1.0f, 0.0f, 1.0f));
Reland "Reland "Implement statements and expressions in DSL C++ code generator."" This is a reland of c412688798e572ac8ca6414a19a48d007500f751 This CL lands the code changes but not the dm test, which is causing link errors. Tests will be relanded as a separate CL, at http://review.skia.org/400097 Original change's description: > Reland "Implement statements and expressions in DSL C++ code generator." > > This is a reland of 16cbfb41dff107ca3388bacf34201311d3c5f14d > > Tests now rely on `shaderDerivativeSupport` and `integerSupport` as > proxies to indicate ES3 support. The SwitchStatement test has been > adjusted to hopefully confuse fewer compilers. > > 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> > > Bug: skia:11854, skia:11891 > Change-Id: I91363e31f34611d15ae350b52d6fc459feeace9c > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399076 > Auto-Submit: John Stiles <johnstiles@google.com> > Commit-Queue: Ethan Nicholas <ethannicholas@google.com> > Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Bug: skia:11854 Bug: skia:11891 Change-Id: Ib1f08256c84d1da2130e0b61356f72435dc0a5a8 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399740 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
2021-04-22 19:05:20 +00:00
EndFragmentProcessor();
}
private:
void onSetData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& _proc) override {
}
};
std::unique_ptr<GrGLSLFragmentProcessor> GrDSLFPTest_HelloWorld::onMakeProgramImpl() const {
return std::make_unique<GrGLSLDSLFPTest_HelloWorld>();
}
void GrDSLFPTest_HelloWorld::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
}
bool GrDSLFPTest_HelloWorld::onIsEqual(const GrFragmentProcessor& other) const {
const GrDSLFPTest_HelloWorld& that = other.cast<GrDSLFPTest_HelloWorld>();
(void) that;
return true;
}
GrDSLFPTest_HelloWorld::GrDSLFPTest_HelloWorld(const GrDSLFPTest_HelloWorld& src)
: INHERITED(kGrDSLFPTest_HelloWorld_ClassID, src.optimizationFlags()) {
this->cloneAndRegisterAllChildProcessors(src);
}
std::unique_ptr<GrFragmentProcessor> GrDSLFPTest_HelloWorld::clone() const {
return std::make_unique<GrDSLFPTest_HelloWorld>(*this);
}
#if GR_TEST_UTILS
SkString GrDSLFPTest_HelloWorld::onDumpInfo() const {
return SkString();
}
#endif