Commit f40319e9 by Olli Etuaho

Add basic support for array constructors

Add limited support for parsing array constructors and writing them out as GLSL code. Still missing from this version: HLSL output, array support in initializer lists, arrays with implicit size. BUG=angleproject:941 Change-Id: I7febf80923c4cd0b730399f1f49f9456cf3668e9 Reviewed-on: https://chromium-review.googlesource.com/260572Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarOlli Etuaho <oetuaho@nvidia.com>
parent 51a1db16
...@@ -221,6 +221,28 @@ const ConstantUnion *TOutputGLSLBase::writeConstantUnion( ...@@ -221,6 +221,28 @@ const ConstantUnion *TOutputGLSLBase::writeConstantUnion(
return pConstUnion; return pConstUnion;
} }
void TOutputGLSLBase::writeConstructorTriplet(Visit visit, const TType &type, const char *constructorBaseType)
{
TInfoSinkBase &out = objSink();
if (visit == PreVisit)
{
if (type.isArray())
{
out << constructorBaseType;
out << arrayBrackets(type);
out << "(";
}
else
{
out << constructorBaseType << "(";
}
}
else
{
writeTriplet(visit, nullptr, ", ", ")");
}
}
void TOutputGLSLBase::visitSymbol(TIntermSymbol *node) void TOutputGLSLBase::visitSymbol(TIntermSymbol *node)
{ {
TInfoSinkBase &out = objSink(); TInfoSinkBase &out = objSink();
...@@ -722,7 +744,6 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -722,7 +744,6 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate *node)
{ {
bool visitChildren = true; bool visitChildren = true;
TInfoSinkBase &out = objSink(); TInfoSinkBase &out = objSink();
TString preString;
bool useEmulatedFunction = (visit == PreVisit && node->getUseEmulatedFunction()); bool useEmulatedFunction = (visit == PreVisit && node->getUseEmulatedFunction());
switch (node->getOp()) switch (node->getOp())
{ {
...@@ -854,66 +875,58 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -854,66 +875,58 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate *node)
visitChildren = false; visitChildren = false;
break; break;
case EOpConstructFloat: case EOpConstructFloat:
writeTriplet(visit, "float(", NULL, ")"); writeConstructorTriplet(visit, node->getType(), "float");
break; break;
case EOpConstructVec2: case EOpConstructVec2:
writeBuiltInFunctionTriplet(visit, "vec2(", false); writeConstructorTriplet(visit, node->getType(), "vec2");
break; break;
case EOpConstructVec3: case EOpConstructVec3:
writeBuiltInFunctionTriplet(visit, "vec3(", false); writeConstructorTriplet(visit, node->getType(), "vec3");
break; break;
case EOpConstructVec4: case EOpConstructVec4:
writeBuiltInFunctionTriplet(visit, "vec4(", false); writeConstructorTriplet(visit, node->getType(), "vec4");
break; break;
case EOpConstructBool: case EOpConstructBool:
writeTriplet(visit, "bool(", NULL, ")"); writeConstructorTriplet(visit, node->getType(), "bool");
break; break;
case EOpConstructBVec2: case EOpConstructBVec2:
writeBuiltInFunctionTriplet(visit, "bvec2(", false); writeConstructorTriplet(visit, node->getType(), "bvec2");
break; break;
case EOpConstructBVec3: case EOpConstructBVec3:
writeBuiltInFunctionTriplet(visit, "bvec3(", false); writeConstructorTriplet(visit, node->getType(), "bvec3");
break; break;
case EOpConstructBVec4: case EOpConstructBVec4:
writeBuiltInFunctionTriplet(visit, "bvec4(", false); writeConstructorTriplet(visit, node->getType(), "bvec4");
break; break;
case EOpConstructInt: case EOpConstructInt:
writeTriplet(visit, "int(", NULL, ")"); writeConstructorTriplet(visit, node->getType(), "int");
break; break;
case EOpConstructIVec2: case EOpConstructIVec2:
writeBuiltInFunctionTriplet(visit, "ivec2(", false); writeConstructorTriplet(visit, node->getType(), "ivec2");
break; break;
case EOpConstructIVec3: case EOpConstructIVec3:
writeBuiltInFunctionTriplet(visit, "ivec3(", false); writeConstructorTriplet(visit, node->getType(), "ivec3");
break; break;
case EOpConstructIVec4: case EOpConstructIVec4:
writeBuiltInFunctionTriplet(visit, "ivec4(", false); writeConstructorTriplet(visit, node->getType(), "ivec4");
break; break;
case EOpConstructMat2: case EOpConstructMat2:
writeBuiltInFunctionTriplet(visit, "mat2(", false); writeConstructorTriplet(visit, node->getType(), "mat2");
break; break;
case EOpConstructMat3: case EOpConstructMat3:
writeBuiltInFunctionTriplet(visit, "mat3(", false); writeConstructorTriplet(visit, node->getType(), "mat3");
break; break;
case EOpConstructMat4: case EOpConstructMat4:
writeBuiltInFunctionTriplet(visit, "mat4(", false); writeConstructorTriplet(visit, node->getType(), "mat4");
break; break;
case EOpConstructStruct: case EOpConstructStruct:
if (visit == PreVisit)
{ {
const TType &type = node->getType(); const TType &type = node->getType();
ASSERT(type.getBasicType() == EbtStruct); ASSERT(type.getBasicType() == EbtStruct);
out << hashName(type.getStruct()->name()) << "("; TString constructorName = hashName(type.getStruct()->name());
} writeConstructorTriplet(visit, node->getType(), constructorName.c_str());
else if (visit == InVisit) break;
{
out << ", ";
}
else
{
out << ")";
} }
break;
case EOpOuterProduct: case EOpOuterProduct:
writeBuiltInFunctionTriplet(visit, "outerProduct(", useEmulatedFunction); writeBuiltInFunctionTriplet(visit, "outerProduct(", useEmulatedFunction);
......
...@@ -36,6 +36,7 @@ class TOutputGLSLBase : public TIntermTraverser ...@@ -36,6 +36,7 @@ class TOutputGLSLBase : public TIntermTraverser
virtual bool writeVariablePrecision(TPrecision precision) = 0; virtual bool writeVariablePrecision(TPrecision precision) = 0;
void writeFunctionParameters(const TIntermSequence &args); void writeFunctionParameters(const TIntermSequence &args);
const ConstantUnion *writeConstantUnion(const TType &type, const ConstantUnion *pConstUnion); const ConstantUnion *writeConstantUnion(const TType &type, const ConstantUnion *pConstUnion);
void writeConstructorTriplet(Visit visit, const TType &type, const char *constructorBaseType);
TString getTypeName(const TType &type); TString getTypeName(const TType &type);
virtual void visitSymbol(TIntermSymbol *node); virtual void visitSymbol(TIntermSymbol *node);
......
...@@ -2202,6 +2202,10 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -2202,6 +2202,10 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
case EOpConstructMat4: outputConstructor(visit, node->getType(), "mat4", node->getSequence()); break; case EOpConstructMat4: outputConstructor(visit, node->getType(), "mat4", node->getSequence()); break;
case EOpConstructStruct: case EOpConstructStruct:
{ {
if (node->getType().isArray())
{
UNIMPLEMENTED();
}
const TString &structName = StructNameString(*node->getType().getStruct()); const TString &structName = StructNameString(*node->getType().getStruct());
mStructureHLSL->addConstructor(node->getType(), structName, node->getSequence()); mStructureHLSL->addConstructor(node->getType(), structName, node->getSequence());
outputTriplet(visit, (structName + "_ctor(").c_str(), ", ", ")"); outputTriplet(visit, (structName + "_ctor(").c_str(), ", ", ")");
...@@ -2829,6 +2833,10 @@ TString OutputHLSL::initializer(const TType &type) ...@@ -2829,6 +2833,10 @@ TString OutputHLSL::initializer(const TType &type)
void OutputHLSL::outputConstructor(Visit visit, const TType &type, const char *name, const TIntermSequence *parameters) void OutputHLSL::outputConstructor(Visit visit, const TType &type, const char *name, const TIntermSequence *parameters)
{ {
if (type.isArray())
{
UNIMPLEMENTED();
}
TInfoSinkBase &out = getInfoSink(); TInfoSinkBase &out = getInfoSink();
if (visit == PreVisit) if (visit == PreVisit)
......
...@@ -1651,7 +1651,24 @@ TIntermTyped *TParseContext::addConstructor(TIntermNode *arguments, TType *type, ...@@ -1651,7 +1651,24 @@ TIntermTyped *TParseContext::addConstructor(TIntermNode *arguments, TType *type,
aggregateArguments->getSequence()->push_back(arguments); aggregateArguments->getSequence()->push_back(arguments);
} }
if (op == EOpConstructStruct) if (type->isArray())
{
// GLSL ES 3.00 section 5.4.4: Each argument must be the same type as the element type of the array.
TIntermSequence *args = aggregateArguments->getSequence();
for (size_t i = 0; i < args->size(); i++)
{
const TType &argType = (*args)[i]->getAsTyped()->getType();
// It has already been checked that the argument is not an array.
ASSERT(!argType.isArray());
if (!argType.sameElementType(*type))
{
error(line, "Array constructor argument has an incorrect type", "Error");
recover();
return nullptr;
}
}
}
else if (op == EOpConstructStruct)
{ {
const TFieldList &fields = type->getStruct()->fields(); const TFieldList &fields = type->getStruct()->fields();
TIntermSequence *args = aggregateArguments->getSequence(); TIntermSequence *args = aggregateArguments->getSequence();
...@@ -1689,7 +1706,8 @@ TIntermTyped *TParseContext::addConstructor(TIntermNode *arguments, TType *type, ...@@ -1689,7 +1706,8 @@ TIntermTyped *TParseContext::addConstructor(TIntermNode *arguments, TType *type,
TIntermTyped* TParseContext::foldConstConstructor(TIntermAggregate* aggrNode, const TType& type) TIntermTyped* TParseContext::foldConstConstructor(TIntermAggregate* aggrNode, const TType& type)
{ {
bool canBeFolded = areAllChildConst(aggrNode); // TODO: Add support for folding array constructors
bool canBeFolded = areAllChildConst(aggrNode) && !type.isArray();
aggrNode->setType(type); aggrNode->setType(type);
if (canBeFolded) { if (canBeFolded) {
bool returnVal = false; bool returnVal = false;
......
...@@ -358,7 +358,10 @@ function_call_header ...@@ -358,7 +358,10 @@ function_call_header
// Grammar Note: Constructors look like functions, but are recognized as types. // Grammar Note: Constructors look like functions, but are recognized as types.
function_identifier function_identifier
: type_specifier_nonarray { : type_specifier_no_prec {
if ($1.array) {
ES3_ONLY("[]", @1, "array constructor");
}
$$ = context->addConstructorFunc($1); $$ = context->addConstructorFunc($1);
} }
| IDENTIFIER { | IDENTIFIER {
...@@ -929,9 +932,10 @@ fully_specified_type ...@@ -929,9 +932,10 @@ fully_specified_type
$$ = $1; $$ = $1;
if ($1.array) { if ($1.array) {
context->error(@1, "not supported", "first-class array"); ES3_ONLY("[]", @1, "first-class-array");
context->recover(); if (context->shaderVersion != 300) {
$1.setArray(false); $1.setArray(false);
}
} }
} }
| type_qualifier type_specifier { | type_qualifier type_specifier {
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#line 25 "./glslang_lex.cpp" #line 26 "./glslang_lex.cpp"
#define YY_INT_ALIGNED short int #define YY_INT_ALIGNED short int
......
...@@ -690,34 +690,34 @@ static const yytype_uint8 yytranslate[] = ...@@ -690,34 +690,34 @@ static const yytype_uint8 yytranslate[] =
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] = static const yytype_uint16 yyrline[] =
{ {
0, 209, 209, 210, 213, 237, 240, 245, 250, 255, 0, 210, 210, 211, 214, 238, 241, 246, 251, 256,
260, 266, 269, 272, 275, 278, 281, 287, 295, 306, 261, 267, 270, 273, 276, 279, 282, 288, 296, 307,
309, 317, 320, 326, 330, 337, 343, 352, 360, 363, 310, 318, 321, 327, 331, 338, 344, 353, 361, 367,
370, 380, 383, 386, 389, 399, 400, 401, 402, 410, 374, 384, 387, 390, 393, 403, 404, 405, 406, 414,
411, 414, 417, 424, 425, 428, 434, 435, 439, 446, 415, 418, 421, 428, 429, 432, 438, 439, 443, 450,
447, 450, 453, 456, 462, 463, 466, 472, 473, 480, 451, 454, 457, 460, 466, 467, 470, 476, 477, 484,
481, 488, 489, 496, 497, 503, 504, 510, 511, 517, 485, 492, 493, 500, 501, 507, 508, 514, 515, 521,
518, 535, 536, 544, 545, 546, 547, 551, 552, 553, 522, 539, 540, 548, 549, 550, 551, 555, 556, 557,
557, 561, 565, 569, 576, 579, 590, 598, 606, 633, 561, 565, 569, 573, 580, 583, 594, 602, 610, 637,
639, 650, 654, 658, 662, 669, 725, 728, 735, 743, 643, 654, 658, 662, 666, 673, 729, 732, 739, 747,
764, 785, 795, 823, 828, 838, 843, 853, 856, 859, 768, 789, 799, 827, 832, 842, 847, 857, 860, 863,
862, 868, 875, 878, 882, 886, 890, 897, 901, 905, 866, 872, 879, 882, 886, 890, 894, 901, 905, 909,
912, 916, 920, 927, 936, 942, 945, 951, 957, 964, 916, 920, 924, 931, 941, 947, 950, 956, 962, 969,
973, 982, 990, 993, 1000, 1004, 1011, 1014, 1018, 1022, 978, 987, 995, 998, 1005, 1009, 1016, 1019, 1023, 1027,
1031, 1040, 1048, 1058, 1070, 1073, 1076, 1082, 1089, 1092, 1036, 1045, 1053, 1063, 1075, 1078, 1081, 1087, 1094, 1097,
1098, 1101, 1104, 1110, 1113, 1128, 1132, 1136, 1140, 1144, 1103, 1106, 1109, 1115, 1118, 1133, 1137, 1141, 1145, 1149,
1148, 1153, 1158, 1163, 1168, 1173, 1178, 1183, 1188, 1193, 1153, 1158, 1163, 1168, 1173, 1178, 1183, 1188, 1193, 1198,
1198, 1203, 1208, 1213, 1218, 1223, 1228, 1233, 1238, 1243, 1203, 1208, 1213, 1218, 1223, 1228, 1233, 1238, 1243, 1248,
1248, 1253, 1257, 1261, 1265, 1269, 1273, 1277, 1281, 1285, 1253, 1258, 1262, 1266, 1270, 1274, 1278, 1282, 1286, 1290,
1289, 1293, 1297, 1301, 1305, 1309, 1313, 1321, 1329, 1333, 1294, 1298, 1302, 1306, 1310, 1314, 1318, 1326, 1334, 1338,
1346, 1346, 1349, 1349, 1355, 1358, 1374, 1377, 1386, 1390, 1351, 1351, 1354, 1354, 1360, 1363, 1379, 1382, 1391, 1395,
1396, 1403, 1418, 1422, 1426, 1427, 1433, 1434, 1435, 1436, 1401, 1408, 1423, 1427, 1431, 1432, 1438, 1439, 1440, 1441,
1437, 1438, 1439, 1443, 1444, 1444, 1444, 1454, 1455, 1459, 1442, 1443, 1444, 1448, 1449, 1449, 1449, 1459, 1460, 1464,
1459, 1460, 1460, 1465, 1468, 1478, 1481, 1487, 1488, 1492, 1464, 1465, 1465, 1470, 1473, 1483, 1486, 1492, 1493, 1497,
1500, 1504, 1511, 1511, 1518, 1521, 1528, 1533, 1550, 1550, 1505, 1509, 1516, 1516, 1523, 1526, 1533, 1538, 1555, 1555,
1555, 1555, 1562, 1562, 1570, 1573, 1579, 1582, 1588, 1592, 1560, 1560, 1567, 1567, 1575, 1578, 1584, 1587, 1593, 1597,
1599, 1602, 1605, 1608, 1611, 1620, 1624, 1631, 1634, 1640, 1604, 1607, 1610, 1613, 1616, 1625, 1629, 1636, 1639, 1645,
1640 1645
}; };
#endif #endif
...@@ -823,44 +823,44 @@ static const yytype_int16 yypact[] = ...@@ -823,44 +823,44 @@ static const yytype_int16 yypact[] =
1974, -24, -328, -328, -328, 184, -328, -328, -328, -328, 1974, -24, -328, -328, -328, 184, -328, -328, -328, -328,
-328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,
-328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328,
-328, -328, -328, -328, -328, -328, -328, 66, -328, -328, -328, -328, -328, -328, -328, -328, -328, -14, -328, -328,
-54, -328, -328, -328, -328, -328, -328, -328, -328, -328, -54, -328, -328, -328, -328, -328, -328, -328, -328, -328,
-328, -328, -328, -328, -328, -328, -328, -328, -328, -77, -328, -328, -328, -328, -328, -328, -328, -328, -328, -36,
-328, -328, -46, -20, -30, 3, 53, -328, 108, 10, -328, -328, -78, -9, -30, 3, 53, -328, 30, 10,
260, -328, -328, 2259, 10, -328, 24, -328, 1899, -328, 260, -328, -328, 2259, 10, -328, -8, -328, 1899, -328,
-328, -328, -328, 2259, -328, -328, -328, -328, -328, 11, -328, -328, -328, 2259, -328, -328, -328, -328, -328, -23,
58, -328, 30, -328, 62, -328, -328, -328, -328, -328, 43, -328, 26, -328, 62, -328, -328, -328, -328, -328,
2123, 151, 120, -328, 64, -22, -328, 65, -328, 2049, 2123, 151, 108, -328, 34, -22, -328, 60, -328, 2049,
-328, -328, -328, 1452, -328, -328, 80, 2049, -328, 109, -328, -328, -328, 1452, -328, -328, 16, 2049, -328, 65,
-10, -328, 389, -328, -328, -328, -328, 120, 2123, -16, -10, -328, 389, -328, -328, -328, -328, 108, 2123, -16,
-328, 1161, 1452, -328, 132, 2123, 120, 1644, -328, 74, -328, 1161, 1452, -328, 129, 2123, 108, 1644, -328, 90,
-328, -328, -328, -328, -328, 1452, 1452, 1452, -328, -328, -328, -328, -328, -328, -328, 1452, 1452, 1452, -328, -328,
-328, -328, -328, -328, -48, -328, -328, -328, 95, 13, -328, -328, -328, -328, -48, -328, -328, -328, 71, 13,
1547, 124, -328, 1452, 87, -70, 119, -57, 131, 106, 1547, 96, -328, 1452, 87, -70, 113, -57, 131, 98,
111, 121, 142, 147, -71, -328, 136, -328, -328, 1729, 97, 109, 141, 143, -71, -328, 133, -328, -328, 1729,
2049, 145, -328, 58, 134, 135, -328, 146, 149, 141, 2049, 123, -328, 43, 127, 128, -328, 139, 142, 134,
1259, 152, 1452, 148, 153, 137, -328, -328, 116, -328, 1259, 145, 1452, 138, 149, 136, -328, -328, 116, -328,
-328, 55, -328, -46, -8, -328, -328, -328, -328, 505, -328, 55, -328, -78, 152, -328, -328, -328, -328, 505,
-328, -328, -328, -328, -328, -328, 155, -328, -328, 1354, -328, -328, -328, -328, -328, -328, 153, -328, -328, 1354,
1452, -328, 156, -328, -328, 120, 163, 61, -328, -59, 1452, -328, 148, -328, -328, 108, 154, 61, -328, -59,
-328, -328, -328, 15, -328, -328, 1452, 2191, -328, -328, -328, -328, -328, 15, -328, -328, 1452, 2191, -328, -328,
1452, 154, -328, -328, -328, 1452, 1452, 1452, 1452, 1452, 1452, 156, -328, -328, -328, 1452, 1452, 1452, 1452, 1452,
1452, 1452, 1452, 1452, 1452, 1452, 1452, 1452, 1452, 1452, 1452, 1452, 1452, 1452, 1452, 1452, 1452, 1452, 1452, 1452,
1452, 1452, 1452, 1452, 1452, -328, -328, 1814, -328, -328, 1452, 1452, 1452, 1452, 1452, -328, -328, 1814, -328, -328,
-328, -328, -328, 166, -328, 1452, -328, -328, 63, 1452, -328, -328, -328, 150, -328, 1452, -328, -328, 63, 1452,
164, -328, -328, -328, 621, -328, -328, -328, -328, -328, 157, -328, -328, -328, 621, -328, -328, -328, -328, -328,
-328, -328, -328, -328, -328, -328, 1452, 1452, -328, -328, -328, -328, -328, -328, -328, -328, 1452, 1452, -328, -328,
-328, 1452, -328, 168, -328, -328, 72, 1452, 120, -328, -328, 1452, -328, 167, -328, -328, 72, 1452, 108, -328,
-32, -328, -328, 170, 167, -328, 175, -328, -328, -328, -32, -328, -328, 168, 146, -328, 159, -328, -328, -328,
-328, -328, 87, 87, -70, -70, 119, 119, 119, 119, -328, -328, 87, 87, -70, -70, 113, 113, 113, 113,
-57, -57, 131, 106, 111, 121, 142, 147, 115, -328, -57, -57, 131, 98, 97, 109, 141, 143, 114, -328,
203, 30, 853, 969, 18, -328, 20, -328, 1066, 621, 220, 26, 853, 969, 18, -328, 20, -328, 1066, 621,
-328, -328, 173, -328, -328, 174, -328, 1452, -328, -328, -328, -328, 170, -328, -328, 171, -328, 1452, -328, -328,
1452, 178, -328, -328, -328, -328, 1066, 166, -328, 167, 1452, 175, -328, -328, -328, -328, 1066, 150, -328, 146,
120, 2123, 195, 192, -328, -328, 176, -328, 1452, -328, 108, 2123, 176, 173, -328, -328, 193, -328, 1452, -328,
188, 199, 294, -328, 204, 200, 737, -328, 202, 22, 166, 178, 284, -328, 194, 191, 737, -328, 197, 22,
1452, 737, 166, -328, 1452, -328, -328, -328, -328, 221, 1452, 737, 150, -328, 1452, -328, -328, -328, -328, 198,
167, -328, -328, -328, -328 146, -328, -328, -328, -328
}; };
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
...@@ -888,11 +888,11 @@ static const yytype_uint16 yydefact[] = ...@@ -888,11 +888,11 @@ static const yytype_uint16 yydefact[] =
61, 63, 65, 67, 69, 86, 0, 28, 90, 0, 61, 63, 65, 67, 69, 86, 0, 28, 90, 0,
0, 0, 147, 0, 0, 0, 250, 0, 0, 0, 0, 0, 147, 0, 0, 0, 250, 0, 0, 0,
0, 0, 0, 0, 0, 224, 233, 237, 39, 71, 0, 0, 0, 0, 0, 224, 233, 237, 39, 71,
84, 0, 213, 0, 153, 216, 235, 215, 214, 0, 84, 0, 213, 0, 142, 216, 235, 215, 214, 0,
217, 218, 219, 220, 221, 222, 101, 103, 105, 0, 217, 218, 219, 220, 221, 222, 101, 103, 105, 0,
0, 119, 0, 212, 121, 0, 210, 0, 208, 0, 0, 119, 0, 212, 121, 0, 210, 0, 208, 0,
205, 32, 33, 0, 15, 16, 0, 0, 22, 21, 205, 32, 33, 0, 15, 16, 0, 0, 22, 21,
0, 23, 25, 27, 34, 0, 0, 0, 0, 0, 0, 155, 25, 27, 34, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 154, 203, 0, 151, 152, 0, 0, 0, 0, 0, 154, 203, 0, 151, 152,
149, 261, 260, 231, 252, 0, 264, 262, 0, 0, 149, 261, 260, 231, 252, 0, 264, 262, 0, 0,
...@@ -914,16 +914,16 @@ static const yytype_uint16 yydefact[] = ...@@ -914,16 +914,16 @@ static const yytype_uint16 yydefact[] =
/* YYPGOTO[NTERM-NUM]. */ /* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] = static const yytype_int16 yypgoto[] =
{ {
-328, -39, -328, -328, -328, -328, -328, -328, 101, -328, -328, -39, -328, -328, -328, -328, -328, -328, 76, -328,
-328, -328, -328, -106, -328, -18, -12, -93, -15, 81, -328, -328, -328, -106, -328, -21, -20, -93, -18, 58,
82, 84, 79, 83, 88, -328, -103, -126, -328, -143, 79, 75, 78, 82, 77, -328, -103, -126, -328, -143,
-120, -328, 9, 14, -328, -328, -328, 218, 253, 249, -120, -328, 9, 14, -328, -328, -328, 213, 251, 245,
224, -328, -328, -324, -328, -328, -104, 41, -68, 348, 219, -328, -328, -324, -328, -328, -104, 41, -68, 345,
-328, -328, 171, -47, 0, -328, -328, -328, -101, -102, -328, -328, 169, 0, -328, -328, -328, -328, -101, -102,
130, 48, -212, 16, -191, -327, -27, -328, -328, -33, 126, 45, -212, 11, -191, -327, -29, -328, -328, -35,
-287, -328, -328, -89, 76, 19, -328, -328, -328, -328, -287, -328, -328, -89, 73, 17, -328, -328, -328, -328,
-328, -5, -328, -328, -328, -328, -328, -328, -328, -328, -328, -7, -328, -328, -328, -328, -328, -328, -328, -328,
-328, 285, -328, -328 -328, 280, -328, -328
}; };
/* YYDEFGOTO[NTERM-NUM]. */ /* YYDEFGOTO[NTERM-NUM]. */
...@@ -934,7 +934,7 @@ static const yytype_int16 yydefgoto[] = ...@@ -934,7 +934,7 @@ static const yytype_int16 yydefgoto[] =
169, 170, 171, 172, 173, 174, 199, 200, 296, 201, 169, 170, 171, 172, 173, 174, 199, 200, 296, 201,
176, 109, 202, 203, 63, 64, 65, 125, 99, 100, 176, 109, 202, 203, 63, 64, 65, 125, 99, 100,
126, 66, 67, 68, 69, 101, 70, 71, 72, 73, 126, 66, 67, 68, 69, 101, 70, 71, 72, 73,
74, 120, 121, 75, 177, 77, 180, 117, 137, 138, 74, 120, 121, 177, 76, 77, 180, 117, 137, 138,
227, 228, 224, 205, 206, 207, 208, 284, 373, 396, 227, 228, 224, 205, 206, 207, 208, 284, 373, 396,
340, 341, 342, 397, 209, 210, 211, 383, 212, 384, 340, 341, 342, 397, 209, 210, 211, 383, 212, 384,
213, 372, 214, 348, 273, 343, 366, 380, 381, 215, 213, 372, 214, 348, 273, 343, 366, 380, 381, 215,
...@@ -946,44 +946,44 @@ static const yytype_int16 yydefgoto[] = ...@@ -946,44 +946,44 @@ static const yytype_int16 yydefgoto[] =
number is the opposite. If YYTABLE_NINF, syntax error. */ number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_int16 yytable[] = static const yytype_int16 yytable[] =
{ {
76, 89, 110, 123, 233, 135, 223, 162, 304, 61, 75, 89, 110, 123, 233, 135, 223, 162, 304, 61,
175, 222, 95, 135, 62, 363, 179, 310, 300, 7, 175, 222, 95, 135, 62, 363, 179, 310, 300, 7,
81, 263, 86, 87, 370, 162, 111, 90, 175, 105, 81, 263, 86, 87, 370, 162, 84, 85, 175, 105,
252, 253, 127, 135, 242, 230, 116, 234, 235, 231, 252, 253, 127, 135, 242, 230, 91, 234, 235, 231,
232, 136, 370, 96, 97, 98, 248, 278, 249, 136, 232, 136, 370, 96, 97, 98, 248, 278, 249, 136,
27, 28, 82, 29, 88, 311, 264, 244, 236, 395, 27, 28, 82, 29, 88, 311, 264, 244, 236, 395,
127, 37, 237, 129, 395, 254, 255, 225, 91, 136, 127, 37, 237, 129, 395, 254, 255, 225, 90, 136,
76, 95, 280, 76, 357, 135, 135, 230, 76, 267, 75, 95, 280, 111, 357, 135, 135, 230, 75, 267,
382, 94, 358, 76, 131, 93, 162, 61, 216, 175, 382, 94, 358, 116, 131, 118, 162, 61, 216, 175,
219, 132, 62, 314, 223, 182, -28, 220, 113, 303, 219, 132, 62, 314, 223, 182, 93, 220, 113, 303,
76, 183, 96, 97, 98, 402, 84, 85, -96, 76, 75, 183, 96, 97, 98, 402, 104, 87, -96, 75,
106, 136, 136, 162, 318, 112, 175, 76, 239, 118, 106, 136, 136, 162, 318, 112, 175, 75, 239, 119,
312, 338, 204, 367, 240, 368, 297, 399, 76, 297, 312, 338, 204, 367, 240, 368, 297, 399, 75, 297,
113, 297, 344, 297, 119, 76, 346, 76, 122, 319, 178, 297, 344, 297, 122, 75, 346, 75, 130, 319,
320, 321, 162, 162, 162, 162, 162, 162, 162, 162, 320, 321, 162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 162, 162, 162, 162, 300, 326, 162, 162, 162, 162, 162, 162, 162, 162, 300, 326,
327, 328, 329, 135, 102, 230, 297, 103, 130, 298, 327, 328, 329, 135, 102, 230, 297, 103, 133, 298,
350, 351, 308, 133, 297, 309, 81, 345, -29, 76, 350, 351, 308, 81, 297, 309, 238, 345, 181, 75,
76, 352, 403, 308, 104, 87, 354, 355, 2, 3, 75, 352, 403, 308, 86, 87, 354, 355, 2, 3,
4, 96, 97, 98, 178, 162, 86, 87, 175, 136, 4, 96, 97, 98, -29, 162, 250, 251, 175, 136,
238, 162, 250, 251, 175, 369, 245, 246, 247, 204, 243, 162, 268, 269, 175, 369, 245, 246, 247, 204,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
256, 257, 181, 369, 268, 269, 297, 360, 243, 295, 256, 257, 259, 369, 258, 297, 360, 322, 323, 295,
322, 323, 258, 261, 377, 389, 259, 376, 324, 325, 324, 325, 261, 260, 377, 389, 262, 376, 330, 331,
262, 330, 331, 265, 371, 260, 283, 400, 271, 272, 265, 271, 272, 274, 371, 283, 275, 400, 276, 279,
274, 162, 362, 275, 175, 276, 279, 282, -155, 361, 281, 162, 362, 282, 175, 305, -28, 297, -229, 301,
281, 301, 371, 305, 2, 3, 4, 76, 223, 307, 307, -23, 371, -30, 2, 3, 4, 75, 223, 347,
8, 9, 10, 11, -229, 353, 347, 359, 297, -30, 8, 9, 10, 11, 353, 359, 361, 374, 375, 378,
374, 375, 378, 388, 204, 12, 13, 14, 15, 16, 390, 386, 387, 391, 204, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
386, 387, 390, 110, 391, 31, 32, 33, 34, 35, 388, 392, 195, 110, 394, 31, 32, 33, 34, 35,
36, 392, 195, 394, 40, 41, 398, 42, 43, 44, 36, 398, 404, 317, 40, 41, 332, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, 385, 56, 57, 58, 404, 107, 60, 317, 332, 55, 385, 56, 57, 58, 334, 107, 60, 333, 335,
335, 333, 204, 204, 334, 336, 217, 124, 204, 204, 337, 217, 204, 204, 336, 124, 128, 218, 204, 204,
128, 337, 218, 83, 270, 306, 356, 393, 401, 364, 83, 306, 270, 356, 364, 393, 401, 349, 115, 379,
349, 379, 365, 115, 0, 0, 204, 0, 0, 0, 365, 0, 0, 0, 0, 0, 204, 0, 0, 0,
0, 76, 0, 0, 108, 0, 0, 0, 0, 0, 0, 75, 0, 0, 108, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 204, 0, 0, 0, 0, 0, 0, 0, 0, 0, 204, 0, 0, 0,
0, 204, 1, 2, 3, 4, 5, 6, 7, 8, 0, 204, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 184, 185, 186, 0, 187, 188, 189, 9, 10, 11, 184, 185, 186, 0, 187, 188, 189,
...@@ -1186,41 +1186,41 @@ static const yytype_int16 yycheck[] = ...@@ -1186,41 +1186,41 @@ static const yytype_int16 yycheck[] =
{ {
0, 40, 70, 92, 147, 109, 132, 113, 220, 0, 0, 40, 70, 92, 147, 109, 132, 113, 220, 0,
113, 131, 9, 117, 0, 342, 117, 76, 209, 9, 113, 131, 9, 117, 0, 342, 117, 76, 209, 9,
44, 92, 76, 77, 348, 131, 73, 104, 131, 68, 44, 92, 76, 77, 348, 131, 40, 41, 131, 68,
87, 88, 100, 137, 160, 137, 83, 85, 86, 145, 87, 88, 100, 137, 160, 137, 114, 85, 86, 145,
146, 109, 366, 40, 41, 42, 116, 190, 118, 117, 146, 109, 366, 40, 41, 42, 116, 190, 118, 117,
40, 41, 76, 43, 108, 114, 127, 163, 106, 386, 40, 41, 76, 43, 108, 114, 127, 163, 106, 386,
128, 51, 110, 102, 391, 122, 123, 135, 114, 137, 128, 51, 110, 102, 391, 122, 123, 135, 104, 137,
70, 9, 192, 73, 106, 179, 180, 179, 78, 180, 70, 9, 192, 73, 106, 179, 180, 179, 78, 180,
367, 111, 114, 83, 106, 105, 192, 78, 127, 192, 367, 111, 114, 83, 106, 108, 192, 78, 127, 192,
106, 113, 78, 236, 220, 105, 104, 113, 106, 219, 106, 113, 78, 236, 220, 105, 105, 113, 106, 219,
100, 111, 40, 41, 42, 392, 40, 41, 105, 109, 100, 111, 40, 41, 42, 392, 76, 77, 105, 109,
69, 179, 180, 219, 240, 74, 219, 117, 105, 108, 69, 179, 180, 219, 240, 74, 219, 117, 105, 76,
105, 264, 122, 105, 111, 105, 111, 105, 128, 111, 105, 264, 122, 105, 111, 105, 111, 105, 128, 111,
106, 111, 275, 111, 76, 135, 279, 137, 108, 245, 114, 111, 275, 111, 108, 135, 279, 137, 104, 245,
246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255,
256, 257, 258, 259, 260, 261, 262, 263, 349, 252, 256, 257, 258, 259, 260, 261, 262, 263, 349, 252,
253, 254, 255, 267, 111, 267, 111, 114, 104, 114, 253, 254, 255, 267, 111, 267, 111, 114, 108, 114,
296, 297, 111, 108, 111, 114, 44, 114, 104, 179, 296, 297, 111, 44, 111, 114, 105, 114, 113, 179,
180, 301, 394, 111, 76, 77, 114, 307, 4, 5, 180, 301, 394, 111, 76, 77, 114, 307, 4, 5,
6, 40, 41, 42, 114, 301, 76, 77, 301, 267, 6, 40, 41, 42, 104, 301, 83, 84, 301, 267,
105, 307, 83, 84, 307, 348, 119, 120, 121, 209, 104, 307, 79, 80, 307, 348, 119, 120, 121, 209,
94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
89, 90, 113, 366, 79, 80, 111, 112, 104, 113, 89, 90, 125, 366, 126, 111, 112, 248, 249, 113,
248, 249, 126, 91, 360, 378, 125, 357, 250, 251, 250, 251, 91, 124, 360, 378, 93, 357, 256, 257,
93, 256, 257, 107, 348, 124, 109, 390, 114, 114, 107, 114, 114, 104, 348, 109, 104, 390, 114, 104,
104, 357, 341, 104, 357, 114, 104, 104, 104, 56, 112, 357, 341, 104, 357, 107, 104, 111, 108, 106,
112, 106, 366, 107, 4, 5, 6, 267, 394, 106, 106, 105, 366, 104, 4, 5, 6, 267, 394, 112,
10, 11, 12, 13, 108, 107, 112, 107, 111, 104, 10, 11, 12, 13, 107, 107, 56, 107, 107, 104,
107, 107, 104, 107, 284, 25, 26, 27, 28, 29, 114, 105, 109, 105, 284, 25, 26, 27, 28, 29,
30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
105, 109, 114, 371, 105, 45, 46, 47, 48, 49, 107, 17, 108, 371, 113, 45, 46, 47, 48, 49,
50, 17, 108, 113, 54, 55, 114, 57, 58, 59, 50, 114, 114, 237, 54, 55, 258, 57, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
70, 370, 72, 73, 74, 114, 76, 77, 237, 258, 70, 370, 72, 73, 74, 260, 76, 77, 259, 261,
261, 259, 342, 343, 260, 262, 128, 94, 348, 349, 263, 128, 342, 343, 262, 94, 101, 128, 348, 349,
101, 263, 128, 5, 183, 225, 308, 384, 391, 343, 5, 225, 183, 308, 343, 384, 391, 284, 78, 366,
284, 366, 343, 78, -1, -1, 366, -1, -1, -1, 343, -1, -1, -1, -1, -1, 366, -1, -1, -1,
-1, 371, -1, -1, 114, -1, -1, -1, -1, -1, -1, 371, -1, -1, 114, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 386, -1, -1, -1, -1, -1, -1, -1, -1, -1, 386, -1, -1, -1,
-1, 391, 3, 4, 5, 6, 7, 8, 9, 10, -1, 391, 3, 4, 5, 6, 7, 8, 9, 10,
...@@ -1441,10 +1441,10 @@ static const yytype_uint8 yystos[] = ...@@ -1441,10 +1441,10 @@ static const yytype_uint8 yystos[] =
78, 79, 80, 81, 82, 85, 86, 104, 115, 116, 78, 79, 80, 81, 82, 85, 86, 104, 115, 116,
117, 118, 130, 131, 132, 134, 135, 136, 137, 138, 117, 118, 130, 131, 132, 134, 135, 136, 137, 138,
139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148,
149, 150, 151, 152, 153, 154, 158, 182, 114, 186, 149, 150, 151, 152, 153, 154, 158, 181, 114, 186,
184, 113, 105, 111, 14, 15, 16, 18, 19, 20, 184, 113, 105, 111, 14, 15, 16, 18, 19, 20,
21, 22, 23, 24, 56, 108, 109, 114, 141, 154, 21, 22, 23, 24, 56, 108, 109, 114, 141, 154,
155, 157, 160, 161, 182, 191, 192, 193, 194, 202, 155, 157, 160, 161, 181, 191, 192, 193, 194, 202,
203, 204, 206, 208, 210, 217, 129, 165, 168, 106, 203, 204, 206, 208, 210, 217, 129, 165, 168, 106,
113, 107, 158, 155, 190, 176, 129, 188, 189, 109, 113, 107, 158, 155, 190, 176, 129, 188, 189, 109,
187, 141, 141, 157, 85, 86, 106, 110, 105, 105, 187, 141, 141, 157, 85, 86, 106, 110, 105, 105,
...@@ -2547,6 +2547,9 @@ yyreduce: ...@@ -2547,6 +2547,9 @@ yyreduce:
case 28: case 28:
{ {
if ((yyvsp[0].interm.type).array) {
ES3_ONLY("[]", (yylsp[0]), "array constructor");
}
(yyval.interm.function) = context->addConstructorFunc((yyvsp[0].interm.type)); (yyval.interm.function) = context->addConstructorFunc((yyvsp[0].interm.type));
} }
...@@ -3484,9 +3487,10 @@ yyreduce: ...@@ -3484,9 +3487,10 @@ yyreduce:
(yyval.interm.type) = (yyvsp[0].interm.type); (yyval.interm.type) = (yyvsp[0].interm.type);
if ((yyvsp[0].interm.type).array) { if ((yyvsp[0].interm.type).array) {
context->error((yylsp[0]), "not supported", "first-class array"); ES3_ONLY("[]", (yylsp[0]), "first-class-array");
context->recover(); if (context->shaderVersion != 300) {
(yyvsp[0].interm.type).setArray(false); (yyvsp[0].interm.type).setArray(false);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment