Re-land "converted OverdrawColorFilter to SkSL"
This reverts commit 2d3cac58fcc8f2d398a421b0341c36479a6ba324.
Bug: skia:
Change-Id: I6607d419f6b30c3e17b52ec5ce67d489bd1ad1dc
Reviewed-on: https://skia-review.googlesource.com/64080
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/SkSLParser.cpp b/src/sksl/SkSLParser.cpp
index 9bfa62f..267d802 100644
--- a/src/sksl/SkSLParser.cpp
+++ b/src/sksl/SkSLParser.cpp
@@ -515,7 +515,7 @@
this->text(name), std::move(sizes)));
}
-/** (EQ INT_LITERAL)? */
+/** EQ INT_LITERAL */
int Parser::layoutInt() {
if (!this->expect(Token::EQ, "'='")) {
return -1;
@@ -527,6 +527,19 @@
return -1;
}
+/** EQ IDENTIFIER */
+StringFragment Parser::layoutIdentifier() {
+ if (!this->expect(Token::EQ, "'='")) {
+ return StringFragment();
+ }
+ Token resultToken;
+ if (!this->expect(Token::IDENTIFIER, "an identifier", &resultToken)) {
+ return StringFragment();
+ }
+ return this->text(resultToken);
+}
+
+
/** EQ <any sequence of tokens with balanced parentheses and no top-level comma> */
String Parser::layoutCode() {
if (!this->expect(Token::EQ, "'='")) {
@@ -604,12 +617,13 @@
int maxVertices = -1;
int invocations = -1;
String when;
+ StringFragment ctype;
Layout::Key key = Layout::kNo_Key;
if (this->checkNext(Token::LAYOUT)) {
if (!this->expect(Token::LPAREN, "'('")) {
return Layout(location, offset, binding, index, set, builtin, inputAttachmentIndex,
originUpperLeft, overrideCoverage, blendSupportAllEquations, format,
- pushConstant, primitive, maxVertices, invocations, when, key);
+ pushConstant, primitive, maxVertices, invocations, when, key, ctype);
}
for (;;) {
Token t = this->nextToken();
@@ -684,6 +698,9 @@
case LayoutToken::KEY:
key = this->layoutKey();
break;
+ case LayoutToken::CTYPE:
+ ctype = this->layoutIdentifier();
+ break;
default:
ASSERT(false);
}
@@ -702,7 +719,7 @@
}
return Layout(location, offset, binding, index, set, builtin, inputAttachmentIndex,
originUpperLeft, overrideCoverage, blendSupportAllEquations, format,
- pushConstant, primitive, maxVertices, invocations, when, key);
+ pushConstant, primitive, maxVertices, invocations, when, key, ctype);
}
/* layout? (UNIFORM | CONST | IN | OUT | INOUT | LOWP | MEDIUMP | HIGHP | FLAT | NOPERSPECTIVE |