Flutter Engine
The Flutter Engine
Functions
SkSLWGSLTestbed.cpp File Reference
#include "include/core/SkTypes.h"
#include "src/sksl/SkSLCompiler.h"
#include "src/sksl/SkSLProgramKind.h"
#include "src/sksl/SkSLProgramSettings.h"
#include "src/sksl/SkSLUtil.h"
#include "src/sksl/codegen/SkSLWGSLCodeGenerator.h"
#include "src/sksl/ir/SkSLProgram.h"
#include "tests/Test.h"
#include <memory>
#include <string>

Go to the source code of this file.

Functions

static void test (skiatest::Reporter *r, const char *src, SkSL::ProgramKind kind=SkSL::ProgramKind::kFragment)
 
 DEF_TEST (SkSLWGSLTestbed, r)
 

Function Documentation

◆ DEF_TEST()

DEF_TEST ( SkSLWGSLTestbed  ,
 
)

Definition at line 38 of file SkSLWGSLTestbed.cpp.

38 {
39 // Add in your SkSL here.
40 test(r,
41 R"__SkSL__(
42 void main() {
static void test(skiatest::Reporter *r, const char *src, SkSL::ProgramKind kind=SkSL::ProgramKind::kFragment)

◆ test()

static void test ( skiatest::Reporter r,
const char *  src,
SkSL::ProgramKind  kind = SkSL::ProgramKind::kFragment 
)
static

Definition at line 20 of file SkSLWGSLTestbed.cpp.

22 {
25 std::unique_ptr<SkSL::Program> program = compiler.convertProgram(kind, std::string(src),
26 settings);
27 if (!program) {
28 SkDebugf("Unexpected error compiling %s\n%s", src, compiler.errorText().c_str());
29 REPORTER_ASSERT(r, program);
30 } else {
31 std::string output;
33 REPORTER_ASSERT(r, output != "");
34 //SkDebugf("WGSL output:\n\n%s", output.c_str());
35 }
36}
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
static const ShaderCaps * Default()
Definition: SkSLUtil.h:168
bool ToWGSL(Program &program, const ShaderCaps *caps, OutputStream &out)
compiler
Definition: malisc.py:17