added initial GLSL support to skslc
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2185393003
Review-Url: https://codereview.chromium.org/2185393003
diff --git a/src/sksl/SkSLParser.cpp b/src/sksl/SkSLParser.cpp
index edff0c6..d6acc7d 100644
--- a/src/sksl/SkSLParser.cpp
+++ b/src/sksl/SkSLParser.cpp
@@ -14,11 +14,26 @@
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunneeded-internal-declaration"
#pragma clang diagnostic ignored "-Wnull-conversion"
+#pragma clang diagnostic ignored "-Wsign-compare"
+#endif
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-compare"
+#endif
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4018)
#endif
#include "lex.sksl.c"
#ifdef __clang__
#pragma clang diagnostic pop
#endif
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
#undef register
#include "ast/SkSLASTBinaryExpression.h"
@@ -471,10 +486,11 @@
int index = -1;
int set = -1;
int builtin = -1;
+ bool originUpperLeft = false;
if (this->peek().fKind == Token::LAYOUT) {
this->nextToken();
if (!this->expect(Token::LPAREN, "'('")) {
- return ASTLayout(location, binding, index, set, builtin);
+ return ASTLayout(location, binding, index, set, builtin, originUpperLeft);
}
for (;;) {
Token t = this->nextToken();
@@ -488,6 +504,8 @@
set = this->layoutInt();
} else if (t.fText == "builtin") {
builtin = this->layoutInt();
+ } else if (t.fText == "origin_upper_left") {
+ originUpperLeft = true;
} else {
this->error(t.fPosition, ("'" + t.fText +
"' is not a valid layout qualifier").c_str());
@@ -501,11 +519,10 @@
}
}
}
- return ASTLayout(location, binding, index, set, builtin);
+ return ASTLayout(location, binding, index, set, builtin, originUpperLeft);
}
-/* layout? (UNIFORM | CONST | IN | OUT | INOUT | LOWP |
- MEDIUMP | HIGHP)* */
+/* layout? (UNIFORM | CONST | IN | OUT | INOUT | LOWP | MEDIUMP | HIGHP | FLAT | NOPERSPECTIVE)* */
ASTModifiers Parser::modifiers() {
ASTLayout layout = this->layout();
int flags = 0;
@@ -545,6 +562,14 @@
this->nextToken();
flags |= ASTModifiers::kHighp_Flag;
break;
+ case Token::FLAT:
+ this->nextToken();
+ flags |= ASTModifiers::kFlat_Flag;
+ break;
+ case Token::NOPERSPECTIVE:
+ this->nextToken();
+ flags |= ASTModifiers::kNoPerspective_Flag;
+ break;
default:
return ASTModifiers(layout, flags);
}