Move symbol builtin check to grammar stage

FYI, move builtin check to type symbol check.
Avoid modifying interface doubleCheck().
This commit is contained in:
Chow 2020-01-08 14:07:50 +08:00
parent a3c7a25e10
commit ab6a58801f
5 changed files with 158 additions and 57 deletions

View File

@ -925,10 +925,9 @@ void TParseVersions::fullIntegerCheck(const TSourceLoc& loc, const char* op)
} }
// Call for any operation needing GLSL double data-type support. // Call for any operation needing GLSL double data-type support.
void TParseVersions::doubleCheck(const TSourceLoc& loc, const char* op, bool builtIn) void TParseVersions::doubleCheck(const TSourceLoc& loc, const char* op)
{ {
requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); //requireProfile(loc, ECoreProfile | ECompatibilityProfile, op);
if (!builtIn)
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader_fp64, op); profileRequires(loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader_fp64, op);
} }

View File

@ -402,6 +402,8 @@ GLSLANG_WEB_EXCLUDE_ON
$$ = parseContext.intermediate.addConstantUnion((unsigned short)$1.u, $1.loc, true); $$ = parseContext.intermediate.addConstantUnion((unsigned short)$1.u, $1.loc, true);
} }
| DOUBLECONSTANT { | DOUBLECONSTANT {
parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double literal");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double literal"); parseContext.doubleCheck($1.loc, "double literal");
$$ = parseContext.intermediate.addConstantUnion($1.d, EbtDouble, $1.loc, true); $$ = parseContext.intermediate.addConstantUnion($1.d, EbtDouble, $1.loc, true);
} }
@ -1751,7 +1753,9 @@ type_specifier_nonarray
} }
GLSLANG_WEB_EXCLUDE_ON GLSLANG_WEB_EXCLUDE_ON
| DOUBLE { | DOUBLE {
parseContext.doubleCheck($1.loc, "double", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
} }
@ -1811,19 +1815,25 @@ GLSLANG_WEB_EXCLUDE_ON
$$.basicType = EbtUint64; $$.basicType = EbtUint64;
} }
| DVEC2 { | DVEC2 {
parseContext.doubleCheck($1.loc, "double vector", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double vector");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setVector(2); $$.setVector(2);
} }
| DVEC3 { | DVEC3 {
parseContext.doubleCheck($1.loc, "double vector", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double vector");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setVector(3); $$.setVector(3);
} }
| DVEC4 { | DVEC4 {
parseContext.doubleCheck($1.loc, "double vector", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double vector");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setVector(4); $$.setVector(4);
@ -2027,73 +2037,97 @@ GLSLANG_WEB_EXCLUDE_ON
$$.setVector(4); $$.setVector(4);
} }
| DMAT2 { | DMAT2 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(2, 2); $$.setMatrix(2, 2);
} }
| DMAT3 { | DMAT3 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(3, 3); $$.setMatrix(3, 3);
} }
| DMAT4 { | DMAT4 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(4, 4); $$.setMatrix(4, 4);
} }
| DMAT2X2 { | DMAT2X2 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(2, 2); $$.setMatrix(2, 2);
} }
| DMAT2X3 { | DMAT2X3 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(2, 3); $$.setMatrix(2, 3);
} }
| DMAT2X4 { | DMAT2X4 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(2, 4); $$.setMatrix(2, 4);
} }
| DMAT3X2 { | DMAT3X2 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(3, 2); $$.setMatrix(3, 2);
} }
| DMAT3X3 { | DMAT3X3 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(3, 3); $$.setMatrix(3, 3);
} }
| DMAT3X4 { | DMAT3X4 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(3, 4); $$.setMatrix(3, 4);
} }
| DMAT4X2 { | DMAT4X2 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(4, 2); $$.setMatrix(4, 2);
} }
| DMAT4X3 { | DMAT4X3 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(4, 3); $$.setMatrix(4, 3);
} }
| DMAT4X4 { | DMAT4X4 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(4, 4); $$.setMatrix(4, 4);

View File

@ -402,6 +402,8 @@ primary_expression
$$ = parseContext.intermediate.addConstantUnion((unsigned short)$1.u, $1.loc, true); $$ = parseContext.intermediate.addConstantUnion((unsigned short)$1.u, $1.loc, true);
} }
| DOUBLECONSTANT { | DOUBLECONSTANT {
parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double literal");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double literal"); parseContext.doubleCheck($1.loc, "double literal");
$$ = parseContext.intermediate.addConstantUnion($1.d, EbtDouble, $1.loc, true); $$ = parseContext.intermediate.addConstantUnion($1.d, EbtDouble, $1.loc, true);
} }
@ -1751,7 +1753,9 @@ type_specifier_nonarray
} }
| DOUBLE { | DOUBLE {
parseContext.doubleCheck($1.loc, "double", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
} }
@ -1811,19 +1815,25 @@ type_specifier_nonarray
$$.basicType = EbtUint64; $$.basicType = EbtUint64;
} }
| DVEC2 { | DVEC2 {
parseContext.doubleCheck($1.loc, "double vector", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double vector");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setVector(2); $$.setVector(2);
} }
| DVEC3 { | DVEC3 {
parseContext.doubleCheck($1.loc, "double vector", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double vector");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setVector(3); $$.setVector(3);
} }
| DVEC4 { | DVEC4 {
parseContext.doubleCheck($1.loc, "double vector", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double vector");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double vector");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setVector(4); $$.setVector(4);
@ -2027,73 +2037,97 @@ type_specifier_nonarray
$$.setVector(4); $$.setVector(4);
} }
| DMAT2 { | DMAT2 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(2, 2); $$.setMatrix(2, 2);
} }
| DMAT3 { | DMAT3 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(3, 3); $$.setMatrix(3, 3);
} }
| DMAT4 { | DMAT4 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(4, 4); $$.setMatrix(4, 4);
} }
| DMAT2X2 { | DMAT2X2 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(2, 2); $$.setMatrix(2, 2);
} }
| DMAT2X3 { | DMAT2X3 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(2, 3); $$.setMatrix(2, 3);
} }
| DMAT2X4 { | DMAT2X4 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(2, 4); $$.setMatrix(2, 4);
} }
| DMAT3X2 { | DMAT3X2 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(3, 2); $$.setMatrix(3, 2);
} }
| DMAT3X3 { | DMAT3X3 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(3, 3); $$.setMatrix(3, 3);
} }
| DMAT3X4 { | DMAT3X4 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(3, 4); $$.setMatrix(3, 4);
} }
| DMAT4X2 { | DMAT4X2 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(4, 2); $$.setMatrix(4, 2);
} }
| DMAT4X3 { | DMAT4X3 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(4, 3); $$.setMatrix(4, 3);
} }
| DMAT4X4 { | DMAT4X4 {
parseContext.doubleCheck($1.loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile($1.loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck($1.loc, "double matrix");
$$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel());
$$.basicType = EbtDouble; $$.basicType = EbtDouble;
$$.setMatrix(4, 4); $$.setMatrix(4, 4);

View File

@ -4279,6 +4279,8 @@ yyreduce:
case 15: case 15:
#line 404 "MachineIndependent/glslang.y" /* yacc.c:1646 */ #line 404 "MachineIndependent/glslang.y" /* yacc.c:1646 */
{ {
parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double literal");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck((yyvsp[0].lex).loc, "double literal"); parseContext.doubleCheck((yyvsp[0].lex).loc, "double literal");
(yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtDouble, (yyvsp[0].lex).loc, true); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtDouble, (yyvsp[0].lex).loc, true);
} }
@ -6498,7 +6500,9 @@ yyreduce:
case 228: case 228:
#line 1753 "MachineIndependent/glslang.y" /* yacc.c:1646 */ #line 1753 "MachineIndependent/glslang.y" /* yacc.c:1646 */
{ {
parseContext.doubleCheck((yyvsp[0].lex).loc, "double", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck((yyvsp[0].lex).loc, "double");
(yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel());
(yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).basicType = EbtDouble;
} }
@ -6618,7 +6622,9 @@ yyreduce:
case 240: case 240:
#line 1813 "MachineIndependent/glslang.y" /* yacc.c:1646 */ #line 1813 "MachineIndependent/glslang.y" /* yacc.c:1646 */
{ {
parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double vector");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector");
(yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel());
(yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).basicType = EbtDouble;
(yyval.interm.type).setVector(2); (yyval.interm.type).setVector(2);
@ -6629,7 +6635,9 @@ yyreduce:
case 241: case 241:
#line 1819 "MachineIndependent/glslang.y" /* yacc.c:1646 */ #line 1819 "MachineIndependent/glslang.y" /* yacc.c:1646 */
{ {
parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double vector");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector");
(yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel());
(yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).basicType = EbtDouble;
(yyval.interm.type).setVector(3); (yyval.interm.type).setVector(3);
@ -6640,7 +6648,9 @@ yyreduce:
case 242: case 242:
#line 1825 "MachineIndependent/glslang.y" /* yacc.c:1646 */ #line 1825 "MachineIndependent/glslang.y" /* yacc.c:1646 */
{ {
parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double vector");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector");
(yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel());
(yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).basicType = EbtDouble;
(yyval.interm.type).setVector(4); (yyval.interm.type).setVector(4);
@ -7014,7 +7024,9 @@ yyreduce:
case 276: case 276:
#line 2029 "MachineIndependent/glslang.y" /* yacc.c:1646 */ #line 2029 "MachineIndependent/glslang.y" /* yacc.c:1646 */
{ {
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix");
(yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel());
(yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).basicType = EbtDouble;
(yyval.interm.type).setMatrix(2, 2); (yyval.interm.type).setMatrix(2, 2);
@ -7025,7 +7037,9 @@ yyreduce:
case 277: case 277:
#line 2035 "MachineIndependent/glslang.y" /* yacc.c:1646 */ #line 2035 "MachineIndependent/glslang.y" /* yacc.c:1646 */
{ {
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix");
(yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel());
(yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).basicType = EbtDouble;
(yyval.interm.type).setMatrix(3, 3); (yyval.interm.type).setMatrix(3, 3);
@ -7036,7 +7050,9 @@ yyreduce:
case 278: case 278:
#line 2041 "MachineIndependent/glslang.y" /* yacc.c:1646 */ #line 2041 "MachineIndependent/glslang.y" /* yacc.c:1646 */
{ {
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix");
(yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel());
(yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).basicType = EbtDouble;
(yyval.interm.type).setMatrix(4, 4); (yyval.interm.type).setMatrix(4, 4);
@ -7047,7 +7063,9 @@ yyreduce:
case 279: case 279:
#line 2047 "MachineIndependent/glslang.y" /* yacc.c:1646 */ #line 2047 "MachineIndependent/glslang.y" /* yacc.c:1646 */
{ {
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix");
(yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel());
(yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).basicType = EbtDouble;
(yyval.interm.type).setMatrix(2, 2); (yyval.interm.type).setMatrix(2, 2);
@ -7058,7 +7076,9 @@ yyreduce:
case 280: case 280:
#line 2053 "MachineIndependent/glslang.y" /* yacc.c:1646 */ #line 2053 "MachineIndependent/glslang.y" /* yacc.c:1646 */
{ {
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix");
(yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel());
(yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).basicType = EbtDouble;
(yyval.interm.type).setMatrix(2, 3); (yyval.interm.type).setMatrix(2, 3);
@ -7069,7 +7089,9 @@ yyreduce:
case 281: case 281:
#line 2059 "MachineIndependent/glslang.y" /* yacc.c:1646 */ #line 2059 "MachineIndependent/glslang.y" /* yacc.c:1646 */
{ {
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix");
(yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel());
(yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).basicType = EbtDouble;
(yyval.interm.type).setMatrix(2, 4); (yyval.interm.type).setMatrix(2, 4);
@ -7080,7 +7102,9 @@ yyreduce:
case 282: case 282:
#line 2065 "MachineIndependent/glslang.y" /* yacc.c:1646 */ #line 2065 "MachineIndependent/glslang.y" /* yacc.c:1646 */
{ {
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix");
(yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel());
(yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).basicType = EbtDouble;
(yyval.interm.type).setMatrix(3, 2); (yyval.interm.type).setMatrix(3, 2);
@ -7091,7 +7115,9 @@ yyreduce:
case 283: case 283:
#line 2071 "MachineIndependent/glslang.y" /* yacc.c:1646 */ #line 2071 "MachineIndependent/glslang.y" /* yacc.c:1646 */
{ {
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix");
(yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel());
(yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).basicType = EbtDouble;
(yyval.interm.type).setMatrix(3, 3); (yyval.interm.type).setMatrix(3, 3);
@ -7102,7 +7128,9 @@ yyreduce:
case 284: case 284:
#line 2077 "MachineIndependent/glslang.y" /* yacc.c:1646 */ #line 2077 "MachineIndependent/glslang.y" /* yacc.c:1646 */
{ {
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix");
(yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel());
(yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).basicType = EbtDouble;
(yyval.interm.type).setMatrix(3, 4); (yyval.interm.type).setMatrix(3, 4);
@ -7113,7 +7141,9 @@ yyreduce:
case 285: case 285:
#line 2083 "MachineIndependent/glslang.y" /* yacc.c:1646 */ #line 2083 "MachineIndependent/glslang.y" /* yacc.c:1646 */
{ {
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix");
(yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel());
(yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).basicType = EbtDouble;
(yyval.interm.type).setMatrix(4, 2); (yyval.interm.type).setMatrix(4, 2);
@ -7124,7 +7154,9 @@ yyreduce:
case 286: case 286:
#line 2089 "MachineIndependent/glslang.y" /* yacc.c:1646 */ #line 2089 "MachineIndependent/glslang.y" /* yacc.c:1646 */
{ {
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix");
(yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel());
(yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).basicType = EbtDouble;
(yyval.interm.type).setMatrix(4, 3); (yyval.interm.type).setMatrix(4, 3);
@ -7135,7 +7167,9 @@ yyreduce:
case 287: case 287:
#line 2095 "MachineIndependent/glslang.y" /* yacc.c:1646 */ #line 2095 "MachineIndependent/glslang.y" /* yacc.c:1646 */
{ {
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix", parseContext.symbolTable.atBuiltInLevel()); parseContext.requireProfile((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, "double matrix");
if (! parseContext.symbolTable.atBuiltInLevel())
parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix");
(yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel());
(yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).basicType = EbtDouble;
(yyval.interm.type).setMatrix(4, 4); (yyval.interm.type).setMatrix(4, 4);

View File

@ -102,7 +102,7 @@ public:
void updateExtensionBehavior(const char* const extension, TExtensionBehavior) { } void updateExtensionBehavior(const char* const extension, TExtensionBehavior) { }
void checkExtensionStage(const TSourceLoc&, const char* const extension) { } void checkExtensionStage(const TSourceLoc&, const char* const extension) { }
void fullIntegerCheck(const TSourceLoc&, const char* op) { } void fullIntegerCheck(const TSourceLoc&, const char* op) { }
void doubleCheck(const TSourceLoc&, const char* op, bool builtIn = false) { } void doubleCheck(const TSourceLoc&, const char* op) { }
bool float16Arithmetic() { return false; } bool float16Arithmetic() { return false; }
void requireFloat16Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) { } void requireFloat16Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) { }
bool int16Arithmetic() { return false; } bool int16Arithmetic() { return false; }
@ -142,7 +142,7 @@ public:
virtual void fullIntegerCheck(const TSourceLoc&, const char* op); virtual void fullIntegerCheck(const TSourceLoc&, const char* op);
virtual void unimplemented(const TSourceLoc&, const char* featureDesc); virtual void unimplemented(const TSourceLoc&, const char* featureDesc);
virtual void doubleCheck(const TSourceLoc&, const char* op, bool builtIn = false); virtual void doubleCheck(const TSourceLoc&, const char* op);
virtual void float16Check(const TSourceLoc&, const char* op, bool builtIn = false); virtual void float16Check(const TSourceLoc&, const char* op, bool builtIn = false);
virtual void float16ScalarVectorCheck(const TSourceLoc&, const char* op, bool builtIn = false); virtual void float16ScalarVectorCheck(const TSourceLoc&, const char* op, bool builtIn = false);
virtual bool float16Arithmetic(); virtual bool float16Arithmetic();