ffeb6f2339
The previous CLs have removed the last significant differences between SkSL::String and std::string. This CL removes SkSL::String entirely and replaces it with std::string throughout the code. Apologies for the very long CL, but I have done my best to make it as simple and reviewable as possible. The vast majority of changes are simple replacement of `SkSL::String` with `std::string`. In the rare spots where code is moved from one place to another, it is logically unchanged. Change-Id: I39563d2db45da229f17f4504dfd63e00bde7a96e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503339 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
/*
|
|
* 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 "src/sksl/SkSLCompiler.h"
|
|
|
|
#include "tests/Test.h"
|
|
|
|
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),
|
|
settings);
|
|
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.
|
|
test(r,
|
|
*SkSL::ShaderCapsFactory::Default(),
|
|
R"__SkSL__(
|
|
void main() {
|
|
sk_FragColor = half4(0);
|
|
}
|
|
)__SkSL__");
|
|
}
|