diff options
Diffstat (limited to 'src/sksl/SkSLMain.cpp')
-rw-r--r-- | src/sksl/SkSLMain.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/sksl/SkSLMain.cpp b/src/sksl/SkSLMain.cpp index 1461bf9aae..46e9c18757 100644 --- a/src/sksl/SkSLMain.cpp +++ b/src/sksl/SkSLMain.cpp @@ -8,7 +8,7 @@ #include "stdio.h" #include <fstream> #include "SkSLCompiler.h" -#include "SkSLFileOutputStream.h" +#include "GrContextOptions.h" /** * Very simple standalone executable to facilitate testing. @@ -34,15 +34,17 @@ int main(int argc, const char** argv) { std::ifstream in(argv[1]); std::string stdText((std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>()); - SkSL::String text(stdText.c_str()); + SkString text(stdText.c_str()); if (in.rdstate()) { printf("error reading '%s'\n", argv[1]); exit(2); } SkSL::Program::Settings settings; - SkSL::String name(argv[2]); + sk_sp<GrShaderCaps> caps = SkSL::ShaderCapsFactory::Default(); + settings.fCaps = caps.get(); + SkString name(argv[2]); if (name.endsWith(".spirv")) { - SkSL::FileOutputStream out(argv[2]); + SkFILEWStream out(argv[2]); SkSL::Compiler compiler; if (!out.isValid()) { printf("error writing '%s'\n", argv[2]); @@ -53,12 +55,8 @@ int main(int argc, const char** argv) { printf("%s", compiler.errorText().c_str()); exit(3); } - if (!out.close()) { - printf("error writing '%s'\n", argv[2]); - exit(4); - } } else if (name.endsWith(".glsl")) { - SkSL::FileOutputStream out(argv[2]); + SkFILEWStream out(argv[2]); SkSL::Compiler compiler; if (!out.isValid()) { printf("error writing '%s'\n", argv[2]); @@ -69,10 +67,6 @@ int main(int argc, const char** argv) { printf("%s", compiler.errorText().c_str()); exit(3); } - if (!out.close()) { - printf("error writing '%s'\n", argv[2]); - exit(4); - } } else { printf("expected output filename to end with '.spirv' or '.glsl'"); } |