2 // Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
3 // Copyright (C) 2012-2013 LunarG, Inc.
4 // Copyright (C) 2017 ARM Limited.
6 // All rights reserved.
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions
12 // Redistributions of source code must retain the above copyright
13 // notice, this list of conditions and the following disclaimer.
15 // Redistributions in binary form must reproduce the above
16 // copyright notice, this list of conditions and the following
17 // disclaimer in the documentation and/or other materials provided
18 // with the distribution.
20 // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
21 // contributors may be used to endorse or promote products derived
22 // from this software without specific prior written permission.
24 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28 // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34 // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 // POSSIBILITY OF SUCH DAMAGE.
39 * This is bison grammar and productions for parsing all versions of the
40 * GLSL shading languages.
47 In 1985, Jeff Lee published his Yacc grammar (which is accompanied by a
48 matching Lex specification) for the April 30, 1985 draft version of the
49 ANSI C standard. Tom Stockfisch reposted it to net.sources in 1987; that
50 original, as mentioned in the answer to question 17.25 of the comp.lang.c
51 FAQ, can be ftp'ed from ftp.uu.net, file usenet/net.sources/ansi.c.grammar.Z.
53 I intend to keep this version as close to the current C Standard grammar as
54 possible; please let me know if you discover discrepancies.
59 #include "SymbolTable.h"
60 #include "ParseHelper.h"
61 #include "../Public/ShaderLang.h"
62 #include "attribute.h"
64 using namespace glslang;
68 %define parse.error verbose
72 glslang::TSourceLoc loc;
74 glslang::TString *string;
78 unsigned long long u64;
82 glslang::TSymbol* symbol;
85 glslang::TSourceLoc loc;
86 glslang::TOperator op;
88 TIntermNode* intermNode;
89 glslang::TIntermNodePair nodePair;
90 glslang::TIntermTyped* intermTypedNode;
91 glslang::TAttributes* attributes;
94 glslang::TPublicType type;
95 glslang::TFunction* function;
96 glslang::TParameter param;
97 glslang::TTypeLoc typeLine;
98 glslang::TTypeList* typeList;
99 glslang::TArraySizes* arraySizes;
100 glslang::TIdentifierList* identifierList;
107 /* windows only pragma */
109 #pragma warning(disable : 4065)
110 #pragma warning(disable : 4127)
111 #pragma warning(disable : 4244)
114 #define parseContext (*pParseContext)
115 #define yyerror(context, msg) context->parserError(msg)
117 extern int yylex(YYSTYPE*, TParseContext&);
121 %parse-param {glslang::TParseContext* pParseContext}
122 %lex-param {parseContext}
123 %pure-parser // enable thread safety
124 %expect 1 // One shift reduce conflict because of if | else
126 %token <lex> ATTRIBUTE VARYING
127 %token <lex> FLOAT16_T FLOAT FLOAT32_T DOUBLE FLOAT64_T
128 %token <lex> CONST BOOL INT UINT INT64_T UINT64_T INT32_T UINT32_T INT16_T UINT16_T INT8_T UINT8_T
129 %token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT SUBROUTINE
130 %token <lex> BVEC2 BVEC3 BVEC4
131 %token <lex> IVEC2 IVEC3 IVEC4
132 %token <lex> UVEC2 UVEC3 UVEC4
133 %token <lex> I64VEC2 I64VEC3 I64VEC4
134 %token <lex> U64VEC2 U64VEC3 U64VEC4
135 %token <lex> I32VEC2 I32VEC3 I32VEC4
136 %token <lex> U32VEC2 U32VEC3 U32VEC4
137 %token <lex> I16VEC2 I16VEC3 I16VEC4
138 %token <lex> U16VEC2 U16VEC3 U16VEC4
139 %token <lex> I8VEC2 I8VEC3 I8VEC4
140 %token <lex> U8VEC2 U8VEC3 U8VEC4
141 %token <lex> VEC2 VEC3 VEC4
142 %token <lex> MAT2 MAT3 MAT4 CENTROID IN OUT INOUT
143 %token <lex> UNIFORM PATCH SAMPLE BUFFER SHARED NONUNIFORM PAYLOADNV PAYLOADINNV HITATTRNV
144 %token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT SUBGROUPCOHERENT NONPRIVATE
145 %token <lex> DVEC2 DVEC3 DVEC4 DMAT2 DMAT3 DMAT4
146 %token <lex> F16VEC2 F16VEC3 F16VEC4 F16MAT2 F16MAT3 F16MAT4
147 %token <lex> F32VEC2 F32VEC3 F32VEC4 F32MAT2 F32MAT3 F32MAT4
148 %token <lex> F64VEC2 F64VEC3 F64VEC4 F64MAT2 F64MAT3 F64MAT4
149 %token <lex> NOPERSPECTIVE FLAT SMOOTH LAYOUT EXPLICITINTERPAMD PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV
151 %token <lex> MAT2X2 MAT2X3 MAT2X4
152 %token <lex> MAT3X2 MAT3X3 MAT3X4
153 %token <lex> MAT4X2 MAT4X3 MAT4X4
154 %token <lex> DMAT2X2 DMAT2X3 DMAT2X4
155 %token <lex> DMAT3X2 DMAT3X3 DMAT3X4
156 %token <lex> DMAT4X2 DMAT4X3 DMAT4X4
157 %token <lex> F16MAT2X2 F16MAT2X3 F16MAT2X4
158 %token <lex> F16MAT3X2 F16MAT3X3 F16MAT3X4
159 %token <lex> F16MAT4X2 F16MAT4X3 F16MAT4X4
160 %token <lex> F32MAT2X2 F32MAT2X3 F32MAT2X4
161 %token <lex> F32MAT3X2 F32MAT3X3 F32MAT3X4
162 %token <lex> F32MAT4X2 F32MAT4X3 F32MAT4X4
163 %token <lex> F64MAT2X2 F64MAT2X3 F64MAT2X4
164 %token <lex> F64MAT3X2 F64MAT3X3 F64MAT3X4
165 %token <lex> F64MAT4X2 F64MAT4X3 F64MAT4X4
166 %token <lex> ATOMIC_UINT
167 %token <lex> ACCSTRUCTNV
169 // combined image/sampler
170 %token <lex> SAMPLER1D SAMPLER2D SAMPLER3D SAMPLERCUBE SAMPLER1DSHADOW SAMPLER2DSHADOW
171 %token <lex> SAMPLERCUBESHADOW SAMPLER1DARRAY SAMPLER2DARRAY SAMPLER1DARRAYSHADOW
172 %token <lex> SAMPLER2DARRAYSHADOW ISAMPLER1D ISAMPLER2D ISAMPLER3D ISAMPLERCUBE
173 %token <lex> ISAMPLER1DARRAY ISAMPLER2DARRAY USAMPLER1D USAMPLER2D USAMPLER3D
174 %token <lex> USAMPLERCUBE USAMPLER1DARRAY USAMPLER2DARRAY
175 %token <lex> SAMPLER2DRECT SAMPLER2DRECTSHADOW ISAMPLER2DRECT USAMPLER2DRECT
176 %token <lex> SAMPLERBUFFER ISAMPLERBUFFER USAMPLERBUFFER
177 %token <lex> SAMPLERCUBEARRAY SAMPLERCUBEARRAYSHADOW
178 %token <lex> ISAMPLERCUBEARRAY USAMPLERCUBEARRAY
179 %token <lex> SAMPLER2DMS ISAMPLER2DMS USAMPLER2DMS
180 %token <lex> SAMPLER2DMSARRAY ISAMPLER2DMSARRAY USAMPLER2DMSARRAY
181 %token <lex> SAMPLEREXTERNALOES
183 %token <lex> F16SAMPLER1D F16SAMPLER2D F16SAMPLER3D F16SAMPLER2DRECT F16SAMPLERCUBE
184 %token <lex> F16SAMPLER1DARRAY F16SAMPLER2DARRAY F16SAMPLERCUBEARRAY
185 %token <lex> F16SAMPLERBUFFER F16SAMPLER2DMS F16SAMPLER2DMSARRAY
186 %token <lex> F16SAMPLER1DSHADOW F16SAMPLER2DSHADOW F16SAMPLER1DARRAYSHADOW F16SAMPLER2DARRAYSHADOW
187 %token <lex> F16SAMPLER2DRECTSHADOW F16SAMPLERCUBESHADOW F16SAMPLERCUBEARRAYSHADOW
190 %token <lex> SAMPLER SAMPLERSHADOW
192 // texture without sampler
193 %token <lex> TEXTURE1D TEXTURE2D TEXTURE3D TEXTURECUBE
194 %token <lex> TEXTURE1DARRAY TEXTURE2DARRAY
195 %token <lex> ITEXTURE1D ITEXTURE2D ITEXTURE3D ITEXTURECUBE
196 %token <lex> ITEXTURE1DARRAY ITEXTURE2DARRAY UTEXTURE1D UTEXTURE2D UTEXTURE3D
197 %token <lex> UTEXTURECUBE UTEXTURE1DARRAY UTEXTURE2DARRAY
198 %token <lex> TEXTURE2DRECT ITEXTURE2DRECT UTEXTURE2DRECT
199 %token <lex> TEXTUREBUFFER ITEXTUREBUFFER UTEXTUREBUFFER
200 %token <lex> TEXTURECUBEARRAY ITEXTURECUBEARRAY UTEXTURECUBEARRAY
201 %token <lex> TEXTURE2DMS ITEXTURE2DMS UTEXTURE2DMS
202 %token <lex> TEXTURE2DMSARRAY ITEXTURE2DMSARRAY UTEXTURE2DMSARRAY
204 %token <lex> F16TEXTURE1D F16TEXTURE2D F16TEXTURE3D F16TEXTURE2DRECT F16TEXTURECUBE
205 %token <lex> F16TEXTURE1DARRAY F16TEXTURE2DARRAY F16TEXTURECUBEARRAY
206 %token <lex> F16TEXTUREBUFFER F16TEXTURE2DMS F16TEXTURE2DMSARRAY
209 %token <lex> SUBPASSINPUT SUBPASSINPUTMS ISUBPASSINPUT ISUBPASSINPUTMS USUBPASSINPUT USUBPASSINPUTMS
210 %token <lex> F16SUBPASSINPUT F16SUBPASSINPUTMS
212 %token <lex> IMAGE1D IIMAGE1D UIMAGE1D IMAGE2D IIMAGE2D
213 %token <lex> UIMAGE2D IMAGE3D IIMAGE3D UIMAGE3D
214 %token <lex> IMAGE2DRECT IIMAGE2DRECT UIMAGE2DRECT
215 %token <lex> IMAGECUBE IIMAGECUBE UIMAGECUBE
216 %token <lex> IMAGEBUFFER IIMAGEBUFFER UIMAGEBUFFER
217 %token <lex> IMAGE1DARRAY IIMAGE1DARRAY UIMAGE1DARRAY
218 %token <lex> IMAGE2DARRAY IIMAGE2DARRAY UIMAGE2DARRAY
219 %token <lex> IMAGECUBEARRAY IIMAGECUBEARRAY UIMAGECUBEARRAY
220 %token <lex> IMAGE2DMS IIMAGE2DMS UIMAGE2DMS
221 %token <lex> IMAGE2DMSARRAY IIMAGE2DMSARRAY UIMAGE2DMSARRAY
223 %token <lex> F16IMAGE1D F16IMAGE2D F16IMAGE3D F16IMAGE2DRECT
224 %token <lex> F16IMAGECUBE F16IMAGE1DARRAY F16IMAGE2DARRAY F16IMAGECUBEARRAY
225 %token <lex> F16IMAGEBUFFER F16IMAGE2DMS F16IMAGE2DMSARRAY
227 %token <lex> STRUCT VOID WHILE
229 %token <lex> IDENTIFIER TYPE_NAME
230 %token <lex> FLOATCONSTANT DOUBLECONSTANT INT16CONSTANT UINT16CONSTANT INT32CONSTANT UINT32CONSTANT INTCONSTANT UINTCONSTANT INT64CONSTANT UINT64CONSTANT BOOLCONSTANT FLOAT16CONSTANT
231 %token <lex> LEFT_OP RIGHT_OP
232 %token <lex> INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP
233 %token <lex> AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN
234 %token <lex> MOD_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN XOR_ASSIGN OR_ASSIGN
235 %token <lex> SUB_ASSIGN
237 %token <lex> LEFT_PAREN RIGHT_PAREN LEFT_BRACKET RIGHT_BRACKET LEFT_BRACE RIGHT_BRACE DOT
238 %token <lex> COMMA COLON EQUAL SEMICOLON BANG DASH TILDE PLUS STAR SLASH PERCENT
239 %token <lex> LEFT_ANGLE RIGHT_ANGLE VERTICAL_BAR CARET AMPERSAND QUESTION
241 %token <lex> INVARIANT PRECISE
242 %token <lex> HIGH_PRECISION MEDIUM_PRECISION LOW_PRECISION PRECISION
244 %token <lex> PACKED RESOURCE SUPERP
246 %type <interm> assignment_operator unary_operator
247 %type <interm.intermTypedNode> variable_identifier primary_expression postfix_expression
248 %type <interm.intermTypedNode> expression integer_expression assignment_expression
249 %type <interm.intermTypedNode> unary_expression multiplicative_expression additive_expression
250 %type <interm.intermTypedNode> relational_expression equality_expression
251 %type <interm.intermTypedNode> conditional_expression constant_expression
252 %type <interm.intermTypedNode> logical_or_expression logical_xor_expression logical_and_expression
253 %type <interm.intermTypedNode> shift_expression and_expression exclusive_or_expression inclusive_or_expression
254 %type <interm.intermTypedNode> function_call initializer initializer_list condition conditionopt
256 %type <interm.intermNode> translation_unit function_definition
257 %type <interm.intermNode> statement simple_statement
258 %type <interm.intermNode> statement_list switch_statement_list compound_statement
259 %type <interm.intermNode> declaration_statement selection_statement selection_statement_nonattributed expression_statement
260 %type <interm.intermNode> switch_statement switch_statement_nonattributed case_label
261 %type <interm.intermNode> declaration external_declaration
262 %type <interm.intermNode> for_init_statement compound_statement_no_new_scope
263 %type <interm.nodePair> selection_rest_statement for_rest_statement
264 %type <interm.intermNode> iteration_statement iteration_statement_nonattributed jump_statement statement_no_new_scope statement_scoped
265 %type <interm> single_declaration init_declarator_list
267 %type <interm> parameter_declaration parameter_declarator parameter_type_specifier
269 %type <interm> array_specifier
270 %type <interm.type> precise_qualifier invariant_qualifier interpolation_qualifier storage_qualifier precision_qualifier
271 %type <interm.type> layout_qualifier layout_qualifier_id_list layout_qualifier_id
272 %type <interm.type> non_uniform_qualifier
274 %type <interm.type> type_qualifier fully_specified_type type_specifier
275 %type <interm.type> single_type_qualifier
276 %type <interm.type> type_specifier_nonarray
277 %type <interm.type> struct_specifier
278 %type <interm.typeLine> struct_declarator
279 %type <interm.typeList> struct_declarator_list struct_declaration struct_declaration_list type_name_list
280 %type <interm> block_structure
281 %type <interm.function> function_header function_declarator
282 %type <interm.function> function_header_with_parameters
283 %type <interm> function_call_header_with_parameters function_call_header_no_parameters function_call_generic function_prototype
284 %type <interm> function_call_or_method function_identifier function_call_header
286 %type <interm.identifierList> identifier_list
288 %type <interm.attributes> attribute attribute_list single_attribute
290 %start translation_unit
295 $$ = parseContext.handleVariable($1.loc, $1.symbol, $1.string);
300 : variable_identifier {
304 parseContext.explicitInt32Check($1.loc, "32-bit signed literal");
305 $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true);
308 parseContext.explicitInt32Check($1.loc, "32-bit signed literal");
309 $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true);
312 $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true);
315 parseContext.fullIntegerCheck($1.loc, "unsigned literal");
316 $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true);
319 parseContext.int64Check($1.loc, "64-bit integer literal");
320 $$ = parseContext.intermediate.addConstantUnion($1.i64, $1.loc, true);
323 parseContext.int64Check($1.loc, "64-bit unsigned integer literal");
324 $$ = parseContext.intermediate.addConstantUnion($1.u64, $1.loc, true);
327 parseContext.explicitInt16Check($1.loc, "16-bit integer literal");
328 $$ = parseContext.intermediate.addConstantUnion((short)$1.i, $1.loc, true);
331 parseContext.explicitInt16Check($1.loc, "16-bit unsigned integer literal");
332 $$ = parseContext.intermediate.addConstantUnion((unsigned short)$1.u, $1.loc, true);
335 $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true);
338 parseContext.doubleCheck($1.loc, "double literal");
339 $$ = parseContext.intermediate.addConstantUnion($1.d, EbtDouble, $1.loc, true);
342 parseContext.float16Check($1.loc, "half float literal");
343 $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat16, $1.loc, true);
346 $$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true);
348 | LEFT_PAREN expression RIGHT_PAREN {
350 if ($$->getAsConstantUnion())
351 $$->getAsConstantUnion()->setExpression();
356 : primary_expression {
359 | postfix_expression LEFT_BRACKET integer_expression RIGHT_BRACKET {
360 $$ = parseContext.handleBracketDereference($2.loc, $1, $3);
365 | postfix_expression DOT IDENTIFIER {
366 $$ = parseContext.handleDotDereference($3.loc, $1, *$3.string);
368 | postfix_expression INC_OP {
369 parseContext.variableCheck($1);
370 parseContext.lValueErrorCheck($2.loc, "++", $1);
371 $$ = parseContext.handleUnaryMath($2.loc, "++", EOpPostIncrement, $1);
373 | postfix_expression DEC_OP {
374 parseContext.variableCheck($1);
375 parseContext.lValueErrorCheck($2.loc, "--", $1);
376 $$ = parseContext.handleUnaryMath($2.loc, "--", EOpPostDecrement, $1);
382 parseContext.integerCheck($1, "[]");
388 : function_call_or_method {
389 $$ = parseContext.handleFunctionCall($1.loc, $1.function, $1.intermNode);
394 function_call_or_method
395 : function_call_generic {
400 function_call_generic
401 : function_call_header_with_parameters RIGHT_PAREN {
405 | function_call_header_no_parameters RIGHT_PAREN {
411 function_call_header_no_parameters
412 : function_call_header VOID {
415 | function_call_header {
420 function_call_header_with_parameters
421 : function_call_header assignment_expression {
422 TParameter param = { 0, new TType };
423 param.type->shallowCopy($2->getType());
424 $1.function->addParameter(param);
425 $$.function = $1.function;
428 | function_call_header_with_parameters COMMA assignment_expression {
429 TParameter param = { 0, new TType };
430 param.type->shallowCopy($3->getType());
431 $1.function->addParameter(param);
432 $$.function = $1.function;
433 $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, $3, $2.loc);
438 : function_identifier LEFT_PAREN {
443 // Grammar Note: Constructors look like functions, but are recognized as types.
449 $$.function = parseContext.handleConstructorCall($1.loc, $1);
451 | postfix_expression {
453 // Should be a method or subroutine call, but we haven't recognized the arguments yet.
458 TIntermMethod* method = $1->getAsMethodNode();
460 $$.function = new TFunction(&method->getMethodName(), TType(EbtInt), EOpArrayLength);
461 $$.intermNode = method->getObject();
463 TIntermSymbol* symbol = $1->getAsSymbolNode();
465 parseContext.reservedErrorCheck(symbol->getLoc(), symbol->getName());
466 TFunction *function = new TFunction(&symbol->getName(), TType(EbtVoid));
467 $$.function = function;
469 parseContext.error($1->getLoc(), "function call, method, or subroutine call expected", "", "");
472 if ($$.function == 0) {
475 $$.function = new TFunction(&empty, TType(EbtVoid), EOpNull);
478 | non_uniform_qualifier {
481 $$.function = parseContext.handleConstructorCall($1.loc, $1);
486 : postfix_expression {
487 parseContext.variableCheck($1);
489 if (TIntermMethod* method = $1->getAsMethodNode())
490 parseContext.error($1->getLoc(), "incomplete method syntax", method->getMethodName().c_str(), "");
492 | INC_OP unary_expression {
493 parseContext.lValueErrorCheck($1.loc, "++", $2);
494 $$ = parseContext.handleUnaryMath($1.loc, "++", EOpPreIncrement, $2);
496 | DEC_OP unary_expression {
497 parseContext.lValueErrorCheck($1.loc, "--", $2);
498 $$ = parseContext.handleUnaryMath($1.loc, "--", EOpPreDecrement, $2);
500 | unary_operator unary_expression {
501 if ($1.op != EOpNull) {
502 char errorOp[2] = {0, 0};
504 case EOpNegative: errorOp[0] = '-'; break;
505 case EOpLogicalNot: errorOp[0] = '!'; break;
506 case EOpBitwiseNot: errorOp[0] = '~'; break;
507 default: break; // some compilers want this
509 $$ = parseContext.handleUnaryMath($1.loc, errorOp, $1.op, $2);
512 if ($$->getAsConstantUnion())
513 $$->getAsConstantUnion()->setExpression();
517 // Grammar Note: No traditional style type casts.
520 : PLUS { $$.loc = $1.loc; $$.op = EOpNull; }
521 | DASH { $$.loc = $1.loc; $$.op = EOpNegative; }
522 | BANG { $$.loc = $1.loc; $$.op = EOpLogicalNot; }
523 | TILDE { $$.loc = $1.loc; $$.op = EOpBitwiseNot;
524 parseContext.fullIntegerCheck($1.loc, "bitwise not"); }
526 // Grammar Note: No '*' or '&' unary ops. Pointers are not supported.
528 multiplicative_expression
529 : unary_expression { $$ = $1; }
530 | multiplicative_expression STAR unary_expression {
531 $$ = parseContext.handleBinaryMath($2.loc, "*", EOpMul, $1, $3);
535 | multiplicative_expression SLASH unary_expression {
536 $$ = parseContext.handleBinaryMath($2.loc, "/", EOpDiv, $1, $3);
540 | multiplicative_expression PERCENT unary_expression {
541 parseContext.fullIntegerCheck($2.loc, "%");
542 $$ = parseContext.handleBinaryMath($2.loc, "%", EOpMod, $1, $3);
549 : multiplicative_expression { $$ = $1; }
550 | additive_expression PLUS multiplicative_expression {
551 $$ = parseContext.handleBinaryMath($2.loc, "+", EOpAdd, $1, $3);
555 | additive_expression DASH multiplicative_expression {
556 $$ = parseContext.handleBinaryMath($2.loc, "-", EOpSub, $1, $3);
563 : additive_expression { $$ = $1; }
564 | shift_expression LEFT_OP additive_expression {
565 parseContext.fullIntegerCheck($2.loc, "bit shift left");
566 $$ = parseContext.handleBinaryMath($2.loc, "<<", EOpLeftShift, $1, $3);
570 | shift_expression RIGHT_OP additive_expression {
571 parseContext.fullIntegerCheck($2.loc, "bit shift right");
572 $$ = parseContext.handleBinaryMath($2.loc, ">>", EOpRightShift, $1, $3);
578 relational_expression
579 : shift_expression { $$ = $1; }
580 | relational_expression LEFT_ANGLE shift_expression {
581 $$ = parseContext.handleBinaryMath($2.loc, "<", EOpLessThan, $1, $3);
583 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
585 | relational_expression RIGHT_ANGLE shift_expression {
586 $$ = parseContext.handleBinaryMath($2.loc, ">", EOpGreaterThan, $1, $3);
588 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
590 | relational_expression LE_OP shift_expression {
591 $$ = parseContext.handleBinaryMath($2.loc, "<=", EOpLessThanEqual, $1, $3);
593 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
595 | relational_expression GE_OP shift_expression {
596 $$ = parseContext.handleBinaryMath($2.loc, ">=", EOpGreaterThanEqual, $1, $3);
598 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
603 : relational_expression { $$ = $1; }
604 | equality_expression EQ_OP relational_expression {
605 parseContext.arrayObjectCheck($2.loc, $1->getType(), "array comparison");
606 parseContext.opaqueCheck($2.loc, $1->getType(), "==");
607 parseContext.specializationCheck($2.loc, $1->getType(), "==");
608 $$ = parseContext.handleBinaryMath($2.loc, "==", EOpEqual, $1, $3);
610 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
612 | equality_expression NE_OP relational_expression {
613 parseContext.arrayObjectCheck($2.loc, $1->getType(), "array comparison");
614 parseContext.opaqueCheck($2.loc, $1->getType(), "!=");
615 parseContext.specializationCheck($2.loc, $1->getType(), "!=");
616 $$ = parseContext.handleBinaryMath($2.loc, "!=", EOpNotEqual, $1, $3);
618 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
623 : equality_expression { $$ = $1; }
624 | and_expression AMPERSAND equality_expression {
625 parseContext.fullIntegerCheck($2.loc, "bitwise and");
626 $$ = parseContext.handleBinaryMath($2.loc, "&", EOpAnd, $1, $3);
632 exclusive_or_expression
633 : and_expression { $$ = $1; }
634 | exclusive_or_expression CARET and_expression {
635 parseContext.fullIntegerCheck($2.loc, "bitwise exclusive or");
636 $$ = parseContext.handleBinaryMath($2.loc, "^", EOpExclusiveOr, $1, $3);
642 inclusive_or_expression
643 : exclusive_or_expression { $$ = $1; }
644 | inclusive_or_expression VERTICAL_BAR exclusive_or_expression {
645 parseContext.fullIntegerCheck($2.loc, "bitwise inclusive or");
646 $$ = parseContext.handleBinaryMath($2.loc, "|", EOpInclusiveOr, $1, $3);
652 logical_and_expression
653 : inclusive_or_expression { $$ = $1; }
654 | logical_and_expression AND_OP inclusive_or_expression {
655 $$ = parseContext.handleBinaryMath($2.loc, "&&", EOpLogicalAnd, $1, $3);
657 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
661 logical_xor_expression
662 : logical_and_expression { $$ = $1; }
663 | logical_xor_expression XOR_OP logical_and_expression {
664 $$ = parseContext.handleBinaryMath($2.loc, "^^", EOpLogicalXor, $1, $3);
666 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
670 logical_or_expression
671 : logical_xor_expression { $$ = $1; }
672 | logical_or_expression OR_OP logical_xor_expression {
673 $$ = parseContext.handleBinaryMath($2.loc, "||", EOpLogicalOr, $1, $3);
675 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
679 conditional_expression
680 : logical_or_expression { $$ = $1; }
681 | logical_or_expression QUESTION {
682 ++parseContext.controlFlowNestingLevel;
684 expression COLON assignment_expression {
685 --parseContext.controlFlowNestingLevel;
686 parseContext.boolCheck($2.loc, $1);
687 parseContext.rValueErrorCheck($2.loc, "?", $1);
688 parseContext.rValueErrorCheck($5.loc, ":", $4);
689 parseContext.rValueErrorCheck($5.loc, ":", $6);
690 $$ = parseContext.intermediate.addSelection($1, $4, $6, $2.loc);
692 parseContext.binaryOpError($2.loc, ":", $4->getCompleteString(), $6->getCompleteString());
698 assignment_expression
699 : conditional_expression { $$ = $1; }
700 | unary_expression assignment_operator assignment_expression {
701 parseContext.arrayObjectCheck($2.loc, $1->getType(), "array assignment");
702 parseContext.opaqueCheck($2.loc, $1->getType(), "=");
703 parseContext.storage16BitAssignmentCheck($2.loc, $1->getType(), "=");
704 parseContext.specializationCheck($2.loc, $1->getType(), "=");
705 parseContext.lValueErrorCheck($2.loc, "assign", $1);
706 parseContext.rValueErrorCheck($2.loc, "assign", $3);
707 $$ = parseContext.intermediate.addAssign($2.op, $1, $3, $2.loc);
709 parseContext.assignError($2.loc, "assign", $1->getCompleteString(), $3->getCompleteString());
722 $$.op = EOpMulAssign;
726 $$.op = EOpDivAssign;
729 parseContext.fullIntegerCheck($1.loc, "%=");
731 $$.op = EOpModAssign;
735 $$.op = EOpAddAssign;
739 $$.op = EOpSubAssign;
742 parseContext.fullIntegerCheck($1.loc, "bit-shift left assign");
743 $$.loc = $1.loc; $$.op = EOpLeftShiftAssign;
746 parseContext.fullIntegerCheck($1.loc, "bit-shift right assign");
747 $$.loc = $1.loc; $$.op = EOpRightShiftAssign;
750 parseContext.fullIntegerCheck($1.loc, "bitwise-and assign");
751 $$.loc = $1.loc; $$.op = EOpAndAssign;
754 parseContext.fullIntegerCheck($1.loc, "bitwise-xor assign");
755 $$.loc = $1.loc; $$.op = EOpExclusiveOrAssign;
758 parseContext.fullIntegerCheck($1.loc, "bitwise-or assign");
759 $$.loc = $1.loc; $$.op = EOpInclusiveOrAssign;
764 : assignment_expression {
767 | expression COMMA assignment_expression {
768 parseContext.samplerConstructorLocationCheck($2.loc, ",", $3);
769 $$ = parseContext.intermediate.addComma($1, $3, $2.loc);
771 parseContext.binaryOpError($2.loc, ",", $1->getCompleteString(), $3->getCompleteString());
778 : conditional_expression {
779 parseContext.constantValueCheck($1, "");
785 : function_prototype SEMICOLON {
786 parseContext.handleFunctionDeclarator($1.loc, *$1.function, true /* prototype */);
788 // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature
790 | init_declarator_list SEMICOLON {
791 if ($1.intermNode && $1.intermNode->getAsAggregate())
792 $1.intermNode->getAsAggregate()->setOperator(EOpSequence);
795 | PRECISION precision_qualifier type_specifier SEMICOLON {
796 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "precision statement");
798 // lazy setting of the previous scope's defaults, has effect only the first time it is called in a particular scope
799 parseContext.symbolTable.setPreviousDefaultPrecisions(&parseContext.defaultPrecision[0]);
800 parseContext.setDefaultPrecision($1.loc, $3, $2.qualifier.precision);
803 | block_structure SEMICOLON {
804 parseContext.declareBlock($1.loc, *$1.typeList);
807 | block_structure IDENTIFIER SEMICOLON {
808 parseContext.declareBlock($1.loc, *$1.typeList, $2.string);
811 | block_structure IDENTIFIER array_specifier SEMICOLON {
812 parseContext.declareBlock($1.loc, *$1.typeList, $2.string, $3.arraySizes);
815 | type_qualifier SEMICOLON {
816 parseContext.globalQualifierFixCheck($1.loc, $1.qualifier);
817 parseContext.updateStandaloneQualifierDefaults($1.loc, $1);
820 | type_qualifier IDENTIFIER SEMICOLON {
821 parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
822 parseContext.addQualifierToExisting($1.loc, $1.qualifier, *$2.string);
825 | type_qualifier IDENTIFIER identifier_list SEMICOLON {
826 parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
827 $3->push_back($2.string);
828 parseContext.addQualifierToExisting($1.loc, $1.qualifier, *$3);
834 : type_qualifier IDENTIFIER LEFT_BRACE { parseContext.nestedBlockCheck($1.loc); } struct_declaration_list RIGHT_BRACE {
835 --parseContext.structNestingLevel;
836 parseContext.blockName = $2.string;
837 parseContext.globalQualifierFixCheck($1.loc, $1.qualifier);
838 parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
839 parseContext.currentBlockQualifier = $1.qualifier;
846 $$ = new TIdentifierList;
847 $$->push_back($2.string);
849 | identifier_list COMMA IDENTIFIER {
851 $$->push_back($3.string);
856 : function_declarator RIGHT_PAREN {
866 | function_header_with_parameters {
872 function_header_with_parameters
873 : function_header parameter_declaration {
876 if ($2.param.type->getBasicType() != EbtVoid)
877 $1->addParameter($2.param);
879 delete $2.param.type;
881 | function_header_with_parameters COMMA parameter_declaration {
883 // Only first parameter of one-parameter functions can be void
884 // The check for named parameters not being void is done in parameter_declarator
886 if ($3.param.type->getBasicType() == EbtVoid) {
888 // This parameter > first is void
890 parseContext.error($2.loc, "cannot be an argument type except for '(void)'", "void", "");
891 delete $3.param.type;
895 $1->addParameter($3.param);
901 : fully_specified_type IDENTIFIER LEFT_PAREN {
902 if ($1.qualifier.storage != EvqGlobal && $1.qualifier.storage != EvqTemporary) {
903 parseContext.error($2.loc, "no qualifiers allowed for function return",
904 GetStorageQualifierString($1.qualifier.storage), "");
907 parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
909 // Add the function as a prototype after parsing it (we do not support recursion)
913 // Potentially rename shader entry point function. No-op most of the time.
914 parseContext.renameShaderFunction($2.string);
917 function = new TFunction($2.string, type);
924 : type_specifier IDENTIFIER {
926 parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
927 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
928 parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
930 if ($1.basicType == EbtVoid) {
931 parseContext.error($2.loc, "illegal use of type 'void'", $2.string->c_str(), "");
933 parseContext.reservedErrorCheck($2.loc, *$2.string);
935 TParameter param = {$2.string, new TType($1)};
939 | type_specifier IDENTIFIER array_specifier {
941 parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
942 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
943 parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
945 TType* type = new TType($1);
946 type->transferArraySizes($3.arraySizes);
947 type->copyArrayInnerSizes($1.arraySizes);
949 parseContext.arrayOfArrayVersionCheck($2.loc, type->getArraySizes());
950 parseContext.arraySizeRequiredCheck($3.loc, *$3.arraySizes);
951 parseContext.reservedErrorCheck($2.loc, *$2.string);
953 TParameter param = { $2.string, type };
960 parameter_declaration
964 : type_qualifier parameter_declarator {
966 if ($1.qualifier.precision != EpqNone)
967 $$.param.type->getQualifier().precision = $1.qualifier.precision;
968 parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier());
970 parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
971 parseContext.parameterTypeCheck($2.loc, $1.qualifier.storage, *$$.param.type);
972 parseContext.paramCheckFix($1.loc, $1.qualifier, *$$.param.type);
975 | parameter_declarator {
978 parseContext.parameterTypeCheck($1.loc, EvqIn, *$1.param.type);
979 parseContext.paramCheckFixStorage($1.loc, EvqTemporary, *$$.param.type);
980 parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier());
985 | type_qualifier parameter_type_specifier {
987 if ($1.qualifier.precision != EpqNone)
988 $$.param.type->getQualifier().precision = $1.qualifier.precision;
989 parseContext.precisionQualifierCheck($1.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier());
991 parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
992 parseContext.parameterTypeCheck($2.loc, $1.qualifier.storage, *$$.param.type);
993 parseContext.paramCheckFix($1.loc, $1.qualifier, *$$.param.type);
995 | parameter_type_specifier {
998 parseContext.parameterTypeCheck($1.loc, EvqIn, *$1.param.type);
999 parseContext.paramCheckFixStorage($1.loc, EvqTemporary, *$$.param.type);
1000 parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier());
1004 parameter_type_specifier
1006 TParameter param = { 0, new TType($1) };
1009 parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
1013 init_declarator_list
1014 : single_declaration {
1017 | init_declarator_list COMMA IDENTIFIER {
1019 parseContext.declareVariable($3.loc, *$3.string, $1.type);
1021 | init_declarator_list COMMA IDENTIFIER array_specifier {
1023 parseContext.declareVariable($3.loc, *$3.string, $1.type, $4.arraySizes);
1025 | init_declarator_list COMMA IDENTIFIER array_specifier EQUAL initializer {
1027 TIntermNode* initNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, $4.arraySizes, $6);
1028 $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, initNode, $5.loc);
1030 | init_declarator_list COMMA IDENTIFIER EQUAL initializer {
1032 TIntermNode* initNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, 0, $5);
1033 $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, initNode, $4.loc);
1038 : fully_specified_type {
1041 parseContext.declareTypeDefaults($$.loc, $$.type);
1043 | fully_specified_type IDENTIFIER {
1046 parseContext.declareVariable($2.loc, *$2.string, $1);
1048 | fully_specified_type IDENTIFIER array_specifier {
1051 parseContext.declareVariable($2.loc, *$2.string, $1, $3.arraySizes);
1053 | fully_specified_type IDENTIFIER array_specifier EQUAL initializer {
1055 TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, $3.arraySizes, $5);
1056 $$.intermNode = parseContext.intermediate.growAggregate(0, initNode, $4.loc);
1058 | fully_specified_type IDENTIFIER EQUAL initializer {
1060 TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, 0, $4);
1061 $$.intermNode = parseContext.intermediate.growAggregate(0, initNode, $3.loc);
1064 // Grammar Note: No 'enum', or 'typedef'.
1066 fully_specified_type
1070 parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $$);
1071 if ($1.arraySizes) {
1072 parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
1073 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
1076 parseContext.precisionQualifierCheck($$.loc, $$.basicType, $$.qualifier);
1078 | type_qualifier type_specifier {
1079 parseContext.globalQualifierFixCheck($1.loc, $1.qualifier);
1080 parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $2);
1082 if ($2.arraySizes) {
1083 parseContext.profileRequires($2.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
1084 parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type");
1087 if ($2.arraySizes && parseContext.arrayQualifierError($2.loc, $1.qualifier))
1088 $2.arraySizes = nullptr;
1090 parseContext.checkNoShaderLayouts($2.loc, $1.shaderQualifiers);
1091 $2.shaderQualifiers.merge($1.shaderQualifiers);
1092 parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true);
1093 parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier);
1097 if (! $$.qualifier.isInterpolation() &&
1098 ((parseContext.language == EShLangVertex && $$.qualifier.storage == EvqVaryingOut) ||
1099 (parseContext.language == EShLangFragment && $$.qualifier.storage == EvqVaryingIn)))
1100 $$.qualifier.smooth = true;
1106 parseContext.globalCheck($1.loc, "invariant");
1107 parseContext.profileRequires($$.loc, ENoProfile, 120, 0, "invariant");
1109 $$.qualifier.invariant = true;
1113 interpolation_qualifier
1115 parseContext.globalCheck($1.loc, "smooth");
1116 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "smooth");
1117 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "smooth");
1119 $$.qualifier.smooth = true;
1122 parseContext.globalCheck($1.loc, "flat");
1123 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "flat");
1124 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "flat");
1126 $$.qualifier.flat = true;
1129 parseContext.globalCheck($1.loc, "noperspective");
1130 #ifdef NV_EXTENSIONS
1131 parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_shader_noperspective_interpolation, "noperspective");
1133 parseContext.requireProfile($1.loc, ~EEsProfile, "noperspective");
1135 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "noperspective");
1137 $$.qualifier.nopersp = true;
1139 | EXPLICITINTERPAMD {
1140 #ifdef AMD_EXTENSIONS
1141 parseContext.globalCheck($1.loc, "__explicitInterpAMD");
1142 parseContext.profileRequires($1.loc, ECoreProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation");
1143 parseContext.profileRequires($1.loc, ECompatibilityProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation");
1145 $$.qualifier.explicitInterp = true;
1149 #ifdef NV_EXTENSIONS
1150 parseContext.globalCheck($1.loc, "pervertexNV");
1151 parseContext.profileRequires($1.loc, ECoreProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric");
1152 parseContext.profileRequires($1.loc, ECompatibilityProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric");
1153 parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric");
1155 $$.qualifier.pervertexNV = true;
1159 #ifdef NV_EXTENSIONS
1160 parseContext.globalCheck($1.loc, "perprimitiveNV");
1161 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangFragmentMask | EShLangMeshNVMask), "perprimitiveNV");
1162 parseContext.profileRequires($1.loc, ECoreProfile, 450, E_GL_NV_mesh_shader, "perprimitiveNV");
1163 parseContext.profileRequires($1.loc, EEsProfile, 320, E_GL_NV_mesh_shader, "perprimitiveNV");
1165 $$.qualifier.perPrimitiveNV = true;
1169 #ifdef NV_EXTENSIONS
1170 parseContext.globalCheck($1.loc, "perviewNV");
1171 parseContext.requireStage($1.loc, EShLangMeshNV, "perviewNV");
1172 parseContext.profileRequires($1.loc, ECoreProfile, 450, E_GL_NV_mesh_shader, "perviewNV");
1173 parseContext.profileRequires($1.loc, EEsProfile, 320, E_GL_NV_mesh_shader, "perviewNV");
1175 $$.qualifier.perViewNV = true;
1179 #ifdef NV_EXTENSIONS
1180 parseContext.globalCheck($1.loc, "taskNV");
1181 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTaskNVMask | EShLangMeshNVMask), "taskNV");
1182 parseContext.profileRequires($1.loc, ECoreProfile, 450, E_GL_NV_mesh_shader, "taskNV");
1183 parseContext.profileRequires($1.loc, EEsProfile, 320, E_GL_NV_mesh_shader, "taskNV");
1185 $$.qualifier.perTaskNV = true;
1191 : LAYOUT LEFT_PAREN layout_qualifier_id_list RIGHT_PAREN {
1196 layout_qualifier_id_list
1197 : layout_qualifier_id {
1200 | layout_qualifier_id_list COMMA layout_qualifier_id {
1202 $$.shaderQualifiers.merge($3.shaderQualifiers);
1203 parseContext.mergeObjectLayoutQualifiers($$.qualifier, $3.qualifier, false);
1209 parseContext.setLayoutQualifier($1.loc, $$, *$1.string);
1211 | IDENTIFIER EQUAL constant_expression {
1213 parseContext.setLayoutQualifier($1.loc, $$, *$1.string, $3);
1215 | SHARED { // because "shared" is both an identifier and a keyword
1217 TString strShared("shared");
1218 parseContext.setLayoutQualifier($1.loc, $$, strShared);
1224 parseContext.profileRequires($$.loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader5, "precise");
1225 parseContext.profileRequires($1.loc, EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, "precise");
1227 $$.qualifier.noContraction = true;
1232 : single_type_qualifier {
1235 | type_qualifier single_type_qualifier {
1237 if ($$.basicType == EbtVoid)
1238 $$.basicType = $2.basicType;
1240 $$.shaderQualifiers.merge($2.shaderQualifiers);
1241 parseContext.mergeQualifiers($$.loc, $$.qualifier, $2.qualifier, false);
1245 single_type_qualifier
1246 : storage_qualifier {
1249 | layout_qualifier {
1252 | precision_qualifier {
1253 parseContext.checkPrecisionQualifier($1.loc, $1.qualifier.precision);
1256 | interpolation_qualifier {
1257 // allow inheritance of storage qualifier from block declaration
1260 | invariant_qualifier {
1261 // allow inheritance of storage qualifier from block declaration
1264 | precise_qualifier {
1265 // allow inheritance of storage qualifier from block declaration
1268 | non_uniform_qualifier {
1276 $$.qualifier.storage = EvqConst; // will later turn into EvqConstReadOnly, if the initializer is not constant
1279 parseContext.requireStage($1.loc, EShLangVertex, "attribute");
1280 parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "attribute");
1281 parseContext.checkDeprecated($1.loc, ENoProfile, 130, "attribute");
1282 parseContext.requireNotRemoved($1.loc, ECoreProfile, 420, "attribute");
1283 parseContext.requireNotRemoved($1.loc, EEsProfile, 300, "attribute");
1285 parseContext.globalCheck($1.loc, "attribute");
1288 $$.qualifier.storage = EvqVaryingIn;
1291 parseContext.checkDeprecated($1.loc, ENoProfile, 130, "varying");
1292 parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "varying");
1293 parseContext.requireNotRemoved($1.loc, ECoreProfile, 420, "varying");
1294 parseContext.requireNotRemoved($1.loc, EEsProfile, 300, "varying");
1296 parseContext.globalCheck($1.loc, "varying");
1299 if (parseContext.language == EShLangVertex)
1300 $$.qualifier.storage = EvqVaryingOut;
1302 $$.qualifier.storage = EvqVaryingIn;
1305 parseContext.globalCheck($1.loc, "inout");
1307 $$.qualifier.storage = EvqInOut;
1310 parseContext.globalCheck($1.loc, "in");
1312 // whether this is a parameter "in" or a pipeline "in" will get sorted out a bit later
1313 $$.qualifier.storage = EvqIn;
1316 parseContext.globalCheck($1.loc, "out");
1318 // whether this is a parameter "out" or a pipeline "out" will get sorted out a bit later
1319 $$.qualifier.storage = EvqOut;
1322 parseContext.profileRequires($1.loc, ENoProfile, 120, 0, "centroid");
1323 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "centroid");
1324 parseContext.globalCheck($1.loc, "centroid");
1326 $$.qualifier.centroid = true;
1329 parseContext.globalCheck($1.loc, "patch");
1330 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTessControlMask | EShLangTessEvaluationMask), "patch");
1332 $$.qualifier.patch = true;
1335 parseContext.globalCheck($1.loc, "sample");
1337 $$.qualifier.sample = true;
1340 parseContext.globalCheck($1.loc, "uniform");
1342 $$.qualifier.storage = EvqUniform;
1345 parseContext.globalCheck($1.loc, "buffer");
1347 $$.qualifier.storage = EvqBuffer;
1350 #ifdef NV_EXTENSIONS
1351 parseContext.globalCheck($1.loc, "hitAttributeNVX");
1352 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangIntersectNVMask | EShLangClosestHitNVMask
1353 | EShLangAnyHitNVMask), "hitAttributeNVX");
1354 parseContext.profileRequires($1.loc, ECoreProfile, 450, E_GL_NVX_raytracing, "hitAttributeNVX");
1356 $$.qualifier.storage = EvqHitAttrNV;
1360 #ifdef NV_EXTENSIONS
1361 parseContext.globalCheck($1.loc, "rayPayloadNVX");
1362 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenNVMask | EShLangClosestHitNVMask |
1363 EShLangAnyHitNVMask | EShLangMissNVMask), "rayPayloadNVX");
1364 parseContext.profileRequires($1.loc, ECoreProfile, 450, E_GL_NVX_raytracing, "rayPayloadNVX");
1366 $$.qualifier.storage = EvqPayloadNV;
1370 #ifdef NV_EXTENSIONS
1371 parseContext.globalCheck($1.loc, "rayPayloadInNVX");
1372 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangClosestHitNVMask |
1373 EShLangAnyHitNVMask | EShLangMissNVMask), "rayPayloadInNVX");
1374 parseContext.profileRequires($1.loc, ECoreProfile, 450, E_GL_NVX_raytracing, "rayPayloadInNVX");
1376 $$.qualifier.storage = EvqPayloadInNV;
1380 parseContext.globalCheck($1.loc, "shared");
1381 parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared");
1382 parseContext.profileRequires($1.loc, EEsProfile, 310, 0, "shared");
1383 #ifdef NV_EXTENSIONS
1384 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangComputeMask | EShLangMeshNVMask | EShLangTaskNVMask), "shared");
1386 parseContext.requireStage($1.loc, EShLangCompute, "shared");
1389 $$.qualifier.storage = EvqShared;
1393 $$.qualifier.coherent = true;
1397 parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "devicecoherent");
1398 $$.qualifier.devicecoherent = true;
1400 | QUEUEFAMILYCOHERENT {
1402 parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "queuefamilycoherent");
1403 $$.qualifier.queuefamilycoherent = true;
1405 | WORKGROUPCOHERENT {
1407 parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "workgroupcoherent");
1408 $$.qualifier.workgroupcoherent = true;
1410 | SUBGROUPCOHERENT {
1412 parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "subgroupcoherent");
1413 $$.qualifier.subgroupcoherent = true;
1417 parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "nonprivate");
1418 $$.qualifier.nonprivate = true;
1422 $$.qualifier.volatil = true;
1426 $$.qualifier.restrict = true;
1430 $$.qualifier.readonly = true;
1434 $$.qualifier.writeonly = true;
1437 parseContext.spvRemoved($1.loc, "subroutine");
1438 parseContext.globalCheck($1.loc, "subroutine");
1439 parseContext.unimplemented($1.loc, "subroutine");
1442 | SUBROUTINE LEFT_PAREN type_name_list RIGHT_PAREN {
1443 parseContext.spvRemoved($1.loc, "subroutine");
1444 parseContext.globalCheck($1.loc, "subroutine");
1445 parseContext.unimplemented($1.loc, "subroutine");
1450 non_uniform_qualifier
1453 $$.qualifier.nonUniform = true;
1461 | type_name_list COMMA IDENTIFIER {
1462 // TODO: 4.0 semantics: subroutines
1463 // 1) make sure each identifier is a type declared earlier with SUBROUTINE
1464 // 2) save all of the identifiers for future comparison with the declared function
1469 : type_specifier_nonarray {
1471 $$.qualifier.precision = parseContext.getDefaultPrecision($$);
1473 | type_specifier_nonarray array_specifier {
1474 parseContext.arrayOfArrayVersionCheck($2.loc, $2.arraySizes);
1476 $$.qualifier.precision = parseContext.getDefaultPrecision($$);
1477 $$.arraySizes = $2.arraySizes;
1482 : LEFT_BRACKET RIGHT_BRACKET {
1484 $$.arraySizes = new TArraySizes;
1485 $$.arraySizes->addInnerSize();
1487 | LEFT_BRACKET conditional_expression RIGHT_BRACKET {
1489 $$.arraySizes = new TArraySizes;
1492 parseContext.arraySizeCheck($2->getLoc(), $2, size);
1493 $$.arraySizes->addInnerSize(size);
1495 | array_specifier LEFT_BRACKET RIGHT_BRACKET {
1497 $$.arraySizes->addInnerSize();
1499 | array_specifier LEFT_BRACKET conditional_expression RIGHT_BRACKET {
1503 parseContext.arraySizeCheck($3->getLoc(), $3, size);
1504 $$.arraySizes->addInnerSize(size);
1508 type_specifier_nonarray
1510 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1511 $$.basicType = EbtVoid;
1514 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1515 $$.basicType = EbtFloat;
1518 parseContext.doubleCheck($1.loc, "double");
1519 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1520 $$.basicType = EbtDouble;
1523 parseContext.float16ScalarVectorCheck($1.loc, "float16_t", parseContext.symbolTable.atBuiltInLevel());
1524 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1525 $$.basicType = EbtFloat16;
1528 parseContext.explicitFloat32Check($1.loc, "float32_t", parseContext.symbolTable.atBuiltInLevel());
1529 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1530 $$.basicType = EbtFloat;
1533 parseContext.explicitFloat64Check($1.loc, "float64_t", parseContext.symbolTable.atBuiltInLevel());
1534 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1535 $$.basicType = EbtDouble;
1538 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1539 $$.basicType = EbtInt;
1542 parseContext.fullIntegerCheck($1.loc, "unsigned integer");
1543 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1544 $$.basicType = EbtUint;
1547 parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer", parseContext.symbolTable.atBuiltInLevel());
1548 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1549 $$.basicType = EbtInt8;
1552 parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
1553 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1554 $$.basicType = EbtUint8;
1557 parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer", parseContext.symbolTable.atBuiltInLevel());
1558 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1559 $$.basicType = EbtInt16;
1562 parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
1563 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1564 $$.basicType = EbtUint16;
1567 parseContext.explicitInt32Check($1.loc, "32-bit signed integer", parseContext.symbolTable.atBuiltInLevel());
1568 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1569 $$.basicType = EbtInt;
1572 parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
1573 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1574 $$.basicType = EbtUint;
1577 parseContext.int64Check($1.loc, "64-bit integer", parseContext.symbolTable.atBuiltInLevel());
1578 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1579 $$.basicType = EbtInt64;
1582 parseContext.int64Check($1.loc, "64-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
1583 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1584 $$.basicType = EbtUint64;
1587 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1588 $$.basicType = EbtBool;
1591 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1592 $$.basicType = EbtFloat;
1596 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1597 $$.basicType = EbtFloat;
1601 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1602 $$.basicType = EbtFloat;
1606 parseContext.doubleCheck($1.loc, "double vector");
1607 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1608 $$.basicType = EbtDouble;
1612 parseContext.doubleCheck($1.loc, "double vector");
1613 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1614 $$.basicType = EbtDouble;
1618 parseContext.doubleCheck($1.loc, "double vector");
1619 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1620 $$.basicType = EbtDouble;
1624 parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel());
1625 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1626 $$.basicType = EbtFloat16;
1630 parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel());
1631 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1632 $$.basicType = EbtFloat16;
1636 parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel());
1637 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1638 $$.basicType = EbtFloat16;
1642 parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel());
1643 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1644 $$.basicType = EbtFloat;
1648 parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel());
1649 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1650 $$.basicType = EbtFloat;
1654 parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel());
1655 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1656 $$.basicType = EbtFloat;
1660 parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel());
1661 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1662 $$.basicType = EbtDouble;
1666 parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel());
1667 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1668 $$.basicType = EbtDouble;
1672 parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel());
1673 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1674 $$.basicType = EbtDouble;
1678 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1679 $$.basicType = EbtBool;
1683 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1684 $$.basicType = EbtBool;
1688 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1689 $$.basicType = EbtBool;
1693 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1694 $$.basicType = EbtInt;
1698 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1699 $$.basicType = EbtInt;
1703 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1704 $$.basicType = EbtInt;
1708 parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
1709 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1710 $$.basicType = EbtInt8;
1714 parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
1715 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1716 $$.basicType = EbtInt8;
1720 parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
1721 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1722 $$.basicType = EbtInt8;
1726 parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
1727 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1728 $$.basicType = EbtInt16;
1732 parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
1733 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1734 $$.basicType = EbtInt16;
1738 parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
1739 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1740 $$.basicType = EbtInt16;
1744 parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
1745 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1746 $$.basicType = EbtInt;
1750 parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
1751 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1752 $$.basicType = EbtInt;
1756 parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
1757 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1758 $$.basicType = EbtInt;
1762 parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
1763 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1764 $$.basicType = EbtInt64;
1768 parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
1769 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1770 $$.basicType = EbtInt64;
1774 parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
1775 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1776 $$.basicType = EbtInt64;
1780 parseContext.fullIntegerCheck($1.loc, "unsigned integer vector");
1781 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1782 $$.basicType = EbtUint;
1786 parseContext.fullIntegerCheck($1.loc, "unsigned integer vector");
1787 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1788 $$.basicType = EbtUint;
1792 parseContext.fullIntegerCheck($1.loc, "unsigned integer vector");
1793 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1794 $$.basicType = EbtUint;
1798 parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
1799 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1800 $$.basicType = EbtUint8;
1804 parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
1805 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1806 $$.basicType = EbtUint8;
1810 parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
1811 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1812 $$.basicType = EbtUint8;
1816 parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
1817 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1818 $$.basicType = EbtUint16;
1822 parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
1823 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1824 $$.basicType = EbtUint16;
1828 parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
1829 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1830 $$.basicType = EbtUint16;
1834 parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
1835 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1836 $$.basicType = EbtUint;
1840 parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
1841 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1842 $$.basicType = EbtUint;
1846 parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
1847 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1848 $$.basicType = EbtUint;
1852 parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
1853 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1854 $$.basicType = EbtUint64;
1858 parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
1859 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1860 $$.basicType = EbtUint64;
1864 parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
1865 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1866 $$.basicType = EbtUint64;
1870 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1871 $$.basicType = EbtFloat;
1875 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1876 $$.basicType = EbtFloat;
1880 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1881 $$.basicType = EbtFloat;
1885 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1886 $$.basicType = EbtFloat;
1890 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1891 $$.basicType = EbtFloat;
1895 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1896 $$.basicType = EbtFloat;
1900 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1901 $$.basicType = EbtFloat;
1905 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1906 $$.basicType = EbtFloat;
1910 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1911 $$.basicType = EbtFloat;
1915 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1916 $$.basicType = EbtFloat;
1920 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1921 $$.basicType = EbtFloat;
1925 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1926 $$.basicType = EbtFloat;
1930 parseContext.doubleCheck($1.loc, "double matrix");
1931 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1932 $$.basicType = EbtDouble;
1936 parseContext.doubleCheck($1.loc, "double matrix");
1937 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1938 $$.basicType = EbtDouble;
1942 parseContext.doubleCheck($1.loc, "double matrix");
1943 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1944 $$.basicType = EbtDouble;
1948 parseContext.doubleCheck($1.loc, "double matrix");
1949 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1950 $$.basicType = EbtDouble;
1954 parseContext.doubleCheck($1.loc, "double matrix");
1955 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1956 $$.basicType = EbtDouble;
1960 parseContext.doubleCheck($1.loc, "double matrix");
1961 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1962 $$.basicType = EbtDouble;
1966 parseContext.doubleCheck($1.loc, "double matrix");
1967 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1968 $$.basicType = EbtDouble;
1972 parseContext.doubleCheck($1.loc, "double matrix");
1973 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1974 $$.basicType = EbtDouble;
1978 parseContext.doubleCheck($1.loc, "double matrix");
1979 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1980 $$.basicType = EbtDouble;
1984 parseContext.doubleCheck($1.loc, "double matrix");
1985 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1986 $$.basicType = EbtDouble;
1990 parseContext.doubleCheck($1.loc, "double matrix");
1991 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1992 $$.basicType = EbtDouble;
1996 parseContext.doubleCheck($1.loc, "double matrix");
1997 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1998 $$.basicType = EbtDouble;
2002 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2003 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2004 $$.basicType = EbtFloat16;
2008 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2009 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2010 $$.basicType = EbtFloat16;
2014 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2015 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2016 $$.basicType = EbtFloat16;
2020 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2021 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2022 $$.basicType = EbtFloat16;
2026 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2027 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2028 $$.basicType = EbtFloat16;
2032 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2033 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2034 $$.basicType = EbtFloat16;
2038 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2039 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2040 $$.basicType = EbtFloat16;
2044 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2045 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2046 $$.basicType = EbtFloat16;
2050 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2051 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2052 $$.basicType = EbtFloat16;
2056 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2057 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2058 $$.basicType = EbtFloat16;
2062 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2063 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2064 $$.basicType = EbtFloat16;
2068 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2069 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2070 $$.basicType = EbtFloat16;
2074 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2075 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2076 $$.basicType = EbtFloat;
2080 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2081 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2082 $$.basicType = EbtFloat;
2086 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2087 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2088 $$.basicType = EbtFloat;
2092 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2093 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2094 $$.basicType = EbtFloat;
2098 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2099 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2100 $$.basicType = EbtFloat;
2104 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2105 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2106 $$.basicType = EbtFloat;
2110 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2111 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2112 $$.basicType = EbtFloat;
2116 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2117 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2118 $$.basicType = EbtFloat;
2122 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2123 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2124 $$.basicType = EbtFloat;
2128 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2129 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2130 $$.basicType = EbtFloat;
2134 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2135 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2136 $$.basicType = EbtFloat;
2140 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2141 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2142 $$.basicType = EbtFloat;
2146 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2147 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2148 $$.basicType = EbtDouble;
2152 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2153 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2154 $$.basicType = EbtDouble;
2158 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2159 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2160 $$.basicType = EbtDouble;
2164 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2165 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2166 $$.basicType = EbtDouble;
2170 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2171 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2172 $$.basicType = EbtDouble;
2176 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2177 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2178 $$.basicType = EbtDouble;
2182 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2183 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2184 $$.basicType = EbtDouble;
2188 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2189 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2190 $$.basicType = EbtDouble;
2194 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2195 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2196 $$.basicType = EbtDouble;
2200 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2201 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2202 $$.basicType = EbtDouble;
2206 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2207 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2208 $$.basicType = EbtDouble;
2212 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2213 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2214 $$.basicType = EbtDouble;
2218 #ifdef NV_EXTENSIONS
2219 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2220 $$.basicType = EbtAccStructNV;
2224 parseContext.vulkanRemoved($1.loc, "atomic counter types");
2225 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2226 $$.basicType = EbtAtomicUint;
2229 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2230 $$.basicType = EbtSampler;
2231 $$.sampler.set(EbtFloat, Esd1D);
2234 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2235 $$.basicType = EbtSampler;
2236 $$.sampler.set(EbtFloat, Esd2D);
2239 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2240 $$.basicType = EbtSampler;
2241 $$.sampler.set(EbtFloat, Esd3D);
2244 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2245 $$.basicType = EbtSampler;
2246 $$.sampler.set(EbtFloat, EsdCube);
2249 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2250 $$.basicType = EbtSampler;
2251 $$.sampler.set(EbtFloat, Esd1D, false, true);
2254 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2255 $$.basicType = EbtSampler;
2256 $$.sampler.set(EbtFloat, Esd2D, false, true);
2258 | SAMPLERCUBESHADOW {
2259 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2260 $$.basicType = EbtSampler;
2261 $$.sampler.set(EbtFloat, EsdCube, false, true);
2264 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2265 $$.basicType = EbtSampler;
2266 $$.sampler.set(EbtFloat, Esd1D, true);
2269 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2270 $$.basicType = EbtSampler;
2271 $$.sampler.set(EbtFloat, Esd2D, true);
2273 | SAMPLER1DARRAYSHADOW {
2274 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2275 $$.basicType = EbtSampler;
2276 $$.sampler.set(EbtFloat, Esd1D, true, true);
2278 | SAMPLER2DARRAYSHADOW {
2279 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2280 $$.basicType = EbtSampler;
2281 $$.sampler.set(EbtFloat, Esd2D, true, true);
2283 | SAMPLERCUBEARRAY {
2284 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2285 $$.basicType = EbtSampler;
2286 $$.sampler.set(EbtFloat, EsdCube, true);
2288 | SAMPLERCUBEARRAYSHADOW {
2289 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2290 $$.basicType = EbtSampler;
2291 $$.sampler.set(EbtFloat, EsdCube, true, true);
2294 #ifdef AMD_EXTENSIONS
2295 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2296 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2297 $$.basicType = EbtSampler;
2298 $$.sampler.set(EbtFloat16, Esd1D);
2302 #ifdef AMD_EXTENSIONS
2303 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2304 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2305 $$.basicType = EbtSampler;
2306 $$.sampler.set(EbtFloat16, Esd2D);
2310 #ifdef AMD_EXTENSIONS
2311 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2312 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2313 $$.basicType = EbtSampler;
2314 $$.sampler.set(EbtFloat16, Esd3D);
2318 #ifdef AMD_EXTENSIONS
2319 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2320 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2321 $$.basicType = EbtSampler;
2322 $$.sampler.set(EbtFloat16, EsdCube);
2325 | F16SAMPLER1DSHADOW {
2326 #ifdef AMD_EXTENSIONS
2327 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2328 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2329 $$.basicType = EbtSampler;
2330 $$.sampler.set(EbtFloat16, Esd1D, false, true);
2333 | F16SAMPLER2DSHADOW {
2334 #ifdef AMD_EXTENSIONS
2335 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2336 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2337 $$.basicType = EbtSampler;
2338 $$.sampler.set(EbtFloat16, Esd2D, false, true);
2341 | F16SAMPLERCUBESHADOW {
2342 #ifdef AMD_EXTENSIONS
2343 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2344 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2345 $$.basicType = EbtSampler;
2346 $$.sampler.set(EbtFloat16, EsdCube, false, true);
2349 | F16SAMPLER1DARRAY {
2350 #ifdef AMD_EXTENSIONS
2351 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2352 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2353 $$.basicType = EbtSampler;
2354 $$.sampler.set(EbtFloat16, Esd1D, true);
2357 | F16SAMPLER2DARRAY {
2358 #ifdef AMD_EXTENSIONS
2359 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2360 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2361 $$.basicType = EbtSampler;
2362 $$.sampler.set(EbtFloat16, Esd2D, true);
2365 | F16SAMPLER1DARRAYSHADOW {
2366 #ifdef AMD_EXTENSIONS
2367 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2368 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2369 $$.basicType = EbtSampler;
2370 $$.sampler.set(EbtFloat16, Esd1D, true, true);
2373 | F16SAMPLER2DARRAYSHADOW {
2374 #ifdef AMD_EXTENSIONS
2375 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2376 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2377 $$.basicType = EbtSampler;
2378 $$.sampler.set(EbtFloat16, Esd2D, true, true);
2381 | F16SAMPLERCUBEARRAY {
2382 #ifdef AMD_EXTENSIONS
2383 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2384 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2385 $$.basicType = EbtSampler;
2386 $$.sampler.set(EbtFloat16, EsdCube, true);
2389 | F16SAMPLERCUBEARRAYSHADOW {
2390 #ifdef AMD_EXTENSIONS
2391 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2392 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2393 $$.basicType = EbtSampler;
2394 $$.sampler.set(EbtFloat16, EsdCube, true, true);
2398 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2399 $$.basicType = EbtSampler;
2400 $$.sampler.set(EbtInt, Esd1D);
2403 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2404 $$.basicType = EbtSampler;
2405 $$.sampler.set(EbtInt, Esd2D);
2408 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2409 $$.basicType = EbtSampler;
2410 $$.sampler.set(EbtInt, Esd3D);
2413 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2414 $$.basicType = EbtSampler;
2415 $$.sampler.set(EbtInt, EsdCube);
2418 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2419 $$.basicType = EbtSampler;
2420 $$.sampler.set(EbtInt, Esd1D, true);
2423 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2424 $$.basicType = EbtSampler;
2425 $$.sampler.set(EbtInt, Esd2D, true);
2427 | ISAMPLERCUBEARRAY {
2428 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2429 $$.basicType = EbtSampler;
2430 $$.sampler.set(EbtInt, EsdCube, true);
2433 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2434 $$.basicType = EbtSampler;
2435 $$.sampler.set(EbtUint, Esd1D);
2438 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2439 $$.basicType = EbtSampler;
2440 $$.sampler.set(EbtUint, Esd2D);
2443 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2444 $$.basicType = EbtSampler;
2445 $$.sampler.set(EbtUint, Esd3D);
2448 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2449 $$.basicType = EbtSampler;
2450 $$.sampler.set(EbtUint, EsdCube);
2453 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2454 $$.basicType = EbtSampler;
2455 $$.sampler.set(EbtUint, Esd1D, true);
2458 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2459 $$.basicType = EbtSampler;
2460 $$.sampler.set(EbtUint, Esd2D, true);
2462 | USAMPLERCUBEARRAY {
2463 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2464 $$.basicType = EbtSampler;
2465 $$.sampler.set(EbtUint, EsdCube, true);
2468 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2469 $$.basicType = EbtSampler;
2470 $$.sampler.set(EbtFloat, EsdRect);
2472 | SAMPLER2DRECTSHADOW {
2473 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2474 $$.basicType = EbtSampler;
2475 $$.sampler.set(EbtFloat, EsdRect, false, true);
2477 | F16SAMPLER2DRECT {
2478 #ifdef AMD_EXTENSIONS
2479 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2480 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2481 $$.basicType = EbtSampler;
2482 $$.sampler.set(EbtFloat16, EsdRect);
2485 | F16SAMPLER2DRECTSHADOW {
2486 #ifdef AMD_EXTENSIONS
2487 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2488 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2489 $$.basicType = EbtSampler;
2490 $$.sampler.set(EbtFloat16, EsdRect, false, true);
2494 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2495 $$.basicType = EbtSampler;
2496 $$.sampler.set(EbtInt, EsdRect);
2499 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2500 $$.basicType = EbtSampler;
2501 $$.sampler.set(EbtUint, EsdRect);
2504 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2505 $$.basicType = EbtSampler;
2506 $$.sampler.set(EbtFloat, EsdBuffer);
2508 | F16SAMPLERBUFFER {
2509 #ifdef AMD_EXTENSIONS
2510 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2511 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2512 $$.basicType = EbtSampler;
2513 $$.sampler.set(EbtFloat16, EsdBuffer);
2517 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2518 $$.basicType = EbtSampler;
2519 $$.sampler.set(EbtInt, EsdBuffer);
2522 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2523 $$.basicType = EbtSampler;
2524 $$.sampler.set(EbtUint, EsdBuffer);
2527 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2528 $$.basicType = EbtSampler;
2529 $$.sampler.set(EbtFloat, Esd2D, false, false, true);
2532 #ifdef AMD_EXTENSIONS
2533 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2534 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2535 $$.basicType = EbtSampler;
2536 $$.sampler.set(EbtFloat16, Esd2D, false, false, true);
2540 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2541 $$.basicType = EbtSampler;
2542 $$.sampler.set(EbtInt, Esd2D, false, false, true);
2545 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2546 $$.basicType = EbtSampler;
2547 $$.sampler.set(EbtUint, Esd2D, false, false, true);
2549 | SAMPLER2DMSARRAY {
2550 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2551 $$.basicType = EbtSampler;
2552 $$.sampler.set(EbtFloat, Esd2D, true, false, true);
2554 | F16SAMPLER2DMSARRAY {
2555 #ifdef AMD_EXTENSIONS
2556 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2557 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2558 $$.basicType = EbtSampler;
2559 $$.sampler.set(EbtFloat16, Esd2D, true, false, true);
2562 | ISAMPLER2DMSARRAY {
2563 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2564 $$.basicType = EbtSampler;
2565 $$.sampler.set(EbtInt, Esd2D, true, false, true);
2567 | USAMPLER2DMSARRAY {
2568 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2569 $$.basicType = EbtSampler;
2570 $$.sampler.set(EbtUint, Esd2D, true, false, true);
2573 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2574 $$.basicType = EbtSampler;
2575 $$.sampler.setPureSampler(false);
2578 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2579 $$.basicType = EbtSampler;
2580 $$.sampler.setPureSampler(true);
2583 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2584 $$.basicType = EbtSampler;
2585 $$.sampler.setTexture(EbtFloat, Esd1D);
2588 #ifdef AMD_EXTENSIONS
2589 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2590 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2591 $$.basicType = EbtSampler;
2592 $$.sampler.setTexture(EbtFloat16, Esd1D);
2596 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2597 $$.basicType = EbtSampler;
2598 $$.sampler.setTexture(EbtFloat, Esd2D);
2601 #ifdef AMD_EXTENSIONS
2602 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2603 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2604 $$.basicType = EbtSampler;
2605 $$.sampler.setTexture(EbtFloat16, Esd2D);
2609 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2610 $$.basicType = EbtSampler;
2611 $$.sampler.setTexture(EbtFloat, Esd3D);
2614 #ifdef AMD_EXTENSIONS
2615 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2616 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2617 $$.basicType = EbtSampler;
2618 $$.sampler.setTexture(EbtFloat16, Esd3D);
2622 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2623 $$.basicType = EbtSampler;
2624 $$.sampler.setTexture(EbtFloat, EsdCube);
2627 #ifdef AMD_EXTENSIONS
2628 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2629 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2630 $$.basicType = EbtSampler;
2631 $$.sampler.setTexture(EbtFloat16, EsdCube);
2635 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2636 $$.basicType = EbtSampler;
2637 $$.sampler.setTexture(EbtFloat, Esd1D, true);
2639 | F16TEXTURE1DARRAY {
2640 #ifdef AMD_EXTENSIONS
2641 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2642 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2643 $$.basicType = EbtSampler;
2644 $$.sampler.setTexture(EbtFloat16, Esd1D, true);
2648 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2649 $$.basicType = EbtSampler;
2650 $$.sampler.setTexture(EbtFloat, Esd2D, true);
2652 | F16TEXTURE2DARRAY {
2653 #ifdef AMD_EXTENSIONS
2654 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2655 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2656 $$.basicType = EbtSampler;
2657 $$.sampler.setTexture(EbtFloat16, Esd2D, true);
2660 | TEXTURECUBEARRAY {
2661 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2662 $$.basicType = EbtSampler;
2663 $$.sampler.setTexture(EbtFloat, EsdCube, true);
2665 | F16TEXTURECUBEARRAY {
2666 #ifdef AMD_EXTENSIONS
2667 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2668 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2669 $$.basicType = EbtSampler;
2670 $$.sampler.setTexture(EbtFloat16, EsdCube, true);
2674 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2675 $$.basicType = EbtSampler;
2676 $$.sampler.setTexture(EbtInt, Esd1D);
2679 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2680 $$.basicType = EbtSampler;
2681 $$.sampler.setTexture(EbtInt, Esd2D);
2684 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2685 $$.basicType = EbtSampler;
2686 $$.sampler.setTexture(EbtInt, Esd3D);
2689 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2690 $$.basicType = EbtSampler;
2691 $$.sampler.setTexture(EbtInt, EsdCube);
2694 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2695 $$.basicType = EbtSampler;
2696 $$.sampler.setTexture(EbtInt, Esd1D, true);
2699 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2700 $$.basicType = EbtSampler;
2701 $$.sampler.setTexture(EbtInt, Esd2D, true);
2703 | ITEXTURECUBEARRAY {
2704 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2705 $$.basicType = EbtSampler;
2706 $$.sampler.setTexture(EbtInt, EsdCube, true);
2709 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2710 $$.basicType = EbtSampler;
2711 $$.sampler.setTexture(EbtUint, Esd1D);
2714 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2715 $$.basicType = EbtSampler;
2716 $$.sampler.setTexture(EbtUint, Esd2D);
2719 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2720 $$.basicType = EbtSampler;
2721 $$.sampler.setTexture(EbtUint, Esd3D);
2724 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2725 $$.basicType = EbtSampler;
2726 $$.sampler.setTexture(EbtUint, EsdCube);
2729 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2730 $$.basicType = EbtSampler;
2731 $$.sampler.setTexture(EbtUint, Esd1D, true);
2734 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2735 $$.basicType = EbtSampler;
2736 $$.sampler.setTexture(EbtUint, Esd2D, true);
2738 | UTEXTURECUBEARRAY {
2739 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2740 $$.basicType = EbtSampler;
2741 $$.sampler.setTexture(EbtUint, EsdCube, true);
2744 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2745 $$.basicType = EbtSampler;
2746 $$.sampler.setTexture(EbtFloat, EsdRect);
2748 | F16TEXTURE2DRECT {
2749 #ifdef AMD_EXTENSIONS
2750 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2751 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2752 $$.basicType = EbtSampler;
2753 $$.sampler.setTexture(EbtFloat16, EsdRect);
2757 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2758 $$.basicType = EbtSampler;
2759 $$.sampler.setTexture(EbtInt, EsdRect);
2762 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2763 $$.basicType = EbtSampler;
2764 $$.sampler.setTexture(EbtUint, EsdRect);
2767 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2768 $$.basicType = EbtSampler;
2769 $$.sampler.setTexture(EbtFloat, EsdBuffer);
2771 | F16TEXTUREBUFFER {
2772 #ifdef AMD_EXTENSIONS
2773 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2774 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2775 $$.basicType = EbtSampler;
2776 $$.sampler.setTexture(EbtFloat16, EsdBuffer);
2780 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2781 $$.basicType = EbtSampler;
2782 $$.sampler.setTexture(EbtInt, EsdBuffer);
2785 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2786 $$.basicType = EbtSampler;
2787 $$.sampler.setTexture(EbtUint, EsdBuffer);
2790 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2791 $$.basicType = EbtSampler;
2792 $$.sampler.setTexture(EbtFloat, Esd2D, false, false, true);
2795 #ifdef AMD_EXTENSIONS
2796 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2797 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2798 $$.basicType = EbtSampler;
2799 $$.sampler.setTexture(EbtFloat16, Esd2D, false, false, true);
2803 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2804 $$.basicType = EbtSampler;
2805 $$.sampler.setTexture(EbtInt, Esd2D, false, false, true);
2808 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2809 $$.basicType = EbtSampler;
2810 $$.sampler.setTexture(EbtUint, Esd2D, false, false, true);
2812 | TEXTURE2DMSARRAY {
2813 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2814 $$.basicType = EbtSampler;
2815 $$.sampler.setTexture(EbtFloat, Esd2D, true, false, true);
2817 | F16TEXTURE2DMSARRAY {
2818 #ifdef AMD_EXTENSIONS
2819 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2820 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2821 $$.basicType = EbtSampler;
2822 $$.sampler.setTexture(EbtFloat16, Esd2D, true, false, true);
2825 | ITEXTURE2DMSARRAY {
2826 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2827 $$.basicType = EbtSampler;
2828 $$.sampler.setTexture(EbtInt, Esd2D, true, false, true);
2830 | UTEXTURE2DMSARRAY {
2831 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2832 $$.basicType = EbtSampler;
2833 $$.sampler.setTexture(EbtUint, Esd2D, true, false, true);
2836 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2837 $$.basicType = EbtSampler;
2838 $$.sampler.setImage(EbtFloat, Esd1D);
2841 #ifdef AMD_EXTENSIONS
2842 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
2843 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2844 $$.basicType = EbtSampler;
2845 $$.sampler.setImage(EbtFloat16, Esd1D);
2849 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2850 $$.basicType = EbtSampler;
2851 $$.sampler.setImage(EbtInt, Esd1D);
2854 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2855 $$.basicType = EbtSampler;
2856 $$.sampler.setImage(EbtUint, Esd1D);
2859 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2860 $$.basicType = EbtSampler;
2861 $$.sampler.setImage(EbtFloat, Esd2D);
2864 #ifdef AMD_EXTENSIONS
2865 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
2866 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2867 $$.basicType = EbtSampler;
2868 $$.sampler.setImage(EbtFloat16, Esd2D);
2872 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2873 $$.basicType = EbtSampler;
2874 $$.sampler.setImage(EbtInt, Esd2D);
2877 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2878 $$.basicType = EbtSampler;
2879 $$.sampler.setImage(EbtUint, Esd2D);
2882 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2883 $$.basicType = EbtSampler;
2884 $$.sampler.setImage(EbtFloat, Esd3D);
2887 #ifdef AMD_EXTENSIONS
2888 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
2889 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2890 $$.basicType = EbtSampler;
2891 $$.sampler.setImage(EbtFloat16, Esd3D);
2895 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2896 $$.basicType = EbtSampler;
2897 $$.sampler.setImage(EbtInt, Esd3D);
2900 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2901 $$.basicType = EbtSampler;
2902 $$.sampler.setImage(EbtUint, Esd3D);
2905 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2906 $$.basicType = EbtSampler;
2907 $$.sampler.setImage(EbtFloat, EsdRect);
2910 #ifdef AMD_EXTENSIONS
2911 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
2912 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2913 $$.basicType = EbtSampler;
2914 $$.sampler.setImage(EbtFloat16, EsdRect);
2918 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2919 $$.basicType = EbtSampler;
2920 $$.sampler.setImage(EbtInt, EsdRect);
2923 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2924 $$.basicType = EbtSampler;
2925 $$.sampler.setImage(EbtUint, EsdRect);
2928 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2929 $$.basicType = EbtSampler;
2930 $$.sampler.setImage(EbtFloat, EsdCube);
2933 #ifdef AMD_EXTENSIONS
2934 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
2935 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2936 $$.basicType = EbtSampler;
2937 $$.sampler.setImage(EbtFloat16, EsdCube);
2941 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2942 $$.basicType = EbtSampler;
2943 $$.sampler.setImage(EbtInt, EsdCube);
2946 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2947 $$.basicType = EbtSampler;
2948 $$.sampler.setImage(EbtUint, EsdCube);
2951 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2952 $$.basicType = EbtSampler;
2953 $$.sampler.setImage(EbtFloat, EsdBuffer);
2956 #ifdef AMD_EXTENSIONS
2957 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
2958 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2959 $$.basicType = EbtSampler;
2960 $$.sampler.setImage(EbtFloat16, EsdBuffer);
2964 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2965 $$.basicType = EbtSampler;
2966 $$.sampler.setImage(EbtInt, EsdBuffer);
2969 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2970 $$.basicType = EbtSampler;
2971 $$.sampler.setImage(EbtUint, EsdBuffer);
2974 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2975 $$.basicType = EbtSampler;
2976 $$.sampler.setImage(EbtFloat, Esd1D, true);
2979 #ifdef AMD_EXTENSIONS
2980 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
2981 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2982 $$.basicType = EbtSampler;
2983 $$.sampler.setImage(EbtFloat16, Esd1D, true);
2987 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2988 $$.basicType = EbtSampler;
2989 $$.sampler.setImage(EbtInt, Esd1D, true);
2992 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2993 $$.basicType = EbtSampler;
2994 $$.sampler.setImage(EbtUint, Esd1D, true);
2997 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2998 $$.basicType = EbtSampler;
2999 $$.sampler.setImage(EbtFloat, Esd2D, true);
3002 #ifdef AMD_EXTENSIONS
3003 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3004 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3005 $$.basicType = EbtSampler;
3006 $$.sampler.setImage(EbtFloat16, Esd2D, true);
3010 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3011 $$.basicType = EbtSampler;
3012 $$.sampler.setImage(EbtInt, Esd2D, true);
3015 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3016 $$.basicType = EbtSampler;
3017 $$.sampler.setImage(EbtUint, Esd2D, true);
3020 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3021 $$.basicType = EbtSampler;
3022 $$.sampler.setImage(EbtFloat, EsdCube, true);
3024 | F16IMAGECUBEARRAY {
3025 #ifdef AMD_EXTENSIONS
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, EsdCube, true);
3033 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3034 $$.basicType = EbtSampler;
3035 $$.sampler.setImage(EbtInt, EsdCube, true);
3038 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3039 $$.basicType = EbtSampler;
3040 $$.sampler.setImage(EbtUint, EsdCube, true);
3043 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3044 $$.basicType = EbtSampler;
3045 $$.sampler.setImage(EbtFloat, Esd2D, false, false, true);
3048 #ifdef AMD_EXTENSIONS
3049 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3050 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3051 $$.basicType = EbtSampler;
3052 $$.sampler.setImage(EbtFloat16, Esd2D, false, false, true);
3056 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3057 $$.basicType = EbtSampler;
3058 $$.sampler.setImage(EbtInt, Esd2D, false, false, true);
3061 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3062 $$.basicType = EbtSampler;
3063 $$.sampler.setImage(EbtUint, Esd2D, false, false, true);
3066 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3067 $$.basicType = EbtSampler;
3068 $$.sampler.setImage(EbtFloat, Esd2D, true, false, true);
3070 | F16IMAGE2DMSARRAY {
3071 #ifdef AMD_EXTENSIONS
3072 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3073 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3074 $$.basicType = EbtSampler;
3075 $$.sampler.setImage(EbtFloat16, Esd2D, true, false, true);
3079 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3080 $$.basicType = EbtSampler;
3081 $$.sampler.setImage(EbtInt, Esd2D, true, false, true);
3084 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3085 $$.basicType = EbtSampler;
3086 $$.sampler.setImage(EbtUint, Esd2D, true, false, true);
3088 | SAMPLEREXTERNALOES { // GL_OES_EGL_image_external
3089 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3090 $$.basicType = EbtSampler;
3091 $$.sampler.set(EbtFloat, Esd2D);
3092 $$.sampler.external = true;
3095 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3096 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3097 $$.basicType = EbtSampler;
3098 $$.sampler.setSubpass(EbtFloat);
3101 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3102 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3103 $$.basicType = EbtSampler;
3104 $$.sampler.setSubpass(EbtFloat, true);
3107 #ifdef AMD_EXTENSIONS
3108 parseContext.float16OpaqueCheck($1.loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel());
3109 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3110 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3111 $$.basicType = EbtSampler;
3112 $$.sampler.setSubpass(EbtFloat16);
3115 | F16SUBPASSINPUTMS {
3116 #ifdef AMD_EXTENSIONS
3117 parseContext.float16OpaqueCheck($1.loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel());
3118 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3119 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3120 $$.basicType = EbtSampler;
3121 $$.sampler.setSubpass(EbtFloat16, true);
3125 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3126 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3127 $$.basicType = EbtSampler;
3128 $$.sampler.setSubpass(EbtInt);
3131 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3132 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3133 $$.basicType = EbtSampler;
3134 $$.sampler.setSubpass(EbtInt, true);
3137 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3138 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3139 $$.basicType = EbtSampler;
3140 $$.sampler.setSubpass(EbtUint);
3143 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3144 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3145 $$.basicType = EbtSampler;
3146 $$.sampler.setSubpass(EbtUint, true);
3148 | struct_specifier {
3150 $$.qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3151 parseContext.structTypeCheck($$.loc, $$);
3155 // This is for user defined type names. The lexical phase looked up the
3158 if (const TVariable* variable = ($1.symbol)->getAsVariable()) {
3159 const TType& structure = variable->getType();
3160 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3161 $$.basicType = EbtStruct;
3162 $$.userDef = &structure;
3164 parseContext.error($1.loc, "expected type name", $1.string->c_str(), "");
3170 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "highp precision qualifier");
3171 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3172 parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqHigh);
3174 | MEDIUM_PRECISION {
3175 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "mediump precision qualifier");
3176 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3177 parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqMedium);
3180 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "lowp precision qualifier");
3181 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3182 parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqLow);
3187 : STRUCT IDENTIFIER LEFT_BRACE { parseContext.nestedStructCheck($1.loc); } struct_declaration_list RIGHT_BRACE {
3188 TType* structure = new TType($5, *$2.string);
3189 parseContext.structArrayCheck($2.loc, *structure);
3190 TVariable* userTypeDef = new TVariable($2.string, *structure, true);
3191 if (! parseContext.symbolTable.insert(*userTypeDef))
3192 parseContext.error($2.loc, "redefinition", $2.string->c_str(), "struct");
3194 $$.basicType = EbtStruct;
3195 $$.userDef = structure;
3196 --parseContext.structNestingLevel;
3198 | STRUCT LEFT_BRACE { parseContext.nestedStructCheck($1.loc); } struct_declaration_list RIGHT_BRACE {
3199 TType* structure = new TType($4, TString(""));
3201 $$.basicType = EbtStruct;
3202 $$.userDef = structure;
3203 --parseContext.structNestingLevel;
3207 struct_declaration_list
3208 : struct_declaration {
3211 | struct_declaration_list struct_declaration {
3213 for (unsigned int i = 0; i < $2->size(); ++i) {
3214 for (unsigned int j = 0; j < $$->size(); ++j) {
3215 if ((*$$)[j].type->getFieldName() == (*$2)[i].type->getFieldName())
3216 parseContext.error((*$2)[i].loc, "duplicate member name:", "", (*$2)[i].type->getFieldName().c_str());
3218 $$->push_back((*$2)[i]);
3224 : type_specifier struct_declarator_list SEMICOLON {
3225 if ($1.arraySizes) {
3226 parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
3227 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
3228 if (parseContext.profile == EEsProfile)
3229 parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
3234 parseContext.voidErrorCheck($1.loc, (*$2)[0].type->getFieldName(), $1.basicType);
3235 parseContext.precisionQualifierCheck($1.loc, $1.basicType, $1.qualifier);
3237 for (unsigned int i = 0; i < $$->size(); ++i) {
3239 type.setFieldName((*$$)[i].type->getFieldName());
3240 type.transferArraySizes((*$$)[i].type->getArraySizes());
3241 type.copyArrayInnerSizes($1.arraySizes);
3242 parseContext.arrayOfArrayVersionCheck((*$$)[i].loc, type.getArraySizes());
3243 (*$$)[i].type->shallowCopy(type);
3246 | type_qualifier type_specifier struct_declarator_list SEMICOLON {
3247 if ($2.arraySizes) {
3248 parseContext.profileRequires($2.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
3249 parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type");
3250 if (parseContext.profile == EEsProfile)
3251 parseContext.arraySizeRequiredCheck($2.loc, *$2.arraySizes);
3256 parseContext.memberQualifierCheck($1);
3257 parseContext.voidErrorCheck($2.loc, (*$3)[0].type->getFieldName(), $2.basicType);
3258 parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true);
3259 parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier);
3261 for (unsigned int i = 0; i < $$->size(); ++i) {
3263 type.setFieldName((*$$)[i].type->getFieldName());
3264 type.transferArraySizes((*$$)[i].type->getArraySizes());
3265 type.copyArrayInnerSizes($2.arraySizes);
3266 parseContext.arrayOfArrayVersionCheck((*$$)[i].loc, type.getArraySizes());
3267 (*$$)[i].type->shallowCopy(type);
3272 struct_declarator_list
3273 : struct_declarator {
3277 | struct_declarator_list COMMA struct_declarator {
3284 $$.type = new TType(EbtVoid);
3286 $$.type->setFieldName(*$1.string);
3288 | IDENTIFIER array_specifier {
3289 parseContext.arrayOfArrayVersionCheck($1.loc, $2.arraySizes);
3291 $$.type = new TType(EbtVoid);
3293 $$.type->setFieldName(*$1.string);
3294 $$.type->transferArraySizes($2.arraySizes);
3299 : assignment_expression {
3302 | LEFT_BRACE initializer_list RIGHT_BRACE {
3303 const char* initFeature = "{ } style initializers";
3304 parseContext.requireProfile($1.loc, ~EEsProfile, initFeature);
3305 parseContext.profileRequires($1.loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature);
3308 | LEFT_BRACE initializer_list COMMA RIGHT_BRACE {
3309 const char* initFeature = "{ } style initializers";
3310 parseContext.requireProfile($1.loc, ~EEsProfile, initFeature);
3311 parseContext.profileRequires($1.loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature);
3318 $$ = parseContext.intermediate.growAggregate(0, $1, $1->getLoc());
3320 | initializer_list COMMA initializer {
3321 $$ = parseContext.intermediate.growAggregate($1, $3);
3325 declaration_statement
3326 : declaration { $$ = $1; }
3330 : compound_statement { $$ = $1; }
3331 | simple_statement { $$ = $1; }
3334 // Grammar Note: labeled statements for switch statements only; 'goto' is not supported.
3337 : declaration_statement { $$ = $1; }
3338 | expression_statement { $$ = $1; }
3339 | selection_statement { $$ = $1; }
3340 | switch_statement { $$ = $1; }
3341 | case_label { $$ = $1; }
3342 | iteration_statement { $$ = $1; }
3343 | jump_statement { $$ = $1; }
3347 : LEFT_BRACE RIGHT_BRACE { $$ = 0; }
3349 parseContext.symbolTable.push();
3350 ++parseContext.statementNestingLevel;
3353 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3354 --parseContext.statementNestingLevel;
3357 if ($3 && $3->getAsAggregate())
3358 $3->getAsAggregate()->setOperator(EOpSequence);
3363 statement_no_new_scope
3364 : compound_statement_no_new_scope { $$ = $1; }
3365 | simple_statement { $$ = $1; }
3370 ++parseContext.controlFlowNestingLevel;
3372 compound_statement {
3373 --parseContext.controlFlowNestingLevel;
3377 parseContext.symbolTable.push();
3378 ++parseContext.statementNestingLevel;
3379 ++parseContext.controlFlowNestingLevel;
3382 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3383 --parseContext.statementNestingLevel;
3384 --parseContext.controlFlowNestingLevel;
3388 compound_statement_no_new_scope
3389 // Statement that doesn't create a new scope, for selection_statement, iteration_statement
3390 : LEFT_BRACE RIGHT_BRACE {
3393 | LEFT_BRACE statement_list RIGHT_BRACE {
3394 if ($2 && $2->getAsAggregate())
3395 $2->getAsAggregate()->setOperator(EOpSequence);
3402 $$ = parseContext.intermediate.makeAggregate($1);
3403 if ($1 && $1->getAsBranchNode() && ($1->getAsBranchNode()->getFlowOp() == EOpCase ||
3404 $1->getAsBranchNode()->getFlowOp() == EOpDefault)) {
3405 parseContext.wrapupSwitchSubsequence(0, $1);
3406 $$ = 0; // start a fresh subsequence for what's after this case
3409 | statement_list statement {
3410 if ($2 && $2->getAsBranchNode() && ($2->getAsBranchNode()->getFlowOp() == EOpCase ||
3411 $2->getAsBranchNode()->getFlowOp() == EOpDefault)) {
3412 parseContext.wrapupSwitchSubsequence($1 ? $1->getAsAggregate() : 0, $2);
3413 $$ = 0; // start a fresh subsequence for what's after this case
3415 $$ = parseContext.intermediate.growAggregate($1, $2);
3419 expression_statement
3420 : SEMICOLON { $$ = 0; }
3421 | expression SEMICOLON { $$ = static_cast<TIntermNode*>($1); }
3425 : selection_statement_nonattributed {
3428 | attribute selection_statement_nonattributed {
3429 parseContext.handleSelectionAttributes(*$1, $2);
3433 selection_statement_nonattributed
3434 : IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement {
3435 parseContext.boolCheck($1.loc, $3);
3436 $$ = parseContext.intermediate.addSelection($3, $5, $1.loc);
3440 selection_rest_statement
3441 : statement_scoped ELSE statement_scoped {
3445 | statement_scoped {
3452 // In 1996 c++ draft, conditions can include single declarations
3455 parseContext.boolCheck($1->getLoc(), $1);
3457 | fully_specified_type IDENTIFIER EQUAL initializer {
3458 parseContext.boolCheck($2.loc, $1);
3461 TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, 0, $4);
3463 $$ = initNode->getAsTyped();
3470 : switch_statement_nonattributed {
3473 | attribute switch_statement_nonattributed {
3474 parseContext.handleSwitchAttributes(*$1, $2);
3478 switch_statement_nonattributed
3479 : SWITCH LEFT_PAREN expression RIGHT_PAREN {
3480 // start new switch sequence on the switch stack
3481 ++parseContext.controlFlowNestingLevel;
3482 ++parseContext.statementNestingLevel;
3483 parseContext.switchSequenceStack.push_back(new TIntermSequence);
3484 parseContext.switchLevel.push_back(parseContext.statementNestingLevel);
3485 parseContext.symbolTable.push();
3487 LEFT_BRACE switch_statement_list RIGHT_BRACE {
3488 $$ = parseContext.addSwitch($1.loc, $3, $7 ? $7->getAsAggregate() : 0);
3489 delete parseContext.switchSequenceStack.back();
3490 parseContext.switchSequenceStack.pop_back();
3491 parseContext.switchLevel.pop_back();
3492 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3493 --parseContext.statementNestingLevel;
3494 --parseContext.controlFlowNestingLevel;
3498 switch_statement_list
3508 : CASE expression COLON {
3510 if (parseContext.switchLevel.size() == 0)
3511 parseContext.error($1.loc, "cannot appear outside switch statement", "case", "");
3512 else if (parseContext.switchLevel.back() != parseContext.statementNestingLevel)
3513 parseContext.error($1.loc, "cannot be nested inside control flow", "case", "");
3515 parseContext.constantValueCheck($2, "case");
3516 parseContext.integerCheck($2, "case");
3517 $$ = parseContext.intermediate.addBranch(EOpCase, $2, $1.loc);
3522 if (parseContext.switchLevel.size() == 0)
3523 parseContext.error($1.loc, "cannot appear outside switch statement", "default", "");
3524 else if (parseContext.switchLevel.back() != parseContext.statementNestingLevel)
3525 parseContext.error($1.loc, "cannot be nested inside control flow", "default", "");
3527 $$ = parseContext.intermediate.addBranch(EOpDefault, $1.loc);
3532 : iteration_statement_nonattributed {
3535 | attribute iteration_statement_nonattributed {
3536 parseContext.handleLoopAttributes(*$1, $2);
3540 iteration_statement_nonattributed
3541 : WHILE LEFT_PAREN {
3542 if (! parseContext.limits.whileLoops)
3543 parseContext.error($1.loc, "while loops not available", "limitation", "");
3544 parseContext.symbolTable.push();
3545 ++parseContext.loopNestingLevel;
3546 ++parseContext.statementNestingLevel;
3547 ++parseContext.controlFlowNestingLevel;
3549 condition RIGHT_PAREN statement_no_new_scope {
3550 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3551 $$ = parseContext.intermediate.addLoop($6, $4, 0, true, $1.loc);
3552 --parseContext.loopNestingLevel;
3553 --parseContext.statementNestingLevel;
3554 --parseContext.controlFlowNestingLevel;
3557 ++parseContext.loopNestingLevel;
3558 ++parseContext.statementNestingLevel;
3559 ++parseContext.controlFlowNestingLevel;
3561 statement WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON {
3562 if (! parseContext.limits.whileLoops)
3563 parseContext.error($1.loc, "do-while loops not available", "limitation", "");
3565 parseContext.boolCheck($8.loc, $6);
3567 $$ = parseContext.intermediate.addLoop($3, $6, 0, false, $4.loc);
3568 --parseContext.loopNestingLevel;
3569 --parseContext.statementNestingLevel;
3570 --parseContext.controlFlowNestingLevel;
3573 parseContext.symbolTable.push();
3574 ++parseContext.loopNestingLevel;
3575 ++parseContext.statementNestingLevel;
3576 ++parseContext.controlFlowNestingLevel;
3578 for_init_statement for_rest_statement RIGHT_PAREN statement_no_new_scope {
3579 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3580 $$ = parseContext.intermediate.makeAggregate($4, $2.loc);
3581 TIntermLoop* forLoop = parseContext.intermediate.addLoop($7, reinterpret_cast<TIntermTyped*>($5.node1), reinterpret_cast<TIntermTyped*>($5.node2), true, $1.loc);
3582 if (! parseContext.limits.nonInductiveForLoops)
3583 parseContext.inductiveLoopCheck($1.loc, $4, forLoop);
3584 $$ = parseContext.intermediate.growAggregate($$, forLoop, $1.loc);
3585 $$->getAsAggregate()->setOperator(EOpSequence);
3586 --parseContext.loopNestingLevel;
3587 --parseContext.statementNestingLevel;
3588 --parseContext.controlFlowNestingLevel;
3593 : expression_statement {
3596 | declaration_statement {
3605 | /* May be null */ {
3611 : conditionopt SEMICOLON {
3615 | conditionopt SEMICOLON expression {
3622 : CONTINUE SEMICOLON {
3623 if (parseContext.loopNestingLevel <= 0)
3624 parseContext.error($1.loc, "continue statement only allowed in loops", "", "");
3625 $$ = parseContext.intermediate.addBranch(EOpContinue, $1.loc);
3628 if (parseContext.loopNestingLevel + parseContext.switchSequenceStack.size() <= 0)
3629 parseContext.error($1.loc, "break statement only allowed in switch and loops", "", "");
3630 $$ = parseContext.intermediate.addBranch(EOpBreak, $1.loc);
3632 | RETURN SEMICOLON {
3633 $$ = parseContext.intermediate.addBranch(EOpReturn, $1.loc);
3634 if (parseContext.currentFunctionType->getBasicType() != EbtVoid)
3635 parseContext.error($1.loc, "non-void function must return a value", "return", "");
3636 if (parseContext.inMain)
3637 parseContext.postEntryPointReturn = true;
3639 | RETURN expression SEMICOLON {
3640 $$ = parseContext.handleReturnValue($1.loc, $2);
3642 | DISCARD SEMICOLON {
3643 parseContext.requireStage($1.loc, EShLangFragment, "discard");
3644 $$ = parseContext.intermediate.addBranch(EOpKill, $1.loc);
3648 // Grammar Note: No 'goto'. Gotos are not supported.
3651 : external_declaration {
3653 parseContext.intermediate.setTreeRoot($$);
3655 | translation_unit external_declaration {
3656 if ($2 != nullptr) {
3657 $$ = parseContext.intermediate.growAggregate($1, $2);
3658 parseContext.intermediate.setTreeRoot($$);
3663 external_declaration
3664 : function_definition {
3671 parseContext.requireProfile($1.loc, ~EEsProfile, "extraneous semicolon");
3672 parseContext.profileRequires($1.loc, ~EEsProfile, 460, nullptr, "extraneous semicolon");
3678 : function_prototype {
3679 $1.function = parseContext.handleFunctionDeclarator($1.loc, *$1.function, false /* not prototype */);
3680 $1.intermNode = parseContext.handleFunctionDefinition($1.loc, *$1.function);
3682 compound_statement_no_new_scope {
3683 // May be best done as post process phase on intermediate code
3684 if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue)
3685 parseContext.error($1.loc, "function does not return a value:", "", $1.function->getName().c_str());
3686 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3687 $$ = parseContext.intermediate.growAggregate($1.intermNode, $3);
3688 parseContext.intermediate.setAggregateOperator($$, EOpFunction, $1.function->getType(), $1.loc);
3689 $$->getAsAggregate()->setName($1.function->getMangledName().c_str());
3691 // store the pragma information for debug and optimize and other vendor specific
3692 // information. This information can be queried from the parse tree
3693 $$->getAsAggregate()->setOptimize(parseContext.contextPragma.optimize);
3694 $$->getAsAggregate()->setDebug(parseContext.contextPragma.debug);
3695 $$->getAsAggregate()->setPragmaTable(parseContext.contextPragma.pragmaTable);
3700 : LEFT_BRACKET LEFT_BRACKET attribute_list RIGHT_BRACKET RIGHT_BRACKET {
3702 parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_control_flow_attributes, "attribute");
3706 : single_attribute {
3709 | attribute_list COMMA single_attribute {
3710 $$ = parseContext.mergeAttributes($1, $3);
3715 $$ = parseContext.makeAttributes(*$1.string);
3717 | IDENTIFIER LEFT_PAREN constant_expression RIGHT_PAREN {
3718 $$ = parseContext.makeAttributes(*$1.string, $3);