2 // Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
3 // Copyright (C) 2012-2013 LunarG, Inc.
4 // Copyright (C) 2017 ARM Limited.
5 // Copyright (C) 2015-2019 Google, Inc.
6 // Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
8 // All rights reserved.
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions
14 // Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
17 // Redistributions in binary form must reproduce the above
18 // copyright notice, this list of conditions and the following
19 // disclaimer in the documentation and/or other materials provided
20 // with the distribution.
22 // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
23 // contributors may be used to endorse or promote products derived
24 // from this software without specific prior written permission.
26 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
29 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
30 // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
31 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
32 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
33 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
34 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
36 // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 // POSSIBILITY OF SUCH DAMAGE.
41 // Do not edit the .y file, only edit the .m4 file.
42 // The .y bison file is not a source file, it is a derivative of the .m4 file.
43 // The m4 file needs to be processed by m4 to generate the .y bison file.
45 // Code sandwiched between a pair:
47 // GLSLANG_WEB_EXCLUDE_ON
51 // GLSLANG_WEB_EXCLUDE_OFF
53 // Will be excluded from the grammar when m4 is executed as:
55 // m4 -P -DGLSLANG_WEB
57 // It will be included when m4 is executed as:
62 m4_define(`GLSLANG_WEB_EXCLUDE_ON', `m4_ifdef(`GLSLANG_WEB', `m4_divert(`-1')')')
63 m4_define(`GLSLANG_WEB_EXCLUDE_OFF', `m4_ifdef(`GLSLANG_WEB', `m4_divert')')
66 * This is bison grammar and productions for parsing all versions of the
67 * GLSL shading languages.
74 In 1985, Jeff Lee published his Yacc grammar (which is accompanied by a
75 matching Lex specification) for the April 30, 1985 draft version of the
76 ANSI C standard. Tom Stockfisch reposted it to net.sources in 1987; that
77 original, as mentioned in the answer to question 17.25 of the comp.lang.c
78 FAQ, can be ftp'ed from ftp.uu.net, file usenet/net.sources/ansi.c.grammar.Z.
80 I intend to keep this version as close to the current C Standard grammar as
81 possible; please let me know if you discover discrepancies.
86 #include "SymbolTable.h"
87 #include "ParseHelper.h"
88 #include "../Public/ShaderLang.h"
89 #include "attribute.h"
91 using namespace glslang;
95 %define parse.error verbose
99 glslang::TSourceLoc loc;
101 glslang::TString *string;
105 unsigned long long u64;
109 glslang::TSymbol* symbol;
112 glslang::TSourceLoc loc;
113 glslang::TOperator op;
115 TIntermNode* intermNode;
116 glslang::TIntermNodePair nodePair;
117 glslang::TIntermTyped* intermTypedNode;
118 glslang::TAttributes* attributes;
119 glslang::TSpirvRequirement* spirvReq;
120 glslang::TSpirvInstruction* spirvInst;
121 glslang::TSpirvTypeParameters* spirvTypeParams;
124 glslang::TPublicType type;
125 glslang::TFunction* function;
126 glslang::TParameter param;
127 glslang::TTypeLoc typeLine;
128 glslang::TTypeList* typeList;
129 glslang::TArraySizes* arraySizes;
130 glslang::TIdentifierList* identifierList;
132 glslang::TArraySizes* typeParameters;
138 /* windows only pragma */
140 #pragma warning(disable : 4065)
141 #pragma warning(disable : 4127)
142 #pragma warning(disable : 4244)
145 #define parseContext (*pParseContext)
146 #define yyerror(context, msg) context->parserError(msg)
148 extern int yylex(YYSTYPE*, TParseContext&);
152 %parse-param {glslang::TParseContext* pParseContext}
153 %lex-param {parseContext}
154 %pure-parser // enable thread safety
155 %expect 1 // One shift reduce conflict because of if | else
157 %token <lex> CONST BOOL INT UINT FLOAT
158 %token <lex> BVEC2 BVEC3 BVEC4
159 %token <lex> IVEC2 IVEC3 IVEC4
160 %token <lex> UVEC2 UVEC3 UVEC4
161 %token <lex> VEC2 VEC3 VEC4
162 %token <lex> MAT2 MAT3 MAT4
163 %token <lex> MAT2X2 MAT2X3 MAT2X4
164 %token <lex> MAT3X2 MAT3X3 MAT3X4
165 %token <lex> MAT4X2 MAT4X3 MAT4X4
167 // combined image/sampler
168 %token <lex> SAMPLER2D SAMPLER3D SAMPLERCUBE SAMPLER2DSHADOW
169 %token <lex> SAMPLERCUBESHADOW SAMPLER2DARRAY
170 %token <lex> SAMPLER2DARRAYSHADOW ISAMPLER2D ISAMPLER3D ISAMPLERCUBE
171 %token <lex> ISAMPLER2DARRAY USAMPLER2D USAMPLER3D
172 %token <lex> USAMPLERCUBE USAMPLER2DARRAY
174 // separate image/sampler
175 %token <lex> SAMPLER SAMPLERSHADOW
176 %token <lex> TEXTURE2D TEXTURE3D TEXTURECUBE TEXTURE2DARRAY
177 %token <lex> ITEXTURE2D ITEXTURE3D ITEXTURECUBE ITEXTURE2DARRAY
178 %token <lex> UTEXTURE2D UTEXTURE3D UTEXTURECUBE UTEXTURE2DARRAY
180 GLSLANG_WEB_EXCLUDE_ON
182 %token <lex> ATTRIBUTE VARYING
183 %token <lex> FLOAT16_T FLOAT32_T DOUBLE FLOAT64_T
184 %token <lex> INT64_T UINT64_T INT32_T UINT32_T INT16_T UINT16_T INT8_T UINT8_T
185 %token <lex> I64VEC2 I64VEC3 I64VEC4
186 %token <lex> U64VEC2 U64VEC3 U64VEC4
187 %token <lex> I32VEC2 I32VEC3 I32VEC4
188 %token <lex> U32VEC2 U32VEC3 U32VEC4
189 %token <lex> I16VEC2 I16VEC3 I16VEC4
190 %token <lex> U16VEC2 U16VEC3 U16VEC4
191 %token <lex> I8VEC2 I8VEC3 I8VEC4
192 %token <lex> U8VEC2 U8VEC3 U8VEC4
193 %token <lex> DVEC2 DVEC3 DVEC4 DMAT2 DMAT3 DMAT4
194 %token <lex> F16VEC2 F16VEC3 F16VEC4 F16MAT2 F16MAT3 F16MAT4
195 %token <lex> F32VEC2 F32VEC3 F32VEC4 F32MAT2 F32MAT3 F32MAT4
196 %token <lex> F64VEC2 F64VEC3 F64VEC4 F64MAT2 F64MAT3 F64MAT4
197 %token <lex> DMAT2X2 DMAT2X3 DMAT2X4
198 %token <lex> DMAT3X2 DMAT3X3 DMAT3X4
199 %token <lex> DMAT4X2 DMAT4X3 DMAT4X4
200 %token <lex> F16MAT2X2 F16MAT2X3 F16MAT2X4
201 %token <lex> F16MAT3X2 F16MAT3X3 F16MAT3X4
202 %token <lex> F16MAT4X2 F16MAT4X3 F16MAT4X4
203 %token <lex> F32MAT2X2 F32MAT2X3 F32MAT2X4
204 %token <lex> F32MAT3X2 F32MAT3X3 F32MAT3X4
205 %token <lex> F32MAT4X2 F32MAT4X3 F32MAT4X4
206 %token <lex> F64MAT2X2 F64MAT2X3 F64MAT2X4
207 %token <lex> F64MAT3X2 F64MAT3X3 F64MAT3X4
208 %token <lex> F64MAT4X2 F64MAT4X3 F64MAT4X4
209 %token <lex> ATOMIC_UINT
210 %token <lex> ACCSTRUCTNV
211 %token <lex> ACCSTRUCTEXT
212 %token <lex> RAYQUERYEXT
213 %token <lex> FCOOPMATNV ICOOPMATNV UCOOPMATNV
215 // combined image/sampler
216 %token <lex> SAMPLERCUBEARRAY SAMPLERCUBEARRAYSHADOW
217 %token <lex> ISAMPLERCUBEARRAY USAMPLERCUBEARRAY
218 %token <lex> SAMPLER1D SAMPLER1DARRAY SAMPLER1DARRAYSHADOW ISAMPLER1D SAMPLER1DSHADOW
219 %token <lex> SAMPLER2DRECT SAMPLER2DRECTSHADOW ISAMPLER2DRECT USAMPLER2DRECT
220 %token <lex> SAMPLERBUFFER ISAMPLERBUFFER USAMPLERBUFFER
221 %token <lex> SAMPLER2DMS ISAMPLER2DMS USAMPLER2DMS
222 %token <lex> SAMPLER2DMSARRAY ISAMPLER2DMSARRAY USAMPLER2DMSARRAY
223 %token <lex> SAMPLEREXTERNALOES
224 %token <lex> SAMPLEREXTERNAL2DY2YEXT
225 %token <lex> ISAMPLER1DARRAY USAMPLER1D USAMPLER1DARRAY
226 %token <lex> F16SAMPLER1D F16SAMPLER2D F16SAMPLER3D F16SAMPLER2DRECT F16SAMPLERCUBE
227 %token <lex> F16SAMPLER1DARRAY F16SAMPLER2DARRAY F16SAMPLERCUBEARRAY
228 %token <lex> F16SAMPLERBUFFER F16SAMPLER2DMS F16SAMPLER2DMSARRAY
229 %token <lex> F16SAMPLER1DSHADOW F16SAMPLER2DSHADOW F16SAMPLER1DARRAYSHADOW F16SAMPLER2DARRAYSHADOW
230 %token <lex> F16SAMPLER2DRECTSHADOW F16SAMPLERCUBESHADOW F16SAMPLERCUBEARRAYSHADOW
233 %token <lex> IMAGE1D IIMAGE1D UIMAGE1D IMAGE2D IIMAGE2D
234 %token <lex> UIMAGE2D IMAGE3D IIMAGE3D UIMAGE3D
235 %token <lex> IMAGE2DRECT IIMAGE2DRECT UIMAGE2DRECT
236 %token <lex> IMAGECUBE IIMAGECUBE UIMAGECUBE
237 %token <lex> IMAGEBUFFER IIMAGEBUFFER UIMAGEBUFFER
238 %token <lex> IMAGE1DARRAY IIMAGE1DARRAY UIMAGE1DARRAY
239 %token <lex> IMAGE2DARRAY IIMAGE2DARRAY UIMAGE2DARRAY
240 %token <lex> IMAGECUBEARRAY IIMAGECUBEARRAY UIMAGECUBEARRAY
241 %token <lex> IMAGE2DMS IIMAGE2DMS UIMAGE2DMS
242 %token <lex> IMAGE2DMSARRAY IIMAGE2DMSARRAY UIMAGE2DMSARRAY
244 %token <lex> F16IMAGE1D F16IMAGE2D F16IMAGE3D F16IMAGE2DRECT
245 %token <lex> F16IMAGECUBE F16IMAGE1DARRAY F16IMAGE2DARRAY F16IMAGECUBEARRAY
246 %token <lex> F16IMAGEBUFFER F16IMAGE2DMS F16IMAGE2DMSARRAY
248 %token <lex> I64IMAGE1D U64IMAGE1D
249 %token <lex> I64IMAGE2D U64IMAGE2D
250 %token <lex> I64IMAGE3D U64IMAGE3D
251 %token <lex> I64IMAGE2DRECT U64IMAGE2DRECT
252 %token <lex> I64IMAGECUBE U64IMAGECUBE
253 %token <lex> I64IMAGEBUFFER U64IMAGEBUFFER
254 %token <lex> I64IMAGE1DARRAY U64IMAGE1DARRAY
255 %token <lex> I64IMAGE2DARRAY U64IMAGE2DARRAY
256 %token <lex> I64IMAGECUBEARRAY U64IMAGECUBEARRAY
257 %token <lex> I64IMAGE2DMS U64IMAGE2DMS
258 %token <lex> I64IMAGE2DMSARRAY U64IMAGE2DMSARRAY
260 // texture without sampler
261 %token <lex> TEXTURECUBEARRAY ITEXTURECUBEARRAY UTEXTURECUBEARRAY
262 %token <lex> TEXTURE1D ITEXTURE1D UTEXTURE1D
263 %token <lex> TEXTURE1DARRAY ITEXTURE1DARRAY UTEXTURE1DARRAY
264 %token <lex> TEXTURE2DRECT ITEXTURE2DRECT UTEXTURE2DRECT
265 %token <lex> TEXTUREBUFFER ITEXTUREBUFFER UTEXTUREBUFFER
266 %token <lex> TEXTURE2DMS ITEXTURE2DMS UTEXTURE2DMS
267 %token <lex> TEXTURE2DMSARRAY ITEXTURE2DMSARRAY UTEXTURE2DMSARRAY
269 %token <lex> F16TEXTURE1D F16TEXTURE2D F16TEXTURE3D F16TEXTURE2DRECT F16TEXTURECUBE
270 %token <lex> F16TEXTURE1DARRAY F16TEXTURE2DARRAY F16TEXTURECUBEARRAY
271 %token <lex> F16TEXTUREBUFFER F16TEXTURE2DMS F16TEXTURE2DMSARRAY
274 %token <lex> SUBPASSINPUT SUBPASSINPUTMS ISUBPASSINPUT ISUBPASSINPUTMS USUBPASSINPUT USUBPASSINPUTMS
275 %token <lex> F16SUBPASSINPUT F16SUBPASSINPUTMS
278 %token <lex> SPIRV_INSTRUCTION SPIRV_EXECUTION_MODE SPIRV_EXECUTION_MODE_ID
279 %token <lex> SPIRV_DECORATE SPIRV_DECORATE_ID SPIRV_DECORATE_STRING
280 %token <lex> SPIRV_TYPE SPIRV_STORAGE_CLASS SPIRV_BY_REFERENCE SPIRV_LITERAL
282 GLSLANG_WEB_EXCLUDE_OFF
284 %token <lex> LEFT_OP RIGHT_OP
285 %token <lex> INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP
286 %token <lex> AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN
287 %token <lex> MOD_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN XOR_ASSIGN OR_ASSIGN
288 %token <lex> SUB_ASSIGN
289 %token <lex> STRING_LITERAL
291 %token <lex> LEFT_PAREN RIGHT_PAREN LEFT_BRACKET RIGHT_BRACKET LEFT_BRACE RIGHT_BRACE DOT
292 %token <lex> COMMA COLON EQUAL SEMICOLON BANG DASH TILDE PLUS STAR SLASH PERCENT
293 %token <lex> LEFT_ANGLE RIGHT_ANGLE VERTICAL_BAR CARET AMPERSAND QUESTION
295 %token <lex> INVARIANT
296 %token <lex> HIGH_PRECISION MEDIUM_PRECISION LOW_PRECISION PRECISION
297 %token <lex> PACKED RESOURCE SUPERP
299 %token <lex> FLOATCONSTANT INTCONSTANT UINTCONSTANT BOOLCONSTANT
300 %token <lex> IDENTIFIER TYPE_NAME
301 %token <lex> CENTROID IN OUT INOUT
302 %token <lex> STRUCT VOID WHILE
303 %token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
304 %token <lex> TERMINATE_INVOCATION
305 %token <lex> TERMINATE_RAY IGNORE_INTERSECTION
306 %token <lex> UNIFORM SHARED BUFFER
307 %token <lex> FLAT SMOOTH LAYOUT
309 GLSLANG_WEB_EXCLUDE_ON
310 %token <lex> DOUBLECONSTANT INT16CONSTANT UINT16CONSTANT FLOAT16CONSTANT INT32CONSTANT UINT32CONSTANT
311 %token <lex> INT64CONSTANT UINT64CONSTANT
312 %token <lex> SUBROUTINE DEMOTE
313 %token <lex> PAYLOADNV PAYLOADINNV HITATTRNV CALLDATANV CALLDATAINNV
314 %token <lex> PAYLOADEXT PAYLOADINEXT HITATTREXT CALLDATAEXT CALLDATAINEXT
315 %token <lex> PATCH SAMPLE NONUNIFORM
316 %token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT
317 %token <lex> SUBGROUPCOHERENT NONPRIVATE SHADERCALLCOHERENT
318 %token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV
320 GLSLANG_WEB_EXCLUDE_OFF
322 %type <interm> assignment_operator unary_operator
323 %type <interm.intermTypedNode> variable_identifier primary_expression postfix_expression
324 %type <interm.intermTypedNode> expression integer_expression assignment_expression
325 %type <interm.intermTypedNode> unary_expression multiplicative_expression additive_expression
326 %type <interm.intermTypedNode> relational_expression equality_expression
327 %type <interm.intermTypedNode> conditional_expression constant_expression
328 %type <interm.intermTypedNode> logical_or_expression logical_xor_expression logical_and_expression
329 %type <interm.intermTypedNode> shift_expression and_expression exclusive_or_expression inclusive_or_expression
330 %type <interm.intermTypedNode> function_call initializer condition conditionopt
332 %type <interm.intermNode> translation_unit function_definition
333 %type <interm.intermNode> statement simple_statement
334 %type <interm.intermNode> statement_list switch_statement_list compound_statement
335 %type <interm.intermNode> declaration_statement selection_statement selection_statement_nonattributed expression_statement
336 %type <interm.intermNode> switch_statement switch_statement_nonattributed case_label
337 %type <interm.intermNode> declaration external_declaration
338 %type <interm.intermNode> for_init_statement compound_statement_no_new_scope
339 %type <interm.nodePair> selection_rest_statement for_rest_statement
340 %type <interm.intermNode> iteration_statement iteration_statement_nonattributed jump_statement statement_no_new_scope statement_scoped
341 %type <interm> single_declaration init_declarator_list
343 %type <interm> parameter_declaration parameter_declarator parameter_type_specifier
345 %type <interm> array_specifier
346 %type <interm.type> invariant_qualifier interpolation_qualifier storage_qualifier precision_qualifier
347 %type <interm.type> layout_qualifier layout_qualifier_id_list layout_qualifier_id
349 %type <interm.typeParameters> type_parameter_specifier
350 %type <interm.typeParameters> type_parameter_specifier_opt
351 %type <interm.typeParameters> type_parameter_specifier_list
353 %type <interm.type> type_qualifier fully_specified_type type_specifier
354 %type <interm.type> single_type_qualifier
355 %type <interm.type> type_specifier_nonarray
356 %type <interm.type> struct_specifier
357 %type <interm.typeLine> struct_declarator
358 %type <interm.typeList> struct_declarator_list struct_declaration struct_declaration_list
359 %type <interm> block_structure
360 %type <interm.function> function_header function_declarator
361 %type <interm.function> function_header_with_parameters
362 %type <interm> function_call_header_with_parameters function_call_header_no_parameters function_call_generic function_prototype
363 %type <interm> function_call_or_method function_identifier function_call_header
365 %type <interm.identifierList> identifier_list
367 GLSLANG_WEB_EXCLUDE_ON
368 %type <interm.type> precise_qualifier non_uniform_qualifier
369 %type <interm.typeList> type_name_list
370 %type <interm.attributes> attribute attribute_list single_attribute
371 %type <interm.intermNode> demote_statement
372 %type <interm.intermTypedNode> initializer_list
373 %type <interm.spirvReq> spirv_requirements_list spirv_requirements_parameter
374 %type <interm.intermNode> spirv_extension_list spirv_capability_list
375 %type <interm.intermNode> spirv_execution_mode_qualifier
376 %type <interm.intermNode> spirv_execution_mode_parameter_list spirv_execution_mode_parameter spirv_execution_mode_id_parameter_list
377 %type <interm.type> spirv_storage_class_qualifier
378 %type <interm.type> spirv_decorate_qualifier
379 %type <interm.intermNode> spirv_decorate_parameter_list spirv_decorate_parameter
380 %type <interm.intermNode> spirv_decorate_id_parameter_list
381 %type <interm.intermNode> spirv_decorate_string_parameter_list
382 %type <interm.type> spirv_type_specifier
383 %type <interm.spirvTypeParams> spirv_type_parameter_list spirv_type_parameter
384 %type <interm.spirvInst> spirv_instruction_qualifier
385 %type <interm.spirvInst> spirv_instruction_qualifier_list spirv_instruction_qualifier_id
386 GLSLANG_WEB_EXCLUDE_OFF
388 %start translation_unit
393 $$ = parseContext.handleVariable($1.loc, $1.symbol, $1.string);
398 : variable_identifier {
401 | LEFT_PAREN expression RIGHT_PAREN {
403 if ($$->getAsConstantUnion())
404 $$->getAsConstantUnion()->setExpression();
407 $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true);
410 $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true);
413 parseContext.fullIntegerCheck($1.loc, "unsigned literal");
414 $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true);
417 $$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true);
419 GLSLANG_WEB_EXCLUDE_ON
421 $$ = parseContext.intermediate.addConstantUnion($1.string, $1.loc, true);
424 parseContext.explicitInt32Check($1.loc, "32-bit signed literal");
425 $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true);
428 parseContext.explicitInt32Check($1.loc, "32-bit signed literal");
429 $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true);
432 parseContext.int64Check($1.loc, "64-bit integer literal");
433 $$ = parseContext.intermediate.addConstantUnion($1.i64, $1.loc, true);
436 parseContext.int64Check($1.loc, "64-bit unsigned integer literal");
437 $$ = parseContext.intermediate.addConstantUnion($1.u64, $1.loc, true);
440 parseContext.explicitInt16Check($1.loc, "16-bit integer literal");
441 $$ = parseContext.intermediate.addConstantUnion((short)$1.i, $1.loc, true);
444 parseContext.explicitInt16Check($1.loc, "16-bit unsigned integer literal");
445 $$ = parseContext.intermediate.addConstantUnion((unsigned short)$1.u, $1.loc, true);
448 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double literal");
449 if (! parseContext.symbolTable.atBuiltInLevel())
450 parseContext.doubleCheck($1.loc, "double literal");
451 $$ = parseContext.intermediate.addConstantUnion($1.d, EbtDouble, $1.loc, true);
454 parseContext.float16Check($1.loc, "half float literal");
455 $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat16, $1.loc, true);
457 GLSLANG_WEB_EXCLUDE_OFF
461 : primary_expression {
464 | postfix_expression LEFT_BRACKET integer_expression RIGHT_BRACKET {
465 $$ = parseContext.handleBracketDereference($2.loc, $1, $3);
470 | postfix_expression DOT IDENTIFIER {
471 $$ = parseContext.handleDotDereference($3.loc, $1, *$3.string);
473 | postfix_expression INC_OP {
474 parseContext.variableCheck($1);
475 parseContext.lValueErrorCheck($2.loc, "++", $1);
476 $$ = parseContext.handleUnaryMath($2.loc, "++", EOpPostIncrement, $1);
478 | postfix_expression DEC_OP {
479 parseContext.variableCheck($1);
480 parseContext.lValueErrorCheck($2.loc, "--", $1);
481 $$ = parseContext.handleUnaryMath($2.loc, "--", EOpPostDecrement, $1);
487 parseContext.integerCheck($1, "[]");
493 : function_call_or_method {
494 $$ = parseContext.handleFunctionCall($1.loc, $1.function, $1.intermNode);
499 function_call_or_method
500 : function_call_generic {
505 function_call_generic
506 : function_call_header_with_parameters RIGHT_PAREN {
510 | function_call_header_no_parameters RIGHT_PAREN {
516 function_call_header_no_parameters
517 : function_call_header VOID {
520 | function_call_header {
525 function_call_header_with_parameters
526 : function_call_header assignment_expression {
527 TParameter param = { 0, new TType };
528 param.type->shallowCopy($2->getType());
529 $1.function->addParameter(param);
530 $$.function = $1.function;
533 | function_call_header_with_parameters COMMA assignment_expression {
534 TParameter param = { 0, new TType };
535 param.type->shallowCopy($3->getType());
536 $1.function->addParameter(param);
537 $$.function = $1.function;
538 $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, $3, $2.loc);
543 : function_identifier LEFT_PAREN {
548 // Grammar Note: Constructors look like functions, but are recognized as types.
554 $$.function = parseContext.handleConstructorCall($1.loc, $1);
556 | postfix_expression {
558 // Should be a method or subroutine call, but we haven't recognized the arguments yet.
563 TIntermMethod* method = $1->getAsMethodNode();
565 $$.function = new TFunction(&method->getMethodName(), TType(EbtInt), EOpArrayLength);
566 $$.intermNode = method->getObject();
568 TIntermSymbol* symbol = $1->getAsSymbolNode();
570 parseContext.reservedErrorCheck(symbol->getLoc(), symbol->getName());
571 TFunction *function = new TFunction(&symbol->getName(), TType(EbtVoid));
572 $$.function = function;
574 parseContext.error($1->getLoc(), "function call, method, or subroutine call expected", "", "");
577 if ($$.function == 0) {
579 TString* empty = NewPoolTString("");
580 $$.function = new TFunction(empty, TType(EbtVoid), EOpNull);
583 GLSLANG_WEB_EXCLUDE_ON
584 | non_uniform_qualifier {
587 $$.function = parseContext.handleConstructorCall($1.loc, $1);
589 GLSLANG_WEB_EXCLUDE_OFF
593 : postfix_expression {
594 parseContext.variableCheck($1);
596 if (TIntermMethod* method = $1->getAsMethodNode())
597 parseContext.error($1->getLoc(), "incomplete method syntax", method->getMethodName().c_str(), "");
599 | INC_OP unary_expression {
600 parseContext.lValueErrorCheck($1.loc, "++", $2);
601 $$ = parseContext.handleUnaryMath($1.loc, "++", EOpPreIncrement, $2);
603 | DEC_OP unary_expression {
604 parseContext.lValueErrorCheck($1.loc, "--", $2);
605 $$ = parseContext.handleUnaryMath($1.loc, "--", EOpPreDecrement, $2);
607 | unary_operator unary_expression {
608 if ($1.op != EOpNull) {
609 char errorOp[2] = {0, 0};
611 case EOpNegative: errorOp[0] = '-'; break;
612 case EOpLogicalNot: errorOp[0] = '!'; break;
613 case EOpBitwiseNot: errorOp[0] = '~'; break;
614 default: break; // some compilers want this
616 $$ = parseContext.handleUnaryMath($1.loc, errorOp, $1.op, $2);
619 if ($$->getAsConstantUnion())
620 $$->getAsConstantUnion()->setExpression();
624 // Grammar Note: No traditional style type casts.
627 : PLUS { $$.loc = $1.loc; $$.op = EOpNull; }
628 | DASH { $$.loc = $1.loc; $$.op = EOpNegative; }
629 | BANG { $$.loc = $1.loc; $$.op = EOpLogicalNot; }
630 | TILDE { $$.loc = $1.loc; $$.op = EOpBitwiseNot;
631 parseContext.fullIntegerCheck($1.loc, "bitwise not"); }
633 // Grammar Note: No '*' or '&' unary ops. Pointers are not supported.
635 multiplicative_expression
636 : unary_expression { $$ = $1; }
637 | multiplicative_expression STAR unary_expression {
638 $$ = parseContext.handleBinaryMath($2.loc, "*", EOpMul, $1, $3);
642 | multiplicative_expression SLASH unary_expression {
643 $$ = parseContext.handleBinaryMath($2.loc, "/", EOpDiv, $1, $3);
647 | multiplicative_expression PERCENT unary_expression {
648 parseContext.fullIntegerCheck($2.loc, "%");
649 $$ = parseContext.handleBinaryMath($2.loc, "%", EOpMod, $1, $3);
656 : multiplicative_expression { $$ = $1; }
657 | additive_expression PLUS multiplicative_expression {
658 $$ = parseContext.handleBinaryMath($2.loc, "+", EOpAdd, $1, $3);
662 | additive_expression DASH multiplicative_expression {
663 $$ = parseContext.handleBinaryMath($2.loc, "-", EOpSub, $1, $3);
670 : additive_expression { $$ = $1; }
671 | shift_expression LEFT_OP additive_expression {
672 parseContext.fullIntegerCheck($2.loc, "bit shift left");
673 $$ = parseContext.handleBinaryMath($2.loc, "<<", EOpLeftShift, $1, $3);
677 | shift_expression RIGHT_OP additive_expression {
678 parseContext.fullIntegerCheck($2.loc, "bit shift right");
679 $$ = parseContext.handleBinaryMath($2.loc, ">>", EOpRightShift, $1, $3);
685 relational_expression
686 : shift_expression { $$ = $1; }
687 | relational_expression LEFT_ANGLE shift_expression {
688 $$ = parseContext.handleBinaryMath($2.loc, "<", EOpLessThan, $1, $3);
690 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
692 | relational_expression RIGHT_ANGLE shift_expression {
693 $$ = parseContext.handleBinaryMath($2.loc, ">", EOpGreaterThan, $1, $3);
695 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
697 | relational_expression LE_OP shift_expression {
698 $$ = parseContext.handleBinaryMath($2.loc, "<=", EOpLessThanEqual, $1, $3);
700 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
702 | relational_expression GE_OP shift_expression {
703 $$ = parseContext.handleBinaryMath($2.loc, ">=", EOpGreaterThanEqual, $1, $3);
705 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
710 : relational_expression { $$ = $1; }
711 | equality_expression EQ_OP relational_expression {
712 parseContext.arrayObjectCheck($2.loc, $1->getType(), "array comparison");
713 parseContext.opaqueCheck($2.loc, $1->getType(), "==");
714 parseContext.specializationCheck($2.loc, $1->getType(), "==");
715 parseContext.referenceCheck($2.loc, $1->getType(), "==");
716 $$ = parseContext.handleBinaryMath($2.loc, "==", EOpEqual, $1, $3);
718 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
720 | equality_expression NE_OP relational_expression {
721 parseContext.arrayObjectCheck($2.loc, $1->getType(), "array comparison");
722 parseContext.opaqueCheck($2.loc, $1->getType(), "!=");
723 parseContext.specializationCheck($2.loc, $1->getType(), "!=");
724 parseContext.referenceCheck($2.loc, $1->getType(), "!=");
725 $$ = parseContext.handleBinaryMath($2.loc, "!=", EOpNotEqual, $1, $3);
727 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
732 : equality_expression { $$ = $1; }
733 | and_expression AMPERSAND equality_expression {
734 parseContext.fullIntegerCheck($2.loc, "bitwise and");
735 $$ = parseContext.handleBinaryMath($2.loc, "&", EOpAnd, $1, $3);
741 exclusive_or_expression
742 : and_expression { $$ = $1; }
743 | exclusive_or_expression CARET and_expression {
744 parseContext.fullIntegerCheck($2.loc, "bitwise exclusive or");
745 $$ = parseContext.handleBinaryMath($2.loc, "^", EOpExclusiveOr, $1, $3);
751 inclusive_or_expression
752 : exclusive_or_expression { $$ = $1; }
753 | inclusive_or_expression VERTICAL_BAR exclusive_or_expression {
754 parseContext.fullIntegerCheck($2.loc, "bitwise inclusive or");
755 $$ = parseContext.handleBinaryMath($2.loc, "|", EOpInclusiveOr, $1, $3);
761 logical_and_expression
762 : inclusive_or_expression { $$ = $1; }
763 | logical_and_expression AND_OP inclusive_or_expression {
764 $$ = parseContext.handleBinaryMath($2.loc, "&&", EOpLogicalAnd, $1, $3);
766 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
770 logical_xor_expression
771 : logical_and_expression { $$ = $1; }
772 | logical_xor_expression XOR_OP logical_and_expression {
773 $$ = parseContext.handleBinaryMath($2.loc, "^^", EOpLogicalXor, $1, $3);
775 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
779 logical_or_expression
780 : logical_xor_expression { $$ = $1; }
781 | logical_or_expression OR_OP logical_xor_expression {
782 $$ = parseContext.handleBinaryMath($2.loc, "||", EOpLogicalOr, $1, $3);
784 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc);
788 conditional_expression
789 : logical_or_expression { $$ = $1; }
790 | logical_or_expression QUESTION {
791 ++parseContext.controlFlowNestingLevel;
793 expression COLON assignment_expression {
794 --parseContext.controlFlowNestingLevel;
795 parseContext.boolCheck($2.loc, $1);
796 parseContext.rValueErrorCheck($2.loc, "?", $1);
797 parseContext.rValueErrorCheck($5.loc, ":", $4);
798 parseContext.rValueErrorCheck($5.loc, ":", $6);
799 $$ = parseContext.intermediate.addSelection($1, $4, $6, $2.loc);
801 parseContext.binaryOpError($2.loc, ":", $4->getCompleteString(), $6->getCompleteString());
807 assignment_expression
808 : conditional_expression { $$ = $1; }
809 | unary_expression assignment_operator assignment_expression {
810 parseContext.arrayObjectCheck($2.loc, $1->getType(), "array assignment");
811 parseContext.opaqueCheck($2.loc, $1->getType(), "=");
812 parseContext.storage16BitAssignmentCheck($2.loc, $1->getType(), "=");
813 parseContext.specializationCheck($2.loc, $1->getType(), "=");
814 parseContext.lValueErrorCheck($2.loc, "assign", $1);
815 parseContext.rValueErrorCheck($2.loc, "assign", $3);
816 $$ = parseContext.addAssign($2.loc, $2.op, $1, $3);
818 parseContext.assignError($2.loc, "assign", $1->getCompleteString(), $3->getCompleteString());
831 $$.op = EOpMulAssign;
835 $$.op = EOpDivAssign;
838 parseContext.fullIntegerCheck($1.loc, "%=");
840 $$.op = EOpModAssign;
844 $$.op = EOpAddAssign;
848 $$.op = EOpSubAssign;
851 parseContext.fullIntegerCheck($1.loc, "bit-shift left assign");
852 $$.loc = $1.loc; $$.op = EOpLeftShiftAssign;
855 parseContext.fullIntegerCheck($1.loc, "bit-shift right assign");
856 $$.loc = $1.loc; $$.op = EOpRightShiftAssign;
859 parseContext.fullIntegerCheck($1.loc, "bitwise-and assign");
860 $$.loc = $1.loc; $$.op = EOpAndAssign;
863 parseContext.fullIntegerCheck($1.loc, "bitwise-xor assign");
864 $$.loc = $1.loc; $$.op = EOpExclusiveOrAssign;
867 parseContext.fullIntegerCheck($1.loc, "bitwise-or assign");
868 $$.loc = $1.loc; $$.op = EOpInclusiveOrAssign;
873 : assignment_expression {
876 | expression COMMA assignment_expression {
877 parseContext.samplerConstructorLocationCheck($2.loc, ",", $3);
878 $$ = parseContext.intermediate.addComma($1, $3, $2.loc);
880 parseContext.binaryOpError($2.loc, ",", $1->getCompleteString(), $3->getCompleteString());
887 : conditional_expression {
888 parseContext.constantValueCheck($1, "");
894 : function_prototype SEMICOLON {
895 parseContext.handleFunctionDeclarator($1.loc, *$1.function, true /* prototype */);
897 // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature
899 GLSLANG_WEB_EXCLUDE_ON
900 | spirv_instruction_qualifier function_prototype SEMICOLON {
901 parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V instruction qualifier");
902 $2.function->setSpirvInstruction(*$1); // Attach SPIR-V intruction qualifier
903 parseContext.handleFunctionDeclarator($2.loc, *$2.function, true /* prototype */);
905 // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature
907 | spirv_execution_mode_qualifier SEMICOLON {
908 parseContext.globalCheck($2.loc, "SPIR-V execution mode qualifier");
909 parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V execution mode qualifier");
912 GLSLANG_WEB_EXCLUDE_OFF
913 | init_declarator_list SEMICOLON {
914 if ($1.intermNode && $1.intermNode->getAsAggregate())
915 $1.intermNode->getAsAggregate()->setOperator(EOpSequence);
918 | PRECISION precision_qualifier type_specifier SEMICOLON {
919 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "precision statement");
920 // lazy setting of the previous scope's defaults, has effect only the first time it is called in a particular scope
921 parseContext.symbolTable.setPreviousDefaultPrecisions(&parseContext.defaultPrecision[0]);
922 parseContext.setDefaultPrecision($1.loc, $3, $2.qualifier.precision);
925 | block_structure SEMICOLON {
926 parseContext.declareBlock($1.loc, *$1.typeList);
929 | block_structure IDENTIFIER SEMICOLON {
930 parseContext.declareBlock($1.loc, *$1.typeList, $2.string);
933 | block_structure IDENTIFIER array_specifier SEMICOLON {
934 parseContext.declareBlock($1.loc, *$1.typeList, $2.string, $3.arraySizes);
937 | type_qualifier SEMICOLON {
938 parseContext.globalQualifierFixCheck($1.loc, $1.qualifier);
939 parseContext.updateStandaloneQualifierDefaults($1.loc, $1);
942 | type_qualifier IDENTIFIER SEMICOLON {
943 parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
944 parseContext.addQualifierToExisting($1.loc, $1.qualifier, *$2.string);
947 | type_qualifier IDENTIFIER identifier_list SEMICOLON {
948 parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
949 $3->push_back($2.string);
950 parseContext.addQualifierToExisting($1.loc, $1.qualifier, *$3);
956 : type_qualifier IDENTIFIER LEFT_BRACE { parseContext.nestedBlockCheck($1.loc); } struct_declaration_list RIGHT_BRACE {
957 --parseContext.blockNestingLevel;
958 parseContext.blockName = $2.string;
959 parseContext.globalQualifierFixCheck($1.loc, $1.qualifier);
960 parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
961 parseContext.currentBlockQualifier = $1.qualifier;
968 $$ = new TIdentifierList;
969 $$->push_back($2.string);
971 | identifier_list COMMA IDENTIFIER {
973 $$->push_back($3.string);
978 : function_declarator RIGHT_PAREN {
982 | function_declarator RIGHT_PAREN attribute {
985 parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute");
986 parseContext.handleFunctionAttributes($2.loc, *$3);
988 | attribute function_declarator RIGHT_PAREN {
991 parseContext.requireExtensions($3.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute");
992 parseContext.handleFunctionAttributes($3.loc, *$1);
994 | attribute function_declarator RIGHT_PAREN attribute {
997 parseContext.requireExtensions($3.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute");
998 parseContext.handleFunctionAttributes($3.loc, *$1);
999 parseContext.handleFunctionAttributes($3.loc, *$4);
1007 | function_header_with_parameters {
1013 function_header_with_parameters
1014 : function_header parameter_declaration {
1015 // Add the parameter
1017 if ($2.param.type->getBasicType() != EbtVoid)
1018 $1->addParameter($2.param);
1020 delete $2.param.type;
1022 | function_header_with_parameters COMMA parameter_declaration {
1024 // Only first parameter of one-parameter functions can be void
1025 // The check for named parameters not being void is done in parameter_declarator
1027 if ($3.param.type->getBasicType() == EbtVoid) {
1029 // This parameter > first is void
1031 parseContext.error($2.loc, "cannot be an argument type except for '(void)'", "void", "");
1032 delete $3.param.type;
1034 // Add the parameter
1036 $1->addParameter($3.param);
1042 : fully_specified_type IDENTIFIER LEFT_PAREN {
1043 if ($1.qualifier.storage != EvqGlobal && $1.qualifier.storage != EvqTemporary) {
1044 parseContext.error($2.loc, "no qualifiers allowed for function return",
1045 GetStorageQualifierString($1.qualifier.storage), "");
1048 parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
1050 // Add the function as a prototype after parsing it (we do not support recursion)
1051 TFunction *function;
1054 // Potentially rename shader entry point function. No-op most of the time.
1055 parseContext.renameShaderFunction($2.string);
1057 // Make the function
1058 function = new TFunction($2.string, type);
1063 parameter_declarator
1065 : type_specifier IDENTIFIER {
1066 if ($1.arraySizes) {
1067 parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
1068 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
1069 parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
1071 if ($1.basicType == EbtVoid) {
1072 parseContext.error($2.loc, "illegal use of type 'void'", $2.string->c_str(), "");
1074 parseContext.reservedErrorCheck($2.loc, *$2.string);
1076 TParameter param = {$2.string, new TType($1)};
1080 | type_specifier IDENTIFIER array_specifier {
1081 if ($1.arraySizes) {
1082 parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
1083 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
1084 parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
1086 TType* type = new TType($1);
1087 type->transferArraySizes($3.arraySizes);
1088 type->copyArrayInnerSizes($1.arraySizes);
1090 parseContext.arrayOfArrayVersionCheck($2.loc, type->getArraySizes());
1091 parseContext.arraySizeRequiredCheck($3.loc, *$3.arraySizes);
1092 parseContext.reservedErrorCheck($2.loc, *$2.string);
1094 TParameter param = { $2.string, type };
1101 parameter_declaration
1105 : type_qualifier parameter_declarator {
1107 if ($1.qualifier.precision != EpqNone)
1108 $$.param.type->getQualifier().precision = $1.qualifier.precision;
1109 parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier());
1111 parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
1112 parseContext.parameterTypeCheck($2.loc, $1.qualifier.storage, *$$.param.type);
1113 parseContext.paramCheckFix($1.loc, $1.qualifier, *$$.param.type);
1116 | parameter_declarator {
1119 parseContext.parameterTypeCheck($1.loc, EvqIn, *$1.param.type);
1120 parseContext.paramCheckFixStorage($1.loc, EvqTemporary, *$$.param.type);
1121 parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier());
1126 | type_qualifier parameter_type_specifier {
1128 if ($1.qualifier.precision != EpqNone)
1129 $$.param.type->getQualifier().precision = $1.qualifier.precision;
1130 parseContext.precisionQualifierCheck($1.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier());
1132 parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers);
1133 parseContext.parameterTypeCheck($2.loc, $1.qualifier.storage, *$$.param.type);
1134 parseContext.paramCheckFix($1.loc, $1.qualifier, *$$.param.type);
1136 | parameter_type_specifier {
1139 parseContext.parameterTypeCheck($1.loc, EvqIn, *$1.param.type);
1140 parseContext.paramCheckFixStorage($1.loc, EvqTemporary, *$$.param.type);
1141 parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier());
1145 parameter_type_specifier
1147 TParameter param = { 0, new TType($1) };
1150 parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
1154 init_declarator_list
1155 : single_declaration {
1158 | init_declarator_list COMMA IDENTIFIER {
1160 parseContext.declareVariable($3.loc, *$3.string, $1.type);
1162 | init_declarator_list COMMA IDENTIFIER array_specifier {
1164 parseContext.declareVariable($3.loc, *$3.string, $1.type, $4.arraySizes);
1166 | init_declarator_list COMMA IDENTIFIER array_specifier EQUAL initializer {
1168 TIntermNode* initNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, $4.arraySizes, $6);
1169 $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, initNode, $5.loc);
1171 | init_declarator_list COMMA IDENTIFIER EQUAL initializer {
1173 TIntermNode* initNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, 0, $5);
1174 $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, initNode, $4.loc);
1179 : fully_specified_type {
1182 GLSLANG_WEB_EXCLUDE_ON
1183 parseContext.declareTypeDefaults($$.loc, $$.type);
1184 GLSLANG_WEB_EXCLUDE_OFF
1186 | fully_specified_type IDENTIFIER {
1189 parseContext.declareVariable($2.loc, *$2.string, $1);
1191 | fully_specified_type IDENTIFIER array_specifier {
1194 parseContext.declareVariable($2.loc, *$2.string, $1, $3.arraySizes);
1196 | fully_specified_type IDENTIFIER array_specifier EQUAL initializer {
1198 TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, $3.arraySizes, $5);
1199 $$.intermNode = parseContext.intermediate.growAggregate(0, initNode, $4.loc);
1201 | fully_specified_type IDENTIFIER EQUAL initializer {
1203 TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, 0, $4);
1204 $$.intermNode = parseContext.intermediate.growAggregate(0, initNode, $3.loc);
1207 // Grammar Note: No 'enum', or 'typedef'.
1209 fully_specified_type
1213 parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $$);
1214 if ($1.arraySizes) {
1215 parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
1216 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
1218 parseContext.precisionQualifierCheck($$.loc, $$.basicType, $$.qualifier);
1220 | type_qualifier type_specifier {
1221 parseContext.globalQualifierFixCheck($1.loc, $1.qualifier);
1222 parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $2);
1224 if ($2.arraySizes) {
1225 parseContext.profileRequires($2.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
1226 parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type");
1229 if ($2.arraySizes && parseContext.arrayQualifierError($2.loc, $1.qualifier))
1230 $2.arraySizes = nullptr;
1232 parseContext.checkNoShaderLayouts($2.loc, $1.shaderQualifiers);
1233 $2.shaderQualifiers.merge($1.shaderQualifiers);
1234 parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true);
1235 parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier);
1239 if (! $$.qualifier.isInterpolation() &&
1240 ((parseContext.language == EShLangVertex && $$.qualifier.storage == EvqVaryingOut) ||
1241 (parseContext.language == EShLangFragment && $$.qualifier.storage == EvqVaryingIn)))
1242 $$.qualifier.smooth = true;
1248 parseContext.globalCheck($1.loc, "invariant");
1249 parseContext.profileRequires($$.loc, ENoProfile, 120, 0, "invariant");
1251 $$.qualifier.invariant = true;
1255 interpolation_qualifier
1257 parseContext.globalCheck($1.loc, "smooth");
1258 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "smooth");
1259 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "smooth");
1261 $$.qualifier.smooth = true;
1264 parseContext.globalCheck($1.loc, "flat");
1265 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "flat");
1266 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "flat");
1268 $$.qualifier.flat = true;
1270 GLSLANG_WEB_EXCLUDE_ON
1272 parseContext.globalCheck($1.loc, "noperspective");
1273 parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_shader_noperspective_interpolation, "noperspective");
1274 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "noperspective");
1276 $$.qualifier.nopersp = true;
1278 | EXPLICITINTERPAMD {
1279 parseContext.globalCheck($1.loc, "__explicitInterpAMD");
1280 parseContext.profileRequires($1.loc, ECoreProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation");
1281 parseContext.profileRequires($1.loc, ECompatibilityProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation");
1283 $$.qualifier.explicitInterp = true;
1286 parseContext.globalCheck($1.loc, "pervertexNV");
1287 parseContext.profileRequires($1.loc, ECoreProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric");
1288 parseContext.profileRequires($1.loc, ECompatibilityProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric");
1289 parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric");
1291 $$.qualifier.pervertexNV = true;
1294 // No need for profile version or extension check. Shader stage already checks both.
1295 parseContext.globalCheck($1.loc, "perprimitiveNV");
1296 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangFragmentMask | EShLangMeshNVMask), "perprimitiveNV");
1297 // Fragment shader stage doesn't check for extension. So we explicitly add below extension check.
1298 if (parseContext.language == EShLangFragment)
1299 parseContext.requireExtensions($1.loc, 1, &E_GL_NV_mesh_shader, "perprimitiveNV");
1301 $$.qualifier.perPrimitiveNV = true;
1304 // No need for profile version or extension check. Shader stage already checks both.
1305 parseContext.globalCheck($1.loc, "perviewNV");
1306 parseContext.requireStage($1.loc, EShLangMeshNV, "perviewNV");
1308 $$.qualifier.perViewNV = true;
1311 // No need for profile version or extension check. Shader stage already checks both.
1312 parseContext.globalCheck($1.loc, "taskNV");
1313 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTaskNVMask | EShLangMeshNVMask), "taskNV");
1315 $$.qualifier.perTaskNV = true;
1317 GLSLANG_WEB_EXCLUDE_OFF
1321 : LAYOUT LEFT_PAREN layout_qualifier_id_list RIGHT_PAREN {
1326 layout_qualifier_id_list
1327 : layout_qualifier_id {
1330 | layout_qualifier_id_list COMMA layout_qualifier_id {
1332 $$.shaderQualifiers.merge($3.shaderQualifiers);
1333 parseContext.mergeObjectLayoutQualifiers($$.qualifier, $3.qualifier, false);
1339 parseContext.setLayoutQualifier($1.loc, $$, *$1.string);
1341 | IDENTIFIER EQUAL constant_expression {
1343 parseContext.setLayoutQualifier($1.loc, $$, *$1.string, $3);
1345 | SHARED { // because "shared" is both an identifier and a keyword
1347 TString strShared("shared");
1348 parseContext.setLayoutQualifier($1.loc, $$, strShared);
1352 GLSLANG_WEB_EXCLUDE_ON
1355 parseContext.profileRequires($$.loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader5, "precise");
1356 parseContext.profileRequires($1.loc, EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, "precise");
1358 $$.qualifier.noContraction = true;
1361 GLSLANG_WEB_EXCLUDE_OFF
1364 : single_type_qualifier {
1367 | type_qualifier single_type_qualifier {
1369 if ($$.basicType == EbtVoid)
1370 $$.basicType = $2.basicType;
1372 $$.shaderQualifiers.merge($2.shaderQualifiers);
1373 parseContext.mergeQualifiers($$.loc, $$.qualifier, $2.qualifier, false);
1377 single_type_qualifier
1378 : storage_qualifier {
1381 | layout_qualifier {
1384 | precision_qualifier {
1385 parseContext.checkPrecisionQualifier($1.loc, $1.qualifier.precision);
1388 | interpolation_qualifier {
1389 // allow inheritance of storage qualifier from block declaration
1392 | invariant_qualifier {
1393 // allow inheritance of storage qualifier from block declaration
1396 GLSLANG_WEB_EXCLUDE_ON
1397 | precise_qualifier {
1398 // allow inheritance of storage qualifier from block declaration
1401 | non_uniform_qualifier {
1404 | spirv_storage_class_qualifier {
1405 parseContext.globalCheck($1.loc, "spirv_storage_class");
1406 parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V storage class qualifier");
1409 | spirv_decorate_qualifier {
1410 parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V decorate qualifier");
1413 | SPIRV_BY_REFERENCE {
1414 parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "spirv_by_reference");
1416 $$.qualifier.setSpirvByReference();
1419 parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "spirv_by_literal");
1421 $$.qualifier.setSpirvLiteral();
1423 GLSLANG_WEB_EXCLUDE_OFF
1429 $$.qualifier.storage = EvqConst; // will later turn into EvqConstReadOnly, if the initializer is not constant
1432 parseContext.globalCheck($1.loc, "inout");
1434 $$.qualifier.storage = EvqInOut;
1437 parseContext.globalCheck($1.loc, "in");
1439 // whether this is a parameter "in" or a pipeline "in" will get sorted out a bit later
1440 $$.qualifier.storage = EvqIn;
1443 parseContext.globalCheck($1.loc, "out");
1445 // whether this is a parameter "out" or a pipeline "out" will get sorted out a bit later
1446 $$.qualifier.storage = EvqOut;
1449 parseContext.profileRequires($1.loc, ENoProfile, 120, 0, "centroid");
1450 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "centroid");
1451 parseContext.globalCheck($1.loc, "centroid");
1453 $$.qualifier.centroid = true;
1456 parseContext.globalCheck($1.loc, "uniform");
1458 $$.qualifier.storage = EvqUniform;
1461 parseContext.globalCheck($1.loc, "shared");
1462 parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared");
1463 parseContext.profileRequires($1.loc, EEsProfile, 310, 0, "shared");
1464 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangComputeMask | EShLangMeshNVMask | EShLangTaskNVMask), "shared");
1466 $$.qualifier.storage = EvqShared;
1469 parseContext.globalCheck($1.loc, "buffer");
1471 $$.qualifier.storage = EvqBuffer;
1473 GLSLANG_WEB_EXCLUDE_ON
1475 parseContext.requireStage($1.loc, EShLangVertex, "attribute");
1476 parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "attribute");
1477 parseContext.checkDeprecated($1.loc, ENoProfile, 130, "attribute");
1478 parseContext.requireNotRemoved($1.loc, ECoreProfile, 420, "attribute");
1479 parseContext.requireNotRemoved($1.loc, EEsProfile, 300, "attribute");
1481 parseContext.globalCheck($1.loc, "attribute");
1484 $$.qualifier.storage = EvqVaryingIn;
1487 parseContext.checkDeprecated($1.loc, ENoProfile, 130, "varying");
1488 parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "varying");
1489 parseContext.requireNotRemoved($1.loc, ECoreProfile, 420, "varying");
1490 parseContext.requireNotRemoved($1.loc, EEsProfile, 300, "varying");
1492 parseContext.globalCheck($1.loc, "varying");
1495 if (parseContext.language == EShLangVertex)
1496 $$.qualifier.storage = EvqVaryingOut;
1498 $$.qualifier.storage = EvqVaryingIn;
1501 parseContext.globalCheck($1.loc, "patch");
1502 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTessControlMask | EShLangTessEvaluationMask), "patch");
1504 $$.qualifier.patch = true;
1507 parseContext.globalCheck($1.loc, "sample");
1509 $$.qualifier.sample = true;
1512 parseContext.globalCheck($1.loc, "hitAttributeNV");
1513 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangIntersectMask | EShLangClosestHitMask
1514 | EShLangAnyHitMask), "hitAttributeNV");
1515 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "hitAttributeNV");
1517 $$.qualifier.storage = EvqHitAttr;
1520 parseContext.globalCheck($1.loc, "hitAttributeEXT");
1521 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangIntersectMask | EShLangClosestHitMask
1522 | EShLangAnyHitMask), "hitAttributeEXT");
1523 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_EXT_ray_tracing, "hitAttributeNV");
1525 $$.qualifier.storage = EvqHitAttr;
1528 parseContext.globalCheck($1.loc, "rayPayloadNV");
1529 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask |
1530 EShLangAnyHitMask | EShLangMissMask), "rayPayloadNV");
1531 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "rayPayloadNV");
1533 $$.qualifier.storage = EvqPayload;
1536 parseContext.globalCheck($1.loc, "rayPayloadEXT");
1537 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask |
1538 EShLangAnyHitMask | EShLangMissMask), "rayPayloadEXT");
1539 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_EXT_ray_tracing, "rayPayloadEXT");
1541 $$.qualifier.storage = EvqPayload;
1544 parseContext.globalCheck($1.loc, "rayPayloadInNV");
1545 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangClosestHitMask |
1546 EShLangAnyHitMask | EShLangMissMask), "rayPayloadInNV");
1547 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "rayPayloadInNV");
1549 $$.qualifier.storage = EvqPayloadIn;
1552 parseContext.globalCheck($1.loc, "rayPayloadInEXT");
1553 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangClosestHitMask |
1554 EShLangAnyHitMask | EShLangMissMask), "rayPayloadInEXT");
1555 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_EXT_ray_tracing, "rayPayloadInEXT");
1557 $$.qualifier.storage = EvqPayloadIn;
1560 parseContext.globalCheck($1.loc, "callableDataNV");
1561 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenMask |
1562 EShLangClosestHitMask | EShLangMissMask | EShLangCallableMask), "callableDataNV");
1563 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "callableDataNV");
1565 $$.qualifier.storage = EvqCallableData;
1568 parseContext.globalCheck($1.loc, "callableDataEXT");
1569 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenMask |
1570 EShLangClosestHitMask | EShLangMissMask | EShLangCallableMask), "callableDataEXT");
1571 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_EXT_ray_tracing, "callableDataEXT");
1573 $$.qualifier.storage = EvqCallableData;
1576 parseContext.globalCheck($1.loc, "callableDataInNV");
1577 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangCallableMask), "callableDataInNV");
1578 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "callableDataInNV");
1580 $$.qualifier.storage = EvqCallableDataIn;
1583 parseContext.globalCheck($1.loc, "callableDataInEXT");
1584 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangCallableMask), "callableDataInEXT");
1585 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_EXT_ray_tracing, "callableDataInEXT");
1587 $$.qualifier.storage = EvqCallableDataIn;
1591 $$.qualifier.coherent = true;
1595 parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "devicecoherent");
1596 $$.qualifier.devicecoherent = true;
1598 | QUEUEFAMILYCOHERENT {
1600 parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "queuefamilycoherent");
1601 $$.qualifier.queuefamilycoherent = true;
1603 | WORKGROUPCOHERENT {
1605 parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "workgroupcoherent");
1606 $$.qualifier.workgroupcoherent = true;
1608 | SUBGROUPCOHERENT {
1610 parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "subgroupcoherent");
1611 $$.qualifier.subgroupcoherent = true;
1615 parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "nonprivate");
1616 $$.qualifier.nonprivate = true;
1618 | SHADERCALLCOHERENT {
1620 parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_ray_tracing, "shadercallcoherent");
1621 $$.qualifier.shadercallcoherent = true;
1625 $$.qualifier.volatil = true;
1629 $$.qualifier.restrict = true;
1633 $$.qualifier.readonly = true;
1637 $$.qualifier.writeonly = true;
1640 parseContext.spvRemoved($1.loc, "subroutine");
1641 parseContext.globalCheck($1.loc, "subroutine");
1642 parseContext.unimplemented($1.loc, "subroutine");
1645 | SUBROUTINE LEFT_PAREN type_name_list RIGHT_PAREN {
1646 parseContext.spvRemoved($1.loc, "subroutine");
1647 parseContext.globalCheck($1.loc, "subroutine");
1648 parseContext.unimplemented($1.loc, "subroutine");
1651 GLSLANG_WEB_EXCLUDE_OFF
1654 GLSLANG_WEB_EXCLUDE_ON
1655 non_uniform_qualifier
1658 $$.qualifier.nonUniform = true;
1666 | type_name_list COMMA IDENTIFIER {
1667 // TODO: 4.0 semantics: subroutines
1668 // 1) make sure each identifier is a type declared earlier with SUBROUTINE
1669 // 2) save all of the identifiers for future comparison with the declared function
1672 GLSLANG_WEB_EXCLUDE_OFF
1675 : type_specifier_nonarray type_parameter_specifier_opt {
1677 $$.qualifier.precision = parseContext.getDefaultPrecision($$);
1678 $$.typeParameters = $2;
1680 | type_specifier_nonarray type_parameter_specifier_opt array_specifier {
1681 parseContext.arrayOfArrayVersionCheck($3.loc, $3.arraySizes);
1683 $$.qualifier.precision = parseContext.getDefaultPrecision($$);
1684 $$.typeParameters = $2;
1685 $$.arraySizes = $3.arraySizes;
1690 : LEFT_BRACKET RIGHT_BRACKET {
1692 $$.arraySizes = new TArraySizes;
1693 $$.arraySizes->addInnerSize();
1695 | LEFT_BRACKET conditional_expression RIGHT_BRACKET {
1697 $$.arraySizes = new TArraySizes;
1700 parseContext.arraySizeCheck($2->getLoc(), $2, size, "array size");
1701 $$.arraySizes->addInnerSize(size);
1703 | array_specifier LEFT_BRACKET RIGHT_BRACKET {
1705 $$.arraySizes->addInnerSize();
1707 | array_specifier LEFT_BRACKET conditional_expression RIGHT_BRACKET {
1711 parseContext.arraySizeCheck($3->getLoc(), $3, size, "array size");
1712 $$.arraySizes->addInnerSize(size);
1716 type_parameter_specifier_opt
1717 : type_parameter_specifier {
1720 | /* May be null */ {
1725 type_parameter_specifier
1726 : LEFT_ANGLE type_parameter_specifier_list RIGHT_ANGLE {
1731 type_parameter_specifier_list
1732 : unary_expression {
1733 $$ = new TArraySizes;
1736 parseContext.arraySizeCheck($1->getLoc(), $1, size, "type parameter");
1737 $$->addInnerSize(size);
1739 | type_parameter_specifier_list COMMA unary_expression {
1743 parseContext.arraySizeCheck($3->getLoc(), $3, size, "type parameter");
1744 $$->addInnerSize(size);
1748 type_specifier_nonarray
1750 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1751 $$.basicType = EbtVoid;
1754 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1755 $$.basicType = EbtFloat;
1758 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1759 $$.basicType = EbtInt;
1762 parseContext.fullIntegerCheck($1.loc, "unsigned integer");
1763 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1764 $$.basicType = EbtUint;
1767 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1768 $$.basicType = EbtBool;
1771 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1772 $$.basicType = EbtFloat;
1776 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1777 $$.basicType = EbtFloat;
1781 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1782 $$.basicType = EbtFloat;
1786 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1787 $$.basicType = EbtBool;
1791 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1792 $$.basicType = EbtBool;
1796 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1797 $$.basicType = EbtBool;
1801 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1802 $$.basicType = EbtInt;
1806 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1807 $$.basicType = EbtInt;
1811 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1812 $$.basicType = EbtInt;
1816 parseContext.fullIntegerCheck($1.loc, "unsigned integer vector");
1817 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1818 $$.basicType = EbtUint;
1822 parseContext.fullIntegerCheck($1.loc, "unsigned integer vector");
1823 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1824 $$.basicType = EbtUint;
1828 parseContext.fullIntegerCheck($1.loc, "unsigned integer vector");
1829 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1830 $$.basicType = EbtUint;
1834 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1835 $$.basicType = EbtFloat;
1839 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1840 $$.basicType = EbtFloat;
1844 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1845 $$.basicType = EbtFloat;
1849 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1850 $$.basicType = EbtFloat;
1854 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1855 $$.basicType = EbtFloat;
1859 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1860 $$.basicType = EbtFloat;
1864 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1865 $$.basicType = EbtFloat;
1869 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1870 $$.basicType = EbtFloat;
1874 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1875 $$.basicType = EbtFloat;
1879 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1880 $$.basicType = EbtFloat;
1884 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1885 $$.basicType = EbtFloat;
1889 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1890 $$.basicType = EbtFloat;
1893 GLSLANG_WEB_EXCLUDE_ON
1895 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double");
1896 if (! parseContext.symbolTable.atBuiltInLevel())
1897 parseContext.doubleCheck($1.loc, "double");
1898 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1899 $$.basicType = EbtDouble;
1902 parseContext.float16ScalarVectorCheck($1.loc, "float16_t", parseContext.symbolTable.atBuiltInLevel());
1903 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1904 $$.basicType = EbtFloat16;
1907 parseContext.explicitFloat32Check($1.loc, "float32_t", parseContext.symbolTable.atBuiltInLevel());
1908 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1909 $$.basicType = EbtFloat;
1912 parseContext.explicitFloat64Check($1.loc, "float64_t", parseContext.symbolTable.atBuiltInLevel());
1913 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1914 $$.basicType = EbtDouble;
1917 parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer", parseContext.symbolTable.atBuiltInLevel());
1918 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1919 $$.basicType = EbtInt8;
1922 parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
1923 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1924 $$.basicType = EbtUint8;
1927 parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer", parseContext.symbolTable.atBuiltInLevel());
1928 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1929 $$.basicType = EbtInt16;
1932 parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
1933 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1934 $$.basicType = EbtUint16;
1937 parseContext.explicitInt32Check($1.loc, "32-bit signed integer", parseContext.symbolTable.atBuiltInLevel());
1938 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1939 $$.basicType = EbtInt;
1942 parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
1943 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1944 $$.basicType = EbtUint;
1947 parseContext.int64Check($1.loc, "64-bit integer", parseContext.symbolTable.atBuiltInLevel());
1948 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1949 $$.basicType = EbtInt64;
1952 parseContext.int64Check($1.loc, "64-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel());
1953 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1954 $$.basicType = EbtUint64;
1957 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector");
1958 if (! parseContext.symbolTable.atBuiltInLevel())
1959 parseContext.doubleCheck($1.loc, "double vector");
1960 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1961 $$.basicType = EbtDouble;
1965 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector");
1966 if (! parseContext.symbolTable.atBuiltInLevel())
1967 parseContext.doubleCheck($1.loc, "double vector");
1968 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1969 $$.basicType = EbtDouble;
1973 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector");
1974 if (! parseContext.symbolTable.atBuiltInLevel())
1975 parseContext.doubleCheck($1.loc, "double vector");
1976 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1977 $$.basicType = EbtDouble;
1981 parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel());
1982 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1983 $$.basicType = EbtFloat16;
1987 parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel());
1988 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1989 $$.basicType = EbtFloat16;
1993 parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel());
1994 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
1995 $$.basicType = EbtFloat16;
1999 parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel());
2000 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2001 $$.basicType = EbtFloat;
2005 parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel());
2006 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2007 $$.basicType = EbtFloat;
2011 parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel());
2012 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2013 $$.basicType = EbtFloat;
2017 parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel());
2018 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2019 $$.basicType = EbtDouble;
2023 parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel());
2024 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2025 $$.basicType = EbtDouble;
2029 parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel());
2030 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2031 $$.basicType = EbtDouble;
2035 parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
2036 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2037 $$.basicType = EbtInt8;
2041 parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
2042 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2043 $$.basicType = EbtInt8;
2047 parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
2048 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2049 $$.basicType = EbtInt8;
2053 parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
2054 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2055 $$.basicType = EbtInt16;
2059 parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
2060 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2061 $$.basicType = EbtInt16;
2065 parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
2066 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2067 $$.basicType = EbtInt16;
2071 parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
2072 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2073 $$.basicType = EbtInt;
2077 parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
2078 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2079 $$.basicType = EbtInt;
2083 parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel());
2084 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2085 $$.basicType = EbtInt;
2089 parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
2090 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2091 $$.basicType = EbtInt64;
2095 parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
2096 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2097 $$.basicType = EbtInt64;
2101 parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel());
2102 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2103 $$.basicType = EbtInt64;
2107 parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2108 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2109 $$.basicType = EbtUint8;
2113 parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2114 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2115 $$.basicType = EbtUint8;
2119 parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2120 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2121 $$.basicType = EbtUint8;
2125 parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2126 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2127 $$.basicType = EbtUint16;
2131 parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2132 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2133 $$.basicType = EbtUint16;
2137 parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2138 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2139 $$.basicType = EbtUint16;
2143 parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2144 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2145 $$.basicType = EbtUint;
2149 parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2150 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2151 $$.basicType = EbtUint;
2155 parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2156 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2157 $$.basicType = EbtUint;
2161 parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2162 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2163 $$.basicType = EbtUint64;
2167 parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2168 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2169 $$.basicType = EbtUint64;
2173 parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel());
2174 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2175 $$.basicType = EbtUint64;
2179 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2180 if (! parseContext.symbolTable.atBuiltInLevel())
2181 parseContext.doubleCheck($1.loc, "double matrix");
2182 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2183 $$.basicType = EbtDouble;
2187 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2188 if (! parseContext.symbolTable.atBuiltInLevel())
2189 parseContext.doubleCheck($1.loc, "double matrix");
2190 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2191 $$.basicType = EbtDouble;
2195 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2196 if (! parseContext.symbolTable.atBuiltInLevel())
2197 parseContext.doubleCheck($1.loc, "double matrix");
2198 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2199 $$.basicType = EbtDouble;
2203 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2204 if (! parseContext.symbolTable.atBuiltInLevel())
2205 parseContext.doubleCheck($1.loc, "double matrix");
2206 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2207 $$.basicType = EbtDouble;
2211 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2212 if (! parseContext.symbolTable.atBuiltInLevel())
2213 parseContext.doubleCheck($1.loc, "double matrix");
2214 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2215 $$.basicType = EbtDouble;
2219 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2220 if (! parseContext.symbolTable.atBuiltInLevel())
2221 parseContext.doubleCheck($1.loc, "double matrix");
2222 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2223 $$.basicType = EbtDouble;
2227 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2228 if (! parseContext.symbolTable.atBuiltInLevel())
2229 parseContext.doubleCheck($1.loc, "double matrix");
2230 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2231 $$.basicType = EbtDouble;
2235 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2236 if (! parseContext.symbolTable.atBuiltInLevel())
2237 parseContext.doubleCheck($1.loc, "double matrix");
2238 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2239 $$.basicType = EbtDouble;
2243 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2244 if (! parseContext.symbolTable.atBuiltInLevel())
2245 parseContext.doubleCheck($1.loc, "double matrix");
2246 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2247 $$.basicType = EbtDouble;
2251 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2252 if (! parseContext.symbolTable.atBuiltInLevel())
2253 parseContext.doubleCheck($1.loc, "double matrix");
2254 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2255 $$.basicType = EbtDouble;
2259 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2260 if (! parseContext.symbolTable.atBuiltInLevel())
2261 parseContext.doubleCheck($1.loc, "double matrix");
2262 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2263 $$.basicType = EbtDouble;
2267 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
2268 if (! parseContext.symbolTable.atBuiltInLevel())
2269 parseContext.doubleCheck($1.loc, "double matrix");
2270 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2271 $$.basicType = EbtDouble;
2275 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2276 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2277 $$.basicType = EbtFloat16;
2281 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2282 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2283 $$.basicType = EbtFloat16;
2287 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2288 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2289 $$.basicType = EbtFloat16;
2293 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2294 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2295 $$.basicType = EbtFloat16;
2299 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2300 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2301 $$.basicType = EbtFloat16;
2305 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2306 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2307 $$.basicType = EbtFloat16;
2311 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2312 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2313 $$.basicType = EbtFloat16;
2317 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2318 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2319 $$.basicType = EbtFloat16;
2323 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2324 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2325 $$.basicType = EbtFloat16;
2329 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2330 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2331 $$.basicType = EbtFloat16;
2335 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2336 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2337 $$.basicType = EbtFloat16;
2341 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel());
2342 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2343 $$.basicType = EbtFloat16;
2347 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2348 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2349 $$.basicType = EbtFloat;
2353 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2354 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2355 $$.basicType = EbtFloat;
2359 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2360 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2361 $$.basicType = EbtFloat;
2365 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2366 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2367 $$.basicType = EbtFloat;
2371 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2372 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2373 $$.basicType = EbtFloat;
2377 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2378 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2379 $$.basicType = EbtFloat;
2383 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2384 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2385 $$.basicType = EbtFloat;
2389 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2390 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2391 $$.basicType = EbtFloat;
2395 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2396 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2397 $$.basicType = EbtFloat;
2401 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2402 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2403 $$.basicType = EbtFloat;
2407 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2408 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2409 $$.basicType = EbtFloat;
2413 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel());
2414 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2415 $$.basicType = EbtFloat;
2419 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2420 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2421 $$.basicType = EbtDouble;
2425 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2426 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2427 $$.basicType = EbtDouble;
2431 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2432 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2433 $$.basicType = EbtDouble;
2437 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2438 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2439 $$.basicType = EbtDouble;
2443 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2444 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2445 $$.basicType = EbtDouble;
2449 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2450 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2451 $$.basicType = EbtDouble;
2455 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2456 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2457 $$.basicType = EbtDouble;
2461 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2462 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2463 $$.basicType = EbtDouble;
2467 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2468 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2469 $$.basicType = EbtDouble;
2473 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2474 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2475 $$.basicType = EbtDouble;
2479 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2480 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2481 $$.basicType = EbtDouble;
2485 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel());
2486 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2487 $$.basicType = EbtDouble;
2491 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2492 $$.basicType = EbtAccStruct;
2495 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2496 $$.basicType = EbtAccStruct;
2499 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2500 $$.basicType = EbtRayQuery;
2503 parseContext.vulkanRemoved($1.loc, "atomic counter types");
2504 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2505 $$.basicType = EbtAtomicUint;
2508 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2509 $$.basicType = EbtSampler;
2510 $$.sampler.set(EbtFloat, Esd1D);
2512 GLSLANG_WEB_EXCLUDE_OFF
2514 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2515 $$.basicType = EbtSampler;
2516 $$.sampler.set(EbtFloat, Esd2D);
2519 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2520 $$.basicType = EbtSampler;
2521 $$.sampler.set(EbtFloat, Esd3D);
2524 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2525 $$.basicType = EbtSampler;
2526 $$.sampler.set(EbtFloat, EsdCube);
2529 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2530 $$.basicType = EbtSampler;
2531 $$.sampler.set(EbtFloat, Esd2D, false, true);
2533 | SAMPLERCUBESHADOW {
2534 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2535 $$.basicType = EbtSampler;
2536 $$.sampler.set(EbtFloat, EsdCube, false, true);
2539 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2540 $$.basicType = EbtSampler;
2541 $$.sampler.set(EbtFloat, Esd2D, true);
2543 | SAMPLER2DARRAYSHADOW {
2544 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2545 $$.basicType = EbtSampler;
2546 $$.sampler.set(EbtFloat, Esd2D, true, true);
2548 GLSLANG_WEB_EXCLUDE_ON
2550 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2551 $$.basicType = EbtSampler;
2552 $$.sampler.set(EbtFloat, Esd1D, false, true);
2555 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2556 $$.basicType = EbtSampler;
2557 $$.sampler.set(EbtFloat, Esd1D, true);
2559 | SAMPLER1DARRAYSHADOW {
2560 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2561 $$.basicType = EbtSampler;
2562 $$.sampler.set(EbtFloat, Esd1D, true, true);
2564 | SAMPLERCUBEARRAY {
2565 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2566 $$.basicType = EbtSampler;
2567 $$.sampler.set(EbtFloat, EsdCube, true);
2569 | SAMPLERCUBEARRAYSHADOW {
2570 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2571 $$.basicType = EbtSampler;
2572 $$.sampler.set(EbtFloat, EsdCube, true, true);
2575 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2576 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2577 $$.basicType = EbtSampler;
2578 $$.sampler.set(EbtFloat16, Esd1D);
2581 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2582 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2583 $$.basicType = EbtSampler;
2584 $$.sampler.set(EbtFloat16, Esd2D);
2587 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2588 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2589 $$.basicType = EbtSampler;
2590 $$.sampler.set(EbtFloat16, Esd3D);
2593 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2594 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2595 $$.basicType = EbtSampler;
2596 $$.sampler.set(EbtFloat16, EsdCube);
2598 | F16SAMPLER1DSHADOW {
2599 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2600 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2601 $$.basicType = EbtSampler;
2602 $$.sampler.set(EbtFloat16, Esd1D, false, true);
2604 | F16SAMPLER2DSHADOW {
2605 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2606 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2607 $$.basicType = EbtSampler;
2608 $$.sampler.set(EbtFloat16, Esd2D, false, true);
2610 | F16SAMPLERCUBESHADOW {
2611 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2612 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2613 $$.basicType = EbtSampler;
2614 $$.sampler.set(EbtFloat16, EsdCube, false, true);
2616 | F16SAMPLER1DARRAY {
2617 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2618 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2619 $$.basicType = EbtSampler;
2620 $$.sampler.set(EbtFloat16, Esd1D, true);
2622 | F16SAMPLER2DARRAY {
2623 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2624 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2625 $$.basicType = EbtSampler;
2626 $$.sampler.set(EbtFloat16, Esd2D, true);
2628 | F16SAMPLER1DARRAYSHADOW {
2629 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2630 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2631 $$.basicType = EbtSampler;
2632 $$.sampler.set(EbtFloat16, Esd1D, true, true);
2634 | F16SAMPLER2DARRAYSHADOW {
2635 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2636 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2637 $$.basicType = EbtSampler;
2638 $$.sampler.set(EbtFloat16, Esd2D, true, true);
2640 | F16SAMPLERCUBEARRAY {
2641 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2642 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2643 $$.basicType = EbtSampler;
2644 $$.sampler.set(EbtFloat16, EsdCube, true);
2646 | F16SAMPLERCUBEARRAYSHADOW {
2647 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2648 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2649 $$.basicType = EbtSampler;
2650 $$.sampler.set(EbtFloat16, EsdCube, true, true);
2653 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2654 $$.basicType = EbtSampler;
2655 $$.sampler.set(EbtInt, Esd1D);
2657 GLSLANG_WEB_EXCLUDE_OFF
2659 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2660 $$.basicType = EbtSampler;
2661 $$.sampler.set(EbtInt, Esd2D);
2664 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2665 $$.basicType = EbtSampler;
2666 $$.sampler.set(EbtInt, Esd3D);
2669 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2670 $$.basicType = EbtSampler;
2671 $$.sampler.set(EbtInt, EsdCube);
2674 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2675 $$.basicType = EbtSampler;
2676 $$.sampler.set(EbtInt, Esd2D, true);
2679 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2680 $$.basicType = EbtSampler;
2681 $$.sampler.set(EbtUint, Esd2D);
2684 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2685 $$.basicType = EbtSampler;
2686 $$.sampler.set(EbtUint, Esd3D);
2689 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2690 $$.basicType = EbtSampler;
2691 $$.sampler.set(EbtUint, EsdCube);
2693 GLSLANG_WEB_EXCLUDE_ON
2695 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2696 $$.basicType = EbtSampler;
2697 $$.sampler.set(EbtInt, Esd1D, true);
2699 | ISAMPLERCUBEARRAY {
2700 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2701 $$.basicType = EbtSampler;
2702 $$.sampler.set(EbtInt, EsdCube, true);
2705 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2706 $$.basicType = EbtSampler;
2707 $$.sampler.set(EbtUint, Esd1D);
2710 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2711 $$.basicType = EbtSampler;
2712 $$.sampler.set(EbtUint, Esd1D, true);
2714 | USAMPLERCUBEARRAY {
2715 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2716 $$.basicType = EbtSampler;
2717 $$.sampler.set(EbtUint, EsdCube, true);
2719 | TEXTURECUBEARRAY {
2720 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2721 $$.basicType = EbtSampler;
2722 $$.sampler.setTexture(EbtFloat, EsdCube, true);
2724 | ITEXTURECUBEARRAY {
2725 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2726 $$.basicType = EbtSampler;
2727 $$.sampler.setTexture(EbtInt, EsdCube, true);
2729 | UTEXTURECUBEARRAY {
2730 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2731 $$.basicType = EbtSampler;
2732 $$.sampler.setTexture(EbtUint, EsdCube, true);
2734 GLSLANG_WEB_EXCLUDE_OFF
2736 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2737 $$.basicType = EbtSampler;
2738 $$.sampler.set(EbtUint, Esd2D, true);
2741 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2742 $$.basicType = EbtSampler;
2743 $$.sampler.setTexture(EbtFloat, Esd2D);
2746 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2747 $$.basicType = EbtSampler;
2748 $$.sampler.setTexture(EbtFloat, Esd3D);
2751 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2752 $$.basicType = EbtSampler;
2753 $$.sampler.setTexture(EbtFloat, Esd2D, true);
2756 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2757 $$.basicType = EbtSampler;
2758 $$.sampler.setTexture(EbtFloat, EsdCube);
2761 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2762 $$.basicType = EbtSampler;
2763 $$.sampler.setTexture(EbtInt, Esd2D);
2766 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2767 $$.basicType = EbtSampler;
2768 $$.sampler.setTexture(EbtInt, Esd3D);
2771 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2772 $$.basicType = EbtSampler;
2773 $$.sampler.setTexture(EbtInt, EsdCube);
2776 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2777 $$.basicType = EbtSampler;
2778 $$.sampler.setTexture(EbtInt, Esd2D, true);
2781 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2782 $$.basicType = EbtSampler;
2783 $$.sampler.setTexture(EbtUint, Esd2D);
2786 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2787 $$.basicType = EbtSampler;
2788 $$.sampler.setTexture(EbtUint, Esd3D);
2791 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2792 $$.basicType = EbtSampler;
2793 $$.sampler.setTexture(EbtUint, EsdCube);
2796 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2797 $$.basicType = EbtSampler;
2798 $$.sampler.setTexture(EbtUint, Esd2D, true);
2801 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2802 $$.basicType = EbtSampler;
2803 $$.sampler.setPureSampler(false);
2806 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2807 $$.basicType = EbtSampler;
2808 $$.sampler.setPureSampler(true);
2810 GLSLANG_WEB_EXCLUDE_ON
2812 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2813 $$.basicType = EbtSampler;
2814 $$.sampler.set(EbtFloat, EsdRect);
2816 | SAMPLER2DRECTSHADOW {
2817 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2818 $$.basicType = EbtSampler;
2819 $$.sampler.set(EbtFloat, EsdRect, false, true);
2821 | F16SAMPLER2DRECT {
2822 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2823 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2824 $$.basicType = EbtSampler;
2825 $$.sampler.set(EbtFloat16, EsdRect);
2827 | F16SAMPLER2DRECTSHADOW {
2828 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2829 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2830 $$.basicType = EbtSampler;
2831 $$.sampler.set(EbtFloat16, EsdRect, false, true);
2834 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2835 $$.basicType = EbtSampler;
2836 $$.sampler.set(EbtInt, EsdRect);
2839 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2840 $$.basicType = EbtSampler;
2841 $$.sampler.set(EbtUint, EsdRect);
2844 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2845 $$.basicType = EbtSampler;
2846 $$.sampler.set(EbtFloat, EsdBuffer);
2848 | F16SAMPLERBUFFER {
2849 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2850 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2851 $$.basicType = EbtSampler;
2852 $$.sampler.set(EbtFloat16, EsdBuffer);
2855 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2856 $$.basicType = EbtSampler;
2857 $$.sampler.set(EbtInt, EsdBuffer);
2860 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2861 $$.basicType = EbtSampler;
2862 $$.sampler.set(EbtUint, EsdBuffer);
2865 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2866 $$.basicType = EbtSampler;
2867 $$.sampler.set(EbtFloat, Esd2D, false, false, true);
2870 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2871 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2872 $$.basicType = EbtSampler;
2873 $$.sampler.set(EbtFloat16, Esd2D, false, false, true);
2876 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2877 $$.basicType = EbtSampler;
2878 $$.sampler.set(EbtInt, Esd2D, false, false, true);
2881 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2882 $$.basicType = EbtSampler;
2883 $$.sampler.set(EbtUint, Esd2D, false, false, true);
2885 | SAMPLER2DMSARRAY {
2886 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2887 $$.basicType = EbtSampler;
2888 $$.sampler.set(EbtFloat, Esd2D, true, false, true);
2890 | F16SAMPLER2DMSARRAY {
2891 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel());
2892 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2893 $$.basicType = EbtSampler;
2894 $$.sampler.set(EbtFloat16, Esd2D, true, false, true);
2896 | ISAMPLER2DMSARRAY {
2897 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2898 $$.basicType = EbtSampler;
2899 $$.sampler.set(EbtInt, Esd2D, true, false, true);
2901 | USAMPLER2DMSARRAY {
2902 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2903 $$.basicType = EbtSampler;
2904 $$.sampler.set(EbtUint, Esd2D, true, false, true);
2907 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2908 $$.basicType = EbtSampler;
2909 $$.sampler.setTexture(EbtFloat, Esd1D);
2912 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2913 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2914 $$.basicType = EbtSampler;
2915 $$.sampler.setTexture(EbtFloat16, Esd1D);
2918 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2919 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2920 $$.basicType = EbtSampler;
2921 $$.sampler.setTexture(EbtFloat16, Esd2D);
2924 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2925 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2926 $$.basicType = EbtSampler;
2927 $$.sampler.setTexture(EbtFloat16, Esd3D);
2930 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2931 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2932 $$.basicType = EbtSampler;
2933 $$.sampler.setTexture(EbtFloat16, EsdCube);
2936 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2937 $$.basicType = EbtSampler;
2938 $$.sampler.setTexture(EbtFloat, Esd1D, true);
2940 | F16TEXTURE1DARRAY {
2941 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2942 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2943 $$.basicType = EbtSampler;
2944 $$.sampler.setTexture(EbtFloat16, Esd1D, true);
2946 | F16TEXTURE2DARRAY {
2947 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2948 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2949 $$.basicType = EbtSampler;
2950 $$.sampler.setTexture(EbtFloat16, Esd2D, true);
2952 | F16TEXTURECUBEARRAY {
2953 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2954 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2955 $$.basicType = EbtSampler;
2956 $$.sampler.setTexture(EbtFloat16, EsdCube, true);
2959 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2960 $$.basicType = EbtSampler;
2961 $$.sampler.setTexture(EbtInt, Esd1D);
2964 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2965 $$.basicType = EbtSampler;
2966 $$.sampler.setTexture(EbtInt, Esd1D, true);
2969 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2970 $$.basicType = EbtSampler;
2971 $$.sampler.setTexture(EbtUint, Esd1D);
2974 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2975 $$.basicType = EbtSampler;
2976 $$.sampler.setTexture(EbtUint, Esd1D, true);
2979 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2980 $$.basicType = EbtSampler;
2981 $$.sampler.setTexture(EbtFloat, EsdRect);
2983 | F16TEXTURE2DRECT {
2984 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
2985 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2986 $$.basicType = EbtSampler;
2987 $$.sampler.setTexture(EbtFloat16, EsdRect);
2990 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2991 $$.basicType = EbtSampler;
2992 $$.sampler.setTexture(EbtInt, EsdRect);
2995 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
2996 $$.basicType = EbtSampler;
2997 $$.sampler.setTexture(EbtUint, EsdRect);
3000 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3001 $$.basicType = EbtSampler;
3002 $$.sampler.setTexture(EbtFloat, EsdBuffer);
3004 | F16TEXTUREBUFFER {
3005 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
3006 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3007 $$.basicType = EbtSampler;
3008 $$.sampler.setTexture(EbtFloat16, EsdBuffer);
3011 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3012 $$.basicType = EbtSampler;
3013 $$.sampler.setTexture(EbtInt, EsdBuffer);
3016 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3017 $$.basicType = EbtSampler;
3018 $$.sampler.setTexture(EbtUint, EsdBuffer);
3021 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3022 $$.basicType = EbtSampler;
3023 $$.sampler.setTexture(EbtFloat, Esd2D, false, false, true);
3026 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
3027 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3028 $$.basicType = EbtSampler;
3029 $$.sampler.setTexture(EbtFloat16, Esd2D, false, false, true);
3032 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3033 $$.basicType = EbtSampler;
3034 $$.sampler.setTexture(EbtInt, Esd2D, false, false, true);
3037 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3038 $$.basicType = EbtSampler;
3039 $$.sampler.setTexture(EbtUint, Esd2D, false, false, true);
3041 | TEXTURE2DMSARRAY {
3042 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3043 $$.basicType = EbtSampler;
3044 $$.sampler.setTexture(EbtFloat, Esd2D, true, false, true);
3046 | F16TEXTURE2DMSARRAY {
3047 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel());
3048 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3049 $$.basicType = EbtSampler;
3050 $$.sampler.setTexture(EbtFloat16, Esd2D, true, false, true);
3052 | ITEXTURE2DMSARRAY {
3053 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3054 $$.basicType = EbtSampler;
3055 $$.sampler.setTexture(EbtInt, Esd2D, true, false, true);
3057 | UTEXTURE2DMSARRAY {
3058 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3059 $$.basicType = EbtSampler;
3060 $$.sampler.setTexture(EbtUint, Esd2D, true, false, true);
3063 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3064 $$.basicType = EbtSampler;
3065 $$.sampler.setImage(EbtFloat, Esd1D);
3068 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3069 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3070 $$.basicType = EbtSampler;
3071 $$.sampler.setImage(EbtFloat16, Esd1D);
3074 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3075 $$.basicType = EbtSampler;
3076 $$.sampler.setImage(EbtInt, Esd1D);
3079 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3080 $$.basicType = EbtSampler;
3081 $$.sampler.setImage(EbtUint, Esd1D);
3084 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3085 $$.basicType = EbtSampler;
3086 $$.sampler.setImage(EbtFloat, Esd2D);
3089 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3090 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3091 $$.basicType = EbtSampler;
3092 $$.sampler.setImage(EbtFloat16, Esd2D);
3095 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3096 $$.basicType = EbtSampler;
3097 $$.sampler.setImage(EbtInt, Esd2D);
3100 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3101 $$.basicType = EbtSampler;
3102 $$.sampler.setImage(EbtUint, Esd2D);
3105 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3106 $$.basicType = EbtSampler;
3107 $$.sampler.setImage(EbtFloat, Esd3D);
3110 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3111 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3112 $$.basicType = EbtSampler;
3113 $$.sampler.setImage(EbtFloat16, Esd3D);
3116 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3117 $$.basicType = EbtSampler;
3118 $$.sampler.setImage(EbtInt, Esd3D);
3121 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3122 $$.basicType = EbtSampler;
3123 $$.sampler.setImage(EbtUint, Esd3D);
3126 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3127 $$.basicType = EbtSampler;
3128 $$.sampler.setImage(EbtFloat, EsdRect);
3131 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3132 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3133 $$.basicType = EbtSampler;
3134 $$.sampler.setImage(EbtFloat16, EsdRect);
3137 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3138 $$.basicType = EbtSampler;
3139 $$.sampler.setImage(EbtInt, EsdRect);
3142 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3143 $$.basicType = EbtSampler;
3144 $$.sampler.setImage(EbtUint, EsdRect);
3147 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3148 $$.basicType = EbtSampler;
3149 $$.sampler.setImage(EbtFloat, EsdCube);
3152 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3153 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3154 $$.basicType = EbtSampler;
3155 $$.sampler.setImage(EbtFloat16, EsdCube);
3158 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3159 $$.basicType = EbtSampler;
3160 $$.sampler.setImage(EbtInt, EsdCube);
3163 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3164 $$.basicType = EbtSampler;
3165 $$.sampler.setImage(EbtUint, EsdCube);
3168 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3169 $$.basicType = EbtSampler;
3170 $$.sampler.setImage(EbtFloat, EsdBuffer);
3173 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3174 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3175 $$.basicType = EbtSampler;
3176 $$.sampler.setImage(EbtFloat16, EsdBuffer);
3179 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3180 $$.basicType = EbtSampler;
3181 $$.sampler.setImage(EbtInt, EsdBuffer);
3184 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3185 $$.basicType = EbtSampler;
3186 $$.sampler.setImage(EbtUint, EsdBuffer);
3189 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3190 $$.basicType = EbtSampler;
3191 $$.sampler.setImage(EbtFloat, Esd1D, true);
3194 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3195 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3196 $$.basicType = EbtSampler;
3197 $$.sampler.setImage(EbtFloat16, Esd1D, true);
3200 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3201 $$.basicType = EbtSampler;
3202 $$.sampler.setImage(EbtInt, Esd1D, true);
3205 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3206 $$.basicType = EbtSampler;
3207 $$.sampler.setImage(EbtUint, Esd1D, true);
3210 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3211 $$.basicType = EbtSampler;
3212 $$.sampler.setImage(EbtFloat, Esd2D, true);
3215 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3216 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3217 $$.basicType = EbtSampler;
3218 $$.sampler.setImage(EbtFloat16, Esd2D, true);
3221 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3222 $$.basicType = EbtSampler;
3223 $$.sampler.setImage(EbtInt, Esd2D, true);
3226 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3227 $$.basicType = EbtSampler;
3228 $$.sampler.setImage(EbtUint, Esd2D, true);
3231 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3232 $$.basicType = EbtSampler;
3233 $$.sampler.setImage(EbtFloat, EsdCube, true);
3235 | F16IMAGECUBEARRAY {
3236 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3237 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3238 $$.basicType = EbtSampler;
3239 $$.sampler.setImage(EbtFloat16, EsdCube, true);
3242 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3243 $$.basicType = EbtSampler;
3244 $$.sampler.setImage(EbtInt, EsdCube, true);
3247 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3248 $$.basicType = EbtSampler;
3249 $$.sampler.setImage(EbtUint, EsdCube, true);
3252 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3253 $$.basicType = EbtSampler;
3254 $$.sampler.setImage(EbtFloat, Esd2D, false, false, true);
3257 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3258 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3259 $$.basicType = EbtSampler;
3260 $$.sampler.setImage(EbtFloat16, Esd2D, false, false, true);
3263 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3264 $$.basicType = EbtSampler;
3265 $$.sampler.setImage(EbtInt, Esd2D, false, false, true);
3268 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3269 $$.basicType = EbtSampler;
3270 $$.sampler.setImage(EbtUint, Esd2D, false, false, true);
3273 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3274 $$.basicType = EbtSampler;
3275 $$.sampler.setImage(EbtFloat, Esd2D, true, false, true);
3277 | F16IMAGE2DMSARRAY {
3278 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel());
3279 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3280 $$.basicType = EbtSampler;
3281 $$.sampler.setImage(EbtFloat16, Esd2D, true, false, true);
3284 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3285 $$.basicType = EbtSampler;
3286 $$.sampler.setImage(EbtInt, Esd2D, true, false, true);
3289 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3290 $$.basicType = EbtSampler;
3291 $$.sampler.setImage(EbtUint, Esd2D, true, false, true);
3294 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3295 $$.basicType = EbtSampler;
3296 $$.sampler.setImage(EbtInt64, Esd1D);
3299 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3300 $$.basicType = EbtSampler;
3301 $$.sampler.setImage(EbtUint64, Esd1D);
3304 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3305 $$.basicType = EbtSampler;
3306 $$.sampler.setImage(EbtInt64, Esd2D);
3309 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3310 $$.basicType = EbtSampler;
3311 $$.sampler.setImage(EbtUint64, Esd2D);
3314 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3315 $$.basicType = EbtSampler;
3316 $$.sampler.setImage(EbtInt64, Esd3D);
3319 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3320 $$.basicType = EbtSampler;
3321 $$.sampler.setImage(EbtUint64, Esd3D);
3324 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3325 $$.basicType = EbtSampler;
3326 $$.sampler.setImage(EbtInt64, EsdRect);
3329 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3330 $$.basicType = EbtSampler;
3331 $$.sampler.setImage(EbtUint64, EsdRect);
3334 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3335 $$.basicType = EbtSampler;
3336 $$.sampler.setImage(EbtInt64, EsdCube);
3339 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3340 $$.basicType = EbtSampler;
3341 $$.sampler.setImage(EbtUint64, EsdCube);
3344 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3345 $$.basicType = EbtSampler;
3346 $$.sampler.setImage(EbtInt64, EsdBuffer);
3349 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3350 $$.basicType = EbtSampler;
3351 $$.sampler.setImage(EbtUint64, EsdBuffer);
3354 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3355 $$.basicType = EbtSampler;
3356 $$.sampler.setImage(EbtInt64, Esd1D, true);
3359 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3360 $$.basicType = EbtSampler;
3361 $$.sampler.setImage(EbtUint64, Esd1D, true);
3364 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3365 $$.basicType = EbtSampler;
3366 $$.sampler.setImage(EbtInt64, Esd2D, true);
3369 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3370 $$.basicType = EbtSampler;
3371 $$.sampler.setImage(EbtUint64, Esd2D, true);
3373 | I64IMAGECUBEARRAY {
3374 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3375 $$.basicType = EbtSampler;
3376 $$.sampler.setImage(EbtInt64, EsdCube, true);
3378 | U64IMAGECUBEARRAY {
3379 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3380 $$.basicType = EbtSampler;
3381 $$.sampler.setImage(EbtUint64, EsdCube, true);
3384 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3385 $$.basicType = EbtSampler;
3386 $$.sampler.setImage(EbtInt64, Esd2D, false, false, true);
3389 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3390 $$.basicType = EbtSampler;
3391 $$.sampler.setImage(EbtUint64, Esd2D, false, false, true);
3393 | I64IMAGE2DMSARRAY {
3394 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3395 $$.basicType = EbtSampler;
3396 $$.sampler.setImage(EbtInt64, Esd2D, true, false, true);
3398 | U64IMAGE2DMSARRAY {
3399 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3400 $$.basicType = EbtSampler;
3401 $$.sampler.setImage(EbtUint64, Esd2D, true, false, true);
3403 | SAMPLEREXTERNALOES { // GL_OES_EGL_image_external
3404 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3405 $$.basicType = EbtSampler;
3406 $$.sampler.set(EbtFloat, Esd2D);
3407 $$.sampler.external = true;
3409 | SAMPLEREXTERNAL2DY2YEXT { // GL_EXT_YUV_target
3410 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3411 $$.basicType = EbtSampler;
3412 $$.sampler.set(EbtFloat, Esd2D);
3413 $$.sampler.yuv = true;
3416 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3417 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3418 $$.basicType = EbtSampler;
3419 $$.sampler.setSubpass(EbtFloat);
3422 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3423 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3424 $$.basicType = EbtSampler;
3425 $$.sampler.setSubpass(EbtFloat, true);
3428 parseContext.float16OpaqueCheck($1.loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel());
3429 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3430 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3431 $$.basicType = EbtSampler;
3432 $$.sampler.setSubpass(EbtFloat16);
3434 | F16SUBPASSINPUTMS {
3435 parseContext.float16OpaqueCheck($1.loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel());
3436 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3437 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3438 $$.basicType = EbtSampler;
3439 $$.sampler.setSubpass(EbtFloat16, true);
3442 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3443 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3444 $$.basicType = EbtSampler;
3445 $$.sampler.setSubpass(EbtInt);
3448 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3449 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3450 $$.basicType = EbtSampler;
3451 $$.sampler.setSubpass(EbtInt, true);
3454 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3455 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3456 $$.basicType = EbtSampler;
3457 $$.sampler.setSubpass(EbtUint);
3460 parseContext.requireStage($1.loc, EShLangFragment, "subpass input");
3461 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3462 $$.basicType = EbtSampler;
3463 $$.sampler.setSubpass(EbtUint, true);
3466 parseContext.fcoopmatCheck($1.loc, "fcoopmatNV", parseContext.symbolTable.atBuiltInLevel());
3467 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3468 $$.basicType = EbtFloat;
3472 parseContext.intcoopmatCheck($1.loc, "icoopmatNV", parseContext.symbolTable.atBuiltInLevel());
3473 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3474 $$.basicType = EbtInt;
3478 parseContext.intcoopmatCheck($1.loc, "ucoopmatNV", parseContext.symbolTable.atBuiltInLevel());
3479 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3480 $$.basicType = EbtUint;
3483 | spirv_type_specifier {
3484 parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_spirv_intrinsics, "SPIR-V type specifier");
3487 GLSLANG_WEB_EXCLUDE_OFF
3488 | struct_specifier {
3490 $$.qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
3491 parseContext.structTypeCheck($$.loc, $$);
3495 // This is for user defined type names. The lexical phase looked up the
3498 if (const TVariable* variable = ($1.symbol)->getAsVariable()) {
3499 const TType& structure = variable->getType();
3500 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3501 $$.basicType = EbtStruct;
3502 $$.userDef = &structure;
3504 parseContext.error($1.loc, "expected type name", $1.string->c_str(), "");
3510 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "highp precision qualifier");
3511 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3512 parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqHigh);
3514 | MEDIUM_PRECISION {
3515 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "mediump precision qualifier");
3516 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3517 parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqMedium);
3520 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "lowp precision qualifier");
3521 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
3522 parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqLow);
3527 : STRUCT IDENTIFIER LEFT_BRACE { parseContext.nestedStructCheck($1.loc); } struct_declaration_list RIGHT_BRACE {
3528 TType* structure = new TType($5, *$2.string);
3529 parseContext.structArrayCheck($2.loc, *structure);
3530 TVariable* userTypeDef = new TVariable($2.string, *structure, true);
3531 if (! parseContext.symbolTable.insert(*userTypeDef))
3532 parseContext.error($2.loc, "redefinition", $2.string->c_str(), "struct");
3534 $$.basicType = EbtStruct;
3535 $$.userDef = structure;
3536 --parseContext.structNestingLevel;
3538 | STRUCT LEFT_BRACE { parseContext.nestedStructCheck($1.loc); } struct_declaration_list RIGHT_BRACE {
3539 TType* structure = new TType($4, TString(""));
3541 $$.basicType = EbtStruct;
3542 $$.userDef = structure;
3543 --parseContext.structNestingLevel;
3547 struct_declaration_list
3548 : struct_declaration {
3551 | struct_declaration_list struct_declaration {
3553 for (unsigned int i = 0; i < $2->size(); ++i) {
3554 for (unsigned int j = 0; j < $$->size(); ++j) {
3555 if ((*$$)[j].type->getFieldName() == (*$2)[i].type->getFieldName())
3556 parseContext.error((*$2)[i].loc, "duplicate member name:", "", (*$2)[i].type->getFieldName().c_str());
3558 $$->push_back((*$2)[i]);
3564 : type_specifier struct_declarator_list SEMICOLON {
3565 if ($1.arraySizes) {
3566 parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
3567 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
3568 if (parseContext.isEsProfile())
3569 parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes);
3574 parseContext.voidErrorCheck($1.loc, (*$2)[0].type->getFieldName(), $1.basicType);
3575 parseContext.precisionQualifierCheck($1.loc, $1.basicType, $1.qualifier);
3577 for (unsigned int i = 0; i < $$->size(); ++i) {
3579 type.setFieldName((*$$)[i].type->getFieldName());
3580 type.transferArraySizes((*$$)[i].type->getArraySizes());
3581 type.copyArrayInnerSizes($1.arraySizes);
3582 parseContext.arrayOfArrayVersionCheck((*$$)[i].loc, type.getArraySizes());
3583 (*$$)[i].type->shallowCopy(type);
3586 | type_qualifier type_specifier struct_declarator_list SEMICOLON {
3587 if ($2.arraySizes) {
3588 parseContext.profileRequires($2.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
3589 parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type");
3590 if (parseContext.isEsProfile())
3591 parseContext.arraySizeRequiredCheck($2.loc, *$2.arraySizes);
3596 parseContext.memberQualifierCheck($1);
3597 parseContext.voidErrorCheck($2.loc, (*$3)[0].type->getFieldName(), $2.basicType);
3598 parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true);
3599 parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier);
3601 for (unsigned int i = 0; i < $$->size(); ++i) {
3603 type.setFieldName((*$$)[i].type->getFieldName());
3604 type.transferArraySizes((*$$)[i].type->getArraySizes());
3605 type.copyArrayInnerSizes($2.arraySizes);
3606 parseContext.arrayOfArrayVersionCheck((*$$)[i].loc, type.getArraySizes());
3607 (*$$)[i].type->shallowCopy(type);
3612 struct_declarator_list
3613 : struct_declarator {
3617 | struct_declarator_list COMMA struct_declarator {
3624 $$.type = new TType(EbtVoid);
3626 $$.type->setFieldName(*$1.string);
3628 | IDENTIFIER array_specifier {
3629 parseContext.arrayOfArrayVersionCheck($1.loc, $2.arraySizes);
3631 $$.type = new TType(EbtVoid);
3633 $$.type->setFieldName(*$1.string);
3634 $$.type->transferArraySizes($2.arraySizes);
3639 : assignment_expression {
3642 GLSLANG_WEB_EXCLUDE_ON
3643 | LEFT_BRACE initializer_list RIGHT_BRACE {
3644 const char* initFeature = "{ } style initializers";
3645 parseContext.requireProfile($1.loc, ~EEsProfile, initFeature);
3646 parseContext.profileRequires($1.loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature);
3649 | LEFT_BRACE initializer_list COMMA RIGHT_BRACE {
3650 const char* initFeature = "{ } style initializers";
3651 parseContext.requireProfile($1.loc, ~EEsProfile, initFeature);
3652 parseContext.profileRequires($1.loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature);
3655 | LEFT_BRACE RIGHT_BRACE {
3656 const char* initFeature = "empty { } initializer";
3657 parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_EXT_null_initializer, initFeature);
3658 parseContext.profileRequires($1.loc, ~EEsProfile, 0, E_GL_EXT_null_initializer, initFeature);
3659 $$ = parseContext.intermediate.makeAggregate($1.loc);
3661 GLSLANG_WEB_EXCLUDE_OFF
3664 GLSLANG_WEB_EXCLUDE_ON
3667 $$ = parseContext.intermediate.growAggregate(0, $1, $1->getLoc());
3669 | initializer_list COMMA initializer {
3670 $$ = parseContext.intermediate.growAggregate($1, $3);
3673 GLSLANG_WEB_EXCLUDE_OFF
3675 declaration_statement
3676 : declaration { $$ = $1; }
3680 : compound_statement { $$ = $1; }
3681 | simple_statement { $$ = $1; }
3684 // Grammar Note: labeled statements for switch statements only; 'goto' is not supported.
3687 : declaration_statement { $$ = $1; }
3688 | expression_statement { $$ = $1; }
3689 | selection_statement { $$ = $1; }
3690 | switch_statement { $$ = $1; }
3691 | case_label { $$ = $1; }
3692 | iteration_statement { $$ = $1; }
3693 | jump_statement { $$ = $1; }
3694 GLSLANG_WEB_EXCLUDE_ON
3695 | demote_statement { $$ = $1; }
3696 GLSLANG_WEB_EXCLUDE_OFF
3699 GLSLANG_WEB_EXCLUDE_ON
3701 : DEMOTE SEMICOLON {
3702 parseContext.requireStage($1.loc, EShLangFragment, "demote");
3703 parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_demote_to_helper_invocation, "demote");
3704 $$ = parseContext.intermediate.addBranch(EOpDemote, $1.loc);
3707 GLSLANG_WEB_EXCLUDE_OFF
3710 : LEFT_BRACE RIGHT_BRACE { $$ = 0; }
3712 parseContext.symbolTable.push();
3713 ++parseContext.statementNestingLevel;
3716 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3717 --parseContext.statementNestingLevel;
3720 if ($3 && $3->getAsAggregate())
3721 $3->getAsAggregate()->setOperator(EOpSequence);
3726 statement_no_new_scope
3727 : compound_statement_no_new_scope { $$ = $1; }
3728 | simple_statement { $$ = $1; }
3733 ++parseContext.controlFlowNestingLevel;
3735 compound_statement {
3736 --parseContext.controlFlowNestingLevel;
3740 parseContext.symbolTable.push();
3741 ++parseContext.statementNestingLevel;
3742 ++parseContext.controlFlowNestingLevel;
3745 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3746 --parseContext.statementNestingLevel;
3747 --parseContext.controlFlowNestingLevel;
3751 compound_statement_no_new_scope
3752 // Statement that doesn't create a new scope, for selection_statement, iteration_statement
3753 : LEFT_BRACE RIGHT_BRACE {
3756 | LEFT_BRACE statement_list RIGHT_BRACE {
3757 if ($2 && $2->getAsAggregate())
3758 $2->getAsAggregate()->setOperator(EOpSequence);
3765 $$ = parseContext.intermediate.makeAggregate($1);
3766 if ($1 && $1->getAsBranchNode() && ($1->getAsBranchNode()->getFlowOp() == EOpCase ||
3767 $1->getAsBranchNode()->getFlowOp() == EOpDefault)) {
3768 parseContext.wrapupSwitchSubsequence(0, $1);
3769 $$ = 0; // start a fresh subsequence for what's after this case
3772 | statement_list statement {
3773 if ($2 && $2->getAsBranchNode() && ($2->getAsBranchNode()->getFlowOp() == EOpCase ||
3774 $2->getAsBranchNode()->getFlowOp() == EOpDefault)) {
3775 parseContext.wrapupSwitchSubsequence($1 ? $1->getAsAggregate() : 0, $2);
3776 $$ = 0; // start a fresh subsequence for what's after this case
3778 $$ = parseContext.intermediate.growAggregate($1, $2);
3782 expression_statement
3783 : SEMICOLON { $$ = 0; }
3784 | expression SEMICOLON { $$ = static_cast<TIntermNode*>($1); }
3788 : selection_statement_nonattributed {
3791 GLSLANG_WEB_EXCLUDE_ON
3792 | attribute selection_statement_nonattributed {
3793 parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute");
3794 parseContext.handleSelectionAttributes(*$1, $2);
3797 GLSLANG_WEB_EXCLUDE_OFF
3799 selection_statement_nonattributed
3800 : IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement {
3801 parseContext.boolCheck($1.loc, $3);
3802 $$ = parseContext.intermediate.addSelection($3, $5, $1.loc);
3806 selection_rest_statement
3807 : statement_scoped ELSE statement_scoped {
3811 | statement_scoped {
3818 // In 1996 c++ draft, conditions can include single declarations
3821 parseContext.boolCheck($1->getLoc(), $1);
3823 | fully_specified_type IDENTIFIER EQUAL initializer {
3824 parseContext.boolCheck($2.loc, $1);
3827 TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, 0, $4);
3829 $$ = initNode->getAsTyped();
3836 : switch_statement_nonattributed {
3839 GLSLANG_WEB_EXCLUDE_ON
3840 | attribute switch_statement_nonattributed {
3841 parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute");
3842 parseContext.handleSwitchAttributes(*$1, $2);
3845 GLSLANG_WEB_EXCLUDE_OFF
3847 switch_statement_nonattributed
3848 : SWITCH LEFT_PAREN expression RIGHT_PAREN {
3849 // start new switch sequence on the switch stack
3850 ++parseContext.controlFlowNestingLevel;
3851 ++parseContext.statementNestingLevel;
3852 parseContext.switchSequenceStack.push_back(new TIntermSequence);
3853 parseContext.switchLevel.push_back(parseContext.statementNestingLevel);
3854 parseContext.symbolTable.push();
3856 LEFT_BRACE switch_statement_list RIGHT_BRACE {
3857 $$ = parseContext.addSwitch($1.loc, $3, $7 ? $7->getAsAggregate() : 0);
3858 delete parseContext.switchSequenceStack.back();
3859 parseContext.switchSequenceStack.pop_back();
3860 parseContext.switchLevel.pop_back();
3861 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3862 --parseContext.statementNestingLevel;
3863 --parseContext.controlFlowNestingLevel;
3867 switch_statement_list
3877 : CASE expression COLON {
3879 if (parseContext.switchLevel.size() == 0)
3880 parseContext.error($1.loc, "cannot appear outside switch statement", "case", "");
3881 else if (parseContext.switchLevel.back() != parseContext.statementNestingLevel)
3882 parseContext.error($1.loc, "cannot be nested inside control flow", "case", "");
3884 parseContext.constantValueCheck($2, "case");
3885 parseContext.integerCheck($2, "case");
3886 $$ = parseContext.intermediate.addBranch(EOpCase, $2, $1.loc);
3891 if (parseContext.switchLevel.size() == 0)
3892 parseContext.error($1.loc, "cannot appear outside switch statement", "default", "");
3893 else if (parseContext.switchLevel.back() != parseContext.statementNestingLevel)
3894 parseContext.error($1.loc, "cannot be nested inside control flow", "default", "");
3896 $$ = parseContext.intermediate.addBranch(EOpDefault, $1.loc);
3901 : iteration_statement_nonattributed {
3904 GLSLANG_WEB_EXCLUDE_ON
3905 | attribute iteration_statement_nonattributed {
3906 parseContext.requireExtensions($2->getLoc(), 1, &E_GL_EXT_control_flow_attributes, "attribute");
3907 parseContext.handleLoopAttributes(*$1, $2);
3910 GLSLANG_WEB_EXCLUDE_OFF
3912 iteration_statement_nonattributed
3913 : WHILE LEFT_PAREN {
3914 if (! parseContext.limits.whileLoops)
3915 parseContext.error($1.loc, "while loops not available", "limitation", "");
3916 parseContext.symbolTable.push();
3917 ++parseContext.loopNestingLevel;
3918 ++parseContext.statementNestingLevel;
3919 ++parseContext.controlFlowNestingLevel;
3921 condition RIGHT_PAREN statement_no_new_scope {
3922 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3923 $$ = parseContext.intermediate.addLoop($6, $4, 0, true, $1.loc);
3924 --parseContext.loopNestingLevel;
3925 --parseContext.statementNestingLevel;
3926 --parseContext.controlFlowNestingLevel;
3929 parseContext.symbolTable.push();
3930 ++parseContext.loopNestingLevel;
3931 ++parseContext.statementNestingLevel;
3932 ++parseContext.controlFlowNestingLevel;
3934 statement WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON {
3935 if (! parseContext.limits.whileLoops)
3936 parseContext.error($1.loc, "do-while loops not available", "limitation", "");
3938 parseContext.boolCheck($8.loc, $6);
3940 $$ = parseContext.intermediate.addLoop($3, $6, 0, false, $4.loc);
3941 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3942 --parseContext.loopNestingLevel;
3943 --parseContext.statementNestingLevel;
3944 --parseContext.controlFlowNestingLevel;
3947 parseContext.symbolTable.push();
3948 ++parseContext.loopNestingLevel;
3949 ++parseContext.statementNestingLevel;
3950 ++parseContext.controlFlowNestingLevel;
3952 for_init_statement for_rest_statement RIGHT_PAREN statement_no_new_scope {
3953 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
3954 $$ = parseContext.intermediate.makeAggregate($4, $2.loc);
3955 TIntermLoop* forLoop = parseContext.intermediate.addLoop($7, reinterpret_cast<TIntermTyped*>($5.node1), reinterpret_cast<TIntermTyped*>($5.node2), true, $1.loc);
3956 if (! parseContext.limits.nonInductiveForLoops)
3957 parseContext.inductiveLoopCheck($1.loc, $4, forLoop);
3958 $$ = parseContext.intermediate.growAggregate($$, forLoop, $1.loc);
3959 $$->getAsAggregate()->setOperator(EOpSequence);
3960 --parseContext.loopNestingLevel;
3961 --parseContext.statementNestingLevel;
3962 --parseContext.controlFlowNestingLevel;
3967 : expression_statement {
3970 | declaration_statement {
3979 | /* May be null */ {
3985 : conditionopt SEMICOLON {
3989 | conditionopt SEMICOLON expression {
3996 : CONTINUE SEMICOLON {
3997 if (parseContext.loopNestingLevel <= 0)
3998 parseContext.error($1.loc, "continue statement only allowed in loops", "", "");
3999 $$ = parseContext.intermediate.addBranch(EOpContinue, $1.loc);
4002 if (parseContext.loopNestingLevel + parseContext.switchSequenceStack.size() <= 0)
4003 parseContext.error($1.loc, "break statement only allowed in switch and loops", "", "");
4004 $$ = parseContext.intermediate.addBranch(EOpBreak, $1.loc);
4006 | RETURN SEMICOLON {
4007 $$ = parseContext.intermediate.addBranch(EOpReturn, $1.loc);
4008 if (parseContext.currentFunctionType->getBasicType() != EbtVoid)
4009 parseContext.error($1.loc, "non-void function must return a value", "return", "");
4010 if (parseContext.inMain)
4011 parseContext.postEntryPointReturn = true;
4013 | RETURN expression SEMICOLON {
4014 $$ = parseContext.handleReturnValue($1.loc, $2);
4016 | DISCARD SEMICOLON {
4017 parseContext.requireStage($1.loc, EShLangFragment, "discard");
4018 $$ = parseContext.intermediate.addBranch(EOpKill, $1.loc);
4020 | TERMINATE_INVOCATION SEMICOLON {
4021 parseContext.requireStage($1.loc, EShLangFragment, "terminateInvocation");
4022 $$ = parseContext.intermediate.addBranch(EOpTerminateInvocation, $1.loc);
4024 GLSLANG_WEB_EXCLUDE_ON
4025 | TERMINATE_RAY SEMICOLON {
4026 parseContext.requireStage($1.loc, EShLangAnyHit, "terminateRayEXT");
4027 $$ = parseContext.intermediate.addBranch(EOpTerminateRayKHR, $1.loc);
4029 | IGNORE_INTERSECTION SEMICOLON {
4030 parseContext.requireStage($1.loc, EShLangAnyHit, "ignoreIntersectionEXT");
4031 $$ = parseContext.intermediate.addBranch(EOpIgnoreIntersectionKHR, $1.loc);
4033 GLSLANG_WEB_EXCLUDE_OFF
4036 // Grammar Note: No 'goto'. Gotos are not supported.
4039 : external_declaration {
4041 parseContext.intermediate.setTreeRoot($$);
4043 | translation_unit external_declaration {
4044 if ($2 != nullptr) {
4045 $$ = parseContext.intermediate.growAggregate($1, $2);
4046 parseContext.intermediate.setTreeRoot($$);
4051 external_declaration
4052 : function_definition {
4058 GLSLANG_WEB_EXCLUDE_ON
4060 parseContext.requireProfile($1.loc, ~EEsProfile, "extraneous semicolon");
4061 parseContext.profileRequires($1.loc, ~EEsProfile, 460, nullptr, "extraneous semicolon");
4064 GLSLANG_WEB_EXCLUDE_OFF
4068 : function_prototype {
4069 $1.function = parseContext.handleFunctionDeclarator($1.loc, *$1.function, false /* not prototype */);
4070 $1.intermNode = parseContext.handleFunctionDefinition($1.loc, *$1.function);
4072 // For ES 100 only, according to ES shading language 100 spec: A function
4073 // body has a scope nested inside the function's definition.
4074 if (parseContext.profile == EEsProfile && parseContext.version == 100)
4076 parseContext.symbolTable.push();
4077 ++parseContext.statementNestingLevel;
4080 compound_statement_no_new_scope {
4081 // May be best done as post process phase on intermediate code
4082 if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue)
4083 parseContext.error($1.loc, "function does not return a value:", "", $1.function->getName().c_str());
4084 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
4085 $$ = parseContext.intermediate.growAggregate($1.intermNode, $3);
4086 parseContext.intermediate.setAggregateOperator($$, EOpFunction, $1.function->getType(), $1.loc);
4087 $$->getAsAggregate()->setName($1.function->getMangledName().c_str());
4089 // store the pragma information for debug and optimize and other vendor specific
4090 // information. This information can be queried from the parse tree
4091 $$->getAsAggregate()->setOptimize(parseContext.contextPragma.optimize);
4092 $$->getAsAggregate()->setDebug(parseContext.contextPragma.debug);
4093 $$->getAsAggregate()->setPragmaTable(parseContext.contextPragma.pragmaTable);
4095 // Set currentFunctionType to empty pointer when goes outside of the function
4096 parseContext.currentFunctionType = nullptr;
4098 // For ES 100 only, according to ES shading language 100 spec: A function
4099 // body has a scope nested inside the function's definition.
4100 if (parseContext.profile == EEsProfile && parseContext.version == 100)
4102 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]);
4103 --parseContext.statementNestingLevel;
4108 GLSLANG_WEB_EXCLUDE_ON
4110 : LEFT_BRACKET LEFT_BRACKET attribute_list RIGHT_BRACKET RIGHT_BRACKET {
4115 : single_attribute {
4118 | attribute_list COMMA single_attribute {
4119 $$ = parseContext.mergeAttributes($1, $3);
4124 $$ = parseContext.makeAttributes(*$1.string);
4126 | IDENTIFIER LEFT_PAREN constant_expression RIGHT_PAREN {
4127 $$ = parseContext.makeAttributes(*$1.string, $3);
4129 GLSLANG_WEB_EXCLUDE_OFF
4131 GLSLANG_WEB_EXCLUDE_ON
4132 spirv_requirements_list
4133 : spirv_requirements_parameter {
4136 | spirv_requirements_list COMMA spirv_requirements_parameter {
4137 $$ = parseContext.mergeSpirvRequirements($2.loc, $1, $3);
4140 spirv_requirements_parameter
4141 : IDENTIFIER EQUAL LEFT_BRACKET spirv_extension_list RIGHT_BRACKET {
4142 $$ = parseContext.makeSpirvRequirement($2.loc, *$1.string, $4->getAsAggregate(), nullptr);
4144 | IDENTIFIER EQUAL LEFT_BRACKET spirv_capability_list RIGHT_BRACKET {
4145 $$ = parseContext.makeSpirvRequirement($2.loc, *$1.string, nullptr, $4->getAsAggregate());
4148 spirv_extension_list
4150 $$ = parseContext.intermediate.makeAggregate(parseContext.intermediate.addConstantUnion($1.string, $1.loc, true));
4152 | spirv_extension_list COMMA STRING_LITERAL {
4153 $$ = parseContext.intermediate.growAggregate($1, parseContext.intermediate.addConstantUnion($3.string, $3.loc, true));
4156 spirv_capability_list
4158 $$ = parseContext.intermediate.makeAggregate(parseContext.intermediate.addConstantUnion($1.i, $1.loc, true));
4160 | spirv_capability_list COMMA INTCONSTANT {
4161 $$ = parseContext.intermediate.growAggregate($1, parseContext.intermediate.addConstantUnion($3.i, $3.loc, true));
4164 spirv_execution_mode_qualifier
4165 : SPIRV_EXECUTION_MODE LEFT_PAREN INTCONSTANT RIGHT_PAREN {
4166 parseContext.intermediate.insertSpirvExecutionMode($3.i);
4169 | SPIRV_EXECUTION_MODE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN {
4170 parseContext.intermediate.insertSpirvRequirement($3);
4171 parseContext.intermediate.insertSpirvExecutionMode($5.i);
4174 | SPIRV_EXECUTION_MODE LEFT_PAREN INTCONSTANT COMMA spirv_execution_mode_parameter_list RIGHT_PAREN {
4175 parseContext.intermediate.insertSpirvExecutionMode($3.i, $5->getAsAggregate());
4178 | SPIRV_EXECUTION_MODE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_execution_mode_parameter_list RIGHT_PAREN {
4179 parseContext.intermediate.insertSpirvRequirement($3);
4180 parseContext.intermediate.insertSpirvExecutionMode($5.i, $7->getAsAggregate());
4183 | SPIRV_EXECUTION_MODE_ID LEFT_PAREN INTCONSTANT COMMA spirv_execution_mode_id_parameter_list RIGHT_PAREN {
4184 parseContext.intermediate.insertSpirvExecutionModeId($3.i, $5->getAsAggregate());
4187 | SPIRV_EXECUTION_MODE_ID LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_execution_mode_id_parameter_list RIGHT_PAREN {
4188 parseContext.intermediate.insertSpirvRequirement($3);
4189 parseContext.intermediate.insertSpirvExecutionModeId($5.i, $7->getAsAggregate());
4193 spirv_execution_mode_parameter_list
4194 : spirv_execution_mode_parameter {
4195 $$ = parseContext.intermediate.makeAggregate($1);
4197 | spirv_execution_mode_parameter_list COMMA spirv_execution_mode_parameter {
4198 $$ = parseContext.intermediate.growAggregate($1, $3);
4201 spirv_execution_mode_parameter
4203 $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true);
4206 $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true);
4209 $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true);
4212 $$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true);
4215 $$ = parseContext.intermediate.addConstantUnion($1.string, $1.loc, true);
4218 spirv_execution_mode_id_parameter_list
4219 : constant_expression {
4220 if ($1->getBasicType() != EbtFloat &&
4221 $1->getBasicType() != EbtInt &&
4222 $1->getBasicType() != EbtUint &&
4223 $1->getBasicType() != EbtBool &&
4224 $1->getBasicType() != EbtString)
4225 parseContext.error($1->getLoc(), "this type not allowed", $1->getType().getBasicString(), "");
4226 $$ = parseContext.intermediate.makeAggregate($1);
4228 | spirv_execution_mode_id_parameter_list COMMA constant_expression {
4229 if ($3->getBasicType() != EbtFloat &&
4230 $3->getBasicType() != EbtInt &&
4231 $3->getBasicType() != EbtUint &&
4232 $3->getBasicType() != EbtBool &&
4233 $3->getBasicType() != EbtString)
4234 parseContext.error($3->getLoc(), "this type not allowed", $3->getType().getBasicString(), "");
4235 $$ = parseContext.intermediate.growAggregate($1, $3);
4238 spirv_storage_class_qualifier
4239 : SPIRV_STORAGE_CLASS LEFT_PAREN INTCONSTANT RIGHT_PAREN {
4241 $$.qualifier.storage = EvqSpirvStorageClass;
4242 $$.qualifier.spirvStorageClass = $3.i;
4244 | SPIRV_STORAGE_CLASS LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN {
4246 parseContext.intermediate.insertSpirvRequirement($3);
4247 $$.qualifier.storage = EvqSpirvStorageClass;
4248 $$.qualifier.spirvStorageClass = $5.i;
4251 spirv_decorate_qualifier
4252 : SPIRV_DECORATE LEFT_PAREN INTCONSTANT RIGHT_PAREN{
4254 $$.qualifier.setSpirvDecorate($3.i);
4256 | SPIRV_DECORATE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT RIGHT_PAREN{
4258 parseContext.intermediate.insertSpirvRequirement($3);
4259 $$.qualifier.setSpirvDecorate($5.i);
4261 | SPIRV_DECORATE LEFT_PAREN INTCONSTANT COMMA spirv_decorate_parameter_list RIGHT_PAREN {
4263 $$.qualifier.setSpirvDecorate($3.i, $5->getAsAggregate());
4265 | SPIRV_DECORATE LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_parameter_list RIGHT_PAREN {
4267 parseContext.intermediate.insertSpirvRequirement($3);
4268 $$.qualifier.setSpirvDecorate($5.i, $7->getAsAggregate());
4270 | SPIRV_DECORATE_ID LEFT_PAREN INTCONSTANT COMMA spirv_decorate_id_parameter_list RIGHT_PAREN {
4272 $$.qualifier.setSpirvDecorateId($3.i, $5->getAsAggregate());
4274 | SPIRV_DECORATE_ID LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_id_parameter_list RIGHT_PAREN {
4276 parseContext.intermediate.insertSpirvRequirement($3);
4277 $$.qualifier.setSpirvDecorateId($5.i, $7->getAsAggregate());
4279 | SPIRV_DECORATE_STRING LEFT_PAREN INTCONSTANT COMMA spirv_decorate_string_parameter_list RIGHT_PAREN {
4281 $$.qualifier.setSpirvDecorateString($3.i, $5->getAsAggregate());
4283 | SPIRV_DECORATE_STRING LEFT_PAREN spirv_requirements_list COMMA INTCONSTANT COMMA spirv_decorate_string_parameter_list RIGHT_PAREN {
4285 parseContext.intermediate.insertSpirvRequirement($3);
4286 $$.qualifier.setSpirvDecorateString($5.i, $7->getAsAggregate());
4289 spirv_decorate_parameter_list
4290 : spirv_decorate_parameter {
4291 $$ = parseContext.intermediate.makeAggregate($1);
4293 | spirv_decorate_parameter_list COMMA spirv_decorate_parameter {
4294 $$ = parseContext.intermediate.growAggregate($1, $3);
4297 spirv_decorate_parameter
4299 $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true);
4302 $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true);
4305 $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true);
4308 $$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true);
4311 spirv_decorate_id_parameter_list
4312 : constant_expression {
4313 if ($1->getBasicType() != EbtFloat &&
4314 $1->getBasicType() != EbtInt &&
4315 $1->getBasicType() != EbtUint &&
4316 $1->getBasicType() != EbtBool)
4317 parseContext.error($1->getLoc(), "this type not allowed", $1->getType().getBasicString(), "");
4318 $$ = parseContext.intermediate.makeAggregate($1);
4320 | spirv_decorate_id_parameter_list COMMA constant_expression {
4321 if ($3->getBasicType() != EbtFloat &&
4322 $3->getBasicType() != EbtInt &&
4323 $3->getBasicType() != EbtUint &&
4324 $3->getBasicType() != EbtBool)
4325 parseContext.error($3->getLoc(), "this type not allowed", $3->getType().getBasicString(), "");
4326 $$ = parseContext.intermediate.growAggregate($1, $3);
4329 spirv_decorate_string_parameter_list
4331 $$ = parseContext.intermediate.makeAggregate(
4332 parseContext.intermediate.addConstantUnion($1.string, $1.loc, true));
4334 | spirv_decorate_string_parameter_list COMMA STRING_LITERAL {
4335 $$ = parseContext.intermediate.growAggregate($1, parseContext.intermediate.addConstantUnion($3.string, $3.loc, true));
4338 spirv_type_specifier
4339 : SPIRV_TYPE LEFT_PAREN spirv_instruction_qualifier_list COMMA spirv_type_parameter_list RIGHT_PAREN {
4340 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
4341 $$.setSpirvType(*$3, $5);
4343 | SPIRV_TYPE LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list COMMA spirv_type_parameter_list RIGHT_PAREN {
4344 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
4345 parseContext.intermediate.insertSpirvRequirement($3);
4346 $$.setSpirvType(*$5, $7);
4348 | SPIRV_TYPE LEFT_PAREN spirv_instruction_qualifier_list RIGHT_PAREN {
4349 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
4350 $$.setSpirvType(*$3);
4352 | SPIRV_TYPE LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list RIGHT_PAREN {
4353 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
4354 parseContext.intermediate.insertSpirvRequirement($3);
4355 $$.setSpirvType(*$5);
4358 spirv_type_parameter_list
4359 : spirv_type_parameter {
4362 | spirv_type_parameter_list COMMA spirv_type_parameter {
4363 $$ = parseContext.mergeSpirvTypeParameters($1, $3);
4366 spirv_type_parameter
4367 : constant_expression {
4368 $$ = parseContext.makeSpirvTypeParameters($1->getLoc(), $1->getAsConstantUnion());
4371 $$ = parseContext.makeSpirvTypeParameters($1);
4374 spirv_instruction_qualifier
4375 : SPIRV_INSTRUCTION LEFT_PAREN spirv_instruction_qualifier_list RIGHT_PAREN {
4378 | SPIRV_INSTRUCTION LEFT_PAREN spirv_requirements_list COMMA spirv_instruction_qualifier_list RIGHT_PAREN {
4379 parseContext.intermediate.insertSpirvRequirement($3);
4383 spirv_instruction_qualifier_list
4384 : spirv_instruction_qualifier_id {
4387 | spirv_instruction_qualifier_list COMMA spirv_instruction_qualifier_id {
4388 $$ = parseContext.mergeSpirvInstruction($2.loc, $1, $3);
4391 spirv_instruction_qualifier_id
4392 : IDENTIFIER EQUAL STRING_LITERAL {
4393 $$ = parseContext.makeSpirvInstruction($2.loc, *$1.string, *$3.string);
4395 | IDENTIFIER EQUAL INTCONSTANT {
4396 $$ = parseContext.makeSpirvInstruction($2.loc, *$1.string, $3.i);
4398 GLSLANG_WEB_EXCLUDE_OFF