Flutter Engine
The Flutter Engine
SkSLMetalTestbed.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2020 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
12#include "src/sksl/SkSLUtil.h"
15#include "tests/Test.h"
16
17#include <memory>
18#include <string>
19
20static void test(skiatest::Reporter* r,
21 const char* src,
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("Metal output:\n\n%s", output.c_str());
35 }
36}
37
38DEF_TEST(SkSLMetalTestbed, r) {
39 // Add in your SkSL here.
40 test(r,
41 R"__SkSL__(
42 void main() {
43 sk_FragColor = half4(0);
44 }
45 )__SkSL__");
46}
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
DEF_TEST(SkSLMetalTestbed, r)
static void test(skiatest::Reporter *r, const char *src, SkSL::ProgramKind kind=SkSL::ProgramKind::kFragment)
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
static const ShaderCaps * Default()
Definition: SkSLUtil.h:168
bool ToMetal(Program &program, const ShaderCaps *caps, OutputStream &out)
compiler
Definition: malisc.py:17