Commit 54b721dd by Nicolas Capens Committed by Nicolas Capens

Fix allowing fragment shader invariant declarations.

Bug 18732025 Change-Id: I8a3024327533c3e6db72248caafc5e618808edf5 Reviewed-on: https://swiftshader-review.googlesource.com/1630Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent ada3e7a3
......@@ -154,13 +154,16 @@ namespace sh
void OutputASM::visitSymbol(TIntermSymbol *symbol)
{
if(symbol->getQualifier() == EvqVaryingOut || symbol->getQualifier() == EvqInvariantVaryingOut)
{
// Vertex varyings don't have to be actively used to successfully link
// against pixel shaders that use them. So make sure they're declared.
if(symbol->getQualifier() == EvqVaryingOut || symbol->getQualifier() == EvqInvariantVaryingOut)
{
if(symbol->getBasicType() != EbtInvariant) // Typeless declarations are not new varyings
{
declareVarying(symbol, -1);
}
}
}
bool OutputASM::visitBinary(Visit visit, TIntermBinary *node)
{
......
......@@ -1363,7 +1363,6 @@ single_declaration
}
}
| INVARIANT IDENTIFIER {
VERTEX_ONLY("invariant declaration", $1.line);
if (context->globalErrorCheck($1.line, context->symbolTable.atGlobalLevel(), "invariant varying"))
context->recover();
$$.type.setBasic(EbtInvariant, EvqInvariantVaryingOut, $2.line);
......
......@@ -669,17 +669,17 @@ static const yytype_uint16 yyrline[] =
953, 961, 988, 993, 1003, 1041, 1044, 1051, 1059, 1080,
1101, 1112, 1141, 1146, 1156, 1161, 1171, 1174, 1177, 1180,
1186, 1193, 1196, 1218, 1236, 1260, 1283, 1287, 1305, 1313,
1345, 1365, 1454, 1463, 1486, 1489, 1495, 1503, 1511, 1519,
1529, 1536, 1539, 1542, 1548, 1551, 1566, 1570, 1574, 1578,
1587, 1592, 1597, 1602, 1607, 1612, 1617, 1622, 1627, 1632,
1638, 1644, 1650, 1655, 1660, 1669, 1674, 1687, 1687, 1701,
1701, 1710, 1713, 1728, 1764, 1768, 1774, 1782, 1798, 1802,
1806, 1807, 1813, 1814, 1815, 1816, 1817, 1821, 1822, 1822,
1822, 1832, 1833, 1837, 1837, 1838, 1838, 1843, 1846, 1856,
1859, 1865, 1866, 1870, 1878, 1882, 1892, 1897, 1914, 1914,
1919, 1919, 1926, 1926, 1934, 1937, 1943, 1946, 1952, 1956,
1963, 1970, 1977, 1984, 1995, 2004, 2008, 2015, 2018, 2024,
2024
1345, 1365, 1453, 1462, 1485, 1488, 1494, 1502, 1510, 1518,
1528, 1535, 1538, 1541, 1547, 1550, 1565, 1569, 1573, 1577,
1586, 1591, 1596, 1601, 1606, 1611, 1616, 1621, 1626, 1631,
1637, 1643, 1649, 1654, 1659, 1668, 1673, 1686, 1686, 1700,
1700, 1709, 1712, 1727, 1763, 1767, 1773, 1781, 1797, 1801,
1805, 1806, 1812, 1813, 1814, 1815, 1816, 1820, 1821, 1821,
1821, 1831, 1832, 1836, 1836, 1837, 1837, 1842, 1845, 1855,
1858, 1864, 1865, 1869, 1877, 1881, 1891, 1896, 1913, 1913,
1918, 1918, 1925, 1925, 1933, 1936, 1942, 1945, 1951, 1955,
1962, 1969, 1976, 1983, 1994, 2003, 2007, 2014, 2017, 2023,
2023
};
#endif
......@@ -3517,7 +3517,6 @@ yyreduce:
case 101:
{
VERTEX_ONLY("invariant declaration", (yyvsp[(1) - (2)].lex).line);
if (context->globalErrorCheck((yyvsp[(1) - (2)].lex).line, context->symbolTable.atGlobalLevel(), "invariant varying"))
context->recover();
(yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yyvsp[(2) - (2)].lex).line);
......
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