re-land of added sk_FragCoord support to skslc
BUG=skia:
Change-Id: Ifac1aa39839058787ad1794200c3dbb93c147a69
Reviewed-on: https://skia-review.googlesource.com/5850
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/tests/SkSLErrorTest.cpp b/tests/SkSLErrorTest.cpp
index c653072..e872977 100644
--- a/tests/SkSLErrorTest.cpp
+++ b/tests/SkSLErrorTest.cpp
@@ -14,21 +14,34 @@
static void test_failure(skiatest::Reporter* r, const char* src, const char* error) {
SkSL::Compiler compiler;
SkDynamicMemoryWStream out;
- bool result = compiler.toSPIRV(SkSL::Program::kFragment_Kind, SkString(src), out);
+ SkSL::Program::Settings settings;
+ sk_sp<GrShaderCaps> caps = SkSL::ShaderCapsFactory::Default();
+ settings.fCaps = caps.get();
+ std::unique_ptr<SkSL::Program> program = compiler.convertProgram(SkSL::Program::kFragment_Kind,
+ SkString(src), settings);
+ if (program) {
+ SkString ignored;
+ compiler.toSPIRV(*program, &ignored);
+ }
SkString skError(error);
if (compiler.errorText() != skError) {
SkDebugf("SKSL ERROR:\n source: %s\n expected: %s received: %s", src, error,
compiler.errorText().c_str());
}
- REPORTER_ASSERT(r, !result);
REPORTER_ASSERT(r, compiler.errorText() == skError);
}
static void test_success(skiatest::Reporter* r, const char* src) {
SkSL::Compiler compiler;
SkDynamicMemoryWStream out;
- bool result = compiler.toSPIRV(SkSL::Program::kFragment_Kind, SkString(src), out);
- REPORTER_ASSERT(r, result);
+ SkSL::Program::Settings settings;
+ sk_sp<GrShaderCaps> caps = SkSL::ShaderCapsFactory::Default();
+ settings.fCaps = caps.get();
+ std::unique_ptr<SkSL::Program> program = compiler.convertProgram(SkSL::Program::kFragment_Kind,
+ SkString(src), settings);
+ REPORTER_ASSERT(r, program);
+ SkString ignored;
+ REPORTER_ASSERT(r, compiler.toSPIRV(*program, &ignored));
}
DEF_TEST(SkSLUndefinedSymbol, r) {