| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "stdio.h" | 8 #include "stdio.h" |
| 9 #include <fstream> | 9 #include <fstream> |
| 10 #include "SkSLCompiler.h" | 10 #include "SkSLCompiler.h" |
| 11 | 11 |
| 12 bool endsWith(const std::string& s, const std::string& ending) { | 12 bool endsWith(const std::string& s, const std::string& ending) { |
| 13 if (s.length() >= ending.length()) { | 13 if (s.length() >= ending.length()) { |
| 14 return (0 == s.compare(s.length() - ending.length(), ending.length(), en
ding)); | 14 return (0 == s.compare(s.length() - ending.length(), ending.length(), en
ding)); |
| 15 } | 15 } |
| 16 return false; | 16 return false; |
| 17 } | 17 } |
| 18 | 18 |
| 19 static SkSL::GLCaps default_caps() { | 19 static SkSL::GLCaps default_caps() { |
| 20 return { | 20 return { |
| 21 400, | 21 400, |
| 22 SkSL::GLCaps::kGL_Standard, | 22 SkSL::GLCaps::kGL_Standard, |
| 23 false, // isCoreProfile | 23 false, // isCoreProfile |
| 24 false, // usesPrecisionModifiers; | 24 false, // usesPrecisionModifiers; |
| 25 false, // mustDeclareFragmentShaderOutput | 25 false, // mustDeclareFragmentShaderOutput |
| 26 true // canUseMinAndAbsTogether | 26 true, // canUseMinAndAbsTogether |
| 27 false // mustForceNegatedAtanParamToFloat |
| 27 }; | 28 }; |
| 28 } | 29 } |
| 29 | 30 |
| 30 /** | 31 /** |
| 31 * Very simple standalone executable to facilitate testing. | 32 * Very simple standalone executable to facilitate testing. |
| 32 */ | 33 */ |
| 33 int main(int argc, const char** argv) { | 34 int main(int argc, const char** argv) { |
| 34 if (argc != 3) { | 35 if (argc != 3) { |
| 35 printf("usage: skslc <input> <output>\n"); | 36 printf("usage: skslc <input> <output>\n"); |
| 36 exit(1); | 37 exit(1); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 exit(3); | 74 exit(3); |
| 74 } | 75 } |
| 75 if (out.rdstate()) { | 76 if (out.rdstate()) { |
| 76 printf("error writing '%s'\n", argv[2]); | 77 printf("error writing '%s'\n", argv[2]); |
| 77 exit(4); | 78 exit(4); |
| 78 } | 79 } |
| 79 } else { | 80 } else { |
| 80 printf("expected output filename to end with '.spirv' or '.glsl'"); | 81 printf("expected output filename to end with '.spirv' or '.glsl'"); |
| 81 } | 82 } |
| 82 } | 83 } |
| OLD | NEW |