2 // Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
3 // Copyright (C) 2012-2013 LunarG, Inc.
4 // Copyright (C) 2017 ARM Limited.
5 // Copyright (C) 2015-2018 Google, Inc.
7 // All rights reserved.
9 // Redistribution and use in source and binary forms, with or without
10 // modification, are permitted provided that the following conditions
13 // Redistributions of source code must retain the above copyright
14 // notice, this list of conditions and the following disclaimer.
16 // Redistributions in binary form must reproduce the above
17 // copyright notice, this list of conditions and the following
18 // disclaimer in the documentation and/or other materials provided
19 // with the distribution.
21 // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
22 // contributors may be used to endorse or promote products derived
23 // from this software without specific prior written permission.
25 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29 // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 // POSSIBILITY OF SUCH DAMAGE.
40 // Do not edit the .y file, only edit the .m4 file.
41 // The .y bison file is not a source file, it is a derivative of the .m4 file.
42 // The m4 file needs to be processed by m4 to generate the .y bison file.
44 // Code sandwiched between a pair:
46 // GLSLANG_WEB_EXCLUDE_ON
50 // GLSLANG_WEB_EXCLUDE_OFF
52 // Will be excluded from the grammar when m4 is executed as:
54 // m4 -P -DGLSLANG_WEB
56 // It will be included when m4 is executed as:
65 * This is bison grammar and productions for parsing all versions of the
66 * GLSL shading languages.
73 In 1985, Jeff Lee published his Yacc grammar (which is accompanied by a
74 matching Lex specification) for the April 30, 1985 draft version of the
75 ANSI C standard. Tom Stockfisch reposted it to net.sources in 1987; that
76 original, as mentioned in the answer to question 17.25 of the comp.lang.c
77 FAQ, can be ftp'ed from ftp.uu.net, file usenet/net.sources/ansi.c.grammar.Z.
79 I intend to keep this version as close to the current C Standard grammar as
80 possible; please let me know if you discover discrepancies.
85 #include "SymbolTable.h"
86 #include "ParseHelper.h"
87 #include "../Public/ShaderLang.h"
88 #include "attribute.h"
90 using namespace glslang;
94 %define parse.error verbose
98 glslang::TSourceLoc loc;
100 glslang::TString *string;
104 unsigned long long u64;
108 glslang::TSymbol* symbol;
111 glslang::TSourceLoc loc;
112 glslang::TOperator op;
114 TIntermNode* intermNode;
115 glslang::TIntermNodePair nodePair;
116 glslang::TIntermTyped* intermTypedNode;
117 glslang::TAttributes* attributes;
120 glslang::TPublicType type;
121 glslang::TFunction* function;
122 glslang::TParameter param;
123 glslang::TTypeLoc typeLine;
124 glslang::TTypeList* typeList;
125 glslang::TArraySizes* arraySizes;
126 glslang::TIdentifierList* identifierList;
128 glslang::TArraySizes* typeParameters;
134 /* windows only pragma */
136 #pragma warning(disable : 4065)
137 #pragma warning(disable : 4127)
138 #pragma warning(disable : 4244)
141 #define parseContext (*pParseContext)
142 #define yyerror(context, msg) context->parserError(msg)
144 extern int yylex(YYSTYPE*, TParseContext&);
148 %parse-param {glslang::TParseContext* pParseContext}
149 %lex-param {parseContext}
150 %pure-parser // enable thread safety
151 %expect 1 // One shift reduce conflict because of if | else
153 %token <lex> CONST BOOL INT UINT FLOAT
154 %token <lex> BVEC2 BVEC3 BVEC4
155 %token <lex> IVEC2 IVEC3 IVEC4
156 %token <lex> UVEC2 UVEC3 UVEC4
157 %token <lex> VEC2 VEC3 VEC4
158 %token <lex> MAT2 MAT3 MAT4
159 %token <lex> MAT2X2 MAT2X3 MAT2X4
160 %token <lex> MAT3X2 MAT3X3 MAT3X4
161 %token <lex> MAT4X2 MAT4X3 MAT4X4
163 // combined image/sampler
164 %token <lex> SAMPLER2D SAMPLER3D SAMPLERCUBE SAMPLER2DSHADOW
165 %token <lex> SAMPLERCUBESHADOW SAMPLER2DARRAY
166 %token <lex> SAMPLER2DARRAYSHADOW ISAMPLER2D ISAMPLER3D ISAMPLERCUBE
167 %token <lex> ISAMPLER2DARRAY USAMPLER2D USAMPLER3D
168 %token <lex> USAMPLERCUBE USAMPLER2DARRAY
170 // separate image/sampler
171 %token <lex> SAMPLER SAMPLERSHADOW
172 %token <lex> TEXTURE2D TEXTURE3D TEXTURECUBE TEXTURE2DARRAY
173 %token <lex> ITEXTURE2D ITEXTURE3D ITEXTURECUBE ITEXTURE2DARRAY
174 %token <lex> UTEXTURE2D UTEXTURE3D UTEXTURECUBE UTEXTURE2DARRAY
178 %token <lex> ATTRIBUTE VARYING
179 %token <lex> FLOAT16_T FLOAT32_T DOUBLE FLOAT64_T
180 %token <lex> INT64_T UINT64_T INT32_T UINT32_T INT16_T UINT16_T INT8_T UINT8_T
181 %token <lex> I64VEC2 I64VEC3 I64VEC4
182 %token <lex> U64VEC2 U64VEC3 U64VEC4
183 %token <lex> I32VEC2 I32VEC3 I32VEC4
184 %token <lex> U32VEC2 U32VEC3 U32VEC4
185 %token <lex> I16VEC2 I16VEC3 I16VEC4
186 %token <lex> U16VEC2 U16VEC3 U16VEC4
187 %token <lex> I8VEC2 I8VEC3 I8VEC4
188 %token <lex> U8VEC2 U8VEC3 U8VEC4
189 %token <lex> DVEC2 DVEC3 DVEC4 DMAT2 DMAT3 DMAT4
190 %token <lex> F16VEC2 F16VEC3 F16VEC4 F16MAT2 F16MAT3 F16MAT4
191 %token <lex> F32VEC2 F32VEC3 F32VEC4 F32MAT2 F32MAT3 F32MAT4
192 %token <lex> F64VEC2 F64VEC3 F64VEC4 F64MAT2 F64MAT3 F64MAT4
193 %token <lex> DMAT2X2 DMAT2X3 DMAT2X4
194 %token <lex> DMAT3X2 DMAT3X3 DMAT3X4
195 %token <lex> DMAT4X2 DMAT4X3 DMAT4X4
196 %token <lex> F16MAT2X2 F16MAT2X3 F16MAT2X4
197 %token <lex> F16MAT3X2 F16MAT3X3 F16MAT3X4
198 %token <lex> F16MAT4X2 F16MAT4X3 F16MAT4X4
199 %token <lex> F32MAT2X2 F32MAT2X3 F32MAT2X4
200 %token <lex> F32MAT3X2 F32MAT3X3 F32MAT3X4
201 %token <lex> F32MAT4X2 F32MAT4X3 F32MAT4X4
202 %token <lex> F64MAT2X2 F64MAT2X3 F64MAT2X4
203 %token <lex> F64MAT3X2 F64MAT3X3 F64MAT3X4
204 %token <lex> F64MAT4X2 F64MAT4X3 F64MAT4X4
205 %token <lex> ATOMIC_UINT
206 %token <lex> ACCSTRUCTNV
207 %token <lex> FCOOPMATNV ICOOPMATNV UCOOPMATNV
209 // combined image/sampler
210 %token <lex> SAMPLERCUBEARRAY SAMPLERCUBEARRAYSHADOW
211 %token <lex> ISAMPLERCUBEARRAY USAMPLERCUBEARRAY
212 %token <lex> SAMPLER1D SAMPLER1DARRAY SAMPLER1DARRAYSHADOW ISAMPLER1D SAMPLER1DSHADOW
213 %token <lex> SAMPLER2DRECT SAMPLER2DRECTSHADOW ISAMPLER2DRECT USAMPLER2DRECT
214 %token <lex> SAMPLERBUFFER ISAMPLERBUFFER USAMPLERBUFFER
215 %token <lex> SAMPLER2DMS ISAMPLER2DMS USAMPLER2DMS
216 %token <lex> SAMPLER2DMSARRAY ISAMPLER2DMSARRAY USAMPLER2DMSARRAY
217 %token <lex> SAMPLEREXTERNALOES
218 %token <lex> SAMPLEREXTERNAL2DY2YEXT
219 %token <lex> ISAMPLER1DARRAY USAMPLER1D USAMPLER1DARRAY
220 %token <lex> F16SAMPLER1D F16SAMPLER2D F16SAMPLER3D F16SAMPLER2DRECT F16SAMPLERCUBE
221 %token <lex> F16SAMPLER1DARRAY F16SAMPLER2DARRAY F16SAMPLERCUBEARRAY
222 %token <lex> F16SAMPLERBUFFER F16SAMPLER2DMS F16SAMPLER2DMSARRAY
223 %token <lex> F16SAMPLER1DSHADOW F16SAMPLER2DSHADOW F16SAMPLER1DARRAYSHADOW F16SAMPLER2DARRAYSHADOW
224 %token <lex> F16SAMPLER2DRECTSHADOW F16SAMPLERCUBESHADOW F16SAMPLERCUBEARRAYSHADOW
227 %token <lex> IMAGE1D IIMAGE1D UIMAGE1D IMAGE2D IIMAGE2D
228 %token <lex> UIMAGE2D IMAGE3D IIMAGE3D UIMAGE3D
229 %token <lex> IMAGE2DRECT IIMAGE2DRECT UIMAGE2DRECT
230 %token <lex> IMAGECUBE IIMAGECUBE UIMAGECUBE
231 %token <lex> IMAGEBUFFER IIMAGEBUFFER UIMAGEBUFFER
232 %token <lex> IMAGE1DARRAY IIMAGE1DARRAY UIMAGE1DARRAY
233 %token <lex> IMAGE2DARRAY IIMAGE2DARRAY UIMAGE2DARRAY
234 %token <lex> IMAGECUBEARRAY IIMAGECUBEARRAY UIMAGECUBEARRAY
235 %token <lex> IMAGE2DMS IIMAGE2DMS UIMAGE2DMS
236 %token <lex> IMAGE2DMSARRAY IIMAGE2DMSARRAY UIMAGE2DMSARRAY
238 %token <lex> F16IMAGE1D F16IMAGE2D F16IMAGE3D F16IMAGE2DRECT
239 %token <lex> F16IMAGECUBE F16IMAGE1DARRAY F16IMAGE2DARRAY F16IMAGECUBEARRAY
240 %token <lex> F16IMAGEBUFFER F16IMAGE2DMS F16IMAGE2DMSARRAY
242 // texture without sampler
243 %token <lex> TEXTURECUBEARRAY ITEXTURECUBEARRAY UTEXTURECUBEARRAY
244 %token <lex> TEXTURE1D ITEXTURE1D UTEXTURE1D
245 %token <lex> TEXTURE1DARRAY ITEXTURE1DARRAY UTEXTURE1DARRAY
246 %token <lex> TEXTURE2DRECT ITEXTURE2DRECT UTEXTURE2DRECT
247 %token <lex> TEXTUREBUFFER ITEXTUREBUFFER UTEXTUREBUFFER
248 %token <lex> TEXTURE2DMS ITEXTURE2DMS UTEXTURE2DMS
249 %token <lex> TEXTURE2DMSARRAY ITEXTURE2DMSARRAY UTEXTURE2DMSARRAY
251 %token <lex> F16TEXTURE1D F16TEXTURE2D F16TEXTURE3D F16TEXTURE2DRECT F16TEXTURECUBE
252 %token <lex> F16TEXTURE1DARRAY F16TEXTURE2DARRAY F16TEXTURECUBEARRAY
253 %token <lex> F16TEXTUREBUFFER F16TEXTURE2DMS F16TEXTURE2DMSARRAY
256 %token <lex> SUBPASSINPUT SUBPASSINPUTMS ISUBPASSINPUT ISUBPASSINPUTMS USUBPASSINPUT USUBPASSINPUTMS
257 %token <lex> F16SUBPASSINPUT F16SUBPASSINPUTMS
261 %token <lex> LEFT_OP RIGHT_OP
262 %token <lex> INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP
263 %token <lex> AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN
264 %token <lex> MOD_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN XOR_ASSIGN OR_ASSIGN
265 %token <lex> SUB_ASSIGN
267 %token <lex> LEFT_PAREN RIGHT_PAREN LEFT_BRACKET RIGHT_BRACKET LEFT_BRACE RIGHT_BRACE DOT
268 %token <lex> COMMA COLON EQUAL SEMICOLON BANG DASH TILDE PLUS STAR SLASH PERCENT
269 %token <lex> LEFT_ANGLE RIGHT_ANGLE VERTICAL_BAR CARET AMPERSAND QUESTION
271 %token <lex> INVARIANT
272 %token <lex> HIGH_PRECISION MEDIUM_PRECISION LOW_PRECISION PRECISION
273 %token <lex> PACKED RESOURCE SUPERP
275 %token <lex> FLOATCONSTANT INTCONSTANT UINTCONSTANT BOOLCONSTANT
276 %token <lex> IDENTIFIER TYPE_NAME
277 %token <lex> CENTROID IN OUT INOUT
278 %token <lex> STRUCT VOID WHILE
279 %token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
280 %token <lex> UNIFORM SHARED BUFFER
281 %token <lex> FLAT SMOOTH LAYOUT
284 %token <lex> DOUBLECONSTANT INT16CONSTANT UINT16CONSTANT FLOAT16CONSTANT INT32CONSTANT UINT32CONSTANT
285 %token <lex> INT64CONSTANT UINT64CONSTANT
286 %token <lex> SUBROUTINE DEMOTE
287 %token <lex> PAYLOADNV PAYLOADINNV HITATTRNV CALLDATANV CALLDATAINNV
288 %token <lex> PATCH SAMPLE NONUNIFORM
289 %token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT
290 %token <lex> SUBGROUPCOHERENT NONPRIVATE
291 %token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV
295 %type <interm> assignment_operator unary_operator
296 %type <interm.intermTypedNode> variable_identifier primary_expression postfix_expression
297 %type <interm.intermTypedNode> expression integer_expression assignment_expression
298 %type <interm.intermTypedNode> unary_expression multiplicative_expression additive_expression
299 %type <interm.intermTypedNode> relational_expression equality_expression
300 %type <interm.intermTypedNode> conditional_expression constant_expression
301 %type <interm.intermTypedNode> logical_or_expression logical_xor_expression logical_and_expression
302 %type <interm.intermTypedNode> shift_expression and_expression exclusive_or_expression inclusive_or_expression
303 %type <interm.intermTypedNode> function_call initializer condition conditionopt
305 %type <interm.intermNode> translation_unit function_definition
306 %type <interm.intermNode> statement simple_statement
307 %type <interm.intermNode> statement_list switch_statement_list compound_statement
308 %type <interm.intermNode> declaration_statement selection_statement selection_statement_nonattributed expression_statement
309 %type <interm.intermNode> switch_statement switch_statement_nonattributed case_label
310 %type <interm.intermNode> declaration external_declaration
311 %type <interm.intermNode> for_init_statement compound_statement_no_new_scope
312 %type <interm.nodePair> selection_rest_statement for_rest_statement
313 %type <interm.intermNode> iteration_statement iteration_statement_nonattributed jump_statement statement_no_new_scope statement_scoped
314 %type <interm> single_declaration init_declarator_list
316 %type <interm> parameter_declaration parameter_declarator parameter_type_specifier
318 %type <interm> array_specifier
319 %type <interm.type> invariant_qualifier interpolation_qualifier storage_qualifier precision_qualifier
320 %type <interm.type> layout_qualifier layout_qualifier_id_list layout_qualifier_id
322 %type <interm.typeParameters> type_parameter_specifier
323 %type <interm.typeParameters> type_parameter_specifier_opt
324 %type <interm.typeParameters> type_parameter_specifier_list
326 %type <interm.type> type_qualifier fully_specified_type type_specifier
327 %type <interm.type> single_type_qualifier
328 %type <interm.type> type_specifier_nonarray
329 %type <interm.type> struct_specifier
330 %type <interm.typeLine> struct_declarator
331 %type <interm.typeList> struct_declarator_list struct_declaration struct_declaration_list
332 %type <interm> block_structure
333 %type <interm.function> function_header function_declarator
334 %type <interm.function> function_header_with_parameters
335 %type <interm> function_call_header_with_parameters function_call_header_no_parameters function_call_generic function_prototype
336 %type <interm> function_call_or_method function_identifier function_call_header
338 %type <interm.identifierList> identifier_list
341 %type <interm.type> precise_qualifier non_uniform_qualifier
342 %type <interm.typeList> type_name_list
343 %type <interm.attributes> attribute attribute_list single_attribute
344 %type <interm.intermNode> demote_statement
345 %type <interm.intermTypedNode> initializer_list
348 %start translation_unit
353 $$ = parseContext.handleVariable($1.loc, $1.symbol, $1.string);
358 : variable_identifier {
361 | LEFT_PAREN expression RIGHT_PAREN {
363 if ($$->getAsConstantUnion())
364 $$->getAsConstantUnion()->setExpression();
367 $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true);
370 $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true);
373 parseContext.fullIntegerCheck($1.loc, "unsigned literal");
374 $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true);
377 $$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true);
381 parseContext.explicitInt32Check($1.loc, "32-bit signed literal");
382 $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true);
385 parseContext.explicitInt32Check($1.loc, "32-bit signed literal");
386 $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true);
389 parseContext.int64Check($1.loc, "64-bit integer literal");
390 $$ = parseContext.intermediate.addConstantUnion($1.i64, $1.loc, true);
393 parseContext.int64Check($1.loc, "64-bit unsigned integer literal");
394 $$ = parseContext.intermediate.addConstantUnion($1.u64, $1.loc, true);
397 parseContext.explicitInt16Check($1.loc, "16-bit integer literal");
398 $$ = parseContext.intermediate.addConstantUnion((short)$1.i, $1.loc, true);
401 parseContext.explicitInt16Check($1.loc, "16-bit unsigned integer literal");
402 $$ = parseContext.intermediate.addConstantUnion((unsigned short)$1.u, $1.loc, true);
405 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double literal");
406 if (! parseContext.symbolTable.atBuiltInLevel())
407 parseContext.doubleCheck($1.loc, "double literal");
408 $$ = parseContext.intermediate.addConstantUnion($1.d, EbtDouble, $1.loc, true);
411 parseContext.float16Check($1.loc, "half float literal");
412 $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat16, $1.loc, true);
418 : primary_expression {
421 | postfix_expression LEFT_BRACKET integer_expression RIGHT_BRACKET {
422 $$ = parseContext.handleBracketDereference($2.loc, $1, $3);
427 | postfix_expression DOT IDENTIFIER {
428 $$ = parseContext.handleDotDereference($3.loc, $1, *$3.string);
430 | postfix_expression INC_OP {
431 parseContext.variableCheck($1);
432 parseContext.lValueErrorCheck($2.loc, "++", $1);
433 $$ = parseContext.handleUnaryMath($2.loc, "++", EOpPostIncrement, $1);
435 | postfix_expression DEC_OP {
436 parseContext.variableCheck($1);
437 parseContext.lValueErrorCheck($2.loc, "--", $1);
438 $$ = parseContext.handleUnaryMath($2.loc, "--", EOpPostDecrement, $1);
444 parseContext.integerCheck($1, "[]");
450 : function_call_or_method {
451 $$ = parseContext.handleFunctionCall($1.loc, $1.function, $1.intermNode);
456 function_call_or_method
457 : function_call_generic {
462 function_call_generic
463 : function_call_header_with_parameters RIGHT_PAREN {
467 | function_call_header_no_parameters RIGHT_PAREN {
473 function_call_header_no_parameters
474 : function_call_header VOID {
477 | function_call_header {
482 function_call_header_with_parameters
483 : function_call_header assignment_expression {
484 TParameter param = { 0, new TType };
485 param.type->shallowCopy($2->getType());
486 $1.function->addParameter(param);
487 $$.function = $1.function;
490 | function_call_header_with_parameters COMMA assignment_expression {
491 TParameter param = { 0, new TType };
492 param.type->shallowCopy($3->getType());
493 $1.function->addParameter(param);
494 $$.function = $1.function;
495 $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, $3, $2.loc);
500 : function_identifier LEFT_PAREN {
505 // Grammar Note: Constructors look like functions, but are recognized as types.
511 $$.function = parseContext.handleConstructorCall($1.loc, $1);
513 | postfix_expression {
515 // Should be a method or subroutine call, but we haven't recognized the arguments yet.
520 TIntermMethod* method = $1->getAsMethodNode();
522 $$.function = new TFunction(&method->getMethodName(), TType(EbtInt), EOpArrayLength);
523 $$.intermNode = method->getObject();
525 TIntermSymbol* symbol = $1->getAsSymbolNode();
527 parseContext.reservedErrorCheck(symbol->getLoc(), symbol->getName());
528 TFunction *function = new TFunction(&symbol->getName(), TType(EbtVoid));
529 $$.function = function;
531 parseContext.error($1->getLoc(), "function call, method, or subroutine call expected", "", "");
534 if ($$.function == 0) {
536 TString* empty = NewPoolTString("");
537 $$.function = new TFunction(empty, TType(EbtVoid), EOpNull);
541 | non_uniform_qualifier {
544 $$.function = parseContext.handleConstructorCall($1.loc, $1);
550 : postfix_expression {
551 parseContext.variableCheck($1);
553 if (TIntermMethod* method = $1->getAsMethodNode())
554 parseContext.error($1->getLoc(), "incomplete method syntax", method->getMethodName().c_str(), "");
556 | INC_OP unary_expression {
557 parseContext.lValueErrorCheck($1.loc, "++", $2);
558 $$ = parseContext.handleUnaryMath($1.loc, "++", EOpPreIncrement, $2);
560 | DEC_OP unary_expression {
561 parseContext.lValueErrorCheck($1.loc, "--", $2);
562 $$ = parseContext.handleUnaryMath($1.loc, "--", EOpPreDecrement, $2);
564 | unary_operator unary_expression {
565 if ($1.op != EOpNull) {
566 char errorOp[2] = {0, 0};
568 case EOpNegative: errorOp[0] = '-'; break;
569 case EOpLogicalNot: errorOp[0] = '!'; break;
570 case EOpBitwiseNot: errorOp[0] = '~'; break;
571 default: break; // some compilers want this
573 $$ = parseContext.handleUnaryMath($1.loc, errorOp, $1.op, $2);
576 if ($$->getAsConstantUnion())
577 $$->getAsConstantUnion()->setExpression();
581 // Grammar Note: No traditional style type casts.
584 : PLUS { $$.loc = $1.loc; $$.op = EOpNull; }
585 | DASH { $$.loc = $1.loc; $$.op = EOpNegative; }
586 | BANG { $$.loc = $1.loc; $$.op = EOpLogicalNot; }
587 | TILDE { $$.loc = $1.loc; $$.op = EOpBitwiseNot;
588 parseContext.fullIntegerCheck($1.loc, "bitwise not"); }
590 // Grammar Note: No '*' or '&' unary ops. Pointers are not supported.
592 multiplicative_expression
593 : unary_expression { $$ = $1; }
594 | multiplicative_expression STAR unary_expression {
595 $$ = parseContext.handleBinaryMath($2.loc, "*", EOpMul, $1, $3);
599 | multiplicative_expression SLASH unary_expression {
600 $$ = parseContext.handleBinaryMath($2.loc, "/", EOpDiv, $1, $3);
604 | multiplicative_expression PERCENT unary_expression {
605 parseContext.fullIntegerCheck($2.loc, "%");
606 $$ = parseContext.handleBinaryMath($2.loc, "%", EOpMod, $1, $3);
613 : multiplicative_expression { $$ = $1; }
614 | additive_expression PLUS multiplicative_expression {
615 $$ = parseContext.handleBinaryMath($2.loc, "+", EOpAdd, $1, $3);
619 | additive_expression DASH multiplicative_expression {
620 $$ = parseContext.handleBinaryMath($2.loc, "-", EOpSub, $1, $3);
627 : additive_expression { $$ = $1; }
628 | shift_expression LEFT_OP additive_expression {
629 parseContext.fullIntegerCheck($2.loc, "bit shift left");
630 $$ = parseContext.handleBinaryMath($2.loc, "<<", EOpLeftShift, $1, $3);
634 | shift_expression RIGHT_OP additive_expression {
635 parseContext.fullIntegerCheck($2.loc, "bit shift right");
636 $$ = parseContext.handleBinaryMath($2.loc, ">>", EOpRightShift, $1, $3);
642 relational_expression
643 : shift_expression { $$ = $1; }
644 | relational_expression LEFT_ANGLE shift_expression {
645 $$ = parseContext.handleBinaryMath($2.loc, "<", EOpLessThan, $1, $3);
647 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
649 | relational_expression RIGHT_ANGLE shift_expression {
650 $$ = parseContext.handleBinaryMath($2.loc, ">", EOpGreaterThan, $1, $3);
652 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
654 | relational_expression LE_OP shift_expression {
655 $$ = parseContext.handleBinaryMath($2.loc, "<=", EOpLessThanEqual, $1, $3);
657 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
659 | relational_expression GE_OP shift_expression {
660 $$ = parseContext.handleBinaryMath($2.loc, ">=", EOpGreaterThanEqual, $1, $3);
662 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
667 : relational_expression { $$ = $1; }
668 | equality_expression EQ_OP relational_expression {
669 parseContext.arrayObjectCheck($2.loc, $1->getType(), "array comparison");
670 parseContext.opaqueCheck($2.loc, $1->getType(), "==");
671 parseContext.specializationCheck($2.loc, $1->getType(), "==");
672 parseContext.referenceCheck($2.loc, $1->getType(), "==");
673 $$ = parseContext.handleBinaryMath($2.loc, "==", EOpEqual, $1, $3);
675 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
677 | equality_expression NE_OP relational_expression {
678 parseContext.arrayObjectCheck($2.loc, $1->getType(), "array comparison");
679 parseContext.opaqueCheck($2.loc, $1->getType(), "!=");
680 parseContext.specializationCheck($2.loc, $1->getType(), "!=");
681 parseContext.referenceCheck($2.loc, $1->getType(), "!=");
682 $$ = parseContext.handleBinaryMath($2.loc, "!=", EOpNotEqual, $1, $3);
684 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
689 : equality_expression { $$ = $1; }
690 | and_expression AMPERSAND equality_expression {
691 parseContext.fullIntegerCheck($2.loc, "bitwise and");
692 $$ = parseContext.handleBinaryMath($2.loc, "&", EOpAnd, $1, $3);
698 exclusive_or_expression
699 : and_expression { $$ = $1; }
700 | exclusive_or_expression CARET and_expression {
701 parseContext.fullIntegerCheck($2.loc, "bitwise exclusive or");
702 $$ = parseContext.handleBinaryMath($2.loc, "^", EOpExclusiveOr, $1, $3);
708 inclusive_or_expression
709 : exclusive_or_expression { $$ = $1; }
710 | inclusive_or_expression VERTICAL_BAR exclusive_or_expression {
711 parseContext.fullIntegerCheck($2.loc, "bitwise inclusive or");
712 $$ = parseContext.handleBinaryMath($2.loc, "|", EOpInclusiveOr, $1, $3);
718 logical_and_expression
719 : inclusive_or_expression { $$ = $1; }
720 | logical_and_expression AND_OP inclusive_or_expression {
721 $$ = parseContext.handleBinaryMath($2.loc, "&&", EOpLogicalAnd, $1, $3);
723 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
727 logical_xor_expression
728 : logical_and_expression { $$ = $1; }
729 | logical_xor_expression XOR_OP logical_and_expression {
730 $$ = parseContext.handleBinaryMath($2.loc, "^^", EOpLogicalXor, $1, $3);
732 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
736 logical_or_expression
737 : logical_xor_expression { $$ = $1; }
738 | logical_or_expression OR_OP logical_xor_expression {
739 $$ = parseContext.handleBinaryMath($2.loc, "||", EOpLogicalOr, $1, $3);
741 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
745 conditional_expression
746 : logical_or_expression { $$ = $1; }
747 | logical_or_expression QUESTION {
748 ++parseContext.controlFlowNestingLevel;
750 expression COLON assignment_expression {
751 --parseContext.controlFlowNestingLevel;
752 parseContext.boolCheck($2.loc, $1);
753 parseContext.rValueErrorCheck($2.loc, "?", $1);
754 parseContext.rValueErrorCheck($5.loc, ":", $4);
755 parseContext.rValueErrorCheck($5.loc, ":", $6);
756 $$ = parseContext.intermediate.addSelection($1, $4, $6, $2.loc);
758 parseContext.binaryOpError($2.loc, ":", $4->getCompleteString(), $6->getCompleteString());
764 assignment_expression
765 : conditional_expression { $$ = $1; }
766 | unary_expression assignment_operator assignment_expression {
767 parseContext.arrayObjectCheck($2.loc, $1->getType(), "array assignment");
768 parseContext.opaqueCheck($2.loc, $1->getType(), "=");
769 parseContext.storage16BitAssignmentCheck($2.loc, $1->getType(), "=");
770 parseContext.specializationCheck($2.loc, $1->getType(), "=");
771 parseContext.lValueErrorCheck($2.loc, "assign", $1);
772 parseContext.rValueErrorCheck($2.loc, "assign", $3);
773 $$ = parseContext.intermediate.addAssign($2.op, $1, $3, $2.loc);
775 parseContext.assignError($2.loc, "assign", $1->getCompleteString(), $3->getCompleteString());
788 $$.op = EOpMulAssign;
792 $$.op = EOpDivAssign;
795 parseContext.fullIntegerCheck($1.loc, "%=");
797 $$.op = EOpModAssign;
801 $$.op = EOpAddAssign;
805 $$.op = EOpSubAssign;
808 parseContext.fullIntegerCheck($1.loc, "bit-shift left assign");
809 $$.loc = $1.loc; $$.op = EOpLeftShiftAssign;
812 parseContext.fullIntegerCheck($1.loc, "bit-shift right assign");
813 $$.loc = $1.loc; $$.op = EOpRightShiftAssign;
816 parseContext.fullIntegerCheck($1.loc, "bitwise-and assign");
817 $$.loc = $1.loc; $$.op = EOpAndAssign;
820 parseContext.fullIntegerCheck($1.loc, "bitwise-xor assign");
821 $$.loc = $1.loc; $$.op = EOpExclusiveOrAssign;
824 parseContext.fullIntegerCheck($1.loc, "bitwise-or assign");
825 $$.loc = $1.loc; $$.op = EOpInclusiveOrAssign;
830 : assignment_expression {
833 | expression COMMA assignment_expression {
834 parseContext.samplerConstructorLocationCheck($2.loc, ",", $3);
835 $$ = parseContext.intermediate.addComma($1, $3, $2.loc);
837 parseContext.binaryOpError($2.loc, ",", $1->getCompleteString(), $3->getCompleteString());
844 : conditional_expression {
845 parseContext.constantValueCheck($1, "");
851 : function_prototype SEMICOLON {
852 parseContext.handleFunctionDeclarator($1.loc, *$1.function, true /* prototype */);
854 // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature
856 | init_declarator_list SEMICOLON {
857 if ($1.intermNode && $1.intermNode->getAsAggregate())
858 $1.intermNode->getAsAggregate()->setOperator(EOpSequence);
861 | PRECISION precision_qualifier type_specifier SEMICOLON {
862 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "precision statement");
863 // lazy setting of the previous scope's defaults, has effect only the first time it is called in a particular scope
864 parseContext.symbolTable.setPreviousDefaultPrecisions(&parseContext.defaultPrecision[0]);
865 parseContext.setDefaultPrecision($1.loc, $3, $2.qualifier.precision);
868 | block_structure SEMICOLON {
869 parseContext.declareBlock($1.loc, *$1.typeList);
872 | block_structure IDENTIFIER SEMICOLON {
873 parseContext.declareBlock($1.loc, *$1.typeList, $2.string);
876 | block_structure IDENTIFIER array_specifier SEMICOLON {
877 parseContext.declareBlock($1.loc, *$1.typeList, $2.string, $3.arraySizes);
880 | type_qualifier SEMICOLON {
881 parseContext.globalQualifierFixCheck($1.loc, $1.qualifier);
882 parseContext.updateStandaloneQualifierDefaults($1.loc, $1);
885 | type_qualifier IDENTIFIER SEMICOLON {
886 parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
887 parseContext.addQualifierToExisting($1.loc, $1.qualifier, *$2.string);
890 | type_qualifier IDENTIFIER identifier_list SEMICOLON {
891 parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
892 $3->push_back($2.string);
893 parseContext.addQualifierToExisting($1.loc, $1.qualifier, *$3);
899 : type_qualifier IDENTIFIER LEFT_BRACE { parseContext.nestedBlockCheck($1.loc); } struct_declaration_list RIGHT_BRACE {
900 --parseContext.structNestingLevel;
901 parseContext.blockName = $2.string;
902 parseContext.globalQualifierFixCheck($1.loc, $1.qualifier);
903 parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
904 parseContext.currentBlockQualifier = $1.qualifier;
911 $$ = new TIdentifierList;
912 $$->push_back($2.string);
914 | identifier_list COMMA IDENTIFIER {
916 $$->push_back($3.string);
921 : function_declarator RIGHT_PAREN {
931 | function_header_with_parameters {
937 function_header_with_parameters
938 : function_header parameter_declaration {
941 if ($2.param.type->getBasicType() != EbtVoid)
942 $1->addParameter($2.param);
944 delete $2.param.type;
946 | function_header_with_parameters COMMA parameter_declaration {
948 // Only first parameter of one-parameter functions can be void
949 // The check for named parameters not being void is done in parameter_declarator
951 if ($3.param.type->getBasicType() == EbtVoid) {
953 // This parameter > first is void
955 parseContext.error($2.loc, "cannot be an argument type except for '(void)'", "void", "");
956 delete $3.param.type;
960 $1->addParameter($3.param);
966 : fully_specified_type IDENTIFIER LEFT_PAREN {
967 if ($1.qualifier.storage != EvqGlobal && $1.qualifier.storage != EvqTemporary) {
968 parseContext.error($2.loc, "no qualifiers allowed for function return",
969 GetStorageQualifierString($1.qualifier.storage), "");
972 parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
974 // Add the function as a prototype after parsing it (we do not support recursion)
978 // Potentially rename shader entry point function. No-op most of the time.
979 parseContext.renameShaderFunction($2.string);
982 function = new TFunction($2.string, type);
989 : type_specifier IDENTIFIER {
991 parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
992 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
993 parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
995 if ($1.basicType == EbtVoid) {
996 parseContext.error($2.loc, "illegal use of type 'void'", $2.string->c_str(), "");
998 parseContext.reservedErrorCheck($2.loc, *$2.string);
1000 TParameter param = {$2.string, new TType($1)};
1004 | type_specifier IDENTIFIER array_specifier {
1005 if ($1.arraySizes) {
1006 parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
1007 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
1008 parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
1010 TType* type = new TType($1);
1011 type->transferArraySizes($3.arraySizes);
1012 type->copyArrayInnerSizes($1.arraySizes);
1014 parseContext.arrayOfArrayVersionCheck($2.loc, type->getArraySizes());
1015 parseContext.arraySizeRequiredCheck($3.loc, *$3.arraySizes);
1016 parseContext.reservedErrorCheck($2.loc, *$2.string);
1018 TParameter param = { $2.string, type };
1025 parameter_declaration
1029 : type_qualifier parameter_declarator {
1031 if ($1.qualifier.precision != EpqNone)
1032 $$.param.type->getQualifier().precision = $1.qualifier.precision;
1033 parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier());
1035 parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
1036 parseContext.parameterTypeCheck($2.loc, $1.qualifier.storage, *$$.param.type);
1037 parseContext.paramCheckFix($1.loc, $1.qualifier, *$$.param.type);
1040 | parameter_declarator {
1043 parseContext.parameterTypeCheck($1.loc, EvqIn, *$1.param.type);
1044 parseContext.paramCheckFixStorage($1.loc, EvqTemporary, *$$.param.type);
1045 parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier());
1050 | type_qualifier parameter_type_specifier {
1052 if ($1.qualifier.precision != EpqNone)
1053 $$.param.type->getQualifier().precision = $1.qualifier.precision;
1054 parseContext.precisionQualifierCheck($1.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier());
1056 parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
1057 parseContext.parameterTypeCheck($2.loc, $1.qualifier.storage, *$$.param.type);
1058 parseContext.paramCheckFix($1.loc, $1.qualifier, *$$.param.type);
1060 | parameter_type_specifier {
1063 parseContext.parameterTypeCheck($1.loc, EvqIn, *$1.param.type);
1064 parseContext.paramCheckFixStorage($1.loc, EvqTemporary, *$$.param.type);
1065 parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier());
1069 parameter_type_specifier
1071 TParameter param = { 0, new TType($1) };
1074 parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
1078 init_declarator_list
1079 : single_declaration {
1082 | init_declarator_list COMMA IDENTIFIER {
1084 parseContext.declareVariable($3.loc, *$3.string, $1.type);
1086 | init_declarator_list COMMA IDENTIFIER array_specifier {
1088 parseContext.declareVariable($3.loc, *$3.string, $1.type, $4.arraySizes);
1090 | init_declarator_list COMMA IDENTIFIER array_specifier EQUAL initializer {
1092 TIntermNode* initNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, $4.arraySizes, $6);
1093 $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, initNode, $5.loc);
1095 | init_declarator_list COMMA IDENTIFIER EQUAL initializer {
1097 TIntermNode* initNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, 0, $5);
1098 $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, initNode, $4.loc);
1103 : fully_specified_type {
1107 parseContext.declareTypeDefaults($$.loc, $$.type);
1110 | fully_specified_type IDENTIFIER {
1113 parseContext.declareVariable($2.loc, *$2.string, $1);
1115 | fully_specified_type IDENTIFIER array_specifier {
1118 parseContext.declareVariable($2.loc, *$2.string, $1, $3.arraySizes);
1120 | fully_specified_type IDENTIFIER array_specifier EQUAL initializer {
1122 TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, $3.arraySizes, $5);
1123 $$.intermNode = parseContext.intermediate.growAggregate(0, initNode, $4.loc);
1125 | fully_specified_type IDENTIFIER EQUAL initializer {
1127 TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, 0, $4);
1128 $$.intermNode = parseContext.intermediate.growAggregate(0, initNode, $3.loc);
1131 // Grammar Note: No 'enum', or 'typedef'.
1133 fully_specified_type
1137 parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $$);
1138 if ($1.arraySizes) {
1139 parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
1140 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
1142 parseContext.precisionQualifierCheck($$.loc, $$.basicType, $$.qualifier);
1144 | type_qualifier type_specifier {
1145 parseContext.globalQualifierFixCheck($1.loc, $1.qualifier);
1146 parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $2);
1148 if ($2.arraySizes) {
1149 parseContext.profileRequires($2.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
1150 parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type");
1153 if ($2.arraySizes && parseContext.arrayQualifierError($2.loc, $1.qualifier))
1154 $2.arraySizes = nullptr;
1156 parseContext.checkNoShaderLayouts($2.loc, $1.shaderQualifiers);
1157 $2.shaderQualifiers.merge($1.shaderQualifiers);
1158 parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true);
1159 parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier);
1163 if (! $$.qualifier.isInterpolation() &&
1164 ((parseContext.language == EShLangVertex && $$.qualifier.storage == EvqVaryingOut) ||
1165 (parseContext.language == EShLangFragment && $$.qualifier.storage == EvqVaryingIn)))
1166 $$.qualifier.smooth = true;
1172 parseContext.globalCheck($1.loc, "invariant");
1173 parseContext.profileRequires($$.loc, ENoProfile, 120, 0, "invariant");
1175 $$.qualifier.invariant = true;
1179 interpolation_qualifier
1181 parseContext.globalCheck($1.loc, "smooth");
1182 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "smooth");
1183 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "smooth");
1185 $$.qualifier.smooth = true;
1188 parseContext.globalCheck($1.loc, "flat");
1189 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "flat");
1190 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "flat");
1192 $$.qualifier.flat = true;
1196 parseContext.globalCheck($1.loc, "noperspective");
1197 parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_shader_noperspective_interpolation, "noperspective");
1198 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "noperspective");
1200 $$.qualifier.nopersp = true;
1202 | EXPLICITINTERPAMD {
1203 parseContext.globalCheck($1.loc, "__explicitInterpAMD");
1204 parseContext.profileRequires($1.loc, ECoreProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation");
1205 parseContext.profileRequires($1.loc, ECompatibilityProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation");
1207 $$.qualifier.explicitInterp = true;
1210 parseContext.globalCheck($1.loc, "pervertexNV");
1211 parseContext.profileRequires($1.loc, ECoreProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric");
1212 parseContext.profileRequires($1.loc, ECompatibilityProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric");
1213 parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric");
1215 $$.qualifier.pervertexNV = true;
1218 // No need for profile version or extension check. Shader stage already checks both.
1219 parseContext.globalCheck($1.loc, "perprimitiveNV");
1220 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangFragmentMask | EShLangMeshNVMask), "perprimitiveNV");
1221 // Fragment shader stage doesn't check for extension. So we explicitly add below extension check.
1222 if (parseContext.language == EShLangFragment)
1223 parseContext.requireExtensions($1.loc, 1, &E_GL_NV_mesh_shader, "perprimitiveNV");
1225 $$.qualifier.perPrimitiveNV = true;
1228 // No need for profile version or extension check. Shader stage already checks both.
1229 parseContext.globalCheck($1.loc, "perviewNV");
1230 parseContext.requireStage($1.loc, EShLangMeshNV, "perviewNV");
1232 $$.qualifier.perViewNV = true;
1235 // No need for profile version or extension check. Shader stage already checks both.
1236 parseContext.globalCheck($1.loc, "taskNV");
1237 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTaskNVMask | EShLangMeshNVMask), "taskNV");
1239 $$.qualifier.perTaskNV = true;
1245 : LAYOUT LEFT_PAREN layout_qualifier_id_list RIGHT_PAREN {
1250 layout_qualifier_id_list
1251 : layout_qualifier_id {
1254 | layout_qualifier_id_list COMMA layout_qualifier_id {
1256 $$.shaderQualifiers.merge($3.shaderQualifiers);
1257 parseContext.mergeObjectLayoutQualifiers($$.qualifier, $3.qualifier, false);
1263 parseContext.setLayoutQualifier($1.loc, $$, *$1.string);
1265 | IDENTIFIER EQUAL constant_expression {
1267 parseContext.setLayoutQualifier($1.loc, $$, *$1.string, $3);
1269 | SHARED { // because "shared" is both an identifier and a keyword
1271 TString strShared("shared");
1272 parseContext.setLayoutQualifier($1.loc, $$, strShared);
1279 parseContext.profileRequires($$.loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader5, "precise");
1280 parseContext.profileRequires($1.loc, EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, "precise");
1282 $$.qualifier.noContraction = true;
1288 : single_type_qualifier {
1291 | type_qualifier single_type_qualifier {
1293 if ($$.basicType == EbtVoid)
1294 $$.basicType = $2.basicType;
1296 $$.shaderQualifiers.merge($2.shaderQualifiers);
1297 parseContext.mergeQualifiers($$.loc, $$.qualifier, $2.qualifier, false);
1301 single_type_qualifier
1302 : storage_qualifier {
1305 | layout_qualifier {
1308 | precision_qualifier {
1309 parseContext.checkPrecisionQualifier($1.loc, $1.qualifier.precision);
1312 | interpolation_qualifier {
1313 // allow inheritance of storage qualifier from block declaration
1316 | invariant_qualifier {
1317 // allow inheritance of storage qualifier from block declaration
1321 | precise_qualifier {
1322 // allow inheritance of storage qualifier from block declaration
1325 | non_uniform_qualifier {
1334 $$.qualifier.storage = EvqConst; // will later turn into EvqConstReadOnly, if the initializer is not constant
1337 parseContext.globalCheck($1.loc, "inout");
1339 $$.qualifier.storage = EvqInOut;
1342 parseContext.globalCheck($1.loc, "in");
1344 // whether this is a parameter "in" or a pipeline "in" will get sorted out a bit later
1345 $$.qualifier.storage = EvqIn;
1348 parseContext.globalCheck($1.loc, "out");
1350 // whether this is a parameter "out" or a pipeline "out" will get sorted out a bit later
1351 $$.qualifier.storage = EvqOut;
1354 parseContext.profileRequires($1.loc, ENoProfile, 120, 0, "centroid");
1355 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "centroid");
1356 parseContext.globalCheck($1.loc, "centroid");
1358 $$.qualifier.centroid = true;
1361 parseContext.globalCheck($1.loc, "uniform");
1363 $$.qualifier.storage = EvqUniform;
1366 parseContext.globalCheck($1.loc, "shared");
1367 parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared");
1368 parseContext.profileRequires($1.loc, EEsProfile, 310, 0, "shared");
1369 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangComputeMask | EShLangMeshNVMask | EShLangTaskNVMask), "shared");
1371 $$.qualifier.storage = EvqShared;
1374 parseContext.globalCheck($1.loc, "buffer");
1376 $$.qualifier.storage = EvqBuffer;
1380 parseContext.requireStage($1.loc, EShLangVertex, "attribute");
1381 parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "attribute");
1382 parseContext.checkDeprecated($1.loc, ENoProfile, 130, "attribute");
1383 parseContext.requireNotRemoved($1.loc, ECoreProfile, 420, "attribute");
1384 parseContext.requireNotRemoved($1.loc, EEsProfile, 300, "attribute");
1386 parseContext.globalCheck($1.loc, "attribute");
1389 $$.qualifier.storage = EvqVaryingIn;
1392 parseContext.checkDeprecated($1.loc, ENoProfile, 130, "varying");
1393 parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "varying");
1394 parseContext.requireNotRemoved($1.loc, ECoreProfile, 420, "varying");
1395 parseContext.requireNotRemoved($1.loc, EEsProfile, 300, "varying");
1397 parseContext.globalCheck($1.loc, "varying");
1400 if (parseContext.language == EShLangVertex)
1401 $$.qualifier.storage = EvqVaryingOut;
1403 $$.qualifier.storage = EvqVaryingIn;
1406 parseContext.globalCheck($1.loc, "patch");
1407 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTessControlMask | EShLangTessEvaluationMask), "patch");
1409 $$.qualifier.patch = true;
1412 parseContext.globalCheck($1.loc, "sample");
1414 $$.qualifier.sample = true;
1417 parseContext.globalCheck($1.loc, "hitAttributeNV");
1418 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangIntersectNVMask | EShLangClosestHitNVMask
1419 | EShLangAnyHitNVMask), "hitAttributeNV");
1420 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "hitAttributeNV");
1422 $$.qualifier.storage = EvqHitAttrNV;
1425 parseContext.globalCheck($1.loc, "rayPayloadNV");
1426 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenNVMask | EShLangClosestHitNVMask |
1427 EShLangAnyHitNVMask | EShLangMissNVMask), "rayPayloadNV");
1428 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "rayPayloadNV");
1430 $$.qualifier.storage = EvqPayloadNV;
1433 parseContext.globalCheck($1.loc, "rayPayloadInNV");
1434 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangClosestHitNVMask |
1435 EShLangAnyHitNVMask | EShLangMissNVMask), "rayPayloadInNV");
1436 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "rayPayloadInNV");
1438 $$.qualifier.storage = EvqPayloadInNV;
1441 parseContext.globalCheck($1.loc, "callableDataNV");
1442 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenNVMask |
1443 EShLangClosestHitNVMask | EShLangMissNVMask | EShLangCallableNVMask), "callableDataNV");
1444 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "callableDataNV");
1446 $$.qualifier.storage = EvqCallableDataNV;
1449 parseContext.globalCheck($1.loc, "callableDataInNV");
1450 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangCallableNVMask), "callableDataInNV");
1451 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "callableDataInNV");
1453 $$.qualifier.storage = EvqCallableDataInNV;
1457 $$.qualifier.coherent = true;
1461 parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "devicecoherent");
1462 $$.qualifier.devicecoherent = true;
1464 | QUEUEFAMILYCOHERENT {
1466 parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "queuefamilycoherent");
1467 $$.qualifier.queuefamilycoherent = true;
1469 | WORKGROUPCOHERENT {
1471 parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "workgroupcoherent");
1472 $$.qualifier.workgroupcoherent = true;
1474 | SUBGROUPCOHERENT {
1476 parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "subgroupcoherent");
1477 $$.qualifier.subgroupcoherent = true;
1481 parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "nonprivate");
1482 $$.qualifier.nonprivate = true;
1486 $$.qualifier.volatil = true;
1490 $$.qualifier.restrict = true;
1494 $$.qualifier.readonly = true;
1498 $$.qualifier.writeonly = true;
1501 parseContext.spvRemoved($1.loc, "subroutine");
1502 parseContext.globalCheck($1.loc, "subroutine");
1503 parseContext.unimplemented($1.loc, "subroutine");
1506 | SUBROUTINE LEFT_PAREN type_name_list RIGHT_PAREN {
1507 parseContext.spvRemoved($1.loc, "subroutine");
1508 parseContext.globalCheck($1.loc, "subroutine");
1509 parseContext.unimplemented($1.loc, "subroutine");
1516 non_uniform_qualifier
1519 $$.qualifier.nonUniform = true;
1527 | type_name_list COMMA IDENTIFIER {
1528 // TODO: 4.0 semantics: subroutines
1529 // 1) make sure each identifier is a type declared earlier with SUBROUTINE
1530 // 2) save all of the identifiers for future comparison with the declared function
1536 : type_specifier_nonarray type_parameter_specifier_opt {
1538 $$.qualifier.precision = parseContext.getDefaultPrecision($$);
1539 $$.typeParameters = $2;
1541 | type_specifier_nonarray type_parameter_specifier_opt array_specifier {
1542 parseContext.arrayOfArrayVersionCheck($3.loc, $3.arraySizes);
1544 $$.qualifier.precision = parseContext.getDefaultPrecision($$);
1545 $$.typeParameters = $2;
1546 $$.arraySizes = $3.arraySizes;
1551 : LEFT_BRACKET RIGHT_BRACKET {
1553 $$.arraySizes = new TArraySizes;
1554 $$.arraySizes->addInnerSize();
1556 | LEFT_BRACKET conditional_expression RIGHT_BRACKET {
1558 $$.arraySizes = new TArraySizes;
1561 parseContext.arraySizeCheck($2->getLoc(), $2, size, "array size");
1562 $$.arraySizes->addInnerSize(size);
1564 | array_specifier LEFT_BRACKET RIGHT_BRACKET {
1566 $$.arraySizes->addInnerSize();
1568 | array_specifier LEFT_BRACKET conditional_expression RIGHT_BRACKET {
1572 parseContext.arraySizeCheck($3->getLoc(), $3, size, "array size");
1573 $$.arraySizes->addInnerSize(size);
1577 type_parameter_specifier_opt
1578 : type_parameter_specifier {
1581 | /* May be null */ {
1586 type_parameter_specifier
1587 : LEFT_ANGLE type_parameter_specifier_list RIGHT_ANGLE {
1592 type_parameter_specifier_list
1593 : unary_expression {
1594 $$ = new TArraySizes;
1597 parseContext.arraySizeCheck($1->getLoc(), $1, size, "type parameter");
1598 $$->addInnerSize(size);
1600 | type_parameter_specifier_list COMMA unary_expression {
1604 parseContext.arraySizeCheck($3->getLoc(), $3, size, "type parameter");
1605 $$->addInnerSize(size);
1609 type_specifier_nonarray
1611 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1612 $$.basicType = EbtVoid;
1615 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1616 $$.basicType = EbtFloat;
1619 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1620 $$.basicType = EbtInt;
1623 parseContext.fullIntegerCheck($1.loc, "unsigned integer");
1624 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1625 $$.basicType = EbtUint;
1628 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1629 $$.basicType = EbtBool;
1632 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1633 $$.basicType = EbtFloat;
1637 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1638 $$.basicType = EbtFloat;
1642 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1643 $$.basicType = EbtFloat;
1647 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1648 $$.basicType = EbtBool;
1652 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1653 $$.basicType = EbtBool;
1657 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1658 $$.basicType = EbtBool;
1662 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1663 $$.basicType = EbtInt;
1667 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1668 $$.basicType = EbtInt;
1672 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1673 $$.basicType = EbtInt;
1677 parseContext.fullIntegerCheck($1.loc, "unsigned integer vector");
1678 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1679 $$.basicType = EbtUint;
1683 parseContext.fullIntegerCheck($1.loc, "unsigned integer vector");
1684 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1685 $$.basicType = EbtUint;
1689 parseContext.fullIntegerCheck($1.loc, "unsigned integer vector");
1690 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1691 $$.basicType = EbtUint;
1695 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1696 $$.basicType = EbtFloat;
1700 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1701 $$.basicType = EbtFloat;
1705 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1706 $$.basicType = EbtFloat;
1710 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1711 $$.basicType = EbtFloat;
1715 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1716 $$.basicType = EbtFloat;
1720 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1721 $$.basicType = EbtFloat;
1725 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1726 $$.basicType = EbtFloat;
1730 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1731 $$.basicType = EbtFloat;
1735 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1736 $$.basicType = EbtFloat;
1740 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1741 $$.basicType = EbtFloat;
1745 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1746 $$.basicType = EbtFloat;
1750 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1751 $$.basicType = EbtFloat;
1756 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double");
1757 if (! parseContext.symbolTable.atBuiltInLevel())
1758 parseContext.doubleCheck($1.loc, "double");
1759 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1760 $$.basicType = EbtDouble;
1763 parseContext.float16ScalarVectorCheck($1.loc, "float16_t", parseContext.symbolTable.atBuiltInLevel());
1764 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1765 $$.basicType = EbtFloat16;
1768 parseContext.explicitFloat32Check($1.loc, "float32_t", parseContext.symbolTable.atBuiltInLevel());
1769 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1770 $$.basicType = EbtFloat;
1773 parseContext.explicitFloat64Check($1.loc, "float64_t", parseContext.symbolTable.atBuiltInLevel());
1774 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1775 $$.basicType = EbtDouble;
1778 parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer", parseContext.symbolTable.atBuiltInLevel());
1779 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1780 $$.basicType = EbtInt8;
1783 parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
1784 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1785 $$.basicType = EbtUint8;
1788 parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer", parseContext.symbolTable.atBuiltInLevel());
1789 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1790 $$.basicType = EbtInt16;
1793 parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
1794 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1795 $$.basicType = EbtUint16;
1798 parseContext.explicitInt32Check($1.loc, "32-bit signed integer", parseContext.symbolTable.atBuiltInLevel());
1799 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1800 $$.basicType = EbtInt;
1803 parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
1804 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1805 $$.basicType = EbtUint;
1808 parseContext.int64Check($1.loc, "64-bit integer", parseContext.symbolTable.atBuiltInLevel());
1809 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1810 $$.basicType = EbtInt64;
1813 parseContext.int64Check($1.loc, "64-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
1814 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1815 $$.basicType = EbtUint64;
1818 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector");
1819 if (! parseContext.symbolTable.atBuiltInLevel())
1820 parseContext.doubleCheck($1.loc, "double vector");
1821 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1822 $$.basicType = EbtDouble;
1826 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector");
1827 if (! parseContext.symbolTable.atBuiltInLevel())
1828 parseContext.doubleCheck($1.loc, "double vector");
1829 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1830 $$.basicType = EbtDouble;
1834 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector");
1835 if (! parseContext.symbolTable.atBuiltInLevel())
1836 parseContext.doubleCheck($1.loc, "double vector");
1837 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1838 $$.basicType = EbtDouble;
1842 parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel());
1843 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1844 $$.basicType = EbtFloat16;
1848 parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel());
1849 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1850 $$.basicType = EbtFloat16;
1854 parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel());
1855 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1856 $$.basicType = EbtFloat16;
1860 parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel());
1861 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1862 $$.basicType = EbtFloat;
1866 parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel());
1867 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1868 $$.basicType = EbtFloat;
1872 parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel());
1873 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1874 $$.basicType = EbtFloat;
1878 parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel());
1879 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1880 $$.basicType = EbtDouble;
1884 parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel());
1885 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1886 $$.basicType = EbtDouble;
1890 parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel());
1891 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1892 $$.basicType = EbtDouble;
1896 parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
1897 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1898 $$.basicType = EbtInt8;
1902 parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
1903 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1904 $$.basicType = EbtInt8;
1908 parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
1909 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1910 $$.basicType = EbtInt8;
1914 parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
1915 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1916 $$.basicType = EbtInt16;
1920 parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
1921 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1922 $$.basicType = EbtInt16;
1926 parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
1927 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1928 $$.basicType = EbtInt16;
1932 parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
1933 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1934 $$.basicType = EbtInt;
1938 parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
1939 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1940 $$.basicType = EbtInt;
1944 parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
1945 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1946 $$.basicType = EbtInt;
1950 parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
1951 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1952 $$.basicType = EbtInt64;
1956 parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
1957 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1958 $$.basicType = EbtInt64;
1962 parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
1963 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1964 $$.basicType = EbtInt64;
1968 parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
1969 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1970 $$.basicType = EbtUint8;
1974 parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
1975 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1976 $$.basicType = EbtUint8;
1980 parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
1981 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1982 $$.basicType = EbtUint8;
1986 parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
1987 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1988 $$.basicType = EbtUint16;
1992 parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
1993 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1994 $$.basicType = EbtUint16;
1998 parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
1999 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2000 $$.basicType = EbtUint16;
2004 parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2005 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2006 $$.basicType = EbtUint;
2010 parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2011 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2012 $$.basicType = EbtUint;
2016 parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2017 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2018 $$.basicType = EbtUint;
2022 parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2023 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2024 $$.basicType = EbtUint64;
2028 parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2029 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2030 $$.basicType = EbtUint64;
2034 parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2035 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2036 $$.basicType = EbtUint64;
2040 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2041 if (! parseContext.symbolTable.atBuiltInLevel())
2042 parseContext.doubleCheck($1.loc, "double matrix");
2043 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2044 $$.basicType = EbtDouble;
2048 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2049 if (! parseContext.symbolTable.atBuiltInLevel())
2050 parseContext.doubleCheck($1.loc, "double matrix");
2051 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2052 $$.basicType = EbtDouble;
2056 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2057 if (! parseContext.symbolTable.atBuiltInLevel())
2058 parseContext.doubleCheck($1.loc, "double matrix");
2059 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2060 $$.basicType = EbtDouble;
2064 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2065 if (! parseContext.symbolTable.atBuiltInLevel())
2066 parseContext.doubleCheck($1.loc, "double matrix");
2067 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2068 $$.basicType = EbtDouble;
2072 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2073 if (! parseContext.symbolTable.atBuiltInLevel())
2074 parseContext.doubleCheck($1.loc, "double matrix");
2075 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2076 $$.basicType = EbtDouble;
2080 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2081 if (! parseContext.symbolTable.atBuiltInLevel())
2082 parseContext.doubleCheck($1.loc, "double matrix");
2083 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2084 $$.basicType = EbtDouble;
2088 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2089 if (! parseContext.symbolTable.atBuiltInLevel())
2090 parseContext.doubleCheck($1.loc, "double matrix");
2091 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2092 $$.basicType = EbtDouble;
2096 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2097 if (! parseContext.symbolTable.atBuiltInLevel())
2098 parseContext.doubleCheck($1.loc, "double matrix");
2099 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2100 $$.basicType = EbtDouble;
2104 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2105 if (! parseContext.symbolTable.atBuiltInLevel())
2106 parseContext.doubleCheck($1.loc, "double matrix");
2107 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2108 $$.basicType = EbtDouble;
2112 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2113 if (! parseContext.symbolTable.atBuiltInLevel())
2114 parseContext.doubleCheck($1.loc, "double matrix");
2115 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2116 $$.basicType = EbtDouble;
2120 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2121 if (! parseContext.symbolTable.atBuiltInLevel())
2122 parseContext.doubleCheck($1.loc, "double matrix");
2123 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2124 $$.basicType = EbtDouble;
2128 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2129 if (! parseContext.symbolTable.atBuiltInLevel())
2130 parseContext.doubleCheck($1.loc, "double matrix");
2131 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2132 $$.basicType = EbtDouble;
2136 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2137 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2138 $$.basicType = EbtFloat16;
2142 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2143 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2144 $$.basicType = EbtFloat16;
2148 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2149 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2150 $$.basicType = EbtFloat16;
2154 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2155 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2156 $$.basicType = EbtFloat16;
2160 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2161 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2162 $$.basicType = EbtFloat16;
2166 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2167 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2168 $$.basicType = EbtFloat16;
2172 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2173 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2174 $$.basicType = EbtFloat16;
2178 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2179 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2180 $$.basicType = EbtFloat16;
2184 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2185 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2186 $$.basicType = EbtFloat16;
2190 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2191 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2192 $$.basicType = EbtFloat16;
2196 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2197 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2198 $$.basicType = EbtFloat16;
2202 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2203 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2204 $$.basicType = EbtFloat16;
2208 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2209 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2210 $$.basicType = EbtFloat;
2214 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2215 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2216 $$.basicType = EbtFloat;
2220 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2221 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2222 $$.basicType = EbtFloat;
2226 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2227 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2228 $$.basicType = EbtFloat;
2232 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2233 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2234 $$.basicType = EbtFloat;
2238 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2239 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2240 $$.basicType = EbtFloat;
2244 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2245 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2246 $$.basicType = EbtFloat;
2250 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2251 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2252 $$.basicType = EbtFloat;
2256 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2257 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2258 $$.basicType = EbtFloat;
2262 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2263 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2264 $$.basicType = EbtFloat;
2268 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2269 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2270 $$.basicType = EbtFloat;
2274 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2275 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2276 $$.basicType = EbtFloat;
2280 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2281 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2282 $$.basicType = EbtDouble;
2286 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2287 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2288 $$.basicType = EbtDouble;
2292 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2293 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2294 $$.basicType = EbtDouble;
2298 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2299 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2300 $$.basicType = EbtDouble;
2304 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2305 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2306 $$.basicType = EbtDouble;
2310 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2311 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2312 $$.basicType = EbtDouble;
2316 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2317 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2318 $$.basicType = EbtDouble;
2322 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2323 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2324 $$.basicType = EbtDouble;
2328 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2329 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2330 $$.basicType = EbtDouble;
2334 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2335 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2336 $$.basicType = EbtDouble;
2340 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2341 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2342 $$.basicType = EbtDouble;
2346 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2347 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2348 $$.basicType = EbtDouble;
2352 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2353 $$.basicType = EbtAccStructNV;
2356 parseContext.vulkanRemoved($1.loc, "atomic counter types");
2357 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2358 $$.basicType = EbtAtomicUint;
2361 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2362 $$.basicType = EbtSampler;
2363 $$.sampler.set(EbtFloat, Esd1D);
2367 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2368 $$.basicType = EbtSampler;
2369 $$.sampler.set(EbtFloat, Esd2D);
2372 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2373 $$.basicType = EbtSampler;
2374 $$.sampler.set(EbtFloat, Esd3D);
2377 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2378 $$.basicType = EbtSampler;
2379 $$.sampler.set(EbtFloat, EsdCube);
2382 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2383 $$.basicType = EbtSampler;
2384 $$.sampler.set(EbtFloat, Esd2D, false, true);
2386 | SAMPLERCUBESHADOW {
2387 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2388 $$.basicType = EbtSampler;
2389 $$.sampler.set(EbtFloat, EsdCube, false, true);
2392 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2393 $$.basicType = EbtSampler;
2394 $$.sampler.set(EbtFloat, Esd2D, true);
2396 | SAMPLER2DARRAYSHADOW {
2397 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2398 $$.basicType = EbtSampler;
2399 $$.sampler.set(EbtFloat, Esd2D, true, true);
2403 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2404 $$.basicType = EbtSampler;
2405 $$.sampler.set(EbtFloat, Esd1D, false, true);
2408 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2409 $$.basicType = EbtSampler;
2410 $$.sampler.set(EbtFloat, Esd1D, true);
2412 | SAMPLER1DARRAYSHADOW {
2413 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2414 $$.basicType = EbtSampler;
2415 $$.sampler.set(EbtFloat, Esd1D, true, true);
2417 | SAMPLERCUBEARRAY {
2418 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2419 $$.basicType = EbtSampler;
2420 $$.sampler.set(EbtFloat, EsdCube, true);
2422 | SAMPLERCUBEARRAYSHADOW {
2423 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2424 $$.basicType = EbtSampler;
2425 $$.sampler.set(EbtFloat, EsdCube, true, true);
2428 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2429 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2430 $$.basicType = EbtSampler;
2431 $$.sampler.set(EbtFloat16, Esd1D);
2434 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2435 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2436 $$.basicType = EbtSampler;
2437 $$.sampler.set(EbtFloat16, Esd2D);
2440 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2441 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2442 $$.basicType = EbtSampler;
2443 $$.sampler.set(EbtFloat16, Esd3D);
2446 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2447 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2448 $$.basicType = EbtSampler;
2449 $$.sampler.set(EbtFloat16, EsdCube);
2451 | F16SAMPLER1DSHADOW {
2452 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2453 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2454 $$.basicType = EbtSampler;
2455 $$.sampler.set(EbtFloat16, Esd1D, false, true);
2457 | F16SAMPLER2DSHADOW {
2458 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2459 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2460 $$.basicType = EbtSampler;
2461 $$.sampler.set(EbtFloat16, Esd2D, false, true);
2463 | F16SAMPLERCUBESHADOW {
2464 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2465 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2466 $$.basicType = EbtSampler;
2467 $$.sampler.set(EbtFloat16, EsdCube, false, true);
2469 | F16SAMPLER1DARRAY {
2470 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2471 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2472 $$.basicType = EbtSampler;
2473 $$.sampler.set(EbtFloat16, Esd1D, true);
2475 | F16SAMPLER2DARRAY {
2476 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2477 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2478 $$.basicType = EbtSampler;
2479 $$.sampler.set(EbtFloat16, Esd2D, true);
2481 | F16SAMPLER1DARRAYSHADOW {
2482 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2483 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2484 $$.basicType = EbtSampler;
2485 $$.sampler.set(EbtFloat16, Esd1D, true, true);
2487 | F16SAMPLER2DARRAYSHADOW {
2488 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2489 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2490 $$.basicType = EbtSampler;
2491 $$.sampler.set(EbtFloat16, Esd2D, true, true);
2493 | F16SAMPLERCUBEARRAY {
2494 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2495 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2496 $$.basicType = EbtSampler;
2497 $$.sampler.set(EbtFloat16, EsdCube, true);
2499 | F16SAMPLERCUBEARRAYSHADOW {
2500 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2501 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2502 $$.basicType = EbtSampler;
2503 $$.sampler.set(EbtFloat16, EsdCube, true, true);
2506 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2507 $$.basicType = EbtSampler;
2508 $$.sampler.set(EbtInt, Esd1D);
2512 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2513 $$.basicType = EbtSampler;
2514 $$.sampler.set(EbtInt, Esd2D);
2517 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2518 $$.basicType = EbtSampler;
2519 $$.sampler.set(EbtInt, Esd3D);
2522 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2523 $$.basicType = EbtSampler;
2524 $$.sampler.set(EbtInt, EsdCube);
2527 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2528 $$.basicType = EbtSampler;
2529 $$.sampler.set(EbtInt, Esd2D, true);
2532 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2533 $$.basicType = EbtSampler;
2534 $$.sampler.set(EbtUint, Esd2D);
2537 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2538 $$.basicType = EbtSampler;
2539 $$.sampler.set(EbtUint, Esd3D);
2542 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2543 $$.basicType = EbtSampler;
2544 $$.sampler.set(EbtUint, EsdCube);
2548 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2549 $$.basicType = EbtSampler;
2550 $$.sampler.set(EbtInt, Esd1D, true);
2552 | ISAMPLERCUBEARRAY {
2553 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2554 $$.basicType = EbtSampler;
2555 $$.sampler.set(EbtInt, EsdCube, true);
2558 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2559 $$.basicType = EbtSampler;
2560 $$.sampler.set(EbtUint, Esd1D);
2563 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2564 $$.basicType = EbtSampler;
2565 $$.sampler.set(EbtUint, Esd1D, true);
2567 | USAMPLERCUBEARRAY {
2568 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2569 $$.basicType = EbtSampler;
2570 $$.sampler.set(EbtUint, EsdCube, true);
2572 | TEXTURECUBEARRAY {
2573 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2574 $$.basicType = EbtSampler;
2575 $$.sampler.setTexture(EbtFloat, EsdCube, true);
2577 | ITEXTURECUBEARRAY {
2578 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2579 $$.basicType = EbtSampler;
2580 $$.sampler.setTexture(EbtInt, EsdCube, true);
2582 | UTEXTURECUBEARRAY {
2583 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2584 $$.basicType = EbtSampler;
2585 $$.sampler.setTexture(EbtUint, EsdCube, true);
2589 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2590 $$.basicType = EbtSampler;
2591 $$.sampler.set(EbtUint, Esd2D, true);
2594 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2595 $$.basicType = EbtSampler;
2596 $$.sampler.setTexture(EbtFloat, Esd2D);
2599 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2600 $$.basicType = EbtSampler;
2601 $$.sampler.setTexture(EbtFloat, Esd3D);
2604 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2605 $$.basicType = EbtSampler;
2606 $$.sampler.setTexture(EbtFloat, Esd2D, true);
2609 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2610 $$.basicType = EbtSampler;
2611 $$.sampler.setTexture(EbtFloat, EsdCube);
2614 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2615 $$.basicType = EbtSampler;
2616 $$.sampler.setTexture(EbtInt, Esd2D);
2619 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2620 $$.basicType = EbtSampler;
2621 $$.sampler.setTexture(EbtInt, Esd3D);
2624 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2625 $$.basicType = EbtSampler;
2626 $$.sampler.setTexture(EbtInt, EsdCube);
2629 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2630 $$.basicType = EbtSampler;
2631 $$.sampler.setTexture(EbtInt, Esd2D, true);
2634 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2635 $$.basicType = EbtSampler;
2636 $$.sampler.setTexture(EbtUint, Esd2D);
2639 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2640 $$.basicType = EbtSampler;
2641 $$.sampler.setTexture(EbtUint, Esd3D);
2644 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2645 $$.basicType = EbtSampler;
2646 $$.sampler.setTexture(EbtUint, EsdCube);
2649 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2650 $$.basicType = EbtSampler;
2651 $$.sampler.setTexture(EbtUint, Esd2D, true);
2654 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2655 $$.basicType = EbtSampler;
2656 $$.sampler.setPureSampler(false);
2659 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2660 $$.basicType = EbtSampler;
2661 $$.sampler.setPureSampler(true);
2665 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2666 $$.basicType = EbtSampler;
2667 $$.sampler.set(EbtFloat, EsdRect);
2669 | SAMPLER2DRECTSHADOW {
2670 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2671 $$.basicType = EbtSampler;
2672 $$.sampler.set(EbtFloat, EsdRect, false, true);
2674 | F16SAMPLER2DRECT {
2675 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2676 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2677 $$.basicType = EbtSampler;
2678 $$.sampler.set(EbtFloat16, EsdRect);
2680 | F16SAMPLER2DRECTSHADOW {
2681 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2682 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2683 $$.basicType = EbtSampler;
2684 $$.sampler.set(EbtFloat16, EsdRect, false, true);
2687 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2688 $$.basicType = EbtSampler;
2689 $$.sampler.set(EbtInt, EsdRect);
2692 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2693 $$.basicType = EbtSampler;
2694 $$.sampler.set(EbtUint, EsdRect);
2697 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2698 $$.basicType = EbtSampler;
2699 $$.sampler.set(EbtFloat, EsdBuffer);
2701 | F16SAMPLERBUFFER {
2702 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2703 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2704 $$.basicType = EbtSampler;
2705 $$.sampler.set(EbtFloat16, EsdBuffer);
2708 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2709 $$.basicType = EbtSampler;
2710 $$.sampler.set(EbtInt, EsdBuffer);
2713 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2714 $$.basicType = EbtSampler;
2715 $$.sampler.set(EbtUint, EsdBuffer);
2718 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2719 $$.basicType = EbtSampler;
2720 $$.sampler.set(EbtFloat, Esd2D, false, false, true);
2723 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2724 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2725 $$.basicType = EbtSampler;
2726 $$.sampler.set(EbtFloat16, Esd2D, false, false, true);
2729 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2730 $$.basicType = EbtSampler;
2731 $$.sampler.set(EbtInt, Esd2D, false, false, true);
2734 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2735 $$.basicType = EbtSampler;
2736 $$.sampler.set(EbtUint, Esd2D, false, false, true);
2738 | SAMPLER2DMSARRAY {
2739 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2740 $$.basicType = EbtSampler;
2741 $$.sampler.set(EbtFloat, Esd2D, true, false, true);
2743 | F16SAMPLER2DMSARRAY {
2744 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2745 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2746 $$.basicType = EbtSampler;
2747 $$.sampler.set(EbtFloat16, Esd2D, true, false, true);
2749 | ISAMPLER2DMSARRAY {
2750 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2751 $$.basicType = EbtSampler;
2752 $$.sampler.set(EbtInt, Esd2D, true, false, true);
2754 | USAMPLER2DMSARRAY {
2755 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2756 $$.basicType = EbtSampler;
2757 $$.sampler.set(EbtUint, Esd2D, true, false, true);
2760 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2761 $$.basicType = EbtSampler;
2762 $$.sampler.setTexture(EbtFloat, Esd1D);
2765 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2766 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2767 $$.basicType = EbtSampler;
2768 $$.sampler.setTexture(EbtFloat16, Esd1D);
2771 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2772 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2773 $$.basicType = EbtSampler;
2774 $$.sampler.setTexture(EbtFloat16, Esd2D);
2777 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2778 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2779 $$.basicType = EbtSampler;
2780 $$.sampler.setTexture(EbtFloat16, Esd3D);
2783 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2784 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2785 $$.basicType = EbtSampler;
2786 $$.sampler.setTexture(EbtFloat16, EsdCube);
2789 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2790 $$.basicType = EbtSampler;
2791 $$.sampler.setTexture(EbtFloat, Esd1D, true);
2793 | F16TEXTURE1DARRAY {
2794 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2795 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2796 $$.basicType = EbtSampler;
2797 $$.sampler.setTexture(EbtFloat16, Esd1D, true);
2799 | F16TEXTURE2DARRAY {
2800 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2801 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2802 $$.basicType = EbtSampler;
2803 $$.sampler.setTexture(EbtFloat16, Esd2D, true);
2805 | F16TEXTURECUBEARRAY {
2806 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2807 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2808 $$.basicType = EbtSampler;
2809 $$.sampler.setTexture(EbtFloat16, EsdCube, true);
2812 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2813 $$.basicType = EbtSampler;
2814 $$.sampler.setTexture(EbtInt, Esd1D);
2817 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2818 $$.basicType = EbtSampler;
2819 $$.sampler.setTexture(EbtInt, Esd1D, true);
2822 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2823 $$.basicType = EbtSampler;
2824 $$.sampler.setTexture(EbtUint, Esd1D);
2827 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2828 $$.basicType = EbtSampler;
2829 $$.sampler.setTexture(EbtUint, Esd1D, true);
2832 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2833 $$.basicType = EbtSampler;
2834 $$.sampler.setTexture(EbtFloat, EsdRect);
2836 | F16TEXTURE2DRECT {
2837 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2838 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2839 $$.basicType = EbtSampler;
2840 $$.sampler.setTexture(EbtFloat16, EsdRect);
2843 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2844 $$.basicType = EbtSampler;
2845 $$.sampler.setTexture(EbtInt, EsdRect);
2848 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2849 $$.basicType = EbtSampler;
2850 $$.sampler.setTexture(EbtUint, EsdRect);
2853 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2854 $$.basicType = EbtSampler;
2855 $$.sampler.setTexture(EbtFloat, EsdBuffer);
2857 | F16TEXTUREBUFFER {
2858 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2859 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2860 $$.basicType = EbtSampler;
2861 $$.sampler.setTexture(EbtFloat16, EsdBuffer);
2864 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2865 $$.basicType = EbtSampler;
2866 $$.sampler.setTexture(EbtInt, EsdBuffer);
2869 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2870 $$.basicType = EbtSampler;
2871 $$.sampler.setTexture(EbtUint, EsdBuffer);
2874 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2875 $$.basicType = EbtSampler;
2876 $$.sampler.setTexture(EbtFloat, Esd2D, false, false, true);
2879 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2880 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2881 $$.basicType = EbtSampler;
2882 $$.sampler.setTexture(EbtFloat16, Esd2D, false, false, true);
2885 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2886 $$.basicType = EbtSampler;
2887 $$.sampler.setTexture(EbtInt, Esd2D, false, false, true);
2890 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2891 $$.basicType = EbtSampler;
2892 $$.sampler.setTexture(EbtUint, Esd2D, false, false, true);
2894 | TEXTURE2DMSARRAY {
2895 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2896 $$.basicType = EbtSampler;
2897 $$.sampler.setTexture(EbtFloat, Esd2D, true, false, true);
2899 | F16TEXTURE2DMSARRAY {
2900 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2901 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2902 $$.basicType = EbtSampler;
2903 $$.sampler.setTexture(EbtFloat16, Esd2D, true, false, true);
2905 | ITEXTURE2DMSARRAY {
2906 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2907 $$.basicType = EbtSampler;
2908 $$.sampler.setTexture(EbtInt, Esd2D, true, false, true);
2910 | UTEXTURE2DMSARRAY {
2911 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2912 $$.basicType = EbtSampler;
2913 $$.sampler.setTexture(EbtUint, Esd2D, true, false, true);
2916 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2917 $$.basicType = EbtSampler;
2918 $$.sampler.setImage(EbtFloat, Esd1D);
2921 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
2922 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2923 $$.basicType = EbtSampler;
2924 $$.sampler.setImage(EbtFloat16, Esd1D);
2927 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2928 $$.basicType = EbtSampler;
2929 $$.sampler.setImage(EbtInt, Esd1D);
2932 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2933 $$.basicType = EbtSampler;
2934 $$.sampler.setImage(EbtUint, Esd1D);
2937 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2938 $$.basicType = EbtSampler;
2939 $$.sampler.setImage(EbtFloat, Esd2D);
2942 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
2943 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2944 $$.basicType = EbtSampler;
2945 $$.sampler.setImage(EbtFloat16, Esd2D);
2948 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2949 $$.basicType = EbtSampler;
2950 $$.sampler.setImage(EbtInt, Esd2D);
2953 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2954 $$.basicType = EbtSampler;
2955 $$.sampler.setImage(EbtUint, Esd2D);
2958 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2959 $$.basicType = EbtSampler;
2960 $$.sampler.setImage(EbtFloat, Esd3D);
2963 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
2964 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2965 $$.basicType = EbtSampler;
2966 $$.sampler.setImage(EbtFloat16, Esd3D);
2969 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2970 $$.basicType = EbtSampler;
2971 $$.sampler.setImage(EbtInt, Esd3D);
2974 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2975 $$.basicType = EbtSampler;
2976 $$.sampler.setImage(EbtUint, Esd3D);
2979 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2980 $$.basicType = EbtSampler;
2981 $$.sampler.setImage(EbtFloat, EsdRect);
2984 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
2985 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2986 $$.basicType = EbtSampler;
2987 $$.sampler.setImage(EbtFloat16, EsdRect);
2990 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2991 $$.basicType = EbtSampler;
2992 $$.sampler.setImage(EbtInt, EsdRect);
2995 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2996 $$.basicType = EbtSampler;
2997 $$.sampler.setImage(EbtUint, EsdRect);
3000 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3001 $$.basicType = EbtSampler;
3002 $$.sampler.setImage(EbtFloat, EsdCube);
3005 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3006 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3007 $$.basicType = EbtSampler;
3008 $$.sampler.setImage(EbtFloat16, EsdCube);
3011 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3012 $$.basicType = EbtSampler;
3013 $$.sampler.setImage(EbtInt, EsdCube);
3016 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3017 $$.basicType = EbtSampler;
3018 $$.sampler.setImage(EbtUint, EsdCube);
3021 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3022 $$.basicType = EbtSampler;
3023 $$.sampler.setImage(EbtFloat, EsdBuffer);
3026 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3027 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3028 $$.basicType = EbtSampler;
3029 $$.sampler.setImage(EbtFloat16, EsdBuffer);
3032 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3033 $$.basicType = EbtSampler;
3034 $$.sampler.setImage(EbtInt, EsdBuffer);
3037 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3038 $$.basicType = EbtSampler;
3039 $$.sampler.setImage(EbtUint, EsdBuffer);
3042 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3043 $$.basicType = EbtSampler;
3044 $$.sampler.setImage(EbtFloat, Esd1D, true);
3047 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3048 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3049 $$.basicType = EbtSampler;
3050 $$.sampler.setImage(EbtFloat16, Esd1D, true);
3053 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3054 $$.basicType = EbtSampler;
3055 $$.sampler.setImage(EbtInt, Esd1D, true);
3058 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3059 $$.basicType = EbtSampler;
3060 $$.sampler.setImage(EbtUint, Esd1D, true);
3063 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3064 $$.basicType = EbtSampler;
3065 $$.sampler.setImage(EbtFloat, Esd2D, true);
3068 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3069 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3070 $$.basicType = EbtSampler;
3071 $$.sampler.setImage(EbtFloat16, Esd2D, true);
3074 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3075 $$.basicType = EbtSampler;
3076 $$.sampler.setImage(EbtInt, Esd2D, true);
3079 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3080 $$.basicType = EbtSampler;
3081 $$.sampler.setImage(EbtUint, Esd2D, true);
3084 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3085 $$.basicType = EbtSampler;
3086 $$.sampler.setImage(EbtFloat, EsdCube, true);
3088 | F16IMAGECUBEARRAY {
3089 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3090 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3091 $$.basicType = EbtSampler;
3092 $$.sampler.setImage(EbtFloat16, EsdCube, true);
3095 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3096 $$.basicType = EbtSampler;
3097 $$.sampler.setImage(EbtInt, EsdCube, true);
3100 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3101 $$.basicType = EbtSampler;
3102 $$.sampler.setImage(EbtUint, EsdCube, true);
3105 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3106 $$.basicType = EbtSampler;
3107 $$.sampler.setImage(EbtFloat, Esd2D, false, false, true);
3110 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3111 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3112 $$.basicType = EbtSampler;
3113 $$.sampler.setImage(EbtFloat16, Esd2D, false, false, true);
3116 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3117 $$.basicType = EbtSampler;
3118 $$.sampler.setImage(EbtInt, Esd2D, false, false, true);
3121 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3122 $$.basicType = EbtSampler;
3123 $$.sampler.setImage(EbtUint, Esd2D, false, false, true);
3126 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3127 $$.basicType = EbtSampler;
3128 $$.sampler.setImage(EbtFloat, Esd2D, true, false, true);
3130 | F16IMAGE2DMSARRAY {
3131 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3132 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3133 $$.basicType = EbtSampler;
3134 $$.sampler.setImage(EbtFloat16, Esd2D, true, false, true);
3137 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3138 $$.basicType = EbtSampler;
3139 $$.sampler.setImage(EbtInt, Esd2D, true, false, true);
3142 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3143 $$.basicType = EbtSampler;
3144 $$.sampler.setImage(EbtUint, Esd2D, true, false, true);
3146 | SAMPLEREXTERNALOES { // GL_OES_EGL_image_external
3147 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3148 $$.basicType = EbtSampler;
3149 $$.sampler.set(EbtFloat, Esd2D);
3150 $$.sampler.external = true;
3152 | SAMPLEREXTERNAL2DY2YEXT { // GL_EXT_YUV_target
3153 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3154 $$.basicType = EbtSampler;
3155 $$.sampler.set(EbtFloat, Esd2D);
3156 $$.sampler.yuv = true;
3159 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3160 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3161 $$.basicType = EbtSampler;
3162 $$.sampler.setSubpass(EbtFloat);
3165 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3166 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3167 $$.basicType = EbtSampler;
3168 $$.sampler.setSubpass(EbtFloat, true);
3171 parseContext.float16OpaqueCheck($1.loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel());
3172 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3173 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3174 $$.basicType = EbtSampler;
3175 $$.sampler.setSubpass(EbtFloat16);
3177 | F16SUBPASSINPUTMS {
3178 parseContext.float16OpaqueCheck($1.loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel());
3179 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3180 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3181 $$.basicType = EbtSampler;
3182 $$.sampler.setSubpass(EbtFloat16, true);
3185 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3186 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3187 $$.basicType = EbtSampler;
3188 $$.sampler.setSubpass(EbtInt);
3191 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3192 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3193 $$.basicType = EbtSampler;
3194 $$.sampler.setSubpass(EbtInt, true);
3197 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3198 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3199 $$.basicType = EbtSampler;
3200 $$.sampler.setSubpass(EbtUint);
3203 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3204 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3205 $$.basicType = EbtSampler;
3206 $$.sampler.setSubpass(EbtUint, true);
3209 parseContext.fcoopmatCheck($1.loc, "fcoopmatNV", parseContext.symbolTable.atBuiltInLevel());
3210 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3211 $$.basicType = EbtFloat;
3215 parseContext.intcoopmatCheck($1.loc, "icoopmatNV", parseContext.symbolTable.atBuiltInLevel());
3216 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3217 $$.basicType = EbtInt;
3221 parseContext.intcoopmatCheck($1.loc, "ucoopmatNV", parseContext.symbolTable.atBuiltInLevel());
3222 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3223 $$.basicType = EbtUint;
3227 | struct_specifier {
3229 $$.qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3230 parseContext.structTypeCheck($$.loc, $$);
3234 // This is for user defined type names. The lexical phase looked up the
3237 if (const TVariable* variable = ($1.symbol)->getAsVariable()) {
3238 const TType& structure = variable->getType();
3239 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3240 $$.basicType = EbtStruct;
3241 $$.userDef = &structure;
3243 parseContext.error($1.loc, "expected type name", $1.string->c_str(), "");
3249 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "highp precision qualifier");
3250 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3251 parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqHigh);
3253 | MEDIUM_PRECISION {
3254 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "mediump precision qualifier");
3255 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3256 parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqMedium);
3259 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "lowp precision qualifier");
3260 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3261 parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqLow);
3266 : STRUCT IDENTIFIER LEFT_BRACE { parseContext.nestedStructCheck($1.loc); } struct_declaration_list RIGHT_BRACE {
3267 TType* structure = new TType($5, *$2.string);
3268 parseContext.structArrayCheck($2.loc, *structure);
3269 TVariable* userTypeDef = new TVariable($2.string, *structure, true);
3270 if (! parseContext.symbolTable.insert(*userTypeDef))
3271 parseContext.error($2.loc, "redefinition", $2.string->c_str(), "struct");
3273 $$.basicType = EbtStruct;
3274 $$.userDef = structure;
3275 --parseContext.structNestingLevel;
3277 | STRUCT LEFT_BRACE { parseContext.nestedStructCheck($1.loc); } struct_declaration_list RIGHT_BRACE {
3278 TType* structure = new TType($4, TString(""));
3280 $$.basicType = EbtStruct;
3281 $$.userDef = structure;
3282 --parseContext.structNestingLevel;
3286 struct_declaration_list
3287 : struct_declaration {
3290 | struct_declaration_list struct_declaration {
3292 for (unsigned int i = 0; i < $2->size(); ++i) {
3293 for (unsigned int j = 0; j < $$->size(); ++j) {
3294 if ((*$$)[j].type->getFieldName() == (*$2)[i].type->getFieldName())
3295 parseContext.error((*$2)[i].loc, "duplicate member name:", "", (*$2)[i].type->getFieldName().c_str());
3297 $$->push_back((*$2)[i]);
3303 : type_specifier struct_declarator_list SEMICOLON {
3304 if ($1.arraySizes) {
3305 parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
3306 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
3307 if (parseContext.isEsProfile())
3308 parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
3313 parseContext.voidErrorCheck($1.loc, (*$2)[0].type->getFieldName(), $1.basicType);
3314 parseContext.precisionQualifierCheck($1.loc, $1.basicType, $1.qualifier);
3316 for (unsigned int i = 0; i < $$->size(); ++i) {
3318 type.setFieldName((*$$)[i].type->getFieldName());
3319 type.transferArraySizes((*$$)[i].type->getArraySizes());
3320 type.copyArrayInnerSizes($1.arraySizes);
3321 parseContext.arrayOfArrayVersionCheck((*$$)[i].loc, type.getArraySizes());
3322 (*$$)[i].type->shallowCopy(type);
3325 | type_qualifier type_specifier struct_declarator_list SEMICOLON {
3326 if ($2.arraySizes) {
3327 parseContext.profileRequires($2.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
3328 parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type");
3329 if (parseContext.isEsProfile())
3330 parseContext.arraySizeRequiredCheck($2.loc, *$2.arraySizes);
3335 parseContext.memberQualifierCheck($1);
3336 parseContext.voidErrorCheck($2.loc, (*$3)[0].type->getFieldName(), $2.basicType);
3337 parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true);
3338 parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier);
3340 for (unsigned int i = 0; i < $$->size(); ++i) {
3342 type.setFieldName((*$$)[i].type->getFieldName());
3343 type.transferArraySizes((*$$)[i].type->getArraySizes());
3344 type.copyArrayInnerSizes($2.arraySizes);
3345 parseContext.arrayOfArrayVersionCheck((*$$)[i].loc, type.getArraySizes());
3346 (*$$)[i].type->shallowCopy(type);
3351 struct_declarator_list
3352 : struct_declarator {
3356 | struct_declarator_list COMMA struct_declarator {
3363 $$.type = new TType(EbtVoid);
3365 $$.type->setFieldName(*$1.string);
3367 | IDENTIFIER array_specifier {
3368 parseContext.arrayOfArrayVersionCheck($1.loc, $2.arraySizes);
3370 $$.type = new TType(EbtVoid);
3372 $$.type->setFieldName(*$1.string);
3373 $$.type->transferArraySizes($2.arraySizes);
3378 : assignment_expression {
3382 | LEFT_BRACE initializer_list RIGHT_BRACE {
3383 const char* initFeature = "{ } style initializers";
3384 parseContext.requireProfile($1.loc, ~EEsProfile, initFeature);
3385 parseContext.profileRequires($1.loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature);
3388 | LEFT_BRACE initializer_list COMMA RIGHT_BRACE {
3389 const char* initFeature = "{ } style initializers";
3390 parseContext.requireProfile($1.loc, ~EEsProfile, initFeature);
3391 parseContext.profileRequires($1.loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature);
3400 $$ = parseContext.intermediate.growAggregate(0, $1, $1->getLoc());
3402 | initializer_list COMMA initializer {
3403 $$ = parseContext.intermediate.growAggregate($1, $3);
3408 declaration_statement
3409 : declaration { $$ = $1; }
3413 : compound_statement { $$ = $1; }
3414 | simple_statement { $$ = $1; }
3417 // Grammar Note: labeled statements for switch statements only; 'goto' is not supported.
3420 : declaration_statement { $$ = $1; }
3421 | expression_statement { $$ = $1; }
3422 | selection_statement { $$ = $1; }
3423 | switch_statement { $$ = $1; }
3424 | case_label { $$ = $1; }
3425 | iteration_statement { $$ = $1; }
3426 | jump_statement { $$ = $1; }
3428 | demote_statement { $$ = $1; }
3434 : DEMOTE SEMICOLON {
3435 parseContext.requireStage($1.loc, EShLangFragment, "demote");
3436 parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_demote_to_helper_invocation, "demote");
3437 $$ = parseContext.intermediate.addBranch(EOpDemote, $1.loc);
3443 : LEFT_BRACE RIGHT_BRACE { $$ = 0; }
3445 parseContext.symbolTable.push();
3446 ++parseContext.statementNestingLevel;
3449 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3450 --parseContext.statementNestingLevel;
3453 if ($3 && $3->getAsAggregate())
3454 $3->getAsAggregate()->setOperator(EOpSequence);
3459 statement_no_new_scope
3460 : compound_statement_no_new_scope { $$ = $1; }
3461 | simple_statement { $$ = $1; }
3466 ++parseContext.controlFlowNestingLevel;
3468 compound_statement {
3469 --parseContext.controlFlowNestingLevel;
3473 parseContext.symbolTable.push();
3474 ++parseContext.statementNestingLevel;
3475 ++parseContext.controlFlowNestingLevel;
3478 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3479 --parseContext.statementNestingLevel;
3480 --parseContext.controlFlowNestingLevel;
3484 compound_statement_no_new_scope
3485 // Statement that doesn't create a new scope, for selection_statement, iteration_statement
3486 : LEFT_BRACE RIGHT_BRACE {
3489 | LEFT_BRACE statement_list RIGHT_BRACE {
3490 if ($2 && $2->getAsAggregate())
3491 $2->getAsAggregate()->setOperator(EOpSequence);
3498 $$ = parseContext.intermediate.makeAggregate($1);
3499 if ($1 && $1->getAsBranchNode() && ($1->getAsBranchNode()->getFlowOp() == EOpCase ||
3500 $1->getAsBranchNode()->getFlowOp() == EOpDefault)) {
3501 parseContext.wrapupSwitchSubsequence(0, $1);
3502 $$ = 0; // start a fresh subsequence for what's after this case
3505 | statement_list statement {
3506 if ($2 && $2->getAsBranchNode() && ($2->getAsBranchNode()->getFlowOp() == EOpCase ||
3507 $2->getAsBranchNode()->getFlowOp() == EOpDefault)) {
3508 parseContext.wrapupSwitchSubsequence($1 ? $1->getAsAggregate() : 0, $2);
3509 $$ = 0; // start a fresh subsequence for what's after this case
3511 $$ = parseContext.intermediate.growAggregate($1, $2);
3515 expression_statement
3516 : SEMICOLON { $$ = 0; }
3517 | expression SEMICOLON { $$ = static_cast<TIntermNode*>($1); }
3521 : selection_statement_nonattributed {
3525 | attribute selection_statement_nonattributed {
3526 parseContext.handleSelectionAttributes(*$1, $2);
3531 selection_statement_nonattributed
3532 : IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement {
3533 parseContext.boolCheck($1.loc, $3);
3534 $$ = parseContext.intermediate.addSelection($3, $5, $1.loc);
3538 selection_rest_statement
3539 : statement_scoped ELSE statement_scoped {
3543 | statement_scoped {
3550 // In 1996 c++ draft, conditions can include single declarations
3553 parseContext.boolCheck($1->getLoc(), $1);
3555 | fully_specified_type IDENTIFIER EQUAL initializer {
3556 parseContext.boolCheck($2.loc, $1);
3559 TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, 0, $4);
3561 $$ = initNode->getAsTyped();
3568 : switch_statement_nonattributed {
3572 | attribute switch_statement_nonattributed {
3573 parseContext.handleSwitchAttributes(*$1, $2);
3578 switch_statement_nonattributed
3579 : SWITCH LEFT_PAREN expression RIGHT_PAREN {
3580 // start new switch sequence on the switch stack
3581 ++parseContext.controlFlowNestingLevel;
3582 ++parseContext.statementNestingLevel;
3583 parseContext.switchSequenceStack.push_back(new TIntermSequence);
3584 parseContext.switchLevel.push_back(parseContext.statementNestingLevel);
3585 parseContext.symbolTable.push();
3587 LEFT_BRACE switch_statement_list RIGHT_BRACE {
3588 $$ = parseContext.addSwitch($1.loc, $3, $7 ? $7->getAsAggregate() : 0);
3589 delete parseContext.switchSequenceStack.back();
3590 parseContext.switchSequenceStack.pop_back();
3591 parseContext.switchLevel.pop_back();
3592 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3593 --parseContext.statementNestingLevel;
3594 --parseContext.controlFlowNestingLevel;
3598 switch_statement_list
3608 : CASE expression COLON {
3610 if (parseContext.switchLevel.size() == 0)
3611 parseContext.error($1.loc, "cannot appear outside switch statement", "case", "");
3612 else if (parseContext.switchLevel.back() != parseContext.statementNestingLevel)
3613 parseContext.error($1.loc, "cannot be nested inside control flow", "case", "");
3615 parseContext.constantValueCheck($2, "case");
3616 parseContext.integerCheck($2, "case");
3617 $$ = parseContext.intermediate.addBranch(EOpCase, $2, $1.loc);
3622 if (parseContext.switchLevel.size() == 0)
3623 parseContext.error($1.loc, "cannot appear outside switch statement", "default", "");
3624 else if (parseContext.switchLevel.back() != parseContext.statementNestingLevel)
3625 parseContext.error($1.loc, "cannot be nested inside control flow", "default", "");
3627 $$ = parseContext.intermediate.addBranch(EOpDefault, $1.loc);
3632 : iteration_statement_nonattributed {
3636 | attribute iteration_statement_nonattributed {
3637 parseContext.handleLoopAttributes(*$1, $2);
3642 iteration_statement_nonattributed
3643 : WHILE LEFT_PAREN {
3644 if (! parseContext.limits.whileLoops)
3645 parseContext.error($1.loc, "while loops not available", "limitation", "");
3646 parseContext.symbolTable.push();
3647 ++parseContext.loopNestingLevel;
3648 ++parseContext.statementNestingLevel;
3649 ++parseContext.controlFlowNestingLevel;
3651 condition RIGHT_PAREN statement_no_new_scope {
3652 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3653 $$ = parseContext.intermediate.addLoop($6, $4, 0, true, $1.loc);
3654 --parseContext.loopNestingLevel;
3655 --parseContext.statementNestingLevel;
3656 --parseContext.controlFlowNestingLevel;
3659 ++parseContext.loopNestingLevel;
3660 ++parseContext.statementNestingLevel;
3661 ++parseContext.controlFlowNestingLevel;
3663 statement WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON {
3664 if (! parseContext.limits.whileLoops)
3665 parseContext.error($1.loc, "do-while loops not available", "limitation", "");
3667 parseContext.boolCheck($8.loc, $6);
3669 $$ = parseContext.intermediate.addLoop($3, $6, 0, false, $4.loc);
3670 --parseContext.loopNestingLevel;
3671 --parseContext.statementNestingLevel;
3672 --parseContext.controlFlowNestingLevel;
3675 parseContext.symbolTable.push();
3676 ++parseContext.loopNestingLevel;
3677 ++parseContext.statementNestingLevel;
3678 ++parseContext.controlFlowNestingLevel;
3680 for_init_statement for_rest_statement RIGHT_PAREN statement_no_new_scope {
3681 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3682 $$ = parseContext.intermediate.makeAggregate($4, $2.loc);
3683 TIntermLoop* forLoop = parseContext.intermediate.addLoop($7, reinterpret_cast<TIntermTyped*>($5.node1), reinterpret_cast<TIntermTyped*>($5.node2), true, $1.loc);
3684 if (! parseContext.limits.nonInductiveForLoops)
3685 parseContext.inductiveLoopCheck($1.loc, $4, forLoop);
3686 $$ = parseContext.intermediate.growAggregate($$, forLoop, $1.loc);
3687 $$->getAsAggregate()->setOperator(EOpSequence);
3688 --parseContext.loopNestingLevel;
3689 --parseContext.statementNestingLevel;
3690 --parseContext.controlFlowNestingLevel;
3695 : expression_statement {
3698 | declaration_statement {
3707 | /* May be null */ {
3713 : conditionopt SEMICOLON {
3717 | conditionopt SEMICOLON expression {
3724 : CONTINUE SEMICOLON {
3725 if (parseContext.loopNestingLevel <= 0)
3726 parseContext.error($1.loc, "continue statement only allowed in loops", "", "");
3727 $$ = parseContext.intermediate.addBranch(EOpContinue, $1.loc);
3730 if (parseContext.loopNestingLevel + parseContext.switchSequenceStack.size() <= 0)
3731 parseContext.error($1.loc, "break statement only allowed in switch and loops", "", "");
3732 $$ = parseContext.intermediate.addBranch(EOpBreak, $1.loc);
3734 | RETURN SEMICOLON {
3735 $$ = parseContext.intermediate.addBranch(EOpReturn, $1.loc);
3736 if (parseContext.currentFunctionType->getBasicType() != EbtVoid)
3737 parseContext.error($1.loc, "non-void function must return a value", "return", "");
3738 if (parseContext.inMain)
3739 parseContext.postEntryPointReturn = true;
3741 | RETURN expression SEMICOLON {
3742 $$ = parseContext.handleReturnValue($1.loc, $2);
3744 | DISCARD SEMICOLON {
3745 parseContext.requireStage($1.loc, EShLangFragment, "discard");
3746 $$ = parseContext.intermediate.addBranch(EOpKill, $1.loc);
3750 // Grammar Note: No 'goto'. Gotos are not supported.
3753 : external_declaration {
3755 parseContext.intermediate.setTreeRoot($$);
3757 | translation_unit external_declaration {
3758 if ($2 != nullptr) {
3759 $$ = parseContext.intermediate.growAggregate($1, $2);
3760 parseContext.intermediate.setTreeRoot($$);
3765 external_declaration
3766 : function_definition {
3774 parseContext.requireProfile($1.loc, ~EEsProfile, "extraneous semicolon");
3775 parseContext.profileRequires($1.loc, ~EEsProfile, 460, nullptr, "extraneous semicolon");
3782 : function_prototype {
3783 $1.function = parseContext.handleFunctionDeclarator($1.loc, *$1.function, false /* not prototype */);
3784 $1.intermNode = parseContext.handleFunctionDefinition($1.loc, *$1.function);
3786 compound_statement_no_new_scope {
3787 // May be best done as post process phase on intermediate code
3788 if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue)
3789 parseContext.error($1.loc, "function does not return a value:", "", $1.function->getName().c_str());
3790 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3791 $$ = parseContext.intermediate.growAggregate($1.intermNode, $3);
3792 parseContext.intermediate.setAggregateOperator($$, EOpFunction, $1.function->getType(), $1.loc);
3793 $$->getAsAggregate()->setName($1.function->getMangledName().c_str());
3795 // store the pragma information for debug and optimize and other vendor specific
3796 // information. This information can be queried from the parse tree
3797 $$->getAsAggregate()->setOptimize(parseContext.contextPragma.optimize);
3798 $$->getAsAggregate()->setDebug(parseContext.contextPragma.debug);
3799 $$->getAsAggregate()->setPragmaTable(parseContext.contextPragma.pragmaTable);
3805 : LEFT_BRACKET LEFT_BRACKET attribute_list RIGHT_BRACKET RIGHT_BRACKET {
3807 parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_control_flow_attributes, "attribute");
3811 : single_attribute {
3814 | attribute_list COMMA single_attribute {
3815 $$ = parseContext.mergeAttributes($1, $3);
3820 $$ = parseContext.makeAttributes(*$1.string);
3822 | IDENTIFIER LEFT_PAREN constant_expression RIGHT_PAREN {
3823 $$ = parseContext.makeAttributes(*$1.string, $3);