skslc can now be compiled with no Skia dependencies, in preparation for its eventual
This reverts commit 9bd301d640ff63c280b202c7dd00bc00a3315ff4.
Bug: skia:
Change-Id: I5ad3f77ef33aa5ce2fd27fe383c9339c571663a1
Reviewed-on: https://skia-review.googlesource.com/10964
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/SkSLMain.cpp b/src/sksl/SkSLMain.cpp
index 46e9c18..1461bf9 100644
--- a/src/sksl/SkSLMain.cpp
+++ b/src/sksl/SkSLMain.cpp
@@ -8,7 +8,7 @@
#include "stdio.h"
#include <fstream>
#include "SkSLCompiler.h"
-#include "GrContextOptions.h"
+#include "SkSLFileOutputStream.h"
/**
* Very simple standalone executable to facilitate testing.
@@ -34,17 +34,15 @@
std::ifstream in(argv[1]);
std::string stdText((std::istreambuf_iterator<char>(in)),
std::istreambuf_iterator<char>());
- SkString text(stdText.c_str());
+ SkSL::String text(stdText.c_str());
if (in.rdstate()) {
printf("error reading '%s'\n", argv[1]);
exit(2);
}
SkSL::Program::Settings settings;
- sk_sp<GrShaderCaps> caps = SkSL::ShaderCapsFactory::Default();
- settings.fCaps = caps.get();
- SkString name(argv[2]);
+ SkSL::String name(argv[2]);
if (name.endsWith(".spirv")) {
- SkFILEWStream out(argv[2]);
+ SkSL::FileOutputStream out(argv[2]);
SkSL::Compiler compiler;
if (!out.isValid()) {
printf("error writing '%s'\n", argv[2]);
@@ -55,8 +53,12 @@
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")) {
- SkFILEWStream out(argv[2]);
+ SkSL::FileOutputStream out(argv[2]);
SkSL::Compiler compiler;
if (!out.isValid()) {
printf("error writing '%s'\n", argv[2]);
@@ -67,6 +69,10 @@
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'");
}