blob: 5cb2f3d458d3b00c1d27cbc2c589604bb76f54bc [file] [log] [blame]
* Copyright 2020 Google LLC
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
#include "include/core/SkTypes.h"
#include "include/private/SkSLProgramKind.h"
#include "src/sksl/SkSLCompiler.h"
#include "src/sksl/SkSLUtil.h"
#include "src/sksl/ir/SkSLProgram.h"
#include "tests/Test.h"
#include <memory>
#include <string>
static void test(skiatest::Reporter* r,
const SkSL::ShaderCaps& caps,
const char* src,
SkSL::ProgramKind kind = SkSL::ProgramKind::kFragment) {
SkSL::Compiler compiler(&caps);
SkSL::Program::Settings settings;
std::unique_ptr<SkSL::Program> program = compiler.convertProgram(kind, std::string(src),
if (!program) {
SkDebugf("Unexpected error compiling %s\n%s", src, compiler.errorText().c_str());
REPORTER_ASSERT(r, program);
} else {
std::string output;
REPORTER_ASSERT(r, compiler.toMetal(*program, &output));
REPORTER_ASSERT(r, output != "");
//SkDebugf("Metal output:\n\n%s", output.c_str());
DEF_TEST(SkSLMetalTestbed, r) {
// Add in your SkSL here.
void main() {
sk_FragColor = half4(0);