diff options
author | ethannicholas <ethannicholas@google.com> | 2016-11-22 08:39:36 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-22 08:39:36 -0800 |
commit | 8ac838d978578c44b75a801489c985e5284dd66f (patch) | |
tree | b53cdcf94cdd49e3d7867099d0d2018a41fc1a05 /src/sksl/SkSLParser.cpp | |
parent | 64773e6c9f61fb319f597a8d7dd7ee377d51a43a (diff) |
added support for push_constant layout
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2187433003
Committed: https://skia.googlesource.com/skia/+/fa5f65ac61fd525029aa9dab161ffe4896c10f6d
Review-Url: https://codereview.chromium.org/2187433003
Diffstat (limited to 'src/sksl/SkSLParser.cpp')
-rw-r--r-- | src/sksl/SkSLParser.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/sksl/SkSLParser.cpp b/src/sksl/SkSLParser.cpp index 58ec750168..80ef870a48 100644 --- a/src/sksl/SkSLParser.cpp +++ b/src/sksl/SkSLParser.cpp @@ -535,8 +535,7 @@ int Parser::layoutInt() { return -1; } -/* LAYOUT LPAREN IDENTIFIER EQ INT_LITERAL (COMMA IDENTIFIER EQ INT_LITERAL)* - RPAREN */ +/* LAYOUT LPAREN IDENTIFIER (EQ INT_LITERAL)? (COMMA IDENTIFIER (EQ INT_LITERAL)?)* RPAREN */ ASTLayout Parser::layout() { int location = -1; int binding = -1; @@ -548,11 +547,13 @@ ASTLayout Parser::layout() { bool overrideCoverage = false; bool blendSupportAllEquations = false; ASTLayout::Format format = ASTLayout::Format::kUnspecified; + bool pushConstant = false; if (this->peek().fKind == Token::LAYOUT) { this->nextToken(); if (!this->expect(Token::LPAREN, "'('")) { return ASTLayout(location, binding, index, set, builtin, inputAttachmentIndex, - originUpperLeft, overrideCoverage, blendSupportAllEquations, format); + originUpperLeft, overrideCoverage, blendSupportAllEquations, format, + pushConstant); } for (;;) { Token t = this->nextToken(); @@ -576,6 +577,8 @@ ASTLayout Parser::layout() { blendSupportAllEquations = true; } else if (ASTLayout::ReadFormat(t.fText, &format)) { // AST::ReadFormat stored the result in 'format'. + } else if (t.fText == "push_constant") { + pushConstant = true; } else { this->error(t.fPosition, ("'" + t.fText + "' is not a valid layout qualifier").c_str()); @@ -590,7 +593,7 @@ ASTLayout Parser::layout() { } } return ASTLayout(location, binding, index, set, builtin, inputAttachmentIndex, originUpperLeft, - overrideCoverage, blendSupportAllEquations, format); + overrideCoverage, blendSupportAllEquations, format, pushConstant); } /* layout? (UNIFORM | CONST | IN | OUT | INOUT | LOWP | MEDIUMP | HIGHP | FLAT | NOPERSPECTIVE)* */ |