diff options
author | 2016-10-10 09:18:23 -0700 | |
---|---|---|
committer | 2016-10-10 09:18:23 -0700 | |
commit | 15341a284e78651d2b47b89753044f8d6e7eda0a (patch) | |
tree | 80e2eecf6c4d11f4aa078afcb2181af156934b6f /src/sksl/SkSLParser.cpp | |
parent | e75c19f6380dd07a19faa39edcdbd75c79c7414d (diff) |
Revert of Turned on SkSL->GLSL compiler (patchset #47 id:1200001 of https://codereview.chromium.org/2288033003/ )
Reason for revert:
Looks like it introduces new static initializers, and it's failing the Chrome roll.
Original issue's description:
> Turned on SkSL->GLSL compiler
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2288033003
>
> Committed: https://skia.googlesource.com/skia/+/9b0fe3d125f237d9884732a48414fa85fc71b4e3
> Committed: https://skia.googlesource.com/skia/+/b12b3c6908c62c908b3680be01e3b5bfd30de310
> Committed: https://skia.googlesource.com/skia/+/f008b0a59f45c0d4bea3e66faf3b01805009ec89
> Committed: https://skia.googlesource.com/skia/+/08b2ccf398e2b81bc05d2c105837e5419899469b
TBR=benjaminwagner@google.com,bsalomon@google.com,egdaniel@google.com,ethannicholas@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review-Url: https://codereview.chromium.org/2403083002
Diffstat (limited to 'src/sksl/SkSLParser.cpp')
-rw-r--r-- | src/sksl/SkSLParser.cpp | 72 |
1 files changed, 18 insertions, 54 deletions
diff --git a/src/sksl/SkSLParser.cpp b/src/sksl/SkSLParser.cpp index 29f1dbd178..b240e4501e 100644 --- a/src/sksl/SkSLParser.cpp +++ b/src/sksl/SkSLParser.cpp @@ -56,9 +56,7 @@ #include "ast/SkSLASTIndexSuffix.h" #include "ast/SkSLASTInterfaceBlock.h" #include "ast/SkSLASTIntLiteral.h" -#include "ast/SkSLASTModifiersDeclaration.h" #include "ast/SkSLASTParameter.h" -#include "ast/SkSLASTPrecision.h" #include "ast/SkSLASTPrefixExpression.h" #include "ast/SkSLASTReturnStatement.h" #include "ast/SkSLASTStatement.h" @@ -99,13 +97,9 @@ std::vector<std::unique_ptr<ASTDeclaration>> Parser::file() { switch (this->peek().fKind) { case Token::END_OF_FILE: return result; - case Token::PRECISION: { - std::unique_ptr<ASTDeclaration> precision = this->precision(); - if (precision) { - result.push_back(std::move(precision)); - } + case Token::PRECISION: + this->precision(); break; - } case Token::DIRECTIVE: { std::unique_ptr<ASTDeclaration> decl = this->directive(); if (decl) { @@ -169,37 +163,29 @@ bool Parser::isType(std::string name) { } /* PRECISION (LOWP | MEDIUMP | HIGHP) type SEMICOLON */ -std::unique_ptr<ASTDeclaration> Parser::precision() { +void Parser::precision() { if (!this->expect(Token::PRECISION, "'precision'")) { - return nullptr; + return; } - Modifiers::Flag result; Token p = this->nextToken(); switch (p.fKind) { - case Token::LOWP: - result = Modifiers::kLowp_Flag; - break; - case Token::MEDIUMP: - result = Modifiers::kMediump_Flag; - break; + case Token::LOWP: // fall through + case Token::MEDIUMP: // fall through case Token::HIGHP: - result = Modifiers::kHighp_Flag; + // ignored for now break; default: this->error(p.fPosition, "expected 'lowp', 'mediump', or 'highp', but found '" + p.fText + "'"); - return nullptr; + return; } - // FIXME handle the type if (!this->type()) { - return nullptr; + return; } this->expect(Token::SEMICOLON, "';'"); - return std::unique_ptr<ASTDeclaration>(new ASTPrecision(p.fPosition, result)); } -/* DIRECTIVE(#version) INT_LITERAL ("es" | "compatibility")? | - DIRECTIVE(#extension) IDENTIFIER COLON IDENTIFIER */ +/* DIRECTIVE(#version) INT_LITERAL | DIRECTIVE(#extension) IDENTIFIER COLON IDENTIFIER */ std::unique_ptr<ASTDeclaration> Parser::directive() { Token start; if (!this->expect(Token::DIRECTIVE, "a directive", &start)) { @@ -207,12 +193,7 @@ std::unique_ptr<ASTDeclaration> Parser::directive() { } if (start.fText == "#version") { this->expect(Token::INT_LITERAL, "a version number"); - Token next = this->peek(); - if (next.fText == "es" || next.fText == "compatibility") { - this->nextToken(); - } - // version is ignored for now; it will eventually become an error when we stop pretending - // to be GLSL + // ignored for now return nullptr; } else if (start.fText == "#extension") { Token name; @@ -246,10 +227,6 @@ std::unique_ptr<ASTDeclaration> Parser::declaration() { if (lookahead.fKind == Token::STRUCT) { return this->structVarDeclaration(modifiers); } - if (lookahead.fKind == Token::SEMICOLON) { - this->nextToken(); - return std::unique_ptr<ASTDeclaration>(new ASTModifiersDeclaration(modifiers)); - } std::unique_ptr<ASTType> type(this->type()); if (!type) { return nullptr; @@ -500,13 +477,10 @@ ASTLayout Parser::layout() { int set = -1; int builtin = -1; bool originUpperLeft = false; - bool overrideCoverage = false; - bool blendSupportAllEquations = false; if (this->peek().fKind == Token::LAYOUT) { this->nextToken(); if (!this->expect(Token::LPAREN, "'('")) { - return ASTLayout(location, binding, index, set, builtin, originUpperLeft, - overrideCoverage, blendSupportAllEquations); + return ASTLayout(location, binding, index, set, builtin, originUpperLeft); } for (;;) { Token t = this->nextToken(); @@ -522,10 +496,6 @@ ASTLayout Parser::layout() { builtin = this->layoutInt(); } else if (t.fText == "origin_upper_left") { originUpperLeft = true; - } else if (t.fText == "override_coverage") { - overrideCoverage = true; - } else if (t.fText == "blend_support_all_equations") { - blendSupportAllEquations = true; } else { this->error(t.fPosition, ("'" + t.fText + "' is not a valid layout qualifier").c_str()); @@ -539,8 +509,7 @@ ASTLayout Parser::layout() { } } } - return ASTLayout(location, binding, index, set, builtin, originUpperLeft, overrideCoverage, - blendSupportAllEquations); + return ASTLayout(location, binding, index, set, builtin, originUpperLeft); } /* layout? (UNIFORM | CONST | IN | OUT | INOUT | LOWP | MEDIUMP | HIGHP | FLAT | NOPERSPECTIVE)* */ @@ -1242,11 +1211,10 @@ std::unique_ptr<ASTExpression> Parser::multiplicativeExpression() { /* postfixExpression | (PLUS | MINUS | NOT | PLUSPLUS | MINUSMINUS) unaryExpression */ std::unique_ptr<ASTExpression> Parser::unaryExpression() { switch (this->peek().fKind) { - case Token::PLUS: // fall through - case Token::MINUS: // fall through - case Token::LOGICALNOT: // fall through - case Token::BITWISENOT: // fall through - case Token::PLUSPLUS: // fall through + case Token::PLUS: // fall through + case Token::MINUS: // fall through + case Token::NOT: // fall through + case Token::PLUSPLUS: // fall through case Token::MINUSMINUS: { Token t = this->nextToken(); std::unique_ptr<ASTExpression> expr = this->unaryExpression(); @@ -1286,16 +1254,12 @@ std::unique_ptr<ASTExpression> Parser::postfixExpression() { } } -/* LBRACKET expression? RBRACKET | DOT IDENTIFIER | LPAREN parameters RPAREN | +/* LBRACKET expression RBRACKET | DOT IDENTIFIER | LPAREN parameters RPAREN | PLUSPLUS | MINUSMINUS */ std::unique_ptr<ASTSuffix> Parser::suffix() { Token next = this->nextToken(); switch (next.fKind) { case Token::LBRACKET: { - if (this->peek().fKind == Token::RBRACKET) { - this->nextToken(); - return std::unique_ptr<ASTSuffix>(new ASTIndexSuffix(next.fPosition)); - } std::unique_ptr<ASTExpression> e = this->expression(); if (!e) { return nullptr; |