Commit 3e9e208b by Alexis Hetu Committed by Alexis Hétu

Added more info to ES3 only errors in parser

Added the same info as Angle's for ES3 only errors. Change-Id: I2f11b34b06f8e1cc1b0a200d568c709ca35469ab Reviewed-on: https://swiftshader-review.googlesource.com/3639Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent b3ff42cd
...@@ -122,9 +122,9 @@ extern void yyerror(YYLTYPE* lloc, TParseContext* context, const char* reason); ...@@ -122,9 +122,9 @@ extern void yyerror(YYLTYPE* lloc, TParseContext* context, const char* reason);
} \ } \
} }
#define ES3_ONLY(S, L) { \ #define ES3_ONLY(TOKEN, LINE, REASON) { \
if (context->getShaderVersion() != 300) { \ if (context->getShaderVersion() != 300) { \
context->error(L, " supported in GLSL ES 3.00 only ", S); \ context->error(LINE, REASON " supported in GLSL ES 3.00 only ", TOKEN); \
context->recover(); \ context->recover(); \
} \ } \
} }
...@@ -361,7 +361,7 @@ function_call_header ...@@ -361,7 +361,7 @@ function_call_header
function_identifier function_identifier
: type_specifier_no_prec { : type_specifier_no_prec {
if ($1.array) { if ($1.array) {
ES3_ONLY("[]", @1); ES3_ONLY("[]", @1, "array constructor");
} }
$$ = context->addConstructorFunc($1); $$ = context->addConstructorFunc($1);
} }
...@@ -431,7 +431,7 @@ unary_operator ...@@ -431,7 +431,7 @@ unary_operator
| DASH { $$.line = @1; $$.op = EOpNegative; } | DASH { $$.line = @1; $$.op = EOpNegative; }
| BANG { $$.line = @1; $$.op = EOpLogicalNot; } | BANG { $$.line = @1; $$.op = EOpLogicalNot; }
| TILDE { | TILDE {
ES3_ONLY("~", @1); ES3_ONLY("~", @1, "bit-wise operator");
$$.line = @1; $$.op = EOpBitwiseNot; $$.line = @1; $$.op = EOpBitwiseNot;
} }
; ;
...@@ -449,7 +449,7 @@ multiplicative_expression ...@@ -449,7 +449,7 @@ multiplicative_expression
} }
| multiplicative_expression PERCENT unary_expression { | multiplicative_expression PERCENT unary_expression {
FRAG_VERT_ONLY("%", @2); FRAG_VERT_ONLY("%", @2);
ES3_ONLY("%", @2); ES3_ONLY("%", @2, "integer modulus operator");
$$ = context->addBinaryMath(EOpIMod, $1, $3, @2); $$ = context->addBinaryMath(EOpIMod, $1, $3, @2);
} }
; ;
...@@ -467,11 +467,11 @@ additive_expression ...@@ -467,11 +467,11 @@ additive_expression
shift_expression shift_expression
: additive_expression { $$ = $1; } : additive_expression { $$ = $1; }
| shift_expression LEFT_OP additive_expression { | shift_expression LEFT_OP additive_expression {
ES3_ONLY("<<", @2); ES3_ONLY("<<", @2, "bit-wise operator");
$$ = context->addBinaryMath(EOpBitShiftLeft, $1, $3, @2); $$ = context->addBinaryMath(EOpBitShiftLeft, $1, $3, @2);
} }
| shift_expression RIGHT_OP additive_expression { | shift_expression RIGHT_OP additive_expression {
ES3_ONLY(">>", @2); ES3_ONLY(">>", @2, "bit-wise operator");
$$ = context->addBinaryMath(EOpBitShiftRight, $1, $3, @2); $$ = context->addBinaryMath(EOpBitShiftRight, $1, $3, @2);
} }
; ;
...@@ -505,7 +505,7 @@ equality_expression ...@@ -505,7 +505,7 @@ equality_expression
and_expression and_expression
: equality_expression { $$ = $1; } : equality_expression { $$ = $1; }
| and_expression AMPERSAND equality_expression { | and_expression AMPERSAND equality_expression {
ES3_ONLY("&", @2); ES3_ONLY("&", @2, "bit-wise operator");
$$ = context->addBinaryMath(EOpBitwiseAnd, $1, $3, @2); $$ = context->addBinaryMath(EOpBitwiseAnd, $1, $3, @2);
} }
; ;
...@@ -513,7 +513,7 @@ and_expression ...@@ -513,7 +513,7 @@ and_expression
exclusive_or_expression exclusive_or_expression
: and_expression { $$ = $1; } : and_expression { $$ = $1; }
| exclusive_or_expression CARET and_expression { | exclusive_or_expression CARET and_expression {
ES3_ONLY("^", @2); ES3_ONLY("^", @2, "bit-wise operator");
$$ = context->addBinaryMath(EOpBitwiseXor, $1, $3, @2); $$ = context->addBinaryMath(EOpBitwiseXor, $1, $3, @2);
} }
; ;
...@@ -521,7 +521,7 @@ exclusive_or_expression ...@@ -521,7 +521,7 @@ exclusive_or_expression
inclusive_or_expression inclusive_or_expression
: exclusive_or_expression { $$ = $1; } : exclusive_or_expression { $$ = $1; }
| inclusive_or_expression VERTICAL_BAR exclusive_or_expression { | inclusive_or_expression VERTICAL_BAR exclusive_or_expression {
ES3_ONLY("|", @2); ES3_ONLY("|", @2, "bit-wise operator");
$$ = context->addBinaryMath(EOpBitwiseOr, $1, $3, @2); $$ = context->addBinaryMath(EOpBitwiseOr, $1, $3, @2);
} }
; ;
...@@ -578,19 +578,19 @@ assignment_operator ...@@ -578,19 +578,19 @@ assignment_operator
: EQUAL { $$.line = @1; $$.op = EOpAssign; } : EQUAL { $$.line = @1; $$.op = EOpAssign; }
| MUL_ASSIGN { FRAG_VERT_ONLY("*=", @1); $$.line = @1; $$.op = EOpMulAssign; } | MUL_ASSIGN { FRAG_VERT_ONLY("*=", @1); $$.line = @1; $$.op = EOpMulAssign; }
| DIV_ASSIGN { FRAG_VERT_ONLY("/=", @1); $$.line = @1; $$.op = EOpDivAssign; } | DIV_ASSIGN { FRAG_VERT_ONLY("/=", @1); $$.line = @1; $$.op = EOpDivAssign; }
| MOD_ASSIGN { ES3_ONLY("%=", @1); | MOD_ASSIGN { ES3_ONLY("%=", @1, "integer modulus operator");
FRAG_VERT_ONLY("%=", @1); $$.line = @1; $$.op = EOpIModAssign; } FRAG_VERT_ONLY("%=", @1); $$.line = @1; $$.op = EOpIModAssign; }
| ADD_ASSIGN { $$.line = @1; $$.op = EOpAddAssign; } | ADD_ASSIGN { $$.line = @1; $$.op = EOpAddAssign; }
| SUB_ASSIGN { $$.line = @1; $$.op = EOpSubAssign; } | SUB_ASSIGN { $$.line = @1; $$.op = EOpSubAssign; }
| LEFT_ASSIGN { ES3_ONLY("<<=", @1); | LEFT_ASSIGN { ES3_ONLY("<<=", @1, "bit-wise operator");
FRAG_VERT_ONLY("<<=", @1); $$.line = @1; $$.op = EOpBitShiftLeftAssign; } FRAG_VERT_ONLY("<<=", @1); $$.line = @1; $$.op = EOpBitShiftLeftAssign; }
| RIGHT_ASSIGN { ES3_ONLY(">>=", @1); | RIGHT_ASSIGN { ES3_ONLY(">>=", @1, "bit-wise operator");
FRAG_VERT_ONLY(">>=", @1); $$.line = @1; $$.op = EOpBitShiftRightAssign; } FRAG_VERT_ONLY(">>=", @1); $$.line = @1; $$.op = EOpBitShiftRightAssign; }
| AND_ASSIGN { ES3_ONLY("&=", @1); | AND_ASSIGN { ES3_ONLY("&=", @1, "bit-wise operator");
FRAG_VERT_ONLY("&=", @1); $$.line = @1; $$.op = EOpBitwiseAndAssign; } FRAG_VERT_ONLY("&=", @1); $$.line = @1; $$.op = EOpBitwiseAndAssign; }
| XOR_ASSIGN { ES3_ONLY("^=", @1); | XOR_ASSIGN { ES3_ONLY("^=", @1, "bit-wise operator");
FRAG_VERT_ONLY("^=", @1); $$.line = @1; $$.op = EOpBitwiseXorAssign; } FRAG_VERT_ONLY("^=", @1); $$.line = @1; $$.op = EOpBitwiseXorAssign; }
| OR_ASSIGN { ES3_ONLY("|=", @1); | OR_ASSIGN { ES3_ONLY("|=", @1, "bit-wise operator");
FRAG_VERT_ONLY("|=", @1); $$.line = @1; $$.op = EOpBitwiseOrAssign; } FRAG_VERT_ONLY("|=", @1); $$.line = @1; $$.op = EOpBitwiseOrAssign; }
; ;
...@@ -666,15 +666,15 @@ declaration ...@@ -666,15 +666,15 @@ declaration
$$ = 0; $$ = 0;
} }
| type_qualifier enter_struct struct_declaration_list RIGHT_BRACE SEMICOLON { | type_qualifier enter_struct struct_declaration_list RIGHT_BRACE SEMICOLON {
ES3_ONLY(getQualifierString($1.qualifier), @1); ES3_ONLY(getQualifierString($1.qualifier), @1, "interface blocks");
$$ = context->addInterfaceBlock($1, @2, *$2.string, $3, NULL, @1, NULL, @1); $$ = context->addInterfaceBlock($1, @2, *$2.string, $3, NULL, @1, NULL, @1);
} }
| type_qualifier enter_struct struct_declaration_list RIGHT_BRACE IDENTIFIER SEMICOLON { | type_qualifier enter_struct struct_declaration_list RIGHT_BRACE IDENTIFIER SEMICOLON {
ES3_ONLY(getQualifierString($1.qualifier), @1); ES3_ONLY(getQualifierString($1.qualifier), @1, "interface blocks");
$$ = context->addInterfaceBlock($1, @2, *$2.string, $3, $5.string, @5, NULL, @1); $$ = context->addInterfaceBlock($1, @2, *$2.string, $3, $5.string, @5, NULL, @1);
} }
| type_qualifier enter_struct struct_declaration_list RIGHT_BRACE IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET SEMICOLON { | type_qualifier enter_struct struct_declaration_list RIGHT_BRACE IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET SEMICOLON {
ES3_ONLY(getQualifierString($1.qualifier), @1); ES3_ONLY(getQualifierString($1.qualifier), @1, "interface blocks");
$$ = context->addInterfaceBlock($1, @2, *$2.string, $3, $5.string, @5, $7, @6); $$ = context->addInterfaceBlock($1, @2, *$2.string, $3, $5.string, @5, $7, @6);
} }
| type_qualifier SEMICOLON { | type_qualifier SEMICOLON {
...@@ -886,12 +886,12 @@ init_declarator_list ...@@ -886,12 +886,12 @@ init_declarator_list
$$.intermAggregate = context->parseArrayDeclarator($$.type, $1.intermAggregate, @3, *$3.string, @4, $5); $$.intermAggregate = context->parseArrayDeclarator($$.type, $1.intermAggregate, @3, *$3.string, @4, $5);
} }
| init_declarator_list COMMA IDENTIFIER LEFT_BRACKET RIGHT_BRACKET EQUAL initializer { | init_declarator_list COMMA IDENTIFIER LEFT_BRACKET RIGHT_BRACKET EQUAL initializer {
ES3_ONLY("[]", @3); ES3_ONLY("[]", @3, "implicitly sized array");
$$ = $1; $$ = $1;
$$.intermAggregate = context->parseArrayInitDeclarator($$.type, $1.intermAggregate, @3, *$3.string, @4, nullptr, @6, $7); $$.intermAggregate = context->parseArrayInitDeclarator($$.type, $1.intermAggregate, @3, *$3.string, @4, nullptr, @6, $7);
} }
| init_declarator_list COMMA IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET EQUAL initializer { | init_declarator_list COMMA IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET EQUAL initializer {
ES3_ONLY("=", @7); ES3_ONLY("=", @7, "first-class arrays (array initializer)");
$$ = $1; $$ = $1;
$$.intermAggregate = context->parseArrayInitDeclarator($$.type, $1.intermAggregate, @3, *$3.string, @4, $5, @7, $8); $$.intermAggregate = context->parseArrayInitDeclarator($$.type, $1.intermAggregate, @3, *$3.string, @4, $5, @7, $8);
} }
...@@ -915,12 +915,12 @@ single_declaration ...@@ -915,12 +915,12 @@ single_declaration
$$.intermAggregate = context->parseSingleArrayDeclaration($$.type, @2, *$2.string, @3, $4); $$.intermAggregate = context->parseSingleArrayDeclaration($$.type, @2, *$2.string, @3, $4);
} }
| fully_specified_type IDENTIFIER LEFT_BRACKET RIGHT_BRACKET EQUAL initializer { | fully_specified_type IDENTIFIER LEFT_BRACKET RIGHT_BRACKET EQUAL initializer {
ES3_ONLY("[]", @3); ES3_ONLY("[]", @3, "implicitly sized array");
$$.type = $1; $$.type = $1;
$$.intermAggregate = context->parseSingleArrayInitDeclaration($$.type, @2, *$2.string, @3, nullptr, @5, $6); $$.intermAggregate = context->parseSingleArrayInitDeclaration($$.type, @2, *$2.string, @3, nullptr, @5, $6);
} }
| fully_specified_type IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET EQUAL initializer { | fully_specified_type IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET EQUAL initializer {
ES3_ONLY("=", @6); ES3_ONLY("=", @6, "first-class arrays (array initializer)");
$$.type = $1; $$.type = $1;
$$.intermAggregate = context->parseSingleArrayInitDeclaration($$.type, @2, *$2.string, @3, $4, @6, $7); $$.intermAggregate = context->parseSingleArrayInitDeclaration($$.type, @2, *$2.string, @3, $4, @6, $7);
} }
...@@ -1008,7 +1008,7 @@ fully_specified_type ...@@ -1008,7 +1008,7 @@ fully_specified_type
$$ = $1; $$ = $1;
if ($1.array) { if ($1.array) {
ES3_ONLY("[]", @1); ES3_ONLY("[]", @1, "first-class-array");
if (context->getShaderVersion() != 300) { if (context->getShaderVersion() != 300) {
$1.clearArrayness(); $1.clearArrayness();
} }
...@@ -1089,17 +1089,17 @@ storage_qualifier ...@@ -1089,17 +1089,17 @@ storage_qualifier
$$.line = @1; $$.line = @1;
} }
| IN_QUAL { | IN_QUAL {
ES3_ONLY("in", @1); ES3_ONLY("in", @1, "storage qualifier");
$$.qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn; $$.qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn;
$$.line = @1; $$.line = @1;
} }
| OUT_QUAL { | OUT_QUAL {
ES3_ONLY("out", @1); ES3_ONLY("out", @1, "storage qualifier");
$$.qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut; $$.qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut;
$$.line = @1; $$.line = @1;
} }
| CENTROID IN_QUAL { | CENTROID IN_QUAL {
ES3_ONLY("centroid in", @1); ES3_ONLY("centroid in", @1, "storage qualifier");
if (context->getShaderType() == GL_VERTEX_SHADER) if (context->getShaderType() == GL_VERTEX_SHADER)
{ {
context->error(@1, "invalid storage qualifier", "it is an error to use 'centroid in' in the vertex shader"); context->error(@1, "invalid storage qualifier", "it is an error to use 'centroid in' in the vertex shader");
...@@ -1108,8 +1108,8 @@ storage_qualifier ...@@ -1108,8 +1108,8 @@ storage_qualifier
$$.qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn; $$.qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn;
$$.line = @2; $$.line = @2;
} }
| CENTROID OUT_QUAL { | CENTROID OUT_QUAL {
ES3_ONLY("centroid out", @1); ES3_ONLY("centroid out", @1, "storage qualifier");
if (context->getShaderType() == GL_FRAGMENT_SHADER) if (context->getShaderType() == GL_FRAGMENT_SHADER)
{ {
context->error(@1, "invalid storage qualifier", "it is an error to use 'centroid out' in the fragment shader"); context->error(@1, "invalid storage qualifier", "it is an error to use 'centroid out' in the fragment shader");
...@@ -1157,7 +1157,7 @@ precision_qualifier ...@@ -1157,7 +1157,7 @@ precision_qualifier
layout_qualifier layout_qualifier
: LAYOUT LEFT_PAREN layout_qualifier_id_list RIGHT_PAREN { : LAYOUT LEFT_PAREN layout_qualifier_id_list RIGHT_PAREN {
ES3_ONLY("layout", @1); ES3_ONLY("layout", @1, "qualifier");
$$ = $3; $$ = $3;
} }
; ;
...@@ -1188,7 +1188,7 @@ type_specifier_no_prec ...@@ -1188,7 +1188,7 @@ type_specifier_no_prec
$$ = $1; $$ = $1;
} }
| type_specifier_nonarray LEFT_BRACKET RIGHT_BRACKET { | type_specifier_nonarray LEFT_BRACKET RIGHT_BRACKET {
ES3_ONLY("[]", @2); ES3_ONLY("[]", @2, "implicitly sized array");
$$ = $1; $$ = $1;
$$.setArray(true, 0); $$.setArray(true, 0);
} }
......
...@@ -358,9 +358,9 @@ extern void yyerror(YYLTYPE* lloc, TParseContext* context, const char* reason); ...@@ -358,9 +358,9 @@ extern void yyerror(YYLTYPE* lloc, TParseContext* context, const char* reason);
} \ } \
} }
#define ES3_ONLY(S, L) { \ #define ES3_ONLY(TOKEN, LINE, REASON) { \
if (context->getShaderVersion() != 300) { \ if (context->getShaderVersion() != 300) { \
context->error(L, " supported in GLSL ES 3.00 only ", S); \ context->error(LINE, REASON " supported in GLSL ES 3.00 only ", TOKEN); \
context->recover(); \ context->recover(); \
} \ } \
} }
...@@ -2713,7 +2713,7 @@ yyreduce: ...@@ -2713,7 +2713,7 @@ yyreduce:
{ {
if ((yyvsp[(1) - (1)].interm.type).array) { if ((yyvsp[(1) - (1)].interm.type).array) {
ES3_ONLY("[]", (yylsp[(1) - (1)])); ES3_ONLY("[]", (yylsp[(1) - (1)]), "array constructor");
} }
(yyval.interm.function) = context->addConstructorFunc((yyvsp[(1) - (1)].interm.type)); (yyval.interm.function) = context->addConstructorFunc((yyvsp[(1) - (1)].interm.type));
} }
...@@ -2816,7 +2816,7 @@ yyreduce: ...@@ -2816,7 +2816,7 @@ yyreduce:
case 36: case 36:
{ {
ES3_ONLY("~", (yylsp[(1) - (1)])); ES3_ONLY("~", (yylsp[(1) - (1)]), "bit-wise operator");
(yyval.interm).line = (yylsp[(1) - (1)]); (yyval.interm).op = EOpBitwiseNot; (yyval.interm).line = (yylsp[(1) - (1)]); (yyval.interm).op = EOpBitwiseNot;
} }
break; break;
...@@ -2846,7 +2846,7 @@ yyreduce: ...@@ -2846,7 +2846,7 @@ yyreduce:
{ {
FRAG_VERT_ONLY("%", (yylsp[(2) - (3)])); FRAG_VERT_ONLY("%", (yylsp[(2) - (3)]));
ES3_ONLY("%", (yylsp[(2) - (3)])); ES3_ONLY("%", (yylsp[(2) - (3)]), "integer modulus operator");
(yyval.interm.intermTypedNode) = context->addBinaryMath(EOpIMod, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)])); (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpIMod, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
} }
break; break;
...@@ -2878,7 +2878,7 @@ yyreduce: ...@@ -2878,7 +2878,7 @@ yyreduce:
case 45: case 45:
{ {
ES3_ONLY("<<", (yylsp[(2) - (3)])); ES3_ONLY("<<", (yylsp[(2) - (3)]), "bit-wise operator");
(yyval.interm.intermTypedNode) = context->addBinaryMath(EOpBitShiftLeft, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)])); (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpBitShiftLeft, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
} }
break; break;
...@@ -2886,7 +2886,7 @@ yyreduce: ...@@ -2886,7 +2886,7 @@ yyreduce:
case 46: case 46:
{ {
ES3_ONLY(">>", (yylsp[(2) - (3)])); ES3_ONLY(">>", (yylsp[(2) - (3)]), "bit-wise operator");
(yyval.interm.intermTypedNode) = context->addBinaryMath(EOpBitShiftRight, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)])); (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpBitShiftRight, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
} }
break; break;
...@@ -2951,7 +2951,7 @@ yyreduce: ...@@ -2951,7 +2951,7 @@ yyreduce:
case 56: case 56:
{ {
ES3_ONLY("&", (yylsp[(2) - (3)])); ES3_ONLY("&", (yylsp[(2) - (3)]), "bit-wise operator");
(yyval.interm.intermTypedNode) = context->addBinaryMath(EOpBitwiseAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)])); (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpBitwiseAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
} }
break; break;
...@@ -2964,7 +2964,7 @@ yyreduce: ...@@ -2964,7 +2964,7 @@ yyreduce:
case 58: case 58:
{ {
ES3_ONLY("^", (yylsp[(2) - (3)])); ES3_ONLY("^", (yylsp[(2) - (3)]), "bit-wise operator");
(yyval.interm.intermTypedNode) = context->addBinaryMath(EOpBitwiseXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)])); (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpBitwiseXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
} }
break; break;
...@@ -2977,7 +2977,7 @@ yyreduce: ...@@ -2977,7 +2977,7 @@ yyreduce:
case 60: case 60:
{ {
ES3_ONLY("|", (yylsp[(2) - (3)])); ES3_ONLY("|", (yylsp[(2) - (3)]), "bit-wise operator");
(yyval.interm.intermTypedNode) = context->addBinaryMath(EOpBitwiseOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)])); (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpBitwiseOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
} }
break; break;
...@@ -3072,7 +3072,7 @@ yyreduce: ...@@ -3072,7 +3072,7 @@ yyreduce:
case 74: case 74:
{ ES3_ONLY("%=", (yylsp[(1) - (1)])); { ES3_ONLY("%=", (yylsp[(1) - (1)]), "integer modulus operator");
FRAG_VERT_ONLY("%=", (yylsp[(1) - (1)])); (yyval.interm).line = (yylsp[(1) - (1)]); (yyval.interm).op = EOpIModAssign; } FRAG_VERT_ONLY("%=", (yylsp[(1) - (1)])); (yyval.interm).line = (yylsp[(1) - (1)]); (yyval.interm).op = EOpIModAssign; }
break; break;
...@@ -3088,31 +3088,31 @@ yyreduce: ...@@ -3088,31 +3088,31 @@ yyreduce:
case 77: case 77:
{ ES3_ONLY("<<=", (yylsp[(1) - (1)])); { ES3_ONLY("<<=", (yylsp[(1) - (1)]), "bit-wise operator");
FRAG_VERT_ONLY("<<=", (yylsp[(1) - (1)])); (yyval.interm).line = (yylsp[(1) - (1)]); (yyval.interm).op = EOpBitShiftLeftAssign; } FRAG_VERT_ONLY("<<=", (yylsp[(1) - (1)])); (yyval.interm).line = (yylsp[(1) - (1)]); (yyval.interm).op = EOpBitShiftLeftAssign; }
break; break;
case 78: case 78:
{ ES3_ONLY(">>=", (yylsp[(1) - (1)])); { ES3_ONLY(">>=", (yylsp[(1) - (1)]), "bit-wise operator");
FRAG_VERT_ONLY(">>=", (yylsp[(1) - (1)])); (yyval.interm).line = (yylsp[(1) - (1)]); (yyval.interm).op = EOpBitShiftRightAssign; } FRAG_VERT_ONLY(">>=", (yylsp[(1) - (1)])); (yyval.interm).line = (yylsp[(1) - (1)]); (yyval.interm).op = EOpBitShiftRightAssign; }
break; break;
case 79: case 79:
{ ES3_ONLY("&=", (yylsp[(1) - (1)])); { ES3_ONLY("&=", (yylsp[(1) - (1)]), "bit-wise operator");
FRAG_VERT_ONLY("&=", (yylsp[(1) - (1)])); (yyval.interm).line = (yylsp[(1) - (1)]); (yyval.interm).op = EOpBitwiseAndAssign; } FRAG_VERT_ONLY("&=", (yylsp[(1) - (1)])); (yyval.interm).line = (yylsp[(1) - (1)]); (yyval.interm).op = EOpBitwiseAndAssign; }
break; break;
case 80: case 80:
{ ES3_ONLY("^=", (yylsp[(1) - (1)])); { ES3_ONLY("^=", (yylsp[(1) - (1)]), "bit-wise operator");
FRAG_VERT_ONLY("^=", (yylsp[(1) - (1)])); (yyval.interm).line = (yylsp[(1) - (1)]); (yyval.interm).op = EOpBitwiseXorAssign; } FRAG_VERT_ONLY("^=", (yylsp[(1) - (1)])); (yyval.interm).line = (yylsp[(1) - (1)]); (yyval.interm).op = EOpBitwiseXorAssign; }
break; break;
case 81: case 81:
{ ES3_ONLY("|=", (yylsp[(1) - (1)])); { ES3_ONLY("|=", (yylsp[(1) - (1)]), "bit-wise operator");
FRAG_VERT_ONLY("|=", (yylsp[(1) - (1)])); (yyval.interm).line = (yylsp[(1) - (1)]); (yyval.interm).op = EOpBitwiseOrAssign; } FRAG_VERT_ONLY("|=", (yylsp[(1) - (1)])); (yyval.interm).line = (yylsp[(1) - (1)]); (yyval.interm).op = EOpBitwiseOrAssign; }
break; break;
...@@ -3208,7 +3208,7 @@ yyreduce: ...@@ -3208,7 +3208,7 @@ yyreduce:
case 89: case 89:
{ {
ES3_ONLY(getQualifierString((yyvsp[(1) - (5)].interm.type).qualifier), (yylsp[(1) - (5)])); ES3_ONLY(getQualifierString((yyvsp[(1) - (5)].interm.type).qualifier), (yylsp[(1) - (5)]), "interface blocks");
(yyval.interm.intermNode) = context->addInterfaceBlock((yyvsp[(1) - (5)].interm.type), (yylsp[(2) - (5)]), *(yyvsp[(2) - (5)].lex).string, (yyvsp[(3) - (5)].interm.fieldList), NULL, (yylsp[(1) - (5)]), NULL, (yylsp[(1) - (5)])); (yyval.interm.intermNode) = context->addInterfaceBlock((yyvsp[(1) - (5)].interm.type), (yylsp[(2) - (5)]), *(yyvsp[(2) - (5)].lex).string, (yyvsp[(3) - (5)].interm.fieldList), NULL, (yylsp[(1) - (5)]), NULL, (yylsp[(1) - (5)]));
} }
break; break;
...@@ -3216,7 +3216,7 @@ yyreduce: ...@@ -3216,7 +3216,7 @@ yyreduce:
case 90: case 90:
{ {
ES3_ONLY(getQualifierString((yyvsp[(1) - (6)].interm.type).qualifier), (yylsp[(1) - (6)])); ES3_ONLY(getQualifierString((yyvsp[(1) - (6)].interm.type).qualifier), (yylsp[(1) - (6)]), "interface blocks");
(yyval.interm.intermNode) = context->addInterfaceBlock((yyvsp[(1) - (6)].interm.type), (yylsp[(2) - (6)]), *(yyvsp[(2) - (6)].lex).string, (yyvsp[(3) - (6)].interm.fieldList), (yyvsp[(5) - (6)].lex).string, (yylsp[(5) - (6)]), NULL, (yylsp[(1) - (6)])); (yyval.interm.intermNode) = context->addInterfaceBlock((yyvsp[(1) - (6)].interm.type), (yylsp[(2) - (6)]), *(yyvsp[(2) - (6)].lex).string, (yyvsp[(3) - (6)].interm.fieldList), (yyvsp[(5) - (6)].lex).string, (yylsp[(5) - (6)]), NULL, (yylsp[(1) - (6)]));
} }
break; break;
...@@ -3224,7 +3224,7 @@ yyreduce: ...@@ -3224,7 +3224,7 @@ yyreduce:
case 91: case 91:
{ {
ES3_ONLY(getQualifierString((yyvsp[(1) - (9)].interm.type).qualifier), (yylsp[(1) - (9)])); ES3_ONLY(getQualifierString((yyvsp[(1) - (9)].interm.type).qualifier), (yylsp[(1) - (9)]), "interface blocks");
(yyval.interm.intermNode) = context->addInterfaceBlock((yyvsp[(1) - (9)].interm.type), (yylsp[(2) - (9)]), *(yyvsp[(2) - (9)].lex).string, (yyvsp[(3) - (9)].interm.fieldList), (yyvsp[(5) - (9)].lex).string, (yylsp[(5) - (9)]), (yyvsp[(7) - (9)].interm.intermTypedNode), (yylsp[(6) - (9)])); (yyval.interm.intermNode) = context->addInterfaceBlock((yyvsp[(1) - (9)].interm.type), (yylsp[(2) - (9)]), *(yyvsp[(2) - (9)].lex).string, (yyvsp[(3) - (9)].interm.fieldList), (yyvsp[(5) - (9)].lex).string, (yylsp[(5) - (9)]), (yyvsp[(7) - (9)].interm.intermTypedNode), (yylsp[(6) - (9)]));
} }
break; break;
...@@ -3484,7 +3484,7 @@ yyreduce: ...@@ -3484,7 +3484,7 @@ yyreduce:
case 113: case 113:
{ {
ES3_ONLY("[]", (yylsp[(3) - (7)])); ES3_ONLY("[]", (yylsp[(3) - (7)]), "implicitly sized array");
(yyval.interm) = (yyvsp[(1) - (7)].interm); (yyval.interm) = (yyvsp[(1) - (7)].interm);
(yyval.interm).intermAggregate = context->parseArrayInitDeclarator((yyval.interm).type, (yyvsp[(1) - (7)].interm).intermAggregate, (yylsp[(3) - (7)]), *(yyvsp[(3) - (7)].lex).string, (yylsp[(4) - (7)]), nullptr, (yylsp[(6) - (7)]), (yyvsp[(7) - (7)].interm.intermTypedNode)); (yyval.interm).intermAggregate = context->parseArrayInitDeclarator((yyval.interm).type, (yyvsp[(1) - (7)].interm).intermAggregate, (yylsp[(3) - (7)]), *(yyvsp[(3) - (7)].lex).string, (yylsp[(4) - (7)]), nullptr, (yylsp[(6) - (7)]), (yyvsp[(7) - (7)].interm.intermTypedNode));
} }
...@@ -3493,7 +3493,7 @@ yyreduce: ...@@ -3493,7 +3493,7 @@ yyreduce:
case 114: case 114:
{ {
ES3_ONLY("=", (yylsp[(7) - (8)])); ES3_ONLY("=", (yylsp[(7) - (8)]), "first-class arrays (array initializer)");
(yyval.interm) = (yyvsp[(1) - (8)].interm); (yyval.interm) = (yyvsp[(1) - (8)].interm);
(yyval.interm).intermAggregate = context->parseArrayInitDeclarator((yyval.interm).type, (yyvsp[(1) - (8)].interm).intermAggregate, (yylsp[(3) - (8)]), *(yyvsp[(3) - (8)].lex).string, (yylsp[(4) - (8)]), (yyvsp[(5) - (8)].interm.intermTypedNode), (yylsp[(7) - (8)]), (yyvsp[(8) - (8)].interm.intermTypedNode)); (yyval.interm).intermAggregate = context->parseArrayInitDeclarator((yyval.interm).type, (yyvsp[(1) - (8)].interm).intermAggregate, (yylsp[(3) - (8)]), *(yyvsp[(3) - (8)].lex).string, (yylsp[(4) - (8)]), (yyvsp[(5) - (8)].interm.intermTypedNode), (yylsp[(7) - (8)]), (yyvsp[(8) - (8)].interm.intermTypedNode));
} }
...@@ -3534,7 +3534,7 @@ yyreduce: ...@@ -3534,7 +3534,7 @@ yyreduce:
case 119: case 119:
{ {
ES3_ONLY("[]", (yylsp[(3) - (6)])); ES3_ONLY("[]", (yylsp[(3) - (6)]), "implicitly sized array");
(yyval.interm).type = (yyvsp[(1) - (6)].interm.type); (yyval.interm).type = (yyvsp[(1) - (6)].interm.type);
(yyval.interm).intermAggregate = context->parseSingleArrayInitDeclaration((yyval.interm).type, (yylsp[(2) - (6)]), *(yyvsp[(2) - (6)].lex).string, (yylsp[(3) - (6)]), nullptr, (yylsp[(5) - (6)]), (yyvsp[(6) - (6)].interm.intermTypedNode)); (yyval.interm).intermAggregate = context->parseSingleArrayInitDeclaration((yyval.interm).type, (yylsp[(2) - (6)]), *(yyvsp[(2) - (6)].lex).string, (yylsp[(3) - (6)]), nullptr, (yylsp[(5) - (6)]), (yyvsp[(6) - (6)].interm.intermTypedNode));
} }
...@@ -3543,7 +3543,7 @@ yyreduce: ...@@ -3543,7 +3543,7 @@ yyreduce:
case 120: case 120:
{ {
ES3_ONLY("=", (yylsp[(6) - (7)])); ES3_ONLY("=", (yylsp[(6) - (7)]), "first-class arrays (array initializer)");
(yyval.interm).type = (yyvsp[(1) - (7)].interm.type); (yyval.interm).type = (yyvsp[(1) - (7)].interm.type);
(yyval.interm).intermAggregate = context->parseSingleArrayInitDeclaration((yyval.interm).type, (yylsp[(2) - (7)]), *(yyvsp[(2) - (7)].lex).string, (yylsp[(3) - (7)]), (yyvsp[(4) - (7)].interm.intermTypedNode), (yylsp[(6) - (7)]), (yyvsp[(7) - (7)].interm.intermTypedNode)); (yyval.interm).intermAggregate = context->parseSingleArrayInitDeclaration((yyval.interm).type, (yylsp[(2) - (7)]), *(yyvsp[(2) - (7)].lex).string, (yylsp[(3) - (7)]), (yyvsp[(4) - (7)].interm.intermTypedNode), (yylsp[(6) - (7)]), (yyvsp[(7) - (7)].interm.intermTypedNode));
} }
...@@ -3571,7 +3571,7 @@ yyreduce: ...@@ -3571,7 +3571,7 @@ yyreduce:
(yyval.interm.type) = (yyvsp[(1) - (1)].interm.type); (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
if ((yyvsp[(1) - (1)].interm.type).array) { if ((yyvsp[(1) - (1)].interm.type).array) {
ES3_ONLY("[]", (yylsp[(1) - (1)])); ES3_ONLY("[]", (yylsp[(1) - (1)]), "first-class-array");
if (context->getShaderVersion() != 300) { if (context->getShaderVersion() != 300) {
(yyvsp[(1) - (1)].interm.type).clearArrayness(); (yyvsp[(1) - (1)].interm.type).clearArrayness();
} }
...@@ -3696,7 +3696,7 @@ yyreduce: ...@@ -3696,7 +3696,7 @@ yyreduce:
case 137: case 137:
{ {
ES3_ONLY("in", (yylsp[(1) - (1)])); ES3_ONLY("in", (yylsp[(1) - (1)]), "storage qualifier");
(yyval.interm.type).qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn; (yyval.interm.type).qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn;
(yyval.interm.type).line = (yylsp[(1) - (1)]); (yyval.interm.type).line = (yylsp[(1) - (1)]);
} }
...@@ -3705,7 +3705,7 @@ yyreduce: ...@@ -3705,7 +3705,7 @@ yyreduce:
case 138: case 138:
{ {
ES3_ONLY("out", (yylsp[(1) - (1)])); ES3_ONLY("out", (yylsp[(1) - (1)]), "storage qualifier");
(yyval.interm.type).qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut; (yyval.interm.type).qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut;
(yyval.interm.type).line = (yylsp[(1) - (1)]); (yyval.interm.type).line = (yylsp[(1) - (1)]);
} }
...@@ -3714,7 +3714,7 @@ yyreduce: ...@@ -3714,7 +3714,7 @@ yyreduce:
case 139: case 139:
{ {
ES3_ONLY("centroid in", (yylsp[(1) - (2)])); ES3_ONLY("centroid in", (yylsp[(1) - (2)]), "storage qualifier");
if (context->getShaderType() == GL_VERTEX_SHADER) if (context->getShaderType() == GL_VERTEX_SHADER)
{ {
context->error((yylsp[(1) - (2)]), "invalid storage qualifier", "it is an error to use 'centroid in' in the vertex shader"); context->error((yylsp[(1) - (2)]), "invalid storage qualifier", "it is an error to use 'centroid in' in the vertex shader");
...@@ -3728,7 +3728,7 @@ yyreduce: ...@@ -3728,7 +3728,7 @@ yyreduce:
case 140: case 140:
{ {
ES3_ONLY("centroid out", (yylsp[(1) - (2)])); ES3_ONLY("centroid out", (yylsp[(1) - (2)]), "storage qualifier");
if (context->getShaderType() == GL_FRAGMENT_SHADER) if (context->getShaderType() == GL_FRAGMENT_SHADER)
{ {
context->error((yylsp[(1) - (2)]), "invalid storage qualifier", "it is an error to use 'centroid out' in the fragment shader"); context->error((yylsp[(1) - (2)]), "invalid storage qualifier", "it is an error to use 'centroid out' in the fragment shader");
...@@ -3795,7 +3795,7 @@ yyreduce: ...@@ -3795,7 +3795,7 @@ yyreduce:
case 147: case 147:
{ {
ES3_ONLY("layout", (yylsp[(1) - (4)])); ES3_ONLY("layout", (yylsp[(1) - (4)]), "qualifier");
(yyval.interm.layoutQualifier) = (yyvsp[(3) - (4)].interm.layoutQualifier); (yyval.interm.layoutQualifier) = (yyvsp[(3) - (4)].interm.layoutQualifier);
} }
break; break;
...@@ -3845,7 +3845,7 @@ yyreduce: ...@@ -3845,7 +3845,7 @@ yyreduce:
case 154: case 154:
{ {
ES3_ONLY("[]", (yylsp[(2) - (3)])); ES3_ONLY("[]", (yylsp[(2) - (3)]), "implicitly sized array");
(yyval.interm.type) = (yyvsp[(1) - (3)].interm.type); (yyval.interm.type) = (yyvsp[(1) - (3)].interm.type);
(yyval.interm.type).setArray(true, 0); (yyval.interm.type).setArray(true, 0);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment