aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/SkSLMain.cpp
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-06-27 14:36:24 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-27 14:36:44 +0000
commited50200682e0de72c3abecaa4d5324ebcd1ed9f9 (patch)
treef991fa9668072f9b87a9929c7834b55cd9175fff /src/sksl/SkSLMain.cpp
parentccf59917d3fe7aaf59de714acfbd0596503f324f (diff)
Revert "sksl fragment processor support"
This reverts commit ccf59917d3fe7aaf59de714acfbd0596503f324f. Reason for revert: breaking iOS bots Original change's description: > sksl fragment processor support > > Bug: skia: > Change-Id: Ia3b0305c2b0c78074303831f628fb01852b90d34 > Reviewed-on: https://skia-review.googlesource.com/17843 > Commit-Queue: Ethan Nicholas <ethannicholas@google.com> > Reviewed-by: Ben Wagner <benjaminwagner@google.com> > Reviewed-by: Mike Klein <mtklein@google.com> TBR=mtklein@google.com,benjaminwagner@google.com,ethannicholas@google.com Change-Id: I0a33060c7c42c7b44c5c13d443ac42958291c2f1 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/20962 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/sksl/SkSLMain.cpp')
-rw-r--r--src/sksl/SkSLMain.cpp68
1 files changed, 7 insertions, 61 deletions
diff --git a/src/sksl/SkSLMain.cpp b/src/sksl/SkSLMain.cpp
index ee868fb35e..1461bf9aae 100644
--- a/src/sksl/SkSLMain.cpp
+++ b/src/sksl/SkSLMain.cpp
@@ -5,28 +5,11 @@
* found in the LICENSE file.
*/
+#include "stdio.h"
#include <fstream>
#include "SkSLCompiler.h"
#include "SkSLFileOutputStream.h"
-// Given the path to a file (e.g. src/gpu/effects/GrFooFragmentProcessor.fp) and the expected
-// filename prefix and suffix (e.g. "Gr" and ".fp"), returns the "base name" of the
-// file (in this case, 'FooFragmentProcessor'). If no match, returns the empty string.
-static SkSL::String base_name(const char* fpPath, const char* prefix, const char* suffix) {
- SkSL::String result;
- const char* end = fpPath + strlen(fpPath);
- const char* fileName = end;
- // back up until we find a slash
- while (fileName != fpPath && '/' != *(fileName - 1) && '\\' != *(fileName - 1)) {
- --fileName;
- }
- if (!strncmp(fileName, prefix, strlen(prefix)) &&
- !strncmp(end - strlen(suffix), suffix, strlen(suffix))) {
- result.append(fileName + strlen(prefix), end - fileName - strlen(prefix) - strlen(suffix));
- }
- return result;
-}
-
/**
* Very simple standalone executable to facilitate testing.
*/
@@ -36,17 +19,15 @@ int main(int argc, const char** argv) {
exit(1);
}
SkSL::Program::Kind kind;
- String input(argv[1]);
- if (input.endsWith(".vert")) {
+ size_t len = strlen(argv[1]);
+ if (len > 5 && !strcmp(argv[1] + strlen(argv[1]) - 5, ".vert")) {
kind = SkSL::Program::kVertex_Kind;
- } else if (input.endsWith(".frag")) {
+ } else if (len > 5 && !strcmp(argv[1] + strlen(argv[1]) - 5, ".frag")) {
kind = SkSL::Program::kFragment_Kind;
- } else if (input.endsWith(".geom")) {
+ } else if (len > 5 && !strcmp(argv[1] + strlen(argv[1]) - 5, ".geom")) {
kind = SkSL::Program::kGeometry_Kind;
- } else if (input.endsWith(".fp")) {
- kind = SkSL::Program::kFragmentProcessor_Kind;
} else {
- printf("input filename must end in '.vert', '.frag', '.geom', or '.fp'\n");
+ printf("input filename must end in '.vert', '.frag', or '.geom'\n");
exit(1);
}
@@ -59,7 +40,6 @@ int main(int argc, const char** argv) {
exit(2);
}
SkSL::Program::Settings settings;
- settings.fArgs.insert(std::make_pair("gpImplementsDistanceVector", 1));
SkSL::String name(argv[2]);
if (name.endsWith(".spirv")) {
SkSL::FileOutputStream out(argv[2]);
@@ -93,41 +73,7 @@ int main(int argc, const char** argv) {
printf("error writing '%s'\n", argv[2]);
exit(4);
}
- } else if (name.endsWith(".h")) {
- SkSL::FileOutputStream out(argv[2]);
- SkSL::Compiler compiler;
- if (!out.isValid()) {
- printf("error writing '%s'\n", argv[2]);
- exit(4);
- }
- settings.fReplaceSettings = false;
- std::unique_ptr<SkSL::Program> program = compiler.convertProgram(kind, text, settings);
- if (!program || !compiler.toH(*program, base_name(argv[1], "Gr", ".fp"), out)) {
- printf("%s", compiler.errorText().c_str());
- exit(3);
- }
- if (!out.close()) {
- printf("error writing '%s'\n", argv[2]);
- exit(4);
- }
- } else if (name.endsWith(".cpp")) {
- SkSL::FileOutputStream out(argv[2]);
- SkSL::Compiler compiler;
- if (!out.isValid()) {
- printf("error writing '%s'\n", argv[2]);
- exit(4);
- }
- settings.fReplaceSettings = false;
- std::unique_ptr<SkSL::Program> program = compiler.convertProgram(kind, text, settings);
- if (!program || !compiler.toCPP(*program, base_name(argv[1], "Gr", ".fp"), out)) {
- 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', '.glsl', '.cpp', or '.h'");
+ printf("expected output filename to end with '.spirv' or '.glsl'");
}
}