aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/SkSLMain.cpp
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-03-30 13:45:54 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-30 18:28:47 +0000
commit7833466da45bfa1e078427c4a6db94d41c5c1535 (patch)
treed3bb49ba327f0bc3cb5cafe52d992702828031b2 /src/sksl/SkSLMain.cpp
parentcdc651d29d88e87ef84d5a586879db2c16ff4579 (diff)
skslc can now be compiled with no Skia dependencies, in preparation for
its eventual role in Skia's build process. Bug: skia: Change-Id: Iaa9933f4fc4a64bec60aa897c509a3513f457a78 Reviewed-on: https://skia-review.googlesource.com/10282 Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Reviewed-by: Ben Wagner <benjaminwagner@google.com>
Diffstat (limited to 'src/sksl/SkSLMain.cpp')
-rw-r--r--src/sksl/SkSLMain.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/sksl/SkSLMain.cpp b/src/sksl/SkSLMain.cpp
index 46e9c18757..1461bf9aae 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 @@ int main(int argc, const char** argv) {
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 @@ 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")) {
- 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 @@ 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'");
}