Commit 12bea0a9 by Jamie Madill

Stop shader local variables from using invalid qualifiers.

Local variables in GLSL can't use any other storage qualifier than 'const', but we weren't checking properly. For example, the can't have 'in' or 'out' storage. This was causing a dEQP conformance test failure. BUG=angle:593 Change-Id: Ibb333950f2d0990a47d1a96caecc455497d5e57e Reviewed-on: https://chromium-review.googlesource.com/191460Reviewed-by: 's avatarNicolas Capens <nicolascapens@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 9f45240c
......@@ -5,3 +5,4 @@
*.bat eol=crlf
*.rc eol=crlf
**/compiled/*.h eol=crlf
*.sh eol=lf
......@@ -1176,7 +1176,12 @@ type_qualifier
$$.setBasic(EbtVoid, EvqInvariantVaryingIn, @1);
}
| storage_qualifier {
$$.setBasic(EbtVoid, $1.qualifier, @1);
if ($1.qualifier != EvqConst && !context->symbolTable.atGlobalLevel()) {
context->error(@1, "Local variables can only use the const storage qualifier.", getQualifierString($1.qualifier));
context->recover();
} else {
$$.setBasic(EbtVoid, $1.qualifier, @1);
}
}
| interpolation_qualifier storage_qualifier {
$$ = context->joinInterpolationQualifiers(@1, $1.qualifier, @2, $2.qualifier);
......
......@@ -805,21 +805,21 @@ static const yytype_uint16 yyrline[] =
845, 852, 907, 910, 917, 925, 946, 967, 977, 1005,
1010, 1020, 1025, 1035, 1038, 1041, 1044, 1050, 1057, 1060,
1064, 1068, 1072, 1079, 1083, 1087, 1094, 1098, 1102, 1123,
1132, 1138, 1141, 1147, 1153, 1160, 1169, 1178, 1181, 1184,
1191, 1195, 1202, 1205, 1209, 1213, 1222, 1231, 1239, 1249,
1256, 1259, 1262, 1268, 1275, 1278, 1284, 1287, 1290, 1296,
1299, 1314, 1318, 1322, 1326, 1330, 1334, 1339, 1344, 1349,
1354, 1359, 1364, 1369, 1374, 1379, 1384, 1389, 1394, 1399,
1404, 1409, 1414, 1419, 1424, 1429, 1434, 1439, 1443, 1447,
1451, 1455, 1459, 1463, 1467, 1471, 1475, 1479, 1483, 1487,
1491, 1495, 1499, 1507, 1515, 1519, 1532, 1532, 1535, 1535,
1541, 1544, 1560, 1563, 1572, 1576, 1582, 1589, 1604, 1608,
1612, 1613, 1619, 1620, 1621, 1622, 1623, 1627, 1628, 1628,
1628, 1638, 1639, 1643, 1643, 1644, 1644, 1649, 1652, 1662,
1665, 1671, 1672, 1676, 1684, 1688, 1698, 1703, 1720, 1720,
1725, 1725, 1732, 1732, 1740, 1743, 1749, 1752, 1758, 1762,
1769, 1776, 1783, 1790, 1801, 1810, 1814, 1821, 1824, 1830,
1830
1132, 1138, 1141, 1147, 1153, 1160, 1169, 1178, 1186, 1189,
1196, 1200, 1207, 1210, 1214, 1218, 1227, 1236, 1244, 1254,
1261, 1264, 1267, 1273, 1280, 1283, 1289, 1292, 1295, 1301,
1304, 1319, 1323, 1327, 1331, 1335, 1339, 1344, 1349, 1354,
1359, 1364, 1369, 1374, 1379, 1384, 1389, 1394, 1399, 1404,
1409, 1414, 1419, 1424, 1429, 1434, 1439, 1444, 1448, 1452,
1456, 1460, 1464, 1468, 1472, 1476, 1480, 1484, 1488, 1492,
1496, 1500, 1504, 1512, 1520, 1524, 1537, 1537, 1540, 1540,
1546, 1549, 1565, 1568, 1577, 1581, 1587, 1594, 1609, 1613,
1617, 1618, 1624, 1625, 1626, 1627, 1628, 1632, 1633, 1633,
1633, 1643, 1644, 1648, 1648, 1649, 1649, 1654, 1657, 1667,
1670, 1676, 1677, 1681, 1689, 1693, 1703, 1708, 1725, 1725,
1730, 1730, 1737, 1737, 1745, 1748, 1754, 1757, 1763, 1767,
1774, 1781, 1788, 1795, 1806, 1815, 1819, 1826, 1829, 1835,
1835
};
#endif
......@@ -3817,7 +3817,12 @@ yyreduce:
case 117:
{
(yyval.interm.type).setBasic(EbtVoid, (yyvsp[(1) - (1)].interm.type).qualifier, (yylsp[(1) - (1)]));
if ((yyvsp[(1) - (1)].interm.type).qualifier != EvqConst && !context->symbolTable.atGlobalLevel()) {
context->error((yylsp[(1) - (1)]), "Local variables can only use the const storage qualifier.", getQualifierString((yyvsp[(1) - (1)].interm.type).qualifier));
context->recover();
} else {
(yyval.interm.type).setBasic(EbtVoid, (yyvsp[(1) - (1)].interm.type).qualifier, (yylsp[(1) - (1)]));
}
}
break;
......
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