1 // 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. 7 // 8 // All rights reserved. 9 // 10 // Redistribution and use in source and binary forms, with or without 11 // modification, are permitted provided that the following conditions 12 // are met: 13 // 14 // Redistributions of source code must retain the above copyright 15 // notice, this list of conditions and the following disclaimer. 16 // 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. 21 // 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. 25 // 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. 38 // 39 40 // 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. 44 // 45 // Code sandwiched between a pair: 46 // 47 // GLSLANG_WEB_EXCLUDE_ON 48 // ... 49 // ... 50 // ... 51 // GLSLANG_WEB_EXCLUDE_OFF 52 // 53 // Will be excluded from the grammar when m4 is executed as: 54 // 55 // m4 -P -DGLSLANG_WEB 56 // 57 // It will be included when m4 is executed as: 58 // 59 // m4 -P 60 // 61 62 63 64 65 /** 66 * This is bison grammar and productions for parsing all versions of the 67 * GLSL shading languages. 68 */ 69 %{ 70 71 /* Based on: 72 ANSI C Yacc grammar 73 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. 79 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. 82 83 Jutta Degener, 1995 84 */ 85 86 #include "SymbolTable.h" 87 #include "ParseHelper.h" 88 #include "../Public/ShaderLang.h" 89 #include "attribute.h" 90 91 using namespace glslang; 92 93 %} 94 95 %define parse.error verbose 96 97 %union { 98 struct { 99 glslang::TSourceLoc loc; 100 union { 101 glslang::TString *string; 102 int i; 103 unsigned int u; 104 long long i64; 105 unsigned long long u64; 106 bool b; 107 double d; 108 }; 109 glslang::TSymbol* symbol; 110 } lex; 111 struct { 112 glslang::TSourceLoc loc; 113 glslang::TOperator op; 114 union { 115 TIntermNode* intermNode; 116 glslang::TIntermNodePair nodePair; 117 glslang::TIntermTyped* intermTypedNode; 118 glslang::TAttributes* attributes; 119 }; 120 union { 121 glslang::TPublicType type; 122 glslang::TFunction* function; 123 glslang::TParameter param; 124 glslang::TTypeLoc typeLine; 125 glslang::TTypeList* typeList; 126 glslang::TArraySizes* arraySizes; 127 glslang::TIdentifierList* identifierList; 128 }; 129 glslang::TArraySizes* typeParameters; 130 } interm; 131 } 132 133 %{ 134 135 /* windows only pragma */ 136 #ifdef _MSC_VER 137 #pragma warning(disable : 4065) 138 #pragma warning(disable : 4127) 139 #pragma warning(disable : 4244) 140 #endif 141 142 #define parseContext (*pParseContext) 143 #define yyerror(context, msg) context->parserError(msg) 144 145 extern int yylex(YYSTYPE*, TParseContext&); 146 147 %} 148 149 %parse-param {glslang::TParseContext* pParseContext} 150 %lex-param {parseContext} 151 %pure-parser // enable thread safety 152 %expect 1 // One shift reduce conflict because of if | else 153 154 %token <lex> CONST BOOL INT UINT FLOAT 155 %token <lex> BVEC2 BVEC3 BVEC4 156 %token <lex> IVEC2 IVEC3 IVEC4 157 %token <lex> UVEC2 UVEC3 UVEC4 158 %token <lex> VEC2 VEC3 VEC4 159 %token <lex> MAT2 MAT3 MAT4 160 %token <lex> MAT2X2 MAT2X3 MAT2X4 161 %token <lex> MAT3X2 MAT3X3 MAT3X4 162 %token <lex> MAT4X2 MAT4X3 MAT4X4 163 164 // combined image/sampler 165 %token <lex> SAMPLER2D SAMPLER3D SAMPLERCUBE SAMPLER2DSHADOW 166 %token <lex> SAMPLERCUBESHADOW SAMPLER2DARRAY 167 %token <lex> SAMPLER2DARRAYSHADOW ISAMPLER2D ISAMPLER3D ISAMPLERCUBE 168 %token <lex> ISAMPLER2DARRAY USAMPLER2D USAMPLER3D 169 %token <lex> USAMPLERCUBE USAMPLER2DARRAY 170 171 // separate image/sampler 172 %token <lex> SAMPLER SAMPLERSHADOW 173 %token <lex> TEXTURE2D TEXTURE3D TEXTURECUBE TEXTURE2DARRAY 174 %token <lex> ITEXTURE2D ITEXTURE3D ITEXTURECUBE ITEXTURE2DARRAY 175 %token <lex> UTEXTURE2D UTEXTURE3D UTEXTURECUBE UTEXTURE2DARRAY 176 177 178 179 %token <lex> ATTRIBUTE VARYING 180 %token <lex> FLOAT16_T FLOAT32_T DOUBLE FLOAT64_T 181 %token <lex> INT64_T UINT64_T INT32_T UINT32_T INT16_T UINT16_T INT8_T UINT8_T 182 %token <lex> I64VEC2 I64VEC3 I64VEC4 183 %token <lex> U64VEC2 U64VEC3 U64VEC4 184 %token <lex> I32VEC2 I32VEC3 I32VEC4 185 %token <lex> U32VEC2 U32VEC3 U32VEC4 186 %token <lex> I16VEC2 I16VEC3 I16VEC4 187 %token <lex> U16VEC2 U16VEC3 U16VEC4 188 %token <lex> I8VEC2 I8VEC3 I8VEC4 189 %token <lex> U8VEC2 U8VEC3 U8VEC4 190 %token <lex> DVEC2 DVEC3 DVEC4 DMAT2 DMAT3 DMAT4 191 %token <lex> F16VEC2 F16VEC3 F16VEC4 F16MAT2 F16MAT3 F16MAT4 192 %token <lex> F32VEC2 F32VEC3 F32VEC4 F32MAT2 F32MAT3 F32MAT4 193 %token <lex> F64VEC2 F64VEC3 F64VEC4 F64MAT2 F64MAT3 F64MAT4 194 %token <lex> DMAT2X2 DMAT2X3 DMAT2X4 195 %token <lex> DMAT3X2 DMAT3X3 DMAT3X4 196 %token <lex> DMAT4X2 DMAT4X3 DMAT4X4 197 %token <lex> F16MAT2X2 F16MAT2X3 F16MAT2X4 198 %token <lex> F16MAT3X2 F16MAT3X3 F16MAT3X4 199 %token <lex> F16MAT4X2 F16MAT4X3 F16MAT4X4 200 %token <lex> F32MAT2X2 F32MAT2X3 F32MAT2X4 201 %token <lex> F32MAT3X2 F32MAT3X3 F32MAT3X4 202 %token <lex> F32MAT4X2 F32MAT4X3 F32MAT4X4 203 %token <lex> F64MAT2X2 F64MAT2X3 F64MAT2X4 204 %token <lex> F64MAT3X2 F64MAT3X3 F64MAT3X4 205 %token <lex> F64MAT4X2 F64MAT4X3 F64MAT4X4 206 %token <lex> ATOMIC_UINT 207 %token <lex> ACCSTRUCTNV 208 %token <lex> ACCSTRUCTEXT 209 %token <lex> RAYQUERYEXT 210 %token <lex> FCOOPMATNV ICOOPMATNV UCOOPMATNV 211 212 // combined image/sampler 213 %token <lex> SAMPLERCUBEARRAY SAMPLERCUBEARRAYSHADOW 214 %token <lex> ISAMPLERCUBEARRAY USAMPLERCUBEARRAY 215 %token <lex> SAMPLER1D SAMPLER1DARRAY SAMPLER1DARRAYSHADOW ISAMPLER1D SAMPLER1DSHADOW 216 %token <lex> SAMPLER2DRECT SAMPLER2DRECTSHADOW ISAMPLER2DRECT USAMPLER2DRECT 217 %token <lex> SAMPLERBUFFER ISAMPLERBUFFER USAMPLERBUFFER 218 %token <lex> SAMPLER2DMS ISAMPLER2DMS USAMPLER2DMS 219 %token <lex> SAMPLER2DMSARRAY ISAMPLER2DMSARRAY USAMPLER2DMSARRAY 220 %token <lex> SAMPLEREXTERNALOES 221 %token <lex> SAMPLEREXTERNAL2DY2YEXT 222 %token <lex> ISAMPLER1DARRAY USAMPLER1D USAMPLER1DARRAY 223 %token <lex> F16SAMPLER1D F16SAMPLER2D F16SAMPLER3D F16SAMPLER2DRECT F16SAMPLERCUBE 224 %token <lex> F16SAMPLER1DARRAY F16SAMPLER2DARRAY F16SAMPLERCUBEARRAY 225 %token <lex> F16SAMPLERBUFFER F16SAMPLER2DMS F16SAMPLER2DMSARRAY 226 %token <lex> F16SAMPLER1DSHADOW F16SAMPLER2DSHADOW F16SAMPLER1DARRAYSHADOW F16SAMPLER2DARRAYSHADOW 227 %token <lex> F16SAMPLER2DRECTSHADOW F16SAMPLERCUBESHADOW F16SAMPLERCUBEARRAYSHADOW 228 229 // images 230 %token <lex> IMAGE1D IIMAGE1D UIMAGE1D IMAGE2D IIMAGE2D 231 %token <lex> UIMAGE2D IMAGE3D IIMAGE3D UIMAGE3D 232 %token <lex> IMAGE2DRECT IIMAGE2DRECT UIMAGE2DRECT 233 %token <lex> IMAGECUBE IIMAGECUBE UIMAGECUBE 234 %token <lex> IMAGEBUFFER IIMAGEBUFFER UIMAGEBUFFER 235 %token <lex> IMAGE1DARRAY IIMAGE1DARRAY UIMAGE1DARRAY 236 %token <lex> IMAGE2DARRAY IIMAGE2DARRAY UIMAGE2DARRAY 237 %token <lex> IMAGECUBEARRAY IIMAGECUBEARRAY UIMAGECUBEARRAY 238 %token <lex> IMAGE2DMS IIMAGE2DMS UIMAGE2DMS 239 %token <lex> IMAGE2DMSARRAY IIMAGE2DMSARRAY UIMAGE2DMSARRAY 240 241 %token <lex> F16IMAGE1D F16IMAGE2D F16IMAGE3D F16IMAGE2DRECT 242 %token <lex> F16IMAGECUBE F16IMAGE1DARRAY F16IMAGE2DARRAY F16IMAGECUBEARRAY 243 %token <lex> F16IMAGEBUFFER F16IMAGE2DMS F16IMAGE2DMSARRAY 244 245 %token <lex> I64IMAGE1D U64IMAGE1D 246 %token <lex> I64IMAGE2D U64IMAGE2D 247 %token <lex> I64IMAGE3D U64IMAGE3D 248 %token <lex> I64IMAGE2DRECT U64IMAGE2DRECT 249 %token <lex> I64IMAGECUBE U64IMAGECUBE 250 %token <lex> I64IMAGEBUFFER U64IMAGEBUFFER 251 %token <lex> I64IMAGE1DARRAY U64IMAGE1DARRAY 252 %token <lex> I64IMAGE2DARRAY U64IMAGE2DARRAY 253 %token <lex> I64IMAGECUBEARRAY U64IMAGECUBEARRAY 254 %token <lex> I64IMAGE2DMS U64IMAGE2DMS 255 %token <lex> I64IMAGE2DMSARRAY U64IMAGE2DMSARRAY 256 257 // texture without sampler 258 %token <lex> TEXTURECUBEARRAY ITEXTURECUBEARRAY UTEXTURECUBEARRAY 259 %token <lex> TEXTURE1D ITEXTURE1D UTEXTURE1D 260 %token <lex> TEXTURE1DARRAY ITEXTURE1DARRAY UTEXTURE1DARRAY 261 %token <lex> TEXTURE2DRECT ITEXTURE2DRECT UTEXTURE2DRECT 262 %token <lex> TEXTUREBUFFER ITEXTUREBUFFER UTEXTUREBUFFER 263 %token <lex> TEXTURE2DMS ITEXTURE2DMS UTEXTURE2DMS 264 %token <lex> TEXTURE2DMSARRAY ITEXTURE2DMSARRAY UTEXTURE2DMSARRAY 265 266 %token <lex> F16TEXTURE1D F16TEXTURE2D F16TEXTURE3D F16TEXTURE2DRECT F16TEXTURECUBE 267 %token <lex> F16TEXTURE1DARRAY F16TEXTURE2DARRAY F16TEXTURECUBEARRAY 268 %token <lex> F16TEXTUREBUFFER F16TEXTURE2DMS F16TEXTURE2DMSARRAY 269 270 // input attachments 271 %token <lex> SUBPASSINPUT SUBPASSINPUTMS ISUBPASSINPUT ISUBPASSINPUTMS USUBPASSINPUT USUBPASSINPUTMS 272 %token <lex> F16SUBPASSINPUT F16SUBPASSINPUTMS 273 274 275 276 %token <lex> LEFT_OP RIGHT_OP 277 %token <lex> INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP 278 %token <lex> AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN 279 %token <lex> MOD_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN XOR_ASSIGN OR_ASSIGN 280 %token <lex> SUB_ASSIGN 281 %token <lex> STRING_LITERAL 282 283 %token <lex> LEFT_PAREN RIGHT_PAREN LEFT_BRACKET RIGHT_BRACKET LEFT_BRACE RIGHT_BRACE DOT 284 %token <lex> COMMA COLON EQUAL SEMICOLON BANG DASH TILDE PLUS STAR SLASH PERCENT 285 %token <lex> LEFT_ANGLE RIGHT_ANGLE VERTICAL_BAR CARET AMPERSAND QUESTION 286 287 %token <lex> INVARIANT 288 %token <lex> HIGH_PRECISION MEDIUM_PRECISION LOW_PRECISION PRECISION 289 %token <lex> PACKED RESOURCE SUPERP 290 291 %token <lex> FLOATCONSTANT INTCONSTANT UINTCONSTANT BOOLCONSTANT 292 %token <lex> IDENTIFIER TYPE_NAME 293 %token <lex> CENTROID IN OUT INOUT 294 %token <lex> STRUCT VOID WHILE 295 %token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT 296 %token <lex> TERMINATE_INVOCATION 297 %token <lex> TERMINATE_RAY IGNORE_INTERSECTION 298 %token <lex> UNIFORM SHARED BUFFER 299 %token <lex> FLAT SMOOTH LAYOUT 300 301 302 %token <lex> DOUBLECONSTANT INT16CONSTANT UINT16CONSTANT FLOAT16CONSTANT INT32CONSTANT UINT32CONSTANT 303 %token <lex> INT64CONSTANT UINT64CONSTANT 304 %token <lex> SUBROUTINE DEMOTE 305 %token <lex> PAYLOADNV PAYLOADINNV HITATTRNV CALLDATANV CALLDATAINNV 306 %token <lex> PAYLOADEXT PAYLOADINEXT HITATTREXT CALLDATAEXT CALLDATAINEXT 307 %token <lex> PATCH SAMPLE NONUNIFORM 308 %token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT 309 %token <lex> SUBGROUPCOHERENT NONPRIVATE SHADERCALLCOHERENT 310 %token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV 311 %token <lex> PRECISE 312 313 314 %type <interm> assignment_operator unary_operator 315 %type <interm.intermTypedNode> variable_identifier primary_expression postfix_expression 316 %type <interm.intermTypedNode> expression integer_expression assignment_expression 317 %type <interm.intermTypedNode> unary_expression multiplicative_expression additive_expression 318 %type <interm.intermTypedNode> relational_expression equality_expression 319 %type <interm.intermTypedNode> conditional_expression constant_expression 320 %type <interm.intermTypedNode> logical_or_expression logical_xor_expression logical_and_expression 321 %type <interm.intermTypedNode> shift_expression and_expression exclusive_or_expression inclusive_or_expression 322 %type <interm.intermTypedNode> function_call initializer condition conditionopt 323 324 %type <interm.intermNode> translation_unit function_definition 325 %type <interm.intermNode> statement simple_statement 326 %type <interm.intermNode> statement_list switch_statement_list compound_statement 327 %type <interm.intermNode> declaration_statement selection_statement selection_statement_nonattributed expression_statement 328 %type <interm.intermNode> switch_statement switch_statement_nonattributed case_label 329 %type <interm.intermNode> declaration external_declaration 330 %type <interm.intermNode> for_init_statement compound_statement_no_new_scope 331 %type <interm.nodePair> selection_rest_statement for_rest_statement 332 %type <interm.intermNode> iteration_statement iteration_statement_nonattributed jump_statement statement_no_new_scope statement_scoped 333 %type <interm> single_declaration init_declarator_list 334 335 %type <interm> parameter_declaration parameter_declarator parameter_type_specifier 336 337 %type <interm> array_specifier 338 %type <interm.type> invariant_qualifier interpolation_qualifier storage_qualifier precision_qualifier 339 %type <interm.type> layout_qualifier layout_qualifier_id_list layout_qualifier_id 340 341 %type <interm.typeParameters> type_parameter_specifier 342 %type <interm.typeParameters> type_parameter_specifier_opt 343 %type <interm.typeParameters> type_parameter_specifier_list 344 345 %type <interm.type> type_qualifier fully_specified_type type_specifier 346 %type <interm.type> single_type_qualifier 347 %type <interm.type> type_specifier_nonarray 348 %type <interm.type> struct_specifier 349 %type <interm.typeLine> struct_declarator 350 %type <interm.typeList> struct_declarator_list struct_declaration struct_declaration_list 351 %type <interm> block_structure 352 %type <interm.function> function_header function_declarator 353 %type <interm.function> function_header_with_parameters 354 %type <interm> function_call_header_with_parameters function_call_header_no_parameters function_call_generic function_prototype 355 %type <interm> function_call_or_method function_identifier function_call_header 356 357 %type <interm.identifierList> identifier_list 358 359 360 %type <interm.type> precise_qualifier non_uniform_qualifier 361 %type <interm.typeList> type_name_list 362 %type <interm.attributes> attribute attribute_list single_attribute 363 %type <interm.intermNode> demote_statement 364 %type <interm.intermTypedNode> initializer_list 365 366 367 %start translation_unit 368 %% 369 370 variable_identifier 371 : IDENTIFIER { 372 $$ = parseContext.handleVariable($1.loc, $1.symbol, $1.string); 373 } 374 ; 375 376 primary_expression 377 : variable_identifier { 378 $$ = $1; 379 } 380 | LEFT_PAREN expression RIGHT_PAREN { 381 $$ = $2; 382 if ($$->getAsConstantUnion()) 383 $$->getAsConstantUnion()->setExpression(); 384 } 385 | FLOATCONSTANT { 386 $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true); 387 } 388 | INTCONSTANT { 389 $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true); 390 } 391 | UINTCONSTANT { 392 parseContext.fullIntegerCheck($1.loc, "unsigned literal"); 393 $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true); 394 } 395 | BOOLCONSTANT { 396 $$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true); 397 } 398 399 | STRING_LITERAL { 400 $$ = parseContext.intermediate.addConstantUnion($1.string, $1.loc, true); 401 } 402 | INT32CONSTANT { 403 parseContext.explicitInt32Check($1.loc, "32-bit signed literal"); 404 $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true); 405 } 406 | UINT32CONSTANT { 407 parseContext.explicitInt32Check($1.loc, "32-bit signed literal"); 408 $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true); 409 } 410 | INT64CONSTANT { 411 parseContext.int64Check($1.loc, "64-bit integer literal"); 412 $$ = parseContext.intermediate.addConstantUnion($1.i64, $1.loc, true); 413 } 414 | UINT64CONSTANT { 415 parseContext.int64Check($1.loc, "64-bit unsigned integer literal"); 416 $$ = parseContext.intermediate.addConstantUnion($1.u64, $1.loc, true); 417 } 418 | INT16CONSTANT { 419 parseContext.explicitInt16Check($1.loc, "16-bit integer literal"); 420 $$ = parseContext.intermediate.addConstantUnion((short)$1.i, $1.loc, true); 421 } 422 | UINT16CONSTANT { 423 parseContext.explicitInt16Check($1.loc, "16-bit unsigned integer literal"); 424 $$ = parseContext.intermediate.addConstantUnion((unsigned short)$1.u, $1.loc, true); 425 } 426 | DOUBLECONSTANT { 427 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double literal"); 428 if (! parseContext.symbolTable.atBuiltInLevel()) 429 parseContext.doubleCheck($1.loc, "double literal"); 430 $$ = parseContext.intermediate.addConstantUnion($1.d, EbtDouble, $1.loc, true); 431 } 432 | FLOAT16CONSTANT { 433 parseContext.float16Check($1.loc, "half float literal"); 434 $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat16, $1.loc, true); 435 } 436 437 ; 438 439 postfix_expression 440 : primary_expression { 441 $$ = $1; 442 } 443 | postfix_expression LEFT_BRACKET integer_expression RIGHT_BRACKET { 444 $$ = parseContext.handleBracketDereference($2.loc, $1, $3); 445 } 446 | function_call { 447 $$ = $1; 448 } 449 | postfix_expression DOT IDENTIFIER { 450 $$ = parseContext.handleDotDereference($3.loc, $1, *$3.string); 451 } 452 | postfix_expression INC_OP { 453 parseContext.variableCheck($1); 454 parseContext.lValueErrorCheck($2.loc, "++", $1); 455 $$ = parseContext.handleUnaryMath($2.loc, "++", EOpPostIncrement, $1); 456 } 457 | postfix_expression DEC_OP { 458 parseContext.variableCheck($1); 459 parseContext.lValueErrorCheck($2.loc, "--", $1); 460 $$ = parseContext.handleUnaryMath($2.loc, "--", EOpPostDecrement, $1); 461 } 462 ; 463 464 integer_expression 465 : expression { 466 parseContext.integerCheck($1, "[]"); 467 $$ = $1; 468 } 469 ; 470 471 function_call 472 : function_call_or_method { 473 $$ = parseContext.handleFunctionCall($1.loc, $1.function, $1.intermNode); 474 delete $1.function; 475 } 476 ; 477 478 function_call_or_method 479 : function_call_generic { 480 $$ = $1; 481 } 482 ; 483 484 function_call_generic 485 : function_call_header_with_parameters RIGHT_PAREN { 486 $$ = $1; 487 $$.loc = $2.loc; 488 } 489 | function_call_header_no_parameters RIGHT_PAREN { 490 $$ = $1; 491 $$.loc = $2.loc; 492 } 493 ; 494 495 function_call_header_no_parameters 496 : function_call_header VOID { 497 $$ = $1; 498 } 499 | function_call_header { 500 $$ = $1; 501 } 502 ; 503 504 function_call_header_with_parameters 505 : function_call_header assignment_expression { 506 TParameter param = { 0, new TType }; 507 param.type->shallowCopy($2->getType()); 508 $1.function->addParameter(param); 509 $$.function = $1.function; 510 $$.intermNode = $2; 511 } 512 | function_call_header_with_parameters COMMA assignment_expression { 513 TParameter param = { 0, new TType }; 514 param.type->shallowCopy($3->getType()); 515 $1.function->addParameter(param); 516 $$.function = $1.function; 517 $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, $3, $2.loc); 518 } 519 ; 520 521 function_call_header 522 : function_identifier LEFT_PAREN { 523 $$ = $1; 524 } 525 ; 526 527 // Grammar Note: Constructors look like functions, but are recognized as types. 528 529 function_identifier 530 : type_specifier { 531 // Constructor 532 $$.intermNode = 0; 533 $$.function = parseContext.handleConstructorCall($1.loc, $1); 534 } 535 | postfix_expression { 536 // 537 // Should be a method or subroutine call, but we haven't recognized the arguments yet. 538 // 539 $$.function = 0; 540 $$.intermNode = 0; 541 542 TIntermMethod* method = $1->getAsMethodNode(); 543 if (method) { 544 $$.function = new TFunction(&method->getMethodName(), TType(EbtInt), EOpArrayLength); 545 $$.intermNode = method->getObject(); 546 } else { 547 TIntermSymbol* symbol = $1->getAsSymbolNode(); 548 if (symbol) { 549 parseContext.reservedErrorCheck(symbol->getLoc(), symbol->getName()); 550 TFunction *function = new TFunction(&symbol->getName(), TType(EbtVoid)); 551 $$.function = function; 552 } else 553 parseContext.error($1->getLoc(), "function call, method, or subroutine call expected", "", ""); 554 } 555 556 if ($$.function == 0) { 557 // error recover 558 TString* empty = NewPoolTString(""); 559 $$.function = new TFunction(empty, TType(EbtVoid), EOpNull); 560 } 561 } 562 563 | non_uniform_qualifier { 564 // Constructor 565 $$.intermNode = 0; 566 $$.function = parseContext.handleConstructorCall($1.loc, $1); 567 } 568 569 ; 570 571 unary_expression 572 : postfix_expression { 573 parseContext.variableCheck($1); 574 $$ = $1; 575 if (TIntermMethod* method = $1->getAsMethodNode()) 576 parseContext.error($1->getLoc(), "incomplete method syntax", method->getMethodName().c_str(), ""); 577 } 578 | INC_OP unary_expression { 579 parseContext.lValueErrorCheck($1.loc, "++", $2); 580 $$ = parseContext.handleUnaryMath($1.loc, "++", EOpPreIncrement, $2); 581 } 582 | DEC_OP unary_expression { 583 parseContext.lValueErrorCheck($1.loc, "--", $2); 584 $$ = parseContext.handleUnaryMath($1.loc, "--", EOpPreDecrement, $2); 585 } 586 | unary_operator unary_expression { 587 if ($1.op != EOpNull) { 588 char errorOp[2] = {0, 0}; 589 switch($1.op) { 590 case EOpNegative: errorOp[0] = '-'; break; 591 case EOpLogicalNot: errorOp[0] = '!'; break; 592 case EOpBitwiseNot: errorOp[0] = '~'; break; 593 default: break; // some compilers want this 594 } 595 $$ = parseContext.handleUnaryMath($1.loc, errorOp, $1.op, $2); 596 } else { 597 $$ = $2; 598 if ($$->getAsConstantUnion()) 599 $$->getAsConstantUnion()->setExpression(); 600 } 601 } 602 ; 603 // Grammar Note: No traditional style type casts. 604 605 unary_operator 606 : PLUS { $$.loc = $1.loc; $$.op = EOpNull; } 607 | DASH { $$.loc = $1.loc; $$.op = EOpNegative; } 608 | BANG { $$.loc = $1.loc; $$.op = EOpLogicalNot; } 609 | TILDE { $$.loc = $1.loc; $$.op = EOpBitwiseNot; 610 parseContext.fullIntegerCheck($1.loc, "bitwise not"); } 611 ; 612 // Grammar Note: No '*' or '&' unary ops. Pointers are not supported. 613 614 multiplicative_expression 615 : unary_expression { $$ = $1; } 616 | multiplicative_expression STAR unary_expression { 617 $$ = parseContext.handleBinaryMath($2.loc, "*", EOpMul, $1, $3); 618 if ($$ == 0) 619 $$ = $1; 620 } 621 | multiplicative_expression SLASH unary_expression { 622 $$ = parseContext.handleBinaryMath($2.loc, "/", EOpDiv, $1, $3); 623 if ($$ == 0) 624 $$ = $1; 625 } 626 | multiplicative_expression PERCENT unary_expression { 627 parseContext.fullIntegerCheck($2.loc, "%"); 628 $$ = parseContext.handleBinaryMath($2.loc, "%", EOpMod, $1, $3); 629 if ($$ == 0) 630 $$ = $1; 631 } 632 ; 633 634 additive_expression 635 : multiplicative_expression { $$ = $1; } 636 | additive_expression PLUS multiplicative_expression { 637 $$ = parseContext.handleBinaryMath($2.loc, "+", EOpAdd, $1, $3); 638 if ($$ == 0) 639 $$ = $1; 640 } 641 | additive_expression DASH multiplicative_expression { 642 $$ = parseContext.handleBinaryMath($2.loc, "-", EOpSub, $1, $3); 643 if ($$ == 0) 644 $$ = $1; 645 } 646 ; 647 648 shift_expression 649 : additive_expression { $$ = $1; } 650 | shift_expression LEFT_OP additive_expression { 651 parseContext.fullIntegerCheck($2.loc, "bit shift left"); 652 $$ = parseContext.handleBinaryMath($2.loc, "<<", EOpLeftShift, $1, $3); 653 if ($$ == 0) 654 $$ = $1; 655 } 656 | shift_expression RIGHT_OP additive_expression { 657 parseContext.fullIntegerCheck($2.loc, "bit shift right"); 658 $$ = parseContext.handleBinaryMath($2.loc, ">>", EOpRightShift, $1, $3); 659 if ($$ == 0) 660 $$ = $1; 661 } 662 ; 663 664 relational_expression 665 : shift_expression { $$ = $1; } 666 | relational_expression LEFT_ANGLE shift_expression { 667 $$ = parseContext.handleBinaryMath($2.loc, "<", EOpLessThan, $1, $3); 668 if ($$ == 0) 669 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); 670 } 671 | relational_expression RIGHT_ANGLE shift_expression { 672 $$ = parseContext.handleBinaryMath($2.loc, ">", EOpGreaterThan, $1, $3); 673 if ($$ == 0) 674 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); 675 } 676 | relational_expression LE_OP shift_expression { 677 $$ = parseContext.handleBinaryMath($2.loc, "<=", EOpLessThanEqual, $1, $3); 678 if ($$ == 0) 679 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); 680 } 681 | relational_expression GE_OP shift_expression { 682 $$ = parseContext.handleBinaryMath($2.loc, ">=", EOpGreaterThanEqual, $1, $3); 683 if ($$ == 0) 684 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); 685 } 686 ; 687 688 equality_expression 689 : relational_expression { $$ = $1; } 690 | equality_expression EQ_OP relational_expression { 691 parseContext.arrayObjectCheck($2.loc, $1->getType(), "array comparison"); 692 parseContext.opaqueCheck($2.loc, $1->getType(), "=="); 693 parseContext.specializationCheck($2.loc, $1->getType(), "=="); 694 parseContext.referenceCheck($2.loc, $1->getType(), "=="); 695 $$ = parseContext.handleBinaryMath($2.loc, "==", EOpEqual, $1, $3); 696 if ($$ == 0) 697 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); 698 } 699 | equality_expression NE_OP relational_expression { 700 parseContext.arrayObjectCheck($2.loc, $1->getType(), "array comparison"); 701 parseContext.opaqueCheck($2.loc, $1->getType(), "!="); 702 parseContext.specializationCheck($2.loc, $1->getType(), "!="); 703 parseContext.referenceCheck($2.loc, $1->getType(), "!="); 704 $$ = parseContext.handleBinaryMath($2.loc, "!=", EOpNotEqual, $1, $3); 705 if ($$ == 0) 706 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); 707 } 708 ; 709 710 and_expression 711 : equality_expression { $$ = $1; } 712 | and_expression AMPERSAND equality_expression { 713 parseContext.fullIntegerCheck($2.loc, "bitwise and"); 714 $$ = parseContext.handleBinaryMath($2.loc, "&", EOpAnd, $1, $3); 715 if ($$ == 0) 716 $$ = $1; 717 } 718 ; 719 720 exclusive_or_expression 721 : and_expression { $$ = $1; } 722 | exclusive_or_expression CARET and_expression { 723 parseContext.fullIntegerCheck($2.loc, "bitwise exclusive or"); 724 $$ = parseContext.handleBinaryMath($2.loc, "^", EOpExclusiveOr, $1, $3); 725 if ($$ == 0) 726 $$ = $1; 727 } 728 ; 729 730 inclusive_or_expression 731 : exclusive_or_expression { $$ = $1; } 732 | inclusive_or_expression VERTICAL_BAR exclusive_or_expression { 733 parseContext.fullIntegerCheck($2.loc, "bitwise inclusive or"); 734 $$ = parseContext.handleBinaryMath($2.loc, "|", EOpInclusiveOr, $1, $3); 735 if ($$ == 0) 736 $$ = $1; 737 } 738 ; 739 740 logical_and_expression 741 : inclusive_or_expression { $$ = $1; } 742 | logical_and_expression AND_OP inclusive_or_expression { 743 $$ = parseContext.handleBinaryMath($2.loc, "&&", EOpLogicalAnd, $1, $3); 744 if ($$ == 0) 745 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); 746 } 747 ; 748 749 logical_xor_expression 750 : logical_and_expression { $$ = $1; } 751 | logical_xor_expression XOR_OP logical_and_expression { 752 $$ = parseContext.handleBinaryMath($2.loc, "^^", EOpLogicalXor, $1, $3); 753 if ($$ == 0) 754 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); 755 } 756 ; 757 758 logical_or_expression 759 : logical_xor_expression { $$ = $1; } 760 | logical_or_expression OR_OP logical_xor_expression { 761 $$ = parseContext.handleBinaryMath($2.loc, "||", EOpLogicalOr, $1, $3); 762 if ($$ == 0) 763 $$ = parseContext.intermediate.addConstantUnion(false, $2.loc); 764 } 765 ; 766 767 conditional_expression 768 : logical_or_expression { $$ = $1; } 769 | logical_or_expression QUESTION { 770 ++parseContext.controlFlowNestingLevel; 771 } 772 expression COLON assignment_expression { 773 --parseContext.controlFlowNestingLevel; 774 parseContext.boolCheck($2.loc, $1); 775 parseContext.rValueErrorCheck($2.loc, "?", $1); 776 parseContext.rValueErrorCheck($5.loc, ":", $4); 777 parseContext.rValueErrorCheck($5.loc, ":", $6); 778 $$ = parseContext.intermediate.addSelection($1, $4, $6, $2.loc); 779 if ($$ == 0) { 780 parseContext.binaryOpError($2.loc, ":", $4->getCompleteString(), $6->getCompleteString()); 781 $$ = $6; 782 } 783 } 784 ; 785 786 assignment_expression 787 : conditional_expression { $$ = $1; } 788 | unary_expression assignment_operator assignment_expression { 789 parseContext.arrayObjectCheck($2.loc, $1->getType(), "array assignment"); 790 parseContext.opaqueCheck($2.loc, $1->getType(), "="); 791 parseContext.storage16BitAssignmentCheck($2.loc, $1->getType(), "="); 792 parseContext.specializationCheck($2.loc, $1->getType(), "="); 793 parseContext.lValueErrorCheck($2.loc, "assign", $1); 794 parseContext.rValueErrorCheck($2.loc, "assign", $3); 795 $$ = parseContext.addAssign($2.loc, $2.op, $1, $3); 796 if ($$ == 0) { 797 parseContext.assignError($2.loc, "assign", $1->getCompleteString(), $3->getCompleteString()); 798 $$ = $1; 799 } 800 } 801 ; 802 803 assignment_operator 804 : EQUAL { 805 $$.loc = $1.loc; 806 $$.op = EOpAssign; 807 } 808 | MUL_ASSIGN { 809 $$.loc = $1.loc; 810 $$.op = EOpMulAssign; 811 } 812 | DIV_ASSIGN { 813 $$.loc = $1.loc; 814 $$.op = EOpDivAssign; 815 } 816 | MOD_ASSIGN { 817 parseContext.fullIntegerCheck($1.loc, "%="); 818 $$.loc = $1.loc; 819 $$.op = EOpModAssign; 820 } 821 | ADD_ASSIGN { 822 $$.loc = $1.loc; 823 $$.op = EOpAddAssign; 824 } 825 | SUB_ASSIGN { 826 $$.loc = $1.loc; 827 $$.op = EOpSubAssign; 828 } 829 | LEFT_ASSIGN { 830 parseContext.fullIntegerCheck($1.loc, "bit-shift left assign"); 831 $$.loc = $1.loc; $$.op = EOpLeftShiftAssign; 832 } 833 | RIGHT_ASSIGN { 834 parseContext.fullIntegerCheck($1.loc, "bit-shift right assign"); 835 $$.loc = $1.loc; $$.op = EOpRightShiftAssign; 836 } 837 | AND_ASSIGN { 838 parseContext.fullIntegerCheck($1.loc, "bitwise-and assign"); 839 $$.loc = $1.loc; $$.op = EOpAndAssign; 840 } 841 | XOR_ASSIGN { 842 parseContext.fullIntegerCheck($1.loc, "bitwise-xor assign"); 843 $$.loc = $1.loc; $$.op = EOpExclusiveOrAssign; 844 } 845 | OR_ASSIGN { 846 parseContext.fullIntegerCheck($1.loc, "bitwise-or assign"); 847 $$.loc = $1.loc; $$.op = EOpInclusiveOrAssign; 848 } 849 ; 850 851 expression 852 : assignment_expression { 853 $$ = $1; 854 } 855 | expression COMMA assignment_expression { 856 parseContext.samplerConstructorLocationCheck($2.loc, ",", $3); 857 $$ = parseContext.intermediate.addComma($1, $3, $2.loc); 858 if ($$ == 0) { 859 parseContext.binaryOpError($2.loc, ",", $1->getCompleteString(), $3->getCompleteString()); 860 $$ = $3; 861 } 862 } 863 ; 864 865 constant_expression 866 : conditional_expression { 867 parseContext.constantValueCheck($1, ""); 868 $$ = $1; 869 } 870 ; 871 872 declaration 873 : function_prototype SEMICOLON { 874 parseContext.handleFunctionDeclarator($1.loc, *$1.function, true /* prototype */); 875 $$ = 0; 876 // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature 877 } 878 | init_declarator_list SEMICOLON { 879 if ($1.intermNode && $1.intermNode->getAsAggregate()) 880 $1.intermNode->getAsAggregate()->setOperator(EOpSequence); 881 $$ = $1.intermNode; 882 } 883 | PRECISION precision_qualifier type_specifier SEMICOLON { 884 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "precision statement"); 885 // lazy setting of the previous scope's defaults, has effect only the first time it is called in a particular scope 886 parseContext.symbolTable.setPreviousDefaultPrecisions(&parseContext.defaultPrecision[0]); 887 parseContext.setDefaultPrecision($1.loc, $3, $2.qualifier.precision); 888 $$ = 0; 889 } 890 | block_structure SEMICOLON { 891 parseContext.declareBlock($1.loc, *$1.typeList); 892 $$ = 0; 893 } 894 | block_structure IDENTIFIER SEMICOLON { 895 parseContext.declareBlock($1.loc, *$1.typeList, $2.string); 896 $$ = 0; 897 } 898 | block_structure IDENTIFIER array_specifier SEMICOLON { 899 parseContext.declareBlock($1.loc, *$1.typeList, $2.string, $3.arraySizes); 900 $$ = 0; 901 } 902 | type_qualifier SEMICOLON { 903 parseContext.globalQualifierFixCheck($1.loc, $1.qualifier); 904 parseContext.updateStandaloneQualifierDefaults($1.loc, $1); 905 $$ = 0; 906 } 907 | type_qualifier IDENTIFIER SEMICOLON { 908 parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers); 909 parseContext.addQualifierToExisting($1.loc, $1.qualifier, *$2.string); 910 $$ = 0; 911 } 912 | type_qualifier IDENTIFIER identifier_list SEMICOLON { 913 parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers); 914 $3->push_back($2.string); 915 parseContext.addQualifierToExisting($1.loc, $1.qualifier, *$3); 916 $$ = 0; 917 } 918 ; 919 920 block_structure 921 : type_qualifier IDENTIFIER LEFT_BRACE { parseContext.nestedBlockCheck($1.loc); } struct_declaration_list RIGHT_BRACE { 922 --parseContext.blockNestingLevel; 923 parseContext.blockName = $2.string; 924 parseContext.globalQualifierFixCheck($1.loc, $1.qualifier); 925 parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers); 926 parseContext.currentBlockQualifier = $1.qualifier; 927 $$.loc = $1.loc; 928 $$.typeList = $5; 929 } 930 931 identifier_list 932 : COMMA IDENTIFIER { 933 $$ = new TIdentifierList; 934 $$->push_back($2.string); 935 } 936 | identifier_list COMMA IDENTIFIER { 937 $$ = $1; 938 $$->push_back($3.string); 939 } 940 ; 941 942 function_prototype 943 : function_declarator RIGHT_PAREN { 944 $$.function = $1; 945 $$.loc = $2.loc; 946 } 947 ; 948 949 function_declarator 950 : function_header { 951 $$ = $1; 952 } 953 | function_header_with_parameters { 954 $$ = $1; 955 } 956 ; 957 958 959 function_header_with_parameters 960 : function_header parameter_declaration { 961 // Add the parameter 962 $$ = $1; 963 if ($2.param.type->getBasicType() != EbtVoid) 964 $1->addParameter($2.param); 965 else 966 delete $2.param.type; 967 } 968 | function_header_with_parameters COMMA parameter_declaration { 969 // 970 // Only first parameter of one-parameter functions can be void 971 // The check for named parameters not being void is done in parameter_declarator 972 // 973 if ($3.param.type->getBasicType() == EbtVoid) { 974 // 975 // This parameter > first is void 976 // 977 parseContext.error($2.loc, "cannot be an argument type except for '(void)'", "void", ""); 978 delete $3.param.type; 979 } else { 980 // Add the parameter 981 $$ = $1; 982 $1->addParameter($3.param); 983 } 984 } 985 ; 986 987 function_header 988 : fully_specified_type IDENTIFIER LEFT_PAREN { 989 if ($1.qualifier.storage != EvqGlobal && $1.qualifier.storage != EvqTemporary) { 990 parseContext.error($2.loc, "no qualifiers allowed for function return", 991 GetStorageQualifierString($1.qualifier.storage), ""); 992 } 993 if ($1.arraySizes) 994 parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes); 995 996 // Add the function as a prototype after parsing it (we do not support recursion) 997 TFunction *function; 998 TType type($1); 999 1000 // Potentially rename shader entry point function. No-op most of the time. 1001 parseContext.renameShaderFunction($2.string); 1002 1003 // Make the function 1004 function = new TFunction($2.string, type); 1005 $$ = function; 1006 } 1007 ; 1008 1009 parameter_declarator 1010 // Type + name 1011 : type_specifier IDENTIFIER { 1012 if ($1.arraySizes) { 1013 parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); 1014 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type"); 1015 parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes); 1016 } 1017 if ($1.basicType == EbtVoid) { 1018 parseContext.error($2.loc, "illegal use of type 'void'", $2.string->c_str(), ""); 1019 } 1020 parseContext.reservedErrorCheck($2.loc, *$2.string); 1021 1022 TParameter param = {$2.string, new TType($1)}; 1023 $$.loc = $2.loc; 1024 $$.param = param; 1025 } 1026 | type_specifier IDENTIFIER array_specifier { 1027 if ($1.arraySizes) { 1028 parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); 1029 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type"); 1030 parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes); 1031 } 1032 TType* type = new TType($1); 1033 type->transferArraySizes($3.arraySizes); 1034 type->copyArrayInnerSizes($1.arraySizes); 1035 1036 parseContext.arrayOfArrayVersionCheck($2.loc, type->getArraySizes()); 1037 parseContext.arraySizeRequiredCheck($3.loc, *$3.arraySizes); 1038 parseContext.reservedErrorCheck($2.loc, *$2.string); 1039 1040 TParameter param = { $2.string, type }; 1041 1042 $$.loc = $2.loc; 1043 $$.param = param; 1044 } 1045 ; 1046 1047 parameter_declaration 1048 // 1049 // With name 1050 // 1051 : type_qualifier parameter_declarator { 1052 $$ = $2; 1053 if ($1.qualifier.precision != EpqNone) 1054 $$.param.type->getQualifier().precision = $1.qualifier.precision; 1055 parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier()); 1056 1057 parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers); 1058 parseContext.parameterTypeCheck($2.loc, $1.qualifier.storage, *$$.param.type); 1059 parseContext.paramCheckFix($1.loc, $1.qualifier, *$$.param.type); 1060 1061 } 1062 | parameter_declarator { 1063 $$ = $1; 1064 1065 parseContext.parameterTypeCheck($1.loc, EvqIn, *$1.param.type); 1066 parseContext.paramCheckFixStorage($1.loc, EvqTemporary, *$$.param.type); 1067 parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier()); 1068 } 1069 // 1070 // Without name 1071 // 1072 | type_qualifier parameter_type_specifier { 1073 $$ = $2; 1074 if ($1.qualifier.precision != EpqNone) 1075 $$.param.type->getQualifier().precision = $1.qualifier.precision; 1076 parseContext.precisionQualifierCheck($1.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier()); 1077 1078 parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers); 1079 parseContext.parameterTypeCheck($2.loc, $1.qualifier.storage, *$$.param.type); 1080 parseContext.paramCheckFix($1.loc, $1.qualifier, *$$.param.type); 1081 } 1082 | parameter_type_specifier { 1083 $$ = $1; 1084 1085 parseContext.parameterTypeCheck($1.loc, EvqIn, *$1.param.type); 1086 parseContext.paramCheckFixStorage($1.loc, EvqTemporary, *$$.param.type); 1087 parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier()); 1088 } 1089 ; 1090 1091 parameter_type_specifier 1092 : type_specifier { 1093 TParameter param = { 0, new TType($1) }; 1094 $$.param = param; 1095 if ($1.arraySizes) 1096 parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes); 1097 } 1098 ; 1099 1100 init_declarator_list 1101 : single_declaration { 1102 $$ = $1; 1103 } 1104 | init_declarator_list COMMA IDENTIFIER { 1105 $$ = $1; 1106 parseContext.declareVariable($3.loc, *$3.string, $1.type); 1107 } 1108 | init_declarator_list COMMA IDENTIFIER array_specifier { 1109 $$ = $1; 1110 parseContext.declareVariable($3.loc, *$3.string, $1.type, $4.arraySizes); 1111 } 1112 | init_declarator_list COMMA IDENTIFIER array_specifier EQUAL initializer { 1113 $$.type = $1.type; 1114 TIntermNode* initNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, $4.arraySizes, $6); 1115 $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, initNode, $5.loc); 1116 } 1117 | init_declarator_list COMMA IDENTIFIER EQUAL initializer { 1118 $$.type = $1.type; 1119 TIntermNode* initNode = parseContext.declareVariable($3.loc, *$3.string, $1.type, 0, $5); 1120 $$.intermNode = parseContext.intermediate.growAggregate($1.intermNode, initNode, $4.loc); 1121 } 1122 ; 1123 1124 single_declaration 1125 : fully_specified_type { 1126 $$.type = $1; 1127 $$.intermNode = 0; 1128 1129 parseContext.declareTypeDefaults($$.loc, $$.type); 1130 1131 } 1132 | fully_specified_type IDENTIFIER { 1133 $$.type = $1; 1134 $$.intermNode = 0; 1135 parseContext.declareVariable($2.loc, *$2.string, $1); 1136 } 1137 | fully_specified_type IDENTIFIER array_specifier { 1138 $$.type = $1; 1139 $$.intermNode = 0; 1140 parseContext.declareVariable($2.loc, *$2.string, $1, $3.arraySizes); 1141 } 1142 | fully_specified_type IDENTIFIER array_specifier EQUAL initializer { 1143 $$.type = $1; 1144 TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, $3.arraySizes, $5); 1145 $$.intermNode = parseContext.intermediate.growAggregate(0, initNode, $4.loc); 1146 } 1147 | fully_specified_type IDENTIFIER EQUAL initializer { 1148 $$.type = $1; 1149 TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, 0, $4); 1150 $$.intermNode = parseContext.intermediate.growAggregate(0, initNode, $3.loc); 1151 } 1152 1153 // Grammar Note: No 'enum', or 'typedef'. 1154 1155 fully_specified_type 1156 : type_specifier { 1157 $$ = $1; 1158 1159 parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $$); 1160 if ($1.arraySizes) { 1161 parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); 1162 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type"); 1163 } 1164 parseContext.precisionQualifierCheck($$.loc, $$.basicType, $$.qualifier); 1165 } 1166 | type_qualifier type_specifier { 1167 parseContext.globalQualifierFixCheck($1.loc, $1.qualifier); 1168 parseContext.globalQualifierTypeCheck($1.loc, $1.qualifier, $2); 1169 1170 if ($2.arraySizes) { 1171 parseContext.profileRequires($2.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); 1172 parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type"); 1173 } 1174 1175 if ($2.arraySizes && parseContext.arrayQualifierError($2.loc, $1.qualifier)) 1176 $2.arraySizes = nullptr; 1177 1178 parseContext.checkNoShaderLayouts($2.loc, $1.shaderQualifiers); 1179 $2.shaderQualifiers.merge($1.shaderQualifiers); 1180 parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true); 1181 parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier); 1182 1183 $$ = $2; 1184 1185 if (! $$.qualifier.isInterpolation() && 1186 ((parseContext.language == EShLangVertex && $$.qualifier.storage == EvqVaryingOut) || 1187 (parseContext.language == EShLangFragment && $$.qualifier.storage == EvqVaryingIn))) 1188 $$.qualifier.smooth = true; 1189 } 1190 ; 1191 1192 invariant_qualifier 1193 : INVARIANT { 1194 parseContext.globalCheck($1.loc, "invariant"); 1195 parseContext.profileRequires($$.loc, ENoProfile, 120, 0, "invariant"); 1196 $$.init($1.loc); 1197 $$.qualifier.invariant = true; 1198 } 1199 ; 1200 1201 interpolation_qualifier 1202 : SMOOTH { 1203 parseContext.globalCheck($1.loc, "smooth"); 1204 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "smooth"); 1205 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "smooth"); 1206 $$.init($1.loc); 1207 $$.qualifier.smooth = true; 1208 } 1209 | FLAT { 1210 parseContext.globalCheck($1.loc, "flat"); 1211 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "flat"); 1212 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "flat"); 1213 $$.init($1.loc); 1214 $$.qualifier.flat = true; 1215 } 1216 1217 | NOPERSPECTIVE { 1218 parseContext.globalCheck($1.loc, "noperspective"); 1219 parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_shader_noperspective_interpolation, "noperspective"); 1220 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "noperspective"); 1221 $$.init($1.loc); 1222 $$.qualifier.nopersp = true; 1223 } 1224 | EXPLICITINTERPAMD { 1225 parseContext.globalCheck($1.loc, "__explicitInterpAMD"); 1226 parseContext.profileRequires($1.loc, ECoreProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation"); 1227 parseContext.profileRequires($1.loc, ECompatibilityProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation"); 1228 $$.init($1.loc); 1229 $$.qualifier.explicitInterp = true; 1230 } 1231 | PERVERTEXNV { 1232 parseContext.globalCheck($1.loc, "pervertexNV"); 1233 parseContext.profileRequires($1.loc, ECoreProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric"); 1234 parseContext.profileRequires($1.loc, ECompatibilityProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric"); 1235 parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric"); 1236 $$.init($1.loc); 1237 $$.qualifier.pervertexNV = true; 1238 } 1239 | PERPRIMITIVENV { 1240 // No need for profile version or extension check. Shader stage already checks both. 1241 parseContext.globalCheck($1.loc, "perprimitiveNV"); 1242 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangFragmentMask | EShLangMeshNVMask), "perprimitiveNV"); 1243 // Fragment shader stage doesn't check for extension. So we explicitly add below extension check. 1244 if (parseContext.language == EShLangFragment) 1245 parseContext.requireExtensions($1.loc, 1, &E_GL_NV_mesh_shader, "perprimitiveNV"); 1246 $$.init($1.loc); 1247 $$.qualifier.perPrimitiveNV = true; 1248 } 1249 | PERVIEWNV { 1250 // No need for profile version or extension check. Shader stage already checks both. 1251 parseContext.globalCheck($1.loc, "perviewNV"); 1252 parseContext.requireStage($1.loc, EShLangMeshNV, "perviewNV"); 1253 $$.init($1.loc); 1254 $$.qualifier.perViewNV = true; 1255 } 1256 | PERTASKNV { 1257 // No need for profile version or extension check. Shader stage already checks both. 1258 parseContext.globalCheck($1.loc, "taskNV"); 1259 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTaskNVMask | EShLangMeshNVMask), "taskNV"); 1260 $$.init($1.loc); 1261 $$.qualifier.perTaskNV = true; 1262 } 1263 1264 ; 1265 1266 layout_qualifier 1267 : LAYOUT LEFT_PAREN layout_qualifier_id_list RIGHT_PAREN { 1268 $$ = $3; 1269 } 1270 ; 1271 1272 layout_qualifier_id_list 1273 : layout_qualifier_id { 1274 $$ = $1; 1275 } 1276 | layout_qualifier_id_list COMMA layout_qualifier_id { 1277 $$ = $1; 1278 $$.shaderQualifiers.merge($3.shaderQualifiers); 1279 parseContext.mergeObjectLayoutQualifiers($$.qualifier, $3.qualifier, false); 1280 } 1281 1282 layout_qualifier_id 1283 : IDENTIFIER { 1284 $$.init($1.loc); 1285 parseContext.setLayoutQualifier($1.loc, $$, *$1.string); 1286 } 1287 | IDENTIFIER EQUAL constant_expression { 1288 $$.init($1.loc); 1289 parseContext.setLayoutQualifier($1.loc, $$, *$1.string, $3); 1290 } 1291 | SHARED { // because "shared" is both an identifier and a keyword 1292 $$.init($1.loc); 1293 TString strShared("shared"); 1294 parseContext.setLayoutQualifier($1.loc, $$, strShared); 1295 } 1296 ; 1297 1298 1299 precise_qualifier 1300 : PRECISE { 1301 parseContext.profileRequires($$.loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader5, "precise"); 1302 parseContext.profileRequires($1.loc, EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, "precise"); 1303 $$.init($1.loc); 1304 $$.qualifier.noContraction = true; 1305 } 1306 ; 1307 1308 1309 type_qualifier 1310 : single_type_qualifier { 1311 $$ = $1; 1312 } 1313 | type_qualifier single_type_qualifier { 1314 $$ = $1; 1315 if ($$.basicType == EbtVoid) 1316 $$.basicType = $2.basicType; 1317 1318 $$.shaderQualifiers.merge($2.shaderQualifiers); 1319 parseContext.mergeQualifiers($$.loc, $$.qualifier, $2.qualifier, false); 1320 } 1321 ; 1322 1323 single_type_qualifier 1324 : storage_qualifier { 1325 $$ = $1; 1326 } 1327 | layout_qualifier { 1328 $$ = $1; 1329 } 1330 | precision_qualifier { 1331 parseContext.checkPrecisionQualifier($1.loc, $1.qualifier.precision); 1332 $$ = $1; 1333 } 1334 | interpolation_qualifier { 1335 // allow inheritance of storage qualifier from block declaration 1336 $$ = $1; 1337 } 1338 | invariant_qualifier { 1339 // allow inheritance of storage qualifier from block declaration 1340 $$ = $1; 1341 } 1342 1343 | precise_qualifier { 1344 // allow inheritance of storage qualifier from block declaration 1345 $$ = $1; 1346 } 1347 | non_uniform_qualifier { 1348 $$ = $1; 1349 } 1350 1351 ; 1352 1353 storage_qualifier 1354 : CONST { 1355 $$.init($1.loc); 1356 $$.qualifier.storage = EvqConst; // will later turn into EvqConstReadOnly, if the initializer is not constant 1357 } 1358 | INOUT { 1359 parseContext.globalCheck($1.loc, "inout"); 1360 $$.init($1.loc); 1361 $$.qualifier.storage = EvqInOut; 1362 } 1363 | IN { 1364 parseContext.globalCheck($1.loc, "in"); 1365 $$.init($1.loc); 1366 // whether this is a parameter "in" or a pipeline "in" will get sorted out a bit later 1367 $$.qualifier.storage = EvqIn; 1368 } 1369 | OUT { 1370 parseContext.globalCheck($1.loc, "out"); 1371 $$.init($1.loc); 1372 // whether this is a parameter "out" or a pipeline "out" will get sorted out a bit later 1373 $$.qualifier.storage = EvqOut; 1374 } 1375 | CENTROID { 1376 parseContext.profileRequires($1.loc, ENoProfile, 120, 0, "centroid"); 1377 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "centroid"); 1378 parseContext.globalCheck($1.loc, "centroid"); 1379 $$.init($1.loc); 1380 $$.qualifier.centroid = true; 1381 } 1382 | UNIFORM { 1383 parseContext.globalCheck($1.loc, "uniform"); 1384 $$.init($1.loc); 1385 $$.qualifier.storage = EvqUniform; 1386 } 1387 | SHARED { 1388 parseContext.globalCheck($1.loc, "shared"); 1389 parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared"); 1390 parseContext.profileRequires($1.loc, EEsProfile, 310, 0, "shared"); 1391 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangComputeMask | EShLangMeshNVMask | EShLangTaskNVMask), "shared"); 1392 $$.init($1.loc); 1393 $$.qualifier.storage = EvqShared; 1394 } 1395 | BUFFER { 1396 parseContext.globalCheck($1.loc, "buffer"); 1397 $$.init($1.loc); 1398 $$.qualifier.storage = EvqBuffer; 1399 } 1400 1401 | ATTRIBUTE { 1402 parseContext.requireStage($1.loc, EShLangVertex, "attribute"); 1403 parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "attribute"); 1404 parseContext.checkDeprecated($1.loc, ENoProfile, 130, "attribute"); 1405 parseContext.requireNotRemoved($1.loc, ECoreProfile, 420, "attribute"); 1406 parseContext.requireNotRemoved($1.loc, EEsProfile, 300, "attribute"); 1407 1408 parseContext.globalCheck($1.loc, "attribute"); 1409 1410 $$.init($1.loc); 1411 $$.qualifier.storage = EvqVaryingIn; 1412 } 1413 | VARYING { 1414 parseContext.checkDeprecated($1.loc, ENoProfile, 130, "varying"); 1415 parseContext.checkDeprecated($1.loc, ECoreProfile, 130, "varying"); 1416 parseContext.requireNotRemoved($1.loc, ECoreProfile, 420, "varying"); 1417 parseContext.requireNotRemoved($1.loc, EEsProfile, 300, "varying"); 1418 1419 parseContext.globalCheck($1.loc, "varying"); 1420 1421 $$.init($1.loc); 1422 if (parseContext.language == EShLangVertex) 1423 $$.qualifier.storage = EvqVaryingOut; 1424 else 1425 $$.qualifier.storage = EvqVaryingIn; 1426 } 1427 | PATCH { 1428 parseContext.globalCheck($1.loc, "patch"); 1429 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTessControlMask | EShLangTessEvaluationMask), "patch"); 1430 $$.init($1.loc); 1431 $$.qualifier.patch = true; 1432 } 1433 | SAMPLE { 1434 parseContext.globalCheck($1.loc, "sample"); 1435 $$.init($1.loc); 1436 $$.qualifier.sample = true; 1437 } 1438 | HITATTRNV { 1439 parseContext.globalCheck($1.loc, "hitAttributeNV"); 1440 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangIntersectMask | EShLangClosestHitMask 1441 | EShLangAnyHitMask), "hitAttributeNV"); 1442 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "hitAttributeNV"); 1443 $$.init($1.loc); 1444 $$.qualifier.storage = EvqHitAttr; 1445 } 1446 | HITATTREXT { 1447 parseContext.globalCheck($1.loc, "hitAttributeEXT"); 1448 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangIntersectMask | EShLangClosestHitMask 1449 | EShLangAnyHitMask), "hitAttributeEXT"); 1450 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_EXT_ray_tracing, "hitAttributeNV"); 1451 $$.init($1.loc); 1452 $$.qualifier.storage = EvqHitAttr; 1453 } 1454 | PAYLOADNV { 1455 parseContext.globalCheck($1.loc, "rayPayloadNV"); 1456 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask | 1457 EShLangAnyHitMask | EShLangMissMask), "rayPayloadNV"); 1458 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "rayPayloadNV"); 1459 $$.init($1.loc); 1460 $$.qualifier.storage = EvqPayload; 1461 } 1462 | PAYLOADEXT { 1463 parseContext.globalCheck($1.loc, "rayPayloadEXT"); 1464 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask | 1465 EShLangAnyHitMask | EShLangMissMask), "rayPayloadEXT"); 1466 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_EXT_ray_tracing, "rayPayloadEXT"); 1467 $$.init($1.loc); 1468 $$.qualifier.storage = EvqPayload; 1469 } 1470 | PAYLOADINNV { 1471 parseContext.globalCheck($1.loc, "rayPayloadInNV"); 1472 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangClosestHitMask | 1473 EShLangAnyHitMask | EShLangMissMask), "rayPayloadInNV"); 1474 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "rayPayloadInNV"); 1475 $$.init($1.loc); 1476 $$.qualifier.storage = EvqPayloadIn; 1477 } 1478 | PAYLOADINEXT { 1479 parseContext.globalCheck($1.loc, "rayPayloadInEXT"); 1480 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangClosestHitMask | 1481 EShLangAnyHitMask | EShLangMissMask), "rayPayloadInEXT"); 1482 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_EXT_ray_tracing, "rayPayloadInEXT"); 1483 $$.init($1.loc); 1484 $$.qualifier.storage = EvqPayloadIn; 1485 } 1486 | CALLDATANV { 1487 parseContext.globalCheck($1.loc, "callableDataNV"); 1488 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenMask | 1489 EShLangClosestHitMask | EShLangMissMask | EShLangCallableMask), "callableDataNV"); 1490 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "callableDataNV"); 1491 $$.init($1.loc); 1492 $$.qualifier.storage = EvqCallableData; 1493 } 1494 | CALLDATAEXT { 1495 parseContext.globalCheck($1.loc, "callableDataEXT"); 1496 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenMask | 1497 EShLangClosestHitMask | EShLangMissMask | EShLangCallableMask), "callableDataEXT"); 1498 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_EXT_ray_tracing, "callableDataEXT"); 1499 $$.init($1.loc); 1500 $$.qualifier.storage = EvqCallableData; 1501 } 1502 | CALLDATAINNV { 1503 parseContext.globalCheck($1.loc, "callableDataInNV"); 1504 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangCallableMask), "callableDataInNV"); 1505 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "callableDataInNV"); 1506 $$.init($1.loc); 1507 $$.qualifier.storage = EvqCallableDataIn; 1508 } 1509 | CALLDATAINEXT { 1510 parseContext.globalCheck($1.loc, "callableDataInEXT"); 1511 parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangCallableMask), "callableDataInEXT"); 1512 parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_EXT_ray_tracing, "callableDataInEXT"); 1513 $$.init($1.loc); 1514 $$.qualifier.storage = EvqCallableDataIn; 1515 } 1516 | COHERENT { 1517 $$.init($1.loc); 1518 $$.qualifier.coherent = true; 1519 } 1520 | DEVICECOHERENT { 1521 $$.init($1.loc); 1522 parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "devicecoherent"); 1523 $$.qualifier.devicecoherent = true; 1524 } 1525 | QUEUEFAMILYCOHERENT { 1526 $$.init($1.loc); 1527 parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "queuefamilycoherent"); 1528 $$.qualifier.queuefamilycoherent = true; 1529 } 1530 | WORKGROUPCOHERENT { 1531 $$.init($1.loc); 1532 parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "workgroupcoherent"); 1533 $$.qualifier.workgroupcoherent = true; 1534 } 1535 | SUBGROUPCOHERENT { 1536 $$.init($1.loc); 1537 parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "subgroupcoherent"); 1538 $$.qualifier.subgroupcoherent = true; 1539 } 1540 | NONPRIVATE { 1541 $$.init($1.loc); 1542 parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "nonprivate"); 1543 $$.qualifier.nonprivate = true; 1544 } 1545 | SHADERCALLCOHERENT { 1546 $$.init($1.loc); 1547 parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_ray_tracing, "shadercallcoherent"); 1548 $$.qualifier.shadercallcoherent = true; 1549 } 1550 | VOLATILE { 1551 $$.init($1.loc); 1552 $$.qualifier.volatil = true; 1553 } 1554 | RESTRICT { 1555 $$.init($1.loc); 1556 $$.qualifier.restrict = true; 1557 } 1558 | READONLY { 1559 $$.init($1.loc); 1560 $$.qualifier.readonly = true; 1561 } 1562 | WRITEONLY { 1563 $$.init($1.loc); 1564 $$.qualifier.writeonly = true; 1565 } 1566 | SUBROUTINE { 1567 parseContext.spvRemoved($1.loc, "subroutine"); 1568 parseContext.globalCheck($1.loc, "subroutine"); 1569 parseContext.unimplemented($1.loc, "subroutine"); 1570 $$.init($1.loc); 1571 } 1572 | SUBROUTINE LEFT_PAREN type_name_list RIGHT_PAREN { 1573 parseContext.spvRemoved($1.loc, "subroutine"); 1574 parseContext.globalCheck($1.loc, "subroutine"); 1575 parseContext.unimplemented($1.loc, "subroutine"); 1576 $$.init($1.loc); 1577 } 1578 1579 ; 1580 1581 1582 non_uniform_qualifier 1583 : NONUNIFORM { 1584 $$.init($1.loc); 1585 $$.qualifier.nonUniform = true; 1586 } 1587 ; 1588 1589 type_name_list 1590 : IDENTIFIER { 1591 // TODO 1592 } 1593 | type_name_list COMMA IDENTIFIER { 1594 // TODO: 4.0 semantics: subroutines 1595 // 1) make sure each identifier is a type declared earlier with SUBROUTINE 1596 // 2) save all of the identifiers for future comparison with the declared function 1597 } 1598 ; 1599 1600 1601 type_specifier 1602 : type_specifier_nonarray type_parameter_specifier_opt { 1603 $$ = $1; 1604 $$.qualifier.precision = parseContext.getDefaultPrecision($$); 1605 $$.typeParameters = $2; 1606 } 1607 | type_specifier_nonarray type_parameter_specifier_opt array_specifier { 1608 parseContext.arrayOfArrayVersionCheck($3.loc, $3.arraySizes); 1609 $$ = $1; 1610 $$.qualifier.precision = parseContext.getDefaultPrecision($$); 1611 $$.typeParameters = $2; 1612 $$.arraySizes = $3.arraySizes; 1613 } 1614 ; 1615 1616 array_specifier 1617 : LEFT_BRACKET RIGHT_BRACKET { 1618 $$.loc = $1.loc; 1619 $$.arraySizes = new TArraySizes; 1620 $$.arraySizes->addInnerSize(); 1621 } 1622 | LEFT_BRACKET conditional_expression RIGHT_BRACKET { 1623 $$.loc = $1.loc; 1624 $$.arraySizes = new TArraySizes; 1625 1626 TArraySize size; 1627 parseContext.arraySizeCheck($2->getLoc(), $2, size, "array size"); 1628 $$.arraySizes->addInnerSize(size); 1629 } 1630 | array_specifier LEFT_BRACKET RIGHT_BRACKET { 1631 $$ = $1; 1632 $$.arraySizes->addInnerSize(); 1633 } 1634 | array_specifier LEFT_BRACKET conditional_expression RIGHT_BRACKET { 1635 $$ = $1; 1636 1637 TArraySize size; 1638 parseContext.arraySizeCheck($3->getLoc(), $3, size, "array size"); 1639 $$.arraySizes->addInnerSize(size); 1640 } 1641 ; 1642 1643 type_parameter_specifier_opt 1644 : type_parameter_specifier { 1645 $$ = $1; 1646 } 1647 | /* May be null */ { 1648 $$ = 0; 1649 } 1650 ; 1651 1652 type_parameter_specifier 1653 : LEFT_ANGLE type_parameter_specifier_list RIGHT_ANGLE { 1654 $$ = $2; 1655 } 1656 ; 1657 1658 type_parameter_specifier_list 1659 : unary_expression { 1660 $$ = new TArraySizes; 1661 1662 TArraySize size; 1663 parseContext.arraySizeCheck($1->getLoc(), $1, size, "type parameter"); 1664 $$->addInnerSize(size); 1665 } 1666 | type_parameter_specifier_list COMMA unary_expression { 1667 $$ = $1; 1668 1669 TArraySize size; 1670 parseContext.arraySizeCheck($3->getLoc(), $3, size, "type parameter"); 1671 $$->addInnerSize(size); 1672 } 1673 ; 1674 1675 type_specifier_nonarray 1676 : VOID { 1677 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1678 $$.basicType = EbtVoid; 1679 } 1680 | FLOAT { 1681 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1682 $$.basicType = EbtFloat; 1683 } 1684 | INT { 1685 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1686 $$.basicType = EbtInt; 1687 } 1688 | UINT { 1689 parseContext.fullIntegerCheck($1.loc, "unsigned integer"); 1690 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1691 $$.basicType = EbtUint; 1692 } 1693 | BOOL { 1694 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1695 $$.basicType = EbtBool; 1696 } 1697 | VEC2 { 1698 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1699 $$.basicType = EbtFloat; 1700 $$.setVector(2); 1701 } 1702 | VEC3 { 1703 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1704 $$.basicType = EbtFloat; 1705 $$.setVector(3); 1706 } 1707 | VEC4 { 1708 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1709 $$.basicType = EbtFloat; 1710 $$.setVector(4); 1711 } 1712 | BVEC2 { 1713 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1714 $$.basicType = EbtBool; 1715 $$.setVector(2); 1716 } 1717 | BVEC3 { 1718 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1719 $$.basicType = EbtBool; 1720 $$.setVector(3); 1721 } 1722 | BVEC4 { 1723 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1724 $$.basicType = EbtBool; 1725 $$.setVector(4); 1726 } 1727 | IVEC2 { 1728 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1729 $$.basicType = EbtInt; 1730 $$.setVector(2); 1731 } 1732 | IVEC3 { 1733 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1734 $$.basicType = EbtInt; 1735 $$.setVector(3); 1736 } 1737 | IVEC4 { 1738 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1739 $$.basicType = EbtInt; 1740 $$.setVector(4); 1741 } 1742 | UVEC2 { 1743 parseContext.fullIntegerCheck($1.loc, "unsigned integer vector"); 1744 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1745 $$.basicType = EbtUint; 1746 $$.setVector(2); 1747 } 1748 | UVEC3 { 1749 parseContext.fullIntegerCheck($1.loc, "unsigned integer vector"); 1750 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1751 $$.basicType = EbtUint; 1752 $$.setVector(3); 1753 } 1754 | UVEC4 { 1755 parseContext.fullIntegerCheck($1.loc, "unsigned integer vector"); 1756 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1757 $$.basicType = EbtUint; 1758 $$.setVector(4); 1759 } 1760 | MAT2 { 1761 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1762 $$.basicType = EbtFloat; 1763 $$.setMatrix(2, 2); 1764 } 1765 | MAT3 { 1766 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1767 $$.basicType = EbtFloat; 1768 $$.setMatrix(3, 3); 1769 } 1770 | MAT4 { 1771 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1772 $$.basicType = EbtFloat; 1773 $$.setMatrix(4, 4); 1774 } 1775 | MAT2X2 { 1776 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1777 $$.basicType = EbtFloat; 1778 $$.setMatrix(2, 2); 1779 } 1780 | MAT2X3 { 1781 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1782 $$.basicType = EbtFloat; 1783 $$.setMatrix(2, 3); 1784 } 1785 | MAT2X4 { 1786 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1787 $$.basicType = EbtFloat; 1788 $$.setMatrix(2, 4); 1789 } 1790 | MAT3X2 { 1791 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1792 $$.basicType = EbtFloat; 1793 $$.setMatrix(3, 2); 1794 } 1795 | MAT3X3 { 1796 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1797 $$.basicType = EbtFloat; 1798 $$.setMatrix(3, 3); 1799 } 1800 | MAT3X4 { 1801 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1802 $$.basicType = EbtFloat; 1803 $$.setMatrix(3, 4); 1804 } 1805 | MAT4X2 { 1806 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1807 $$.basicType = EbtFloat; 1808 $$.setMatrix(4, 2); 1809 } 1810 | MAT4X3 { 1811 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1812 $$.basicType = EbtFloat; 1813 $$.setMatrix(4, 3); 1814 } 1815 | MAT4X4 { 1816 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1817 $$.basicType = EbtFloat; 1818 $$.setMatrix(4, 4); 1819 } 1820 1821 | DOUBLE { 1822 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double"); 1823 if (! parseContext.symbolTable.atBuiltInLevel()) 1824 parseContext.doubleCheck($1.loc, "double"); 1825 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1826 $$.basicType = EbtDouble; 1827 } 1828 | FLOAT16_T { 1829 parseContext.float16ScalarVectorCheck($1.loc, "float16_t", parseContext.symbolTable.atBuiltInLevel()); 1830 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1831 $$.basicType = EbtFloat16; 1832 } 1833 | FLOAT32_T { 1834 parseContext.explicitFloat32Check($1.loc, "float32_t", parseContext.symbolTable.atBuiltInLevel()); 1835 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1836 $$.basicType = EbtFloat; 1837 } 1838 | FLOAT64_T { 1839 parseContext.explicitFloat64Check($1.loc, "float64_t", parseContext.symbolTable.atBuiltInLevel()); 1840 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1841 $$.basicType = EbtDouble; 1842 } 1843 | INT8_T { 1844 parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); 1845 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1846 $$.basicType = EbtInt8; 1847 } 1848 | UINT8_T { 1849 parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); 1850 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1851 $$.basicType = EbtUint8; 1852 } 1853 | INT16_T { 1854 parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); 1855 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1856 $$.basicType = EbtInt16; 1857 } 1858 | UINT16_T { 1859 parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); 1860 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1861 $$.basicType = EbtUint16; 1862 } 1863 | INT32_T { 1864 parseContext.explicitInt32Check($1.loc, "32-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); 1865 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1866 $$.basicType = EbtInt; 1867 } 1868 | UINT32_T { 1869 parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); 1870 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1871 $$.basicType = EbtUint; 1872 } 1873 | INT64_T { 1874 parseContext.int64Check($1.loc, "64-bit integer", parseContext.symbolTable.atBuiltInLevel()); 1875 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1876 $$.basicType = EbtInt64; 1877 } 1878 | UINT64_T { 1879 parseContext.int64Check($1.loc, "64-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); 1880 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1881 $$.basicType = EbtUint64; 1882 } 1883 | DVEC2 { 1884 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector"); 1885 if (! parseContext.symbolTable.atBuiltInLevel()) 1886 parseContext.doubleCheck($1.loc, "double vector"); 1887 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1888 $$.basicType = EbtDouble; 1889 $$.setVector(2); 1890 } 1891 | DVEC3 { 1892 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector"); 1893 if (! parseContext.symbolTable.atBuiltInLevel()) 1894 parseContext.doubleCheck($1.loc, "double vector"); 1895 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1896 $$.basicType = EbtDouble; 1897 $$.setVector(3); 1898 } 1899 | DVEC4 { 1900 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector"); 1901 if (! parseContext.symbolTable.atBuiltInLevel()) 1902 parseContext.doubleCheck($1.loc, "double vector"); 1903 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1904 $$.basicType = EbtDouble; 1905 $$.setVector(4); 1906 } 1907 | F16VEC2 { 1908 parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); 1909 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1910 $$.basicType = EbtFloat16; 1911 $$.setVector(2); 1912 } 1913 | F16VEC3 { 1914 parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); 1915 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1916 $$.basicType = EbtFloat16; 1917 $$.setVector(3); 1918 } 1919 | F16VEC4 { 1920 parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); 1921 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1922 $$.basicType = EbtFloat16; 1923 $$.setVector(4); 1924 } 1925 | F32VEC2 { 1926 parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); 1927 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1928 $$.basicType = EbtFloat; 1929 $$.setVector(2); 1930 } 1931 | F32VEC3 { 1932 parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); 1933 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1934 $$.basicType = EbtFloat; 1935 $$.setVector(3); 1936 } 1937 | F32VEC4 { 1938 parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); 1939 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1940 $$.basicType = EbtFloat; 1941 $$.setVector(4); 1942 } 1943 | F64VEC2 { 1944 parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); 1945 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1946 $$.basicType = EbtDouble; 1947 $$.setVector(2); 1948 } 1949 | F64VEC3 { 1950 parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); 1951 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1952 $$.basicType = EbtDouble; 1953 $$.setVector(3); 1954 } 1955 | F64VEC4 { 1956 parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); 1957 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1958 $$.basicType = EbtDouble; 1959 $$.setVector(4); 1960 } 1961 | I8VEC2 { 1962 parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); 1963 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1964 $$.basicType = EbtInt8; 1965 $$.setVector(2); 1966 } 1967 | I8VEC3 { 1968 parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); 1969 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1970 $$.basicType = EbtInt8; 1971 $$.setVector(3); 1972 } 1973 | I8VEC4 { 1974 parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); 1975 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1976 $$.basicType = EbtInt8; 1977 $$.setVector(4); 1978 } 1979 | I16VEC2 { 1980 parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); 1981 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1982 $$.basicType = EbtInt16; 1983 $$.setVector(2); 1984 } 1985 | I16VEC3 { 1986 parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); 1987 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1988 $$.basicType = EbtInt16; 1989 $$.setVector(3); 1990 } 1991 | I16VEC4 { 1992 parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); 1993 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 1994 $$.basicType = EbtInt16; 1995 $$.setVector(4); 1996 } 1997 | I32VEC2 { 1998 parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); 1999 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2000 $$.basicType = EbtInt; 2001 $$.setVector(2); 2002 } 2003 | I32VEC3 { 2004 parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); 2005 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2006 $$.basicType = EbtInt; 2007 $$.setVector(3); 2008 } 2009 | I32VEC4 { 2010 parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); 2011 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2012 $$.basicType = EbtInt; 2013 $$.setVector(4); 2014 } 2015 | I64VEC2 { 2016 parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); 2017 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2018 $$.basicType = EbtInt64; 2019 $$.setVector(2); 2020 } 2021 | I64VEC3 { 2022 parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); 2023 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2024 $$.basicType = EbtInt64; 2025 $$.setVector(3); 2026 } 2027 | I64VEC4 { 2028 parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); 2029 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2030 $$.basicType = EbtInt64; 2031 $$.setVector(4); 2032 } 2033 | U8VEC2 { 2034 parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); 2035 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2036 $$.basicType = EbtUint8; 2037 $$.setVector(2); 2038 } 2039 | U8VEC3 { 2040 parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); 2041 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2042 $$.basicType = EbtUint8; 2043 $$.setVector(3); 2044 } 2045 | U8VEC4 { 2046 parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); 2047 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2048 $$.basicType = EbtUint8; 2049 $$.setVector(4); 2050 } 2051 | U16VEC2 { 2052 parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); 2053 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2054 $$.basicType = EbtUint16; 2055 $$.setVector(2); 2056 } 2057 | U16VEC3 { 2058 parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); 2059 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2060 $$.basicType = EbtUint16; 2061 $$.setVector(3); 2062 } 2063 | U16VEC4 { 2064 parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); 2065 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2066 $$.basicType = EbtUint16; 2067 $$.setVector(4); 2068 } 2069 | U32VEC2 { 2070 parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); 2071 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2072 $$.basicType = EbtUint; 2073 $$.setVector(2); 2074 } 2075 | U32VEC3 { 2076 parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); 2077 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2078 $$.basicType = EbtUint; 2079 $$.setVector(3); 2080 } 2081 | U32VEC4 { 2082 parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); 2083 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2084 $$.basicType = EbtUint; 2085 $$.setVector(4); 2086 } 2087 | U64VEC2 { 2088 parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); 2089 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2090 $$.basicType = EbtUint64; 2091 $$.setVector(2); 2092 } 2093 | U64VEC3 { 2094 parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); 2095 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2096 $$.basicType = EbtUint64; 2097 $$.setVector(3); 2098 } 2099 | U64VEC4 { 2100 parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); 2101 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2102 $$.basicType = EbtUint64; 2103 $$.setVector(4); 2104 } 2105 | DMAT2 { 2106 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); 2107 if (! parseContext.symbolTable.atBuiltInLevel()) 2108 parseContext.doubleCheck($1.loc, "double matrix"); 2109 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2110 $$.basicType = EbtDouble; 2111 $$.setMatrix(2, 2); 2112 } 2113 | DMAT3 { 2114 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); 2115 if (! parseContext.symbolTable.atBuiltInLevel()) 2116 parseContext.doubleCheck($1.loc, "double matrix"); 2117 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2118 $$.basicType = EbtDouble; 2119 $$.setMatrix(3, 3); 2120 } 2121 | DMAT4 { 2122 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); 2123 if (! parseContext.symbolTable.atBuiltInLevel()) 2124 parseContext.doubleCheck($1.loc, "double matrix"); 2125 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2126 $$.basicType = EbtDouble; 2127 $$.setMatrix(4, 4); 2128 } 2129 | DMAT2X2 { 2130 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); 2131 if (! parseContext.symbolTable.atBuiltInLevel()) 2132 parseContext.doubleCheck($1.loc, "double matrix"); 2133 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2134 $$.basicType = EbtDouble; 2135 $$.setMatrix(2, 2); 2136 } 2137 | DMAT2X3 { 2138 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); 2139 if (! parseContext.symbolTable.atBuiltInLevel()) 2140 parseContext.doubleCheck($1.loc, "double matrix"); 2141 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2142 $$.basicType = EbtDouble; 2143 $$.setMatrix(2, 3); 2144 } 2145 | DMAT2X4 { 2146 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); 2147 if (! parseContext.symbolTable.atBuiltInLevel()) 2148 parseContext.doubleCheck($1.loc, "double matrix"); 2149 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2150 $$.basicType = EbtDouble; 2151 $$.setMatrix(2, 4); 2152 } 2153 | DMAT3X2 { 2154 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); 2155 if (! parseContext.symbolTable.atBuiltInLevel()) 2156 parseContext.doubleCheck($1.loc, "double matrix"); 2157 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2158 $$.basicType = EbtDouble; 2159 $$.setMatrix(3, 2); 2160 } 2161 | DMAT3X3 { 2162 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); 2163 if (! parseContext.symbolTable.atBuiltInLevel()) 2164 parseContext.doubleCheck($1.loc, "double matrix"); 2165 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2166 $$.basicType = EbtDouble; 2167 $$.setMatrix(3, 3); 2168 } 2169 | DMAT3X4 { 2170 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); 2171 if (! parseContext.symbolTable.atBuiltInLevel()) 2172 parseContext.doubleCheck($1.loc, "double matrix"); 2173 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2174 $$.basicType = EbtDouble; 2175 $$.setMatrix(3, 4); 2176 } 2177 | DMAT4X2 { 2178 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); 2179 if (! parseContext.symbolTable.atBuiltInLevel()) 2180 parseContext.doubleCheck($1.loc, "double matrix"); 2181 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2182 $$.basicType = EbtDouble; 2183 $$.setMatrix(4, 2); 2184 } 2185 | DMAT4X3 { 2186 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); 2187 if (! parseContext.symbolTable.atBuiltInLevel()) 2188 parseContext.doubleCheck($1.loc, "double matrix"); 2189 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2190 $$.basicType = EbtDouble; 2191 $$.setMatrix(4, 3); 2192 } 2193 | DMAT4X4 { 2194 parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix"); 2195 if (! parseContext.symbolTable.atBuiltInLevel()) 2196 parseContext.doubleCheck($1.loc, "double matrix"); 2197 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2198 $$.basicType = EbtDouble; 2199 $$.setMatrix(4, 4); 2200 } 2201 | F16MAT2 { 2202 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); 2203 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2204 $$.basicType = EbtFloat16; 2205 $$.setMatrix(2, 2); 2206 } 2207 | F16MAT3 { 2208 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); 2209 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2210 $$.basicType = EbtFloat16; 2211 $$.setMatrix(3, 3); 2212 } 2213 | F16MAT4 { 2214 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); 2215 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2216 $$.basicType = EbtFloat16; 2217 $$.setMatrix(4, 4); 2218 } 2219 | F16MAT2X2 { 2220 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); 2221 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2222 $$.basicType = EbtFloat16; 2223 $$.setMatrix(2, 2); 2224 } 2225 | F16MAT2X3 { 2226 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); 2227 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2228 $$.basicType = EbtFloat16; 2229 $$.setMatrix(2, 3); 2230 } 2231 | F16MAT2X4 { 2232 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); 2233 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2234 $$.basicType = EbtFloat16; 2235 $$.setMatrix(2, 4); 2236 } 2237 | F16MAT3X2 { 2238 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); 2239 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2240 $$.basicType = EbtFloat16; 2241 $$.setMatrix(3, 2); 2242 } 2243 | F16MAT3X3 { 2244 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); 2245 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2246 $$.basicType = EbtFloat16; 2247 $$.setMatrix(3, 3); 2248 } 2249 | F16MAT3X4 { 2250 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); 2251 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2252 $$.basicType = EbtFloat16; 2253 $$.setMatrix(3, 4); 2254 } 2255 | F16MAT4X2 { 2256 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); 2257 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2258 $$.basicType = EbtFloat16; 2259 $$.setMatrix(4, 2); 2260 } 2261 | F16MAT4X3 { 2262 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); 2263 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2264 $$.basicType = EbtFloat16; 2265 $$.setMatrix(4, 3); 2266 } 2267 | F16MAT4X4 { 2268 parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); 2269 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2270 $$.basicType = EbtFloat16; 2271 $$.setMatrix(4, 4); 2272 } 2273 | F32MAT2 { 2274 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2275 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2276 $$.basicType = EbtFloat; 2277 $$.setMatrix(2, 2); 2278 } 2279 | F32MAT3 { 2280 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2281 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2282 $$.basicType = EbtFloat; 2283 $$.setMatrix(3, 3); 2284 } 2285 | F32MAT4 { 2286 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2287 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2288 $$.basicType = EbtFloat; 2289 $$.setMatrix(4, 4); 2290 } 2291 | F32MAT2X2 { 2292 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2293 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2294 $$.basicType = EbtFloat; 2295 $$.setMatrix(2, 2); 2296 } 2297 | F32MAT2X3 { 2298 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2299 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2300 $$.basicType = EbtFloat; 2301 $$.setMatrix(2, 3); 2302 } 2303 | F32MAT2X4 { 2304 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2305 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2306 $$.basicType = EbtFloat; 2307 $$.setMatrix(2, 4); 2308 } 2309 | F32MAT3X2 { 2310 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2311 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2312 $$.basicType = EbtFloat; 2313 $$.setMatrix(3, 2); 2314 } 2315 | F32MAT3X3 { 2316 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2317 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2318 $$.basicType = EbtFloat; 2319 $$.setMatrix(3, 3); 2320 } 2321 | F32MAT3X4 { 2322 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2323 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2324 $$.basicType = EbtFloat; 2325 $$.setMatrix(3, 4); 2326 } 2327 | F32MAT4X2 { 2328 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2329 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2330 $$.basicType = EbtFloat; 2331 $$.setMatrix(4, 2); 2332 } 2333 | F32MAT4X3 { 2334 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2335 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2336 $$.basicType = EbtFloat; 2337 $$.setMatrix(4, 3); 2338 } 2339 | F32MAT4X4 { 2340 parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2341 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2342 $$.basicType = EbtFloat; 2343 $$.setMatrix(4, 4); 2344 } 2345 | F64MAT2 { 2346 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2347 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2348 $$.basicType = EbtDouble; 2349 $$.setMatrix(2, 2); 2350 } 2351 | F64MAT3 { 2352 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2353 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2354 $$.basicType = EbtDouble; 2355 $$.setMatrix(3, 3); 2356 } 2357 | F64MAT4 { 2358 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2359 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2360 $$.basicType = EbtDouble; 2361 $$.setMatrix(4, 4); 2362 } 2363 | F64MAT2X2 { 2364 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2365 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2366 $$.basicType = EbtDouble; 2367 $$.setMatrix(2, 2); 2368 } 2369 | F64MAT2X3 { 2370 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2371 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2372 $$.basicType = EbtDouble; 2373 $$.setMatrix(2, 3); 2374 } 2375 | F64MAT2X4 { 2376 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2377 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2378 $$.basicType = EbtDouble; 2379 $$.setMatrix(2, 4); 2380 } 2381 | F64MAT3X2 { 2382 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2383 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2384 $$.basicType = EbtDouble; 2385 $$.setMatrix(3, 2); 2386 } 2387 | F64MAT3X3 { 2388 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2389 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2390 $$.basicType = EbtDouble; 2391 $$.setMatrix(3, 3); 2392 } 2393 | F64MAT3X4 { 2394 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2395 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2396 $$.basicType = EbtDouble; 2397 $$.setMatrix(3, 4); 2398 } 2399 | F64MAT4X2 { 2400 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2401 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2402 $$.basicType = EbtDouble; 2403 $$.setMatrix(4, 2); 2404 } 2405 | F64MAT4X3 { 2406 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2407 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2408 $$.basicType = EbtDouble; 2409 $$.setMatrix(4, 3); 2410 } 2411 | F64MAT4X4 { 2412 parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); 2413 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2414 $$.basicType = EbtDouble; 2415 $$.setMatrix(4, 4); 2416 } 2417 | ACCSTRUCTNV { 2418 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2419 $$.basicType = EbtAccStruct; 2420 } 2421 | ACCSTRUCTEXT { 2422 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2423 $$.basicType = EbtAccStruct; 2424 } 2425 | RAYQUERYEXT { 2426 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2427 $$.basicType = EbtRayQuery; 2428 } 2429 | ATOMIC_UINT { 2430 parseContext.vulkanRemoved($1.loc, "atomic counter types"); 2431 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2432 $$.basicType = EbtAtomicUint; 2433 } 2434 | SAMPLER1D { 2435 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2436 $$.basicType = EbtSampler; 2437 $$.sampler.set(EbtFloat, Esd1D); 2438 } 2439 2440 | SAMPLER2D { 2441 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2442 $$.basicType = EbtSampler; 2443 $$.sampler.set(EbtFloat, Esd2D); 2444 } 2445 | SAMPLER3D { 2446 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2447 $$.basicType = EbtSampler; 2448 $$.sampler.set(EbtFloat, Esd3D); 2449 } 2450 | SAMPLERCUBE { 2451 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2452 $$.basicType = EbtSampler; 2453 $$.sampler.set(EbtFloat, EsdCube); 2454 } 2455 | SAMPLER2DSHADOW { 2456 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2457 $$.basicType = EbtSampler; 2458 $$.sampler.set(EbtFloat, Esd2D, false, true); 2459 } 2460 | SAMPLERCUBESHADOW { 2461 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2462 $$.basicType = EbtSampler; 2463 $$.sampler.set(EbtFloat, EsdCube, false, true); 2464 } 2465 | SAMPLER2DARRAY { 2466 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2467 $$.basicType = EbtSampler; 2468 $$.sampler.set(EbtFloat, Esd2D, true); 2469 } 2470 | SAMPLER2DARRAYSHADOW { 2471 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2472 $$.basicType = EbtSampler; 2473 $$.sampler.set(EbtFloat, Esd2D, true, true); 2474 } 2475 2476 | SAMPLER1DSHADOW { 2477 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2478 $$.basicType = EbtSampler; 2479 $$.sampler.set(EbtFloat, Esd1D, false, true); 2480 } 2481 | SAMPLER1DARRAY { 2482 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2483 $$.basicType = EbtSampler; 2484 $$.sampler.set(EbtFloat, Esd1D, true); 2485 } 2486 | SAMPLER1DARRAYSHADOW { 2487 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2488 $$.basicType = EbtSampler; 2489 $$.sampler.set(EbtFloat, Esd1D, true, true); 2490 } 2491 | SAMPLERCUBEARRAY { 2492 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2493 $$.basicType = EbtSampler; 2494 $$.sampler.set(EbtFloat, EsdCube, true); 2495 } 2496 | SAMPLERCUBEARRAYSHADOW { 2497 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2498 $$.basicType = EbtSampler; 2499 $$.sampler.set(EbtFloat, EsdCube, true, true); 2500 } 2501 | F16SAMPLER1D { 2502 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); 2503 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2504 $$.basicType = EbtSampler; 2505 $$.sampler.set(EbtFloat16, Esd1D); 2506 } 2507 | F16SAMPLER2D { 2508 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); 2509 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2510 $$.basicType = EbtSampler; 2511 $$.sampler.set(EbtFloat16, Esd2D); 2512 } 2513 | F16SAMPLER3D { 2514 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); 2515 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2516 $$.basicType = EbtSampler; 2517 $$.sampler.set(EbtFloat16, Esd3D); 2518 } 2519 | F16SAMPLERCUBE { 2520 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); 2521 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2522 $$.basicType = EbtSampler; 2523 $$.sampler.set(EbtFloat16, EsdCube); 2524 } 2525 | F16SAMPLER1DSHADOW { 2526 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); 2527 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2528 $$.basicType = EbtSampler; 2529 $$.sampler.set(EbtFloat16, Esd1D, false, true); 2530 } 2531 | F16SAMPLER2DSHADOW { 2532 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); 2533 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2534 $$.basicType = EbtSampler; 2535 $$.sampler.set(EbtFloat16, Esd2D, false, true); 2536 } 2537 | F16SAMPLERCUBESHADOW { 2538 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); 2539 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2540 $$.basicType = EbtSampler; 2541 $$.sampler.set(EbtFloat16, EsdCube, false, true); 2542 } 2543 | F16SAMPLER1DARRAY { 2544 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); 2545 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2546 $$.basicType = EbtSampler; 2547 $$.sampler.set(EbtFloat16, Esd1D, true); 2548 } 2549 | F16SAMPLER2DARRAY { 2550 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); 2551 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2552 $$.basicType = EbtSampler; 2553 $$.sampler.set(EbtFloat16, Esd2D, true); 2554 } 2555 | F16SAMPLER1DARRAYSHADOW { 2556 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); 2557 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2558 $$.basicType = EbtSampler; 2559 $$.sampler.set(EbtFloat16, Esd1D, true, true); 2560 } 2561 | F16SAMPLER2DARRAYSHADOW { 2562 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); 2563 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2564 $$.basicType = EbtSampler; 2565 $$.sampler.set(EbtFloat16, Esd2D, true, true); 2566 } 2567 | F16SAMPLERCUBEARRAY { 2568 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); 2569 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2570 $$.basicType = EbtSampler; 2571 $$.sampler.set(EbtFloat16, EsdCube, true); 2572 } 2573 | F16SAMPLERCUBEARRAYSHADOW { 2574 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); 2575 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2576 $$.basicType = EbtSampler; 2577 $$.sampler.set(EbtFloat16, EsdCube, true, true); 2578 } 2579 | ISAMPLER1D { 2580 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2581 $$.basicType = EbtSampler; 2582 $$.sampler.set(EbtInt, Esd1D); 2583 } 2584 2585 | ISAMPLER2D { 2586 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2587 $$.basicType = EbtSampler; 2588 $$.sampler.set(EbtInt, Esd2D); 2589 } 2590 | ISAMPLER3D { 2591 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2592 $$.basicType = EbtSampler; 2593 $$.sampler.set(EbtInt, Esd3D); 2594 } 2595 | ISAMPLERCUBE { 2596 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2597 $$.basicType = EbtSampler; 2598 $$.sampler.set(EbtInt, EsdCube); 2599 } 2600 | ISAMPLER2DARRAY { 2601 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2602 $$.basicType = EbtSampler; 2603 $$.sampler.set(EbtInt, Esd2D, true); 2604 } 2605 | USAMPLER2D { 2606 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2607 $$.basicType = EbtSampler; 2608 $$.sampler.set(EbtUint, Esd2D); 2609 } 2610 | USAMPLER3D { 2611 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2612 $$.basicType = EbtSampler; 2613 $$.sampler.set(EbtUint, Esd3D); 2614 } 2615 | USAMPLERCUBE { 2616 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2617 $$.basicType = EbtSampler; 2618 $$.sampler.set(EbtUint, EsdCube); 2619 } 2620 2621 | ISAMPLER1DARRAY { 2622 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2623 $$.basicType = EbtSampler; 2624 $$.sampler.set(EbtInt, Esd1D, true); 2625 } 2626 | ISAMPLERCUBEARRAY { 2627 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2628 $$.basicType = EbtSampler; 2629 $$.sampler.set(EbtInt, EsdCube, true); 2630 } 2631 | USAMPLER1D { 2632 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2633 $$.basicType = EbtSampler; 2634 $$.sampler.set(EbtUint, Esd1D); 2635 } 2636 | USAMPLER1DARRAY { 2637 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2638 $$.basicType = EbtSampler; 2639 $$.sampler.set(EbtUint, Esd1D, true); 2640 } 2641 | USAMPLERCUBEARRAY { 2642 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2643 $$.basicType = EbtSampler; 2644 $$.sampler.set(EbtUint, EsdCube, true); 2645 } 2646 | TEXTURECUBEARRAY { 2647 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2648 $$.basicType = EbtSampler; 2649 $$.sampler.setTexture(EbtFloat, EsdCube, true); 2650 } 2651 | ITEXTURECUBEARRAY { 2652 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2653 $$.basicType = EbtSampler; 2654 $$.sampler.setTexture(EbtInt, EsdCube, true); 2655 } 2656 | UTEXTURECUBEARRAY { 2657 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2658 $$.basicType = EbtSampler; 2659 $$.sampler.setTexture(EbtUint, EsdCube, true); 2660 } 2661 2662 | USAMPLER2DARRAY { 2663 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2664 $$.basicType = EbtSampler; 2665 $$.sampler.set(EbtUint, Esd2D, true); 2666 } 2667 | TEXTURE2D { 2668 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2669 $$.basicType = EbtSampler; 2670 $$.sampler.setTexture(EbtFloat, Esd2D); 2671 } 2672 | TEXTURE3D { 2673 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2674 $$.basicType = EbtSampler; 2675 $$.sampler.setTexture(EbtFloat, Esd3D); 2676 } 2677 | TEXTURE2DARRAY { 2678 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2679 $$.basicType = EbtSampler; 2680 $$.sampler.setTexture(EbtFloat, Esd2D, true); 2681 } 2682 | TEXTURECUBE { 2683 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2684 $$.basicType = EbtSampler; 2685 $$.sampler.setTexture(EbtFloat, EsdCube); 2686 } 2687 | ITEXTURE2D { 2688 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2689 $$.basicType = EbtSampler; 2690 $$.sampler.setTexture(EbtInt, Esd2D); 2691 } 2692 | ITEXTURE3D { 2693 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2694 $$.basicType = EbtSampler; 2695 $$.sampler.setTexture(EbtInt, Esd3D); 2696 } 2697 | ITEXTURECUBE { 2698 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2699 $$.basicType = EbtSampler; 2700 $$.sampler.setTexture(EbtInt, EsdCube); 2701 } 2702 | ITEXTURE2DARRAY { 2703 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2704 $$.basicType = EbtSampler; 2705 $$.sampler.setTexture(EbtInt, Esd2D, true); 2706 } 2707 | UTEXTURE2D { 2708 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2709 $$.basicType = EbtSampler; 2710 $$.sampler.setTexture(EbtUint, Esd2D); 2711 } 2712 | UTEXTURE3D { 2713 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2714 $$.basicType = EbtSampler; 2715 $$.sampler.setTexture(EbtUint, Esd3D); 2716 } 2717 | UTEXTURECUBE { 2718 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2719 $$.basicType = EbtSampler; 2720 $$.sampler.setTexture(EbtUint, EsdCube); 2721 } 2722 | UTEXTURE2DARRAY { 2723 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2724 $$.basicType = EbtSampler; 2725 $$.sampler.setTexture(EbtUint, Esd2D, true); 2726 } 2727 | SAMPLER { 2728 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2729 $$.basicType = EbtSampler; 2730 $$.sampler.setPureSampler(false); 2731 } 2732 | SAMPLERSHADOW { 2733 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2734 $$.basicType = EbtSampler; 2735 $$.sampler.setPureSampler(true); 2736 } 2737 2738 | SAMPLER2DRECT { 2739 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2740 $$.basicType = EbtSampler; 2741 $$.sampler.set(EbtFloat, EsdRect); 2742 } 2743 | SAMPLER2DRECTSHADOW { 2744 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2745 $$.basicType = EbtSampler; 2746 $$.sampler.set(EbtFloat, EsdRect, false, true); 2747 } 2748 | F16SAMPLER2DRECT { 2749 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); 2750 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2751 $$.basicType = EbtSampler; 2752 $$.sampler.set(EbtFloat16, EsdRect); 2753 } 2754 | F16SAMPLER2DRECTSHADOW { 2755 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); 2756 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2757 $$.basicType = EbtSampler; 2758 $$.sampler.set(EbtFloat16, EsdRect, false, true); 2759 } 2760 | ISAMPLER2DRECT { 2761 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2762 $$.basicType = EbtSampler; 2763 $$.sampler.set(EbtInt, EsdRect); 2764 } 2765 | USAMPLER2DRECT { 2766 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2767 $$.basicType = EbtSampler; 2768 $$.sampler.set(EbtUint, EsdRect); 2769 } 2770 | SAMPLERBUFFER { 2771 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2772 $$.basicType = EbtSampler; 2773 $$.sampler.set(EbtFloat, EsdBuffer); 2774 } 2775 | F16SAMPLERBUFFER { 2776 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); 2777 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2778 $$.basicType = EbtSampler; 2779 $$.sampler.set(EbtFloat16, EsdBuffer); 2780 } 2781 | ISAMPLERBUFFER { 2782 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2783 $$.basicType = EbtSampler; 2784 $$.sampler.set(EbtInt, EsdBuffer); 2785 } 2786 | USAMPLERBUFFER { 2787 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2788 $$.basicType = EbtSampler; 2789 $$.sampler.set(EbtUint, EsdBuffer); 2790 } 2791 | SAMPLER2DMS { 2792 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2793 $$.basicType = EbtSampler; 2794 $$.sampler.set(EbtFloat, Esd2D, false, false, true); 2795 } 2796 | F16SAMPLER2DMS { 2797 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); 2798 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2799 $$.basicType = EbtSampler; 2800 $$.sampler.set(EbtFloat16, Esd2D, false, false, true); 2801 } 2802 | ISAMPLER2DMS { 2803 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2804 $$.basicType = EbtSampler; 2805 $$.sampler.set(EbtInt, Esd2D, false, false, true); 2806 } 2807 | USAMPLER2DMS { 2808 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2809 $$.basicType = EbtSampler; 2810 $$.sampler.set(EbtUint, Esd2D, false, false, true); 2811 } 2812 | SAMPLER2DMSARRAY { 2813 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2814 $$.basicType = EbtSampler; 2815 $$.sampler.set(EbtFloat, Esd2D, true, false, true); 2816 } 2817 | F16SAMPLER2DMSARRAY { 2818 parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); 2819 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2820 $$.basicType = EbtSampler; 2821 $$.sampler.set(EbtFloat16, Esd2D, true, false, true); 2822 } 2823 | ISAMPLER2DMSARRAY { 2824 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2825 $$.basicType = EbtSampler; 2826 $$.sampler.set(EbtInt, Esd2D, true, false, true); 2827 } 2828 | USAMPLER2DMSARRAY { 2829 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2830 $$.basicType = EbtSampler; 2831 $$.sampler.set(EbtUint, Esd2D, true, false, true); 2832 } 2833 | TEXTURE1D { 2834 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2835 $$.basicType = EbtSampler; 2836 $$.sampler.setTexture(EbtFloat, Esd1D); 2837 } 2838 | F16TEXTURE1D { 2839 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); 2840 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2841 $$.basicType = EbtSampler; 2842 $$.sampler.setTexture(EbtFloat16, Esd1D); 2843 } 2844 | F16TEXTURE2D { 2845 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); 2846 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2847 $$.basicType = EbtSampler; 2848 $$.sampler.setTexture(EbtFloat16, Esd2D); 2849 } 2850 | F16TEXTURE3D { 2851 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); 2852 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2853 $$.basicType = EbtSampler; 2854 $$.sampler.setTexture(EbtFloat16, Esd3D); 2855 } 2856 | F16TEXTURECUBE { 2857 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); 2858 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2859 $$.basicType = EbtSampler; 2860 $$.sampler.setTexture(EbtFloat16, EsdCube); 2861 } 2862 | TEXTURE1DARRAY { 2863 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2864 $$.basicType = EbtSampler; 2865 $$.sampler.setTexture(EbtFloat, Esd1D, true); 2866 } 2867 | F16TEXTURE1DARRAY { 2868 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); 2869 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2870 $$.basicType = EbtSampler; 2871 $$.sampler.setTexture(EbtFloat16, Esd1D, true); 2872 } 2873 | F16TEXTURE2DARRAY { 2874 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); 2875 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2876 $$.basicType = EbtSampler; 2877 $$.sampler.setTexture(EbtFloat16, Esd2D, true); 2878 } 2879 | F16TEXTURECUBEARRAY { 2880 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); 2881 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2882 $$.basicType = EbtSampler; 2883 $$.sampler.setTexture(EbtFloat16, EsdCube, true); 2884 } 2885 | ITEXTURE1D { 2886 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2887 $$.basicType = EbtSampler; 2888 $$.sampler.setTexture(EbtInt, Esd1D); 2889 } 2890 | ITEXTURE1DARRAY { 2891 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2892 $$.basicType = EbtSampler; 2893 $$.sampler.setTexture(EbtInt, Esd1D, true); 2894 } 2895 | UTEXTURE1D { 2896 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2897 $$.basicType = EbtSampler; 2898 $$.sampler.setTexture(EbtUint, Esd1D); 2899 } 2900 | UTEXTURE1DARRAY { 2901 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2902 $$.basicType = EbtSampler; 2903 $$.sampler.setTexture(EbtUint, Esd1D, true); 2904 } 2905 | TEXTURE2DRECT { 2906 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2907 $$.basicType = EbtSampler; 2908 $$.sampler.setTexture(EbtFloat, EsdRect); 2909 } 2910 | F16TEXTURE2DRECT { 2911 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); 2912 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2913 $$.basicType = EbtSampler; 2914 $$.sampler.setTexture(EbtFloat16, EsdRect); 2915 } 2916 | ITEXTURE2DRECT { 2917 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2918 $$.basicType = EbtSampler; 2919 $$.sampler.setTexture(EbtInt, EsdRect); 2920 } 2921 | UTEXTURE2DRECT { 2922 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2923 $$.basicType = EbtSampler; 2924 $$.sampler.setTexture(EbtUint, EsdRect); 2925 } 2926 | TEXTUREBUFFER { 2927 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2928 $$.basicType = EbtSampler; 2929 $$.sampler.setTexture(EbtFloat, EsdBuffer); 2930 } 2931 | F16TEXTUREBUFFER { 2932 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); 2933 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2934 $$.basicType = EbtSampler; 2935 $$.sampler.setTexture(EbtFloat16, EsdBuffer); 2936 } 2937 | ITEXTUREBUFFER { 2938 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2939 $$.basicType = EbtSampler; 2940 $$.sampler.setTexture(EbtInt, EsdBuffer); 2941 } 2942 | UTEXTUREBUFFER { 2943 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2944 $$.basicType = EbtSampler; 2945 $$.sampler.setTexture(EbtUint, EsdBuffer); 2946 } 2947 | TEXTURE2DMS { 2948 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2949 $$.basicType = EbtSampler; 2950 $$.sampler.setTexture(EbtFloat, Esd2D, false, false, true); 2951 } 2952 | F16TEXTURE2DMS { 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, Esd2D, false, false, true); 2957 } 2958 | ITEXTURE2DMS { 2959 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2960 $$.basicType = EbtSampler; 2961 $$.sampler.setTexture(EbtInt, Esd2D, false, false, true); 2962 } 2963 | UTEXTURE2DMS { 2964 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2965 $$.basicType = EbtSampler; 2966 $$.sampler.setTexture(EbtUint, Esd2D, false, false, true); 2967 } 2968 | TEXTURE2DMSARRAY { 2969 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2970 $$.basicType = EbtSampler; 2971 $$.sampler.setTexture(EbtFloat, Esd2D, true, false, true); 2972 } 2973 | F16TEXTURE2DMSARRAY { 2974 parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); 2975 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2976 $$.basicType = EbtSampler; 2977 $$.sampler.setTexture(EbtFloat16, Esd2D, true, false, true); 2978 } 2979 | ITEXTURE2DMSARRAY { 2980 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2981 $$.basicType = EbtSampler; 2982 $$.sampler.setTexture(EbtInt, Esd2D, true, false, true); 2983 } 2984 | UTEXTURE2DMSARRAY { 2985 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2986 $$.basicType = EbtSampler; 2987 $$.sampler.setTexture(EbtUint, Esd2D, true, false, true); 2988 } 2989 | IMAGE1D { 2990 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2991 $$.basicType = EbtSampler; 2992 $$.sampler.setImage(EbtFloat, Esd1D); 2993 } 2994 | F16IMAGE1D { 2995 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); 2996 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 2997 $$.basicType = EbtSampler; 2998 $$.sampler.setImage(EbtFloat16, Esd1D); 2999 } 3000 | IIMAGE1D { 3001 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3002 $$.basicType = EbtSampler; 3003 $$.sampler.setImage(EbtInt, Esd1D); 3004 } 3005 | UIMAGE1D { 3006 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3007 $$.basicType = EbtSampler; 3008 $$.sampler.setImage(EbtUint, Esd1D); 3009 } 3010 | IMAGE2D { 3011 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3012 $$.basicType = EbtSampler; 3013 $$.sampler.setImage(EbtFloat, Esd2D); 3014 } 3015 | F16IMAGE2D { 3016 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); 3017 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3018 $$.basicType = EbtSampler; 3019 $$.sampler.setImage(EbtFloat16, Esd2D); 3020 } 3021 | IIMAGE2D { 3022 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3023 $$.basicType = EbtSampler; 3024 $$.sampler.setImage(EbtInt, Esd2D); 3025 } 3026 | UIMAGE2D { 3027 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3028 $$.basicType = EbtSampler; 3029 $$.sampler.setImage(EbtUint, Esd2D); 3030 } 3031 | IMAGE3D { 3032 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3033 $$.basicType = EbtSampler; 3034 $$.sampler.setImage(EbtFloat, Esd3D); 3035 } 3036 | F16IMAGE3D { 3037 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); 3038 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3039 $$.basicType = EbtSampler; 3040 $$.sampler.setImage(EbtFloat16, Esd3D); 3041 } 3042 | IIMAGE3D { 3043 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3044 $$.basicType = EbtSampler; 3045 $$.sampler.setImage(EbtInt, Esd3D); 3046 } 3047 | UIMAGE3D { 3048 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3049 $$.basicType = EbtSampler; 3050 $$.sampler.setImage(EbtUint, Esd3D); 3051 } 3052 | IMAGE2DRECT { 3053 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3054 $$.basicType = EbtSampler; 3055 $$.sampler.setImage(EbtFloat, EsdRect); 3056 } 3057 | F16IMAGE2DRECT { 3058 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); 3059 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3060 $$.basicType = EbtSampler; 3061 $$.sampler.setImage(EbtFloat16, EsdRect); 3062 } 3063 | IIMAGE2DRECT { 3064 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3065 $$.basicType = EbtSampler; 3066 $$.sampler.setImage(EbtInt, EsdRect); 3067 } 3068 | UIMAGE2DRECT { 3069 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3070 $$.basicType = EbtSampler; 3071 $$.sampler.setImage(EbtUint, EsdRect); 3072 } 3073 | IMAGECUBE { 3074 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3075 $$.basicType = EbtSampler; 3076 $$.sampler.setImage(EbtFloat, EsdCube); 3077 } 3078 | F16IMAGECUBE { 3079 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); 3080 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3081 $$.basicType = EbtSampler; 3082 $$.sampler.setImage(EbtFloat16, EsdCube); 3083 } 3084 | IIMAGECUBE { 3085 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3086 $$.basicType = EbtSampler; 3087 $$.sampler.setImage(EbtInt, EsdCube); 3088 } 3089 | UIMAGECUBE { 3090 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3091 $$.basicType = EbtSampler; 3092 $$.sampler.setImage(EbtUint, EsdCube); 3093 } 3094 | IMAGEBUFFER { 3095 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3096 $$.basicType = EbtSampler; 3097 $$.sampler.setImage(EbtFloat, EsdBuffer); 3098 } 3099 | F16IMAGEBUFFER { 3100 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); 3101 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3102 $$.basicType = EbtSampler; 3103 $$.sampler.setImage(EbtFloat16, EsdBuffer); 3104 } 3105 | IIMAGEBUFFER { 3106 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3107 $$.basicType = EbtSampler; 3108 $$.sampler.setImage(EbtInt, EsdBuffer); 3109 } 3110 | UIMAGEBUFFER { 3111 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3112 $$.basicType = EbtSampler; 3113 $$.sampler.setImage(EbtUint, EsdBuffer); 3114 } 3115 | IMAGE1DARRAY { 3116 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3117 $$.basicType = EbtSampler; 3118 $$.sampler.setImage(EbtFloat, Esd1D, true); 3119 } 3120 | F16IMAGE1DARRAY { 3121 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); 3122 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3123 $$.basicType = EbtSampler; 3124 $$.sampler.setImage(EbtFloat16, Esd1D, true); 3125 } 3126 | IIMAGE1DARRAY { 3127 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3128 $$.basicType = EbtSampler; 3129 $$.sampler.setImage(EbtInt, Esd1D, true); 3130 } 3131 | UIMAGE1DARRAY { 3132 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3133 $$.basicType = EbtSampler; 3134 $$.sampler.setImage(EbtUint, Esd1D, true); 3135 } 3136 | IMAGE2DARRAY { 3137 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3138 $$.basicType = EbtSampler; 3139 $$.sampler.setImage(EbtFloat, Esd2D, true); 3140 } 3141 | F16IMAGE2DARRAY { 3142 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); 3143 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3144 $$.basicType = EbtSampler; 3145 $$.sampler.setImage(EbtFloat16, Esd2D, true); 3146 } 3147 | IIMAGE2DARRAY { 3148 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3149 $$.basicType = EbtSampler; 3150 $$.sampler.setImage(EbtInt, Esd2D, true); 3151 } 3152 | UIMAGE2DARRAY { 3153 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3154 $$.basicType = EbtSampler; 3155 $$.sampler.setImage(EbtUint, Esd2D, true); 3156 } 3157 | IMAGECUBEARRAY { 3158 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3159 $$.basicType = EbtSampler; 3160 $$.sampler.setImage(EbtFloat, EsdCube, true); 3161 } 3162 | F16IMAGECUBEARRAY { 3163 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); 3164 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3165 $$.basicType = EbtSampler; 3166 $$.sampler.setImage(EbtFloat16, EsdCube, true); 3167 } 3168 | IIMAGECUBEARRAY { 3169 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3170 $$.basicType = EbtSampler; 3171 $$.sampler.setImage(EbtInt, EsdCube, true); 3172 } 3173 | UIMAGECUBEARRAY { 3174 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3175 $$.basicType = EbtSampler; 3176 $$.sampler.setImage(EbtUint, EsdCube, true); 3177 } 3178 | IMAGE2DMS { 3179 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3180 $$.basicType = EbtSampler; 3181 $$.sampler.setImage(EbtFloat, Esd2D, false, false, true); 3182 } 3183 | F16IMAGE2DMS { 3184 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); 3185 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3186 $$.basicType = EbtSampler; 3187 $$.sampler.setImage(EbtFloat16, Esd2D, false, false, true); 3188 } 3189 | IIMAGE2DMS { 3190 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3191 $$.basicType = EbtSampler; 3192 $$.sampler.setImage(EbtInt, Esd2D, false, false, true); 3193 } 3194 | UIMAGE2DMS { 3195 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3196 $$.basicType = EbtSampler; 3197 $$.sampler.setImage(EbtUint, Esd2D, false, false, true); 3198 } 3199 | IMAGE2DMSARRAY { 3200 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3201 $$.basicType = EbtSampler; 3202 $$.sampler.setImage(EbtFloat, Esd2D, true, false, true); 3203 } 3204 | F16IMAGE2DMSARRAY { 3205 parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); 3206 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3207 $$.basicType = EbtSampler; 3208 $$.sampler.setImage(EbtFloat16, Esd2D, true, false, true); 3209 } 3210 | IIMAGE2DMSARRAY { 3211 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3212 $$.basicType = EbtSampler; 3213 $$.sampler.setImage(EbtInt, Esd2D, true, false, true); 3214 } 3215 | UIMAGE2DMSARRAY { 3216 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3217 $$.basicType = EbtSampler; 3218 $$.sampler.setImage(EbtUint, Esd2D, true, false, true); 3219 } 3220 | I64IMAGE1D { 3221 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3222 $$.basicType = EbtSampler; 3223 $$.sampler.setImage(EbtInt64, Esd1D); 3224 } 3225 | U64IMAGE1D { 3226 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3227 $$.basicType = EbtSampler; 3228 $$.sampler.setImage(EbtUint64, Esd1D); 3229 } 3230 | I64IMAGE2D { 3231 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3232 $$.basicType = EbtSampler; 3233 $$.sampler.setImage(EbtInt64, Esd2D); 3234 } 3235 | U64IMAGE2D { 3236 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3237 $$.basicType = EbtSampler; 3238 $$.sampler.setImage(EbtUint64, Esd2D); 3239 } 3240 | I64IMAGE3D { 3241 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3242 $$.basicType = EbtSampler; 3243 $$.sampler.setImage(EbtInt64, Esd3D); 3244 } 3245 | U64IMAGE3D { 3246 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3247 $$.basicType = EbtSampler; 3248 $$.sampler.setImage(EbtUint64, Esd3D); 3249 } 3250 | I64IMAGE2DRECT { 3251 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3252 $$.basicType = EbtSampler; 3253 $$.sampler.setImage(EbtInt64, EsdRect); 3254 } 3255 | U64IMAGE2DRECT { 3256 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3257 $$.basicType = EbtSampler; 3258 $$.sampler.setImage(EbtUint64, EsdRect); 3259 } 3260 | I64IMAGECUBE { 3261 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3262 $$.basicType = EbtSampler; 3263 $$.sampler.setImage(EbtInt64, EsdCube); 3264 } 3265 | U64IMAGECUBE { 3266 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3267 $$.basicType = EbtSampler; 3268 $$.sampler.setImage(EbtUint64, EsdCube); 3269 } 3270 | I64IMAGEBUFFER { 3271 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3272 $$.basicType = EbtSampler; 3273 $$.sampler.setImage(EbtInt64, EsdBuffer); 3274 } 3275 | U64IMAGEBUFFER { 3276 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3277 $$.basicType = EbtSampler; 3278 $$.sampler.setImage(EbtUint64, EsdBuffer); 3279 } 3280 | I64IMAGE1DARRAY { 3281 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3282 $$.basicType = EbtSampler; 3283 $$.sampler.setImage(EbtInt64, Esd1D, true); 3284 } 3285 | U64IMAGE1DARRAY { 3286 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3287 $$.basicType = EbtSampler; 3288 $$.sampler.setImage(EbtUint64, Esd1D, true); 3289 } 3290 | I64IMAGE2DARRAY { 3291 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3292 $$.basicType = EbtSampler; 3293 $$.sampler.setImage(EbtInt64, Esd2D, true); 3294 } 3295 | U64IMAGE2DARRAY { 3296 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3297 $$.basicType = EbtSampler; 3298 $$.sampler.setImage(EbtUint64, Esd2D, true); 3299 } 3300 | I64IMAGECUBEARRAY { 3301 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3302 $$.basicType = EbtSampler; 3303 $$.sampler.setImage(EbtInt64, EsdCube, true); 3304 } 3305 | U64IMAGECUBEARRAY { 3306 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3307 $$.basicType = EbtSampler; 3308 $$.sampler.setImage(EbtUint64, EsdCube, true); 3309 } 3310 | I64IMAGE2DMS { 3311 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3312 $$.basicType = EbtSampler; 3313 $$.sampler.setImage(EbtInt64, Esd2D, false, false, true); 3314 } 3315 | U64IMAGE2DMS { 3316 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3317 $$.basicType = EbtSampler; 3318 $$.sampler.setImage(EbtUint64, Esd2D, false, false, true); 3319 } 3320 | I64IMAGE2DMSARRAY { 3321 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3322 $$.basicType = EbtSampler; 3323 $$.sampler.setImage(EbtInt64, Esd2D, true, false, true); 3324 } 3325 | U64IMAGE2DMSARRAY { 3326 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3327 $$.basicType = EbtSampler; 3328 $$.sampler.setImage(EbtUint64, Esd2D, true, false, true); 3329 } 3330 | SAMPLEREXTERNALOES { // GL_OES_EGL_image_external 3331 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3332 $$.basicType = EbtSampler; 3333 $$.sampler.set(EbtFloat, Esd2D); 3334 $$.sampler.external = true; 3335 } 3336 | SAMPLEREXTERNAL2DY2YEXT { // GL_EXT_YUV_target 3337 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3338 $$.basicType = EbtSampler; 3339 $$.sampler.set(EbtFloat, Esd2D); 3340 $$.sampler.yuv = true; 3341 } 3342 | SUBPASSINPUT { 3343 parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); 3344 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3345 $$.basicType = EbtSampler; 3346 $$.sampler.setSubpass(EbtFloat); 3347 } 3348 | SUBPASSINPUTMS { 3349 parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); 3350 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3351 $$.basicType = EbtSampler; 3352 $$.sampler.setSubpass(EbtFloat, true); 3353 } 3354 | F16SUBPASSINPUT { 3355 parseContext.float16OpaqueCheck($1.loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel()); 3356 parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); 3357 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3358 $$.basicType = EbtSampler; 3359 $$.sampler.setSubpass(EbtFloat16); 3360 } 3361 | F16SUBPASSINPUTMS { 3362 parseContext.float16OpaqueCheck($1.loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel()); 3363 parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); 3364 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3365 $$.basicType = EbtSampler; 3366 $$.sampler.setSubpass(EbtFloat16, true); 3367 } 3368 | ISUBPASSINPUT { 3369 parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); 3370 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3371 $$.basicType = EbtSampler; 3372 $$.sampler.setSubpass(EbtInt); 3373 } 3374 | ISUBPASSINPUTMS { 3375 parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); 3376 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3377 $$.basicType = EbtSampler; 3378 $$.sampler.setSubpass(EbtInt, true); 3379 } 3380 | USUBPASSINPUT { 3381 parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); 3382 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3383 $$.basicType = EbtSampler; 3384 $$.sampler.setSubpass(EbtUint); 3385 } 3386 | USUBPASSINPUTMS { 3387 parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); 3388 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3389 $$.basicType = EbtSampler; 3390 $$.sampler.setSubpass(EbtUint, true); 3391 } 3392 | FCOOPMATNV { 3393 parseContext.fcoopmatCheck($1.loc, "fcoopmatNV", parseContext.symbolTable.atBuiltInLevel()); 3394 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3395 $$.basicType = EbtFloat; 3396 $$.coopmat = true; 3397 } 3398 | ICOOPMATNV { 3399 parseContext.intcoopmatCheck($1.loc, "icoopmatNV", parseContext.symbolTable.atBuiltInLevel()); 3400 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3401 $$.basicType = EbtInt; 3402 $$.coopmat = true; 3403 } 3404 | UCOOPMATNV { 3405 parseContext.intcoopmatCheck($1.loc, "ucoopmatNV", parseContext.symbolTable.atBuiltInLevel()); 3406 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3407 $$.basicType = EbtUint; 3408 $$.coopmat = true; 3409 } 3410 3411 | struct_specifier { 3412 $$ = $1; 3413 $$.qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; 3414 parseContext.structTypeCheck($$.loc, $$); 3415 } 3416 | TYPE_NAME { 3417 // 3418 // This is for user defined type names. The lexical phase looked up the 3419 // type. 3420 // 3421 if (const TVariable* variable = ($1.symbol)->getAsVariable()) { 3422 const TType& structure = variable->getType(); 3423 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3424 $$.basicType = EbtStruct; 3425 $$.userDef = &structure; 3426 } else 3427 parseContext.error($1.loc, "expected type name", $1.string->c_str(), ""); 3428 } 3429 ; 3430 3431 precision_qualifier 3432 : HIGH_PRECISION { 3433 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "highp precision qualifier"); 3434 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3435 parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqHigh); 3436 } 3437 | MEDIUM_PRECISION { 3438 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "mediump precision qualifier"); 3439 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3440 parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqMedium); 3441 } 3442 | LOW_PRECISION { 3443 parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "lowp precision qualifier"); 3444 $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); 3445 parseContext.handlePrecisionQualifier($1.loc, $$.qualifier, EpqLow); 3446 } 3447 ; 3448 3449 struct_specifier 3450 : STRUCT IDENTIFIER LEFT_BRACE { parseContext.nestedStructCheck($1.loc); } struct_declaration_list RIGHT_BRACE { 3451 TType* structure = new TType($5, *$2.string); 3452 parseContext.structArrayCheck($2.loc, *structure); 3453 TVariable* userTypeDef = new TVariable($2.string, *structure, true); 3454 if (! parseContext.symbolTable.insert(*userTypeDef)) 3455 parseContext.error($2.loc, "redefinition", $2.string->c_str(), "struct"); 3456 $$.init($1.loc); 3457 $$.basicType = EbtStruct; 3458 $$.userDef = structure; 3459 --parseContext.structNestingLevel; 3460 } 3461 | STRUCT LEFT_BRACE { parseContext.nestedStructCheck($1.loc); } struct_declaration_list RIGHT_BRACE { 3462 TType* structure = new TType($4, TString("")); 3463 $$.init($1.loc); 3464 $$.basicType = EbtStruct; 3465 $$.userDef = structure; 3466 --parseContext.structNestingLevel; 3467 } 3468 ; 3469 3470 struct_declaration_list 3471 : struct_declaration { 3472 $$ = $1; 3473 } 3474 | struct_declaration_list struct_declaration { 3475 $$ = $1; 3476 for (unsigned int i = 0; i < $2->size(); ++i) { 3477 for (unsigned int j = 0; j < $$->size(); ++j) { 3478 if ((*$$)[j].type->getFieldName() == (*$2)[i].type->getFieldName()) 3479 parseContext.error((*$2)[i].loc, "duplicate member name:", "", (*$2)[i].type->getFieldName().c_str()); 3480 } 3481 $$->push_back((*$2)[i]); 3482 } 3483 } 3484 ; 3485 3486 struct_declaration 3487 : type_specifier struct_declarator_list SEMICOLON { 3488 if ($1.arraySizes) { 3489 parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); 3490 parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type"); 3491 if (parseContext.isEsProfile()) 3492 parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes); 3493 } 3494 3495 $$ = $2; 3496 3497 parseContext.voidErrorCheck($1.loc, (*$2)[0].type->getFieldName(), $1.basicType); 3498 parseContext.precisionQualifierCheck($1.loc, $1.basicType, $1.qualifier); 3499 3500 for (unsigned int i = 0; i < $$->size(); ++i) { 3501 TType type($1); 3502 type.setFieldName((*$$)[i].type->getFieldName()); 3503 type.transferArraySizes((*$$)[i].type->getArraySizes()); 3504 type.copyArrayInnerSizes($1.arraySizes); 3505 parseContext.arrayOfArrayVersionCheck((*$$)[i].loc, type.getArraySizes()); 3506 (*$$)[i].type->shallowCopy(type); 3507 } 3508 } 3509 | type_qualifier type_specifier struct_declarator_list SEMICOLON { 3510 if ($2.arraySizes) { 3511 parseContext.profileRequires($2.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); 3512 parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type"); 3513 if (parseContext.isEsProfile()) 3514 parseContext.arraySizeRequiredCheck($2.loc, *$2.arraySizes); 3515 } 3516 3517 $$ = $3; 3518 3519 parseContext.memberQualifierCheck($1); 3520 parseContext.voidErrorCheck($2.loc, (*$3)[0].type->getFieldName(), $2.basicType); 3521 parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true); 3522 parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier); 3523 3524 for (unsigned int i = 0; i < $$->size(); ++i) { 3525 TType type($2); 3526 type.setFieldName((*$$)[i].type->getFieldName()); 3527 type.transferArraySizes((*$$)[i].type->getArraySizes()); 3528 type.copyArrayInnerSizes($2.arraySizes); 3529 parseContext.arrayOfArrayVersionCheck((*$$)[i].loc, type.getArraySizes()); 3530 (*$$)[i].type->shallowCopy(type); 3531 } 3532 } 3533 ; 3534 3535 struct_declarator_list 3536 : struct_declarator { 3537 $$ = new TTypeList; 3538 $$->push_back($1); 3539 } 3540 | struct_declarator_list COMMA struct_declarator { 3541 $$->push_back($3); 3542 } 3543 ; 3544 3545 struct_declarator 3546 : IDENTIFIER { 3547 $$.type = new TType(EbtVoid); 3548 $$.loc = $1.loc; 3549 $$.type->setFieldName(*$1.string); 3550 } 3551 | IDENTIFIER array_specifier { 3552 parseContext.arrayOfArrayVersionCheck($1.loc, $2.arraySizes); 3553 3554 $$.type = new TType(EbtVoid); 3555 $$.loc = $1.loc; 3556 $$.type->setFieldName(*$1.string); 3557 $$.type->transferArraySizes($2.arraySizes); 3558 } 3559 ; 3560 3561 initializer 3562 : assignment_expression { 3563 $$ = $1; 3564 } 3565 3566 | LEFT_BRACE initializer_list RIGHT_BRACE { 3567 const char* initFeature = "{ } style initializers"; 3568 parseContext.requireProfile($1.loc, ~EEsProfile, initFeature); 3569 parseContext.profileRequires($1.loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature); 3570 $$ = $2; 3571 } 3572 | LEFT_BRACE initializer_list COMMA RIGHT_BRACE { 3573 const char* initFeature = "{ } style initializers"; 3574 parseContext.requireProfile($1.loc, ~EEsProfile, initFeature); 3575 parseContext.profileRequires($1.loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature); 3576 $$ = $2; 3577 } 3578 | LEFT_BRACE RIGHT_BRACE { 3579 const char* initFeature = "empty { } initializer"; 3580 parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_EXT_null_initializer, initFeature); 3581 parseContext.profileRequires($1.loc, ~EEsProfile, 0, E_GL_EXT_null_initializer, initFeature); 3582 $$ = parseContext.intermediate.makeAggregate($1.loc); 3583 } 3584 3585 ; 3586 3587 3588 initializer_list 3589 : initializer { 3590 $$ = parseContext.intermediate.growAggregate(0, $1, $1->getLoc()); 3591 } 3592 | initializer_list COMMA initializer { 3593 $$ = parseContext.intermediate.growAggregate($1, $3); 3594 } 3595 ; 3596 3597 3598 declaration_statement 3599 : declaration { $$ = $1; } 3600 ; 3601 3602 statement 3603 : compound_statement { $$ = $1; } 3604 | simple_statement { $$ = $1; } 3605 ; 3606 3607 // Grammar Note: labeled statements for switch statements only; 'goto' is not supported. 3608 3609 simple_statement 3610 : declaration_statement { $$ = $1; } 3611 | expression_statement { $$ = $1; } 3612 | selection_statement { $$ = $1; } 3613 | switch_statement { $$ = $1; } 3614 | case_label { $$ = $1; } 3615 | iteration_statement { $$ = $1; } 3616 | jump_statement { $$ = $1; } 3617 3618 | demote_statement { $$ = $1; } 3619 3620 ; 3621 3622 3623 demote_statement 3624 : DEMOTE SEMICOLON { 3625 parseContext.requireStage($1.loc, EShLangFragment, "demote"); 3626 parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_demote_to_helper_invocation, "demote"); 3627 $$ = parseContext.intermediate.addBranch(EOpDemote, $1.loc); 3628 } 3629 ; 3630 3631 3632 compound_statement 3633 : LEFT_BRACE RIGHT_BRACE { $$ = 0; } 3634 | LEFT_BRACE { 3635 parseContext.symbolTable.push(); 3636 ++parseContext.statementNestingLevel; 3637 } 3638 statement_list { 3639 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); 3640 --parseContext.statementNestingLevel; 3641 } 3642 RIGHT_BRACE { 3643 if ($3 && $3->getAsAggregate()) 3644 $3->getAsAggregate()->setOperator(EOpSequence); 3645 $$ = $3; 3646 } 3647 ; 3648 3649 statement_no_new_scope 3650 : compound_statement_no_new_scope { $$ = $1; } 3651 | simple_statement { $$ = $1; } 3652 ; 3653 3654 statement_scoped 3655 : { 3656 ++parseContext.controlFlowNestingLevel; 3657 } 3658 compound_statement { 3659 --parseContext.controlFlowNestingLevel; 3660 $$ = $2; 3661 } 3662 | { 3663 parseContext.symbolTable.push(); 3664 ++parseContext.statementNestingLevel; 3665 ++parseContext.controlFlowNestingLevel; 3666 } 3667 simple_statement { 3668 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); 3669 --parseContext.statementNestingLevel; 3670 --parseContext.controlFlowNestingLevel; 3671 $$ = $2; 3672 } 3673 3674 compound_statement_no_new_scope 3675 // Statement that doesn't create a new scope, for selection_statement, iteration_statement 3676 : LEFT_BRACE RIGHT_BRACE { 3677 $$ = 0; 3678 } 3679 | LEFT_BRACE statement_list RIGHT_BRACE { 3680 if ($2 && $2->getAsAggregate()) 3681 $2->getAsAggregate()->setOperator(EOpSequence); 3682 $$ = $2; 3683 } 3684 ; 3685 3686 statement_list 3687 : statement { 3688 $$ = parseContext.intermediate.makeAggregate($1); 3689 if ($1 && $1->getAsBranchNode() && ($1->getAsBranchNode()->getFlowOp() == EOpCase || 3690 $1->getAsBranchNode()->getFlowOp() == EOpDefault)) { 3691 parseContext.wrapupSwitchSubsequence(0, $1); 3692 $$ = 0; // start a fresh subsequence for what's after this case 3693 } 3694 } 3695 | statement_list statement { 3696 if ($2 && $2->getAsBranchNode() && ($2->getAsBranchNode()->getFlowOp() == EOpCase || 3697 $2->getAsBranchNode()->getFlowOp() == EOpDefault)) { 3698 parseContext.wrapupSwitchSubsequence($1 ? $1->getAsAggregate() : 0, $2); 3699 $$ = 0; // start a fresh subsequence for what's after this case 3700 } else 3701 $$ = parseContext.intermediate.growAggregate($1, $2); 3702 } 3703 ; 3704 3705 expression_statement 3706 : SEMICOLON { $$ = 0; } 3707 | expression SEMICOLON { $$ = static_cast<TIntermNode*>($1); } 3708 ; 3709 3710 selection_statement 3711 : selection_statement_nonattributed { 3712 $$ = $1; 3713 } 3714 3715 | attribute selection_statement_nonattributed { 3716 parseContext.handleSelectionAttributes(*$1, $2); 3717 $$ = $2; 3718 } 3719 3720 3721 selection_statement_nonattributed 3722 : IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement { 3723 parseContext.boolCheck($1.loc, $3); 3724 $$ = parseContext.intermediate.addSelection($3, $5, $1.loc); 3725 } 3726 ; 3727 3728 selection_rest_statement 3729 : statement_scoped ELSE statement_scoped { 3730 $$.node1 = $1; 3731 $$.node2 = $3; 3732 } 3733 | statement_scoped { 3734 $$.node1 = $1; 3735 $$.node2 = 0; 3736 } 3737 ; 3738 3739 condition 3740 // In 1996 c++ draft, conditions can include single declarations 3741 : expression { 3742 $$ = $1; 3743 parseContext.boolCheck($1->getLoc(), $1); 3744 } 3745 | fully_specified_type IDENTIFIER EQUAL initializer { 3746 parseContext.boolCheck($2.loc, $1); 3747 3748 TType type($1); 3749 TIntermNode* initNode = parseContext.declareVariable($2.loc, *$2.string, $1, 0, $4); 3750 if (initNode) 3751 $$ = initNode->getAsTyped(); 3752 else 3753 $$ = 0; 3754 } 3755 ; 3756 3757 switch_statement 3758 : switch_statement_nonattributed { 3759 $$ = $1; 3760 } 3761 3762 | attribute switch_statement_nonattributed { 3763 parseContext.handleSwitchAttributes(*$1, $2); 3764 $$ = $2; 3765 } 3766 3767 3768 switch_statement_nonattributed 3769 : SWITCH LEFT_PAREN expression RIGHT_PAREN { 3770 // start new switch sequence on the switch stack 3771 ++parseContext.controlFlowNestingLevel; 3772 ++parseContext.statementNestingLevel; 3773 parseContext.switchSequenceStack.push_back(new TIntermSequence); 3774 parseContext.switchLevel.push_back(parseContext.statementNestingLevel); 3775 parseContext.symbolTable.push(); 3776 } 3777 LEFT_BRACE switch_statement_list RIGHT_BRACE { 3778 $$ = parseContext.addSwitch($1.loc, $3, $7 ? $7->getAsAggregate() : 0); 3779 delete parseContext.switchSequenceStack.back(); 3780 parseContext.switchSequenceStack.pop_back(); 3781 parseContext.switchLevel.pop_back(); 3782 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); 3783 --parseContext.statementNestingLevel; 3784 --parseContext.controlFlowNestingLevel; 3785 } 3786 ; 3787 3788 switch_statement_list 3789 : /* nothing */ { 3790 $$ = 0; 3791 } 3792 | statement_list { 3793 $$ = $1; 3794 } 3795 ; 3796 3797 case_label 3798 : CASE expression COLON { 3799 $$ = 0; 3800 if (parseContext.switchLevel.size() == 0) 3801 parseContext.error($1.loc, "cannot appear outside switch statement", "case", ""); 3802 else if (parseContext.switchLevel.back() != parseContext.statementNestingLevel) 3803 parseContext.error($1.loc, "cannot be nested inside control flow", "case", ""); 3804 else { 3805 parseContext.constantValueCheck($2, "case"); 3806 parseContext.integerCheck($2, "case"); 3807 $$ = parseContext.intermediate.addBranch(EOpCase, $2, $1.loc); 3808 } 3809 } 3810 | DEFAULT COLON { 3811 $$ = 0; 3812 if (parseContext.switchLevel.size() == 0) 3813 parseContext.error($1.loc, "cannot appear outside switch statement", "default", ""); 3814 else if (parseContext.switchLevel.back() != parseContext.statementNestingLevel) 3815 parseContext.error($1.loc, "cannot be nested inside control flow", "default", ""); 3816 else 3817 $$ = parseContext.intermediate.addBranch(EOpDefault, $1.loc); 3818 } 3819 ; 3820 3821 iteration_statement 3822 : iteration_statement_nonattributed { 3823 $$ = $1; 3824 } 3825 3826 | attribute iteration_statement_nonattributed { 3827 parseContext.handleLoopAttributes(*$1, $2); 3828 $$ = $2; 3829 } 3830 3831 3832 iteration_statement_nonattributed 3833 : WHILE LEFT_PAREN { 3834 if (! parseContext.limits.whileLoops) 3835 parseContext.error($1.loc, "while loops not available", "limitation", ""); 3836 parseContext.symbolTable.push(); 3837 ++parseContext.loopNestingLevel; 3838 ++parseContext.statementNestingLevel; 3839 ++parseContext.controlFlowNestingLevel; 3840 } 3841 condition RIGHT_PAREN statement_no_new_scope { 3842 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); 3843 $$ = parseContext.intermediate.addLoop($6, $4, 0, true, $1.loc); 3844 --parseContext.loopNestingLevel; 3845 --parseContext.statementNestingLevel; 3846 --parseContext.controlFlowNestingLevel; 3847 } 3848 | DO { 3849 ++parseContext.loopNestingLevel; 3850 ++parseContext.statementNestingLevel; 3851 ++parseContext.controlFlowNestingLevel; 3852 } 3853 statement WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON { 3854 if (! parseContext.limits.whileLoops) 3855 parseContext.error($1.loc, "do-while loops not available", "limitation", ""); 3856 3857 parseContext.boolCheck($8.loc, $6); 3858 3859 $$ = parseContext.intermediate.addLoop($3, $6, 0, false, $4.loc); 3860 --parseContext.loopNestingLevel; 3861 --parseContext.statementNestingLevel; 3862 --parseContext.controlFlowNestingLevel; 3863 } 3864 | FOR LEFT_PAREN { 3865 parseContext.symbolTable.push(); 3866 ++parseContext.loopNestingLevel; 3867 ++parseContext.statementNestingLevel; 3868 ++parseContext.controlFlowNestingLevel; 3869 } 3870 for_init_statement for_rest_statement RIGHT_PAREN statement_no_new_scope { 3871 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); 3872 $$ = parseContext.intermediate.makeAggregate($4, $2.loc); 3873 TIntermLoop* forLoop = parseContext.intermediate.addLoop($7, reinterpret_cast<TIntermTyped*>($5.node1), reinterpret_cast<TIntermTyped*>($5.node2), true, $1.loc); 3874 if (! parseContext.limits.nonInductiveForLoops) 3875 parseContext.inductiveLoopCheck($1.loc, $4, forLoop); 3876 $$ = parseContext.intermediate.growAggregate($$, forLoop, $1.loc); 3877 $$->getAsAggregate()->setOperator(EOpSequence); 3878 --parseContext.loopNestingLevel; 3879 --parseContext.statementNestingLevel; 3880 --parseContext.controlFlowNestingLevel; 3881 } 3882 ; 3883 3884 for_init_statement 3885 : expression_statement { 3886 $$ = $1; 3887 } 3888 | declaration_statement { 3889 $$ = $1; 3890 } 3891 ; 3892 3893 conditionopt 3894 : condition { 3895 $$ = $1; 3896 } 3897 | /* May be null */ { 3898 $$ = 0; 3899 } 3900 ; 3901 3902 for_rest_statement 3903 : conditionopt SEMICOLON { 3904 $$.node1 = $1; 3905 $$.node2 = 0; 3906 } 3907 | conditionopt SEMICOLON expression { 3908 $$.node1 = $1; 3909 $$.node2 = $3; 3910 } 3911 ; 3912 3913 jump_statement 3914 : CONTINUE SEMICOLON { 3915 if (parseContext.loopNestingLevel <= 0) 3916 parseContext.error($1.loc, "continue statement only allowed in loops", "", ""); 3917 $$ = parseContext.intermediate.addBranch(EOpContinue, $1.loc); 3918 } 3919 | BREAK SEMICOLON { 3920 if (parseContext.loopNestingLevel + parseContext.switchSequenceStack.size() <= 0) 3921 parseContext.error($1.loc, "break statement only allowed in switch and loops", "", ""); 3922 $$ = parseContext.intermediate.addBranch(EOpBreak, $1.loc); 3923 } 3924 | RETURN SEMICOLON { 3925 $$ = parseContext.intermediate.addBranch(EOpReturn, $1.loc); 3926 if (parseContext.currentFunctionType->getBasicType() != EbtVoid) 3927 parseContext.error($1.loc, "non-void function must return a value", "return", ""); 3928 if (parseContext.inMain) 3929 parseContext.postEntryPointReturn = true; 3930 } 3931 | RETURN expression SEMICOLON { 3932 $$ = parseContext.handleReturnValue($1.loc, $2); 3933 } 3934 | DISCARD SEMICOLON { 3935 parseContext.requireStage($1.loc, EShLangFragment, "discard"); 3936 $$ = parseContext.intermediate.addBranch(EOpKill, $1.loc); 3937 } 3938 | TERMINATE_INVOCATION SEMICOLON { 3939 parseContext.requireStage($1.loc, EShLangFragment, "terminateInvocation"); 3940 $$ = parseContext.intermediate.addBranch(EOpTerminateInvocation, $1.loc); 3941 } 3942 3943 | TERMINATE_RAY SEMICOLON { 3944 parseContext.requireStage($1.loc, EShLangAnyHit, "terminateRayEXT"); 3945 $$ = parseContext.intermediate.addBranch(EOpTerminateRayKHR, $1.loc); 3946 } 3947 | IGNORE_INTERSECTION SEMICOLON { 3948 parseContext.requireStage($1.loc, EShLangAnyHit, "ignoreIntersectionEXT"); 3949 $$ = parseContext.intermediate.addBranch(EOpIgnoreIntersectionKHR, $1.loc); 3950 } 3951 3952 ; 3953 3954 // Grammar Note: No 'goto'. Gotos are not supported. 3955 3956 translation_unit 3957 : external_declaration { 3958 $$ = $1; 3959 parseContext.intermediate.setTreeRoot($$); 3960 } 3961 | translation_unit external_declaration { 3962 if ($2 != nullptr) { 3963 $$ = parseContext.intermediate.growAggregate($1, $2); 3964 parseContext.intermediate.setTreeRoot($$); 3965 } 3966 } 3967 ; 3968 3969 external_declaration 3970 : function_definition { 3971 $$ = $1; 3972 } 3973 | declaration { 3974 $$ = $1; 3975 } 3976 3977 | SEMICOLON { 3978 parseContext.requireProfile($1.loc, ~EEsProfile, "extraneous semicolon"); 3979 parseContext.profileRequires($1.loc, ~EEsProfile, 460, nullptr, "extraneous semicolon"); 3980 $$ = nullptr; 3981 } 3982 3983 ; 3984 3985 function_definition 3986 : function_prototype { 3987 $1.function = parseContext.handleFunctionDeclarator($1.loc, *$1.function, false /* not prototype */); 3988 $1.intermNode = parseContext.handleFunctionDefinition($1.loc, *$1.function); 3989 3990 // For ES 100 only, according to ES shading language 100 spec: A function 3991 // body has a scope nested inside the function's definition. 3992 if (parseContext.profile == EEsProfile && parseContext.version == 100) 3993 { 3994 parseContext.symbolTable.push(); 3995 ++parseContext.statementNestingLevel; 3996 } 3997 } 3998 compound_statement_no_new_scope { 3999 // May be best done as post process phase on intermediate code 4000 if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue) 4001 parseContext.error($1.loc, "function does not return a value:", "", $1.function->getName().c_str()); 4002 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); 4003 $$ = parseContext.intermediate.growAggregate($1.intermNode, $3); 4004 parseContext.intermediate.setAggregateOperator($$, EOpFunction, $1.function->getType(), $1.loc); 4005 $$->getAsAggregate()->setName($1.function->getMangledName().c_str()); 4006 4007 // store the pragma information for debug and optimize and other vendor specific 4008 // information. This information can be queried from the parse tree 4009 $$->getAsAggregate()->setOptimize(parseContext.contextPragma.optimize); 4010 $$->getAsAggregate()->setDebug(parseContext.contextPragma.debug); 4011 $$->getAsAggregate()->setPragmaTable(parseContext.contextPragma.pragmaTable); 4012 4013 // Set currentFunctionType to empty pointer when goes outside of the function 4014 parseContext.currentFunctionType = nullptr; 4015 4016 // For ES 100 only, according to ES shading language 100 spec: A function 4017 // body has a scope nested inside the function's definition. 4018 if (parseContext.profile == EEsProfile && parseContext.version == 100) 4019 { 4020 parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); 4021 --parseContext.statementNestingLevel; 4022 } 4023 } 4024 ; 4025 4026 4027 attribute 4028 : LEFT_BRACKET LEFT_BRACKET attribute_list RIGHT_BRACKET RIGHT_BRACKET { 4029 $$ = $3; 4030 parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_control_flow_attributes, "attribute"); 4031 } 4032 4033 attribute_list 4034 : single_attribute { 4035 $$ = $1; 4036 } 4037 | attribute_list COMMA single_attribute { 4038 $$ = parseContext.mergeAttributes($1, $3); 4039 } 4040 4041 single_attribute 4042 : IDENTIFIER { 4043 $$ = parseContext.makeAttributes(*$1.string); 4044 } 4045 | IDENTIFIER LEFT_PAREN constant_expression RIGHT_PAREN { 4046 $$ = parseContext.makeAttributes(*$1.string, $3); 4047 } 4048 4049 4050 %% 4051