Removed code for unsupported pack-unpack language.

Review URL: https://codereview.appspot.com/9685045 Conflicts: src/compiler/glslang_tab.cpp git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@2258 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 1714ed34
......@@ -90,10 +90,6 @@ enum TQualifier
EvqInvariantVaryingOut, // vertex shaders only read/write
EvqUniform, // Readonly, vertex and fragment
// pack/unpack input and output
EvqInput,
EvqOutput,
// parameters
EvqIn,
EvqOut,
......@@ -137,8 +133,6 @@ inline const char* getQualifierString(TQualifier q)
case EvqIn: return "in"; break;
case EvqOut: return "out"; break;
case EvqInOut: return "inout"; break;
case EvqInput: return "input"; break;
case EvqOutput: return "output"; break;
case EvqPosition: return "Position"; break;
case EvqPointSize: return "PointSize"; break;
case EvqFragCoord: return "FragCoord"; break;
......
......@@ -319,7 +319,6 @@ bool TParseContext::lValueErrorCheck(const TSourceLoc& line, const char* op, TIn
case EvqAttribute: message = "can't modify an attribute"; break;
case EvqUniform: message = "can't modify a uniform"; break;
case EvqVaryingIn: message = "can't modify a varying"; break;
case EvqInput: message = "can't modify an input"; break;
case EvqFragCoord: message = "can't modify gl_FragCoord"; break;
case EvqFrontFacing: message = "can't modify gl_FrontFacing"; break;
case EvqPointCoord: message = "can't modify gl_PointCoord"; break;
......
......@@ -103,14 +103,6 @@ static void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason)
} \
} while (0)
#define FRAG_VERT_ONLY(S, L) { \
if (context->shaderType != SH_FRAGMENT_SHADER && \
context->shaderType != SH_VERTEX_SHADER) { \
context->error(L, " supported in vertex/fragment shaders only ", S); \
context->recover(); \
} \
}
#define VERTEX_ONLY(S, L) { \
if (context->shaderType != SH_VERTEX_SHADER) { \
context->error(L, " supported in vertex shaders only ", S); \
......@@ -647,33 +639,33 @@ function_identifier
case EbtFloat:
if ($1.matrix) {
switch($1.size) {
case 2: op = EOpConstructMat2; break;
case 3: op = EOpConstructMat3; break;
case 4: op = EOpConstructMat4; break;
case 2: op = EOpConstructMat2; break;
case 3: op = EOpConstructMat3; break;
case 4: op = EOpConstructMat4; break;
}
} else {
switch($1.size) {
case 1: op = EOpConstructFloat; break;
case 2: op = EOpConstructVec2; break;
case 3: op = EOpConstructVec3; break;
case 4: op = EOpConstructVec4; break;
case 1: op = EOpConstructFloat; break;
case 2: op = EOpConstructVec2; break;
case 3: op = EOpConstructVec3; break;
case 4: op = EOpConstructVec4; break;
}
}
break;
case EbtInt:
switch($1.size) {
case 1: op = EOpConstructInt; break;
case 2: FRAG_VERT_ONLY("ivec2", @1); op = EOpConstructIVec2; break;
case 3: FRAG_VERT_ONLY("ivec3", @1); op = EOpConstructIVec3; break;
case 4: FRAG_VERT_ONLY("ivec4", @1); op = EOpConstructIVec4; break;
case 1: op = EOpConstructInt; break;
case 2: op = EOpConstructIVec2; break;
case 3: op = EOpConstructIVec3; break;
case 4: op = EOpConstructIVec4; break;
}
break;
case EbtBool:
switch($1.size) {
case 1: op = EOpConstructBool; break;
case 2: FRAG_VERT_ONLY("bvec2", @1); op = EOpConstructBVec2; break;
case 3: FRAG_VERT_ONLY("bvec3", @1); op = EOpConstructBVec3; break;
case 4: FRAG_VERT_ONLY("bvec4", @1); op = EOpConstructBVec4; break;
case 1: op = EOpConstructBool; break;
case 2: op = EOpConstructBVec2; break;
case 3: op = EOpConstructBVec3; break;
case 4: op = EOpConstructBVec4; break;
}
break;
default: break;
......@@ -753,7 +745,6 @@ unary_operator
multiplicative_expression
: unary_expression { $$ = $1; }
| multiplicative_expression STAR unary_expression {
FRAG_VERT_ONLY("*", @2);
$$ = context->intermediate.addBinaryMath(EOpMul, $1, $3, @2, context->symbolTable);
if ($$ == 0) {
context->binaryOpError(@2, "*", $1->getCompleteString(), $3->getCompleteString());
......@@ -762,7 +753,6 @@ multiplicative_expression
}
}
| multiplicative_expression SLASH unary_expression {
FRAG_VERT_ONLY("/", @2);
$$ = context->intermediate.addBinaryMath(EOpDiv, $1, $3, @2, context->symbolTable);
if ($$ == 0) {
context->binaryOpError(@2, "/", $1->getCompleteString(), $3->getCompleteString());
......@@ -951,11 +941,11 @@ assignment_expression
;
assignment_operator
: EQUAL { $$.op = EOpAssign; }
| MUL_ASSIGN { FRAG_VERT_ONLY("*=", @1); $$.op = EOpMulAssign; }
| DIV_ASSIGN { FRAG_VERT_ONLY("/=", @1); $$.op = EOpDivAssign; }
| ADD_ASSIGN { $$.op = EOpAddAssign; }
| SUB_ASSIGN { $$.op = EOpSubAssign; }
: EQUAL { $$.op = EOpAssign; }
| MUL_ASSIGN { $$.op = EOpMulAssign; }
| DIV_ASSIGN { $$.op = EOpDivAssign; }
| ADD_ASSIGN { $$.op = EOpAddAssign; }
| SUB_ASSIGN { $$.op = EOpSubAssign; }
;
expression
......@@ -1404,76 +1394,8 @@ single_declaration
$$.intermAggregate = context->intermediate.makeAggregate(symbol, @2);
}
}
//
// Place holder for the pack/unpack languages.
//
// | buffer_specifier {
// $$.intermAggregate = 0;
// }
;
// Grammar Note: No 'enum', or 'typedef'.
//
// Place holder for the pack/unpack languages.
//
//%type <interm> buffer_declaration
//%type <interm.type> buffer_specifier input_or_output buffer_declaration_list
//buffer_specifier
// : input_or_output LEFT_BRACE buffer_declaration_list RIGHT_BRACE {
// }
// ;
//
//input_or_output
// : INPUT {
// if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "input"))
// context->recover();
// UNPACK_ONLY("input", @1);
// $$.qualifier = EvqInput;
// }
// | OUTPUT {
// if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "output"))
// context->recover();
// PACK_ONLY("output", @1);
// $$.qualifier = EvqOutput;
// }
// ;
//
// Place holder for the pack/unpack languages.
//
//buffer_declaration_list
// : buffer_declaration {
// }
// | buffer_declaration_list buffer_declaration {
// }
// ;
//
// Input/output semantics:
// float must be 16 or 32 bits
// float alignment restrictions?
// check for only one input and only one output
// sum of bitfields has to be multiple of 32
//
//
// Place holder for the pack/unpack languages.
//
//buffer_declaration
// : type_specifier IDENTIFIER COLON constant_expression SEMICOLON {
// if (context->reservedErrorCheck(@2, *$2.string, context))
// context->recover();
// $$.variable = new TVariable($2.string, $1);
// if (! context->symbolTable.insert(*$$.variable)) {
// context->error(@2, "redefinition", $$.variable->getName().c_str());
// context->recover();
// // don't have to delete $$.variable, the pool pop will take care of it
// }
// }
// ;
fully_specified_type
: type_specifier {
$$ = $1;
......@@ -1603,11 +1525,6 @@ type_specifier_nonarray
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
$$.setBasic(EbtBool, qual, @1);
}
// | UNSIGNED INT_TYPE {
// PACK_UNPACK_ONLY("unsigned", @1);
// TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
// $$.setBasic(EbtInt, qual, @1);
// }
| VEC2 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
$$.setBasic(EbtFloat, qual, @1);
......@@ -1654,30 +1571,25 @@ type_specifier_nonarray
$$.setAggregate(4);
}
| MATRIX2 {
FRAG_VERT_ONLY("mat2", @1);
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
$$.setBasic(EbtFloat, qual, @1);
$$.setAggregate(2, true);
}
| MATRIX3 {
FRAG_VERT_ONLY("mat3", @1);
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
$$.setBasic(EbtFloat, qual, @1);
$$.setAggregate(3, true);
}
| MATRIX4 {
FRAG_VERT_ONLY("mat4", @1);
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
$$.setBasic(EbtFloat, qual, @1);
$$.setAggregate(4, true);
}
| SAMPLER2D {
FRAG_VERT_ONLY("sampler2D", @1);
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
$$.setBasic(EbtSampler2D, qual, @1);
}
| SAMPLERCUBE {
FRAG_VERT_ONLY("samplerCube", @1);
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
$$.setBasic(EbtSamplerCube, qual, @1);
}
......@@ -1686,7 +1598,6 @@ type_specifier_nonarray
context->error(@1, "unsupported type", "samplerExternalOES");
context->recover();
}
FRAG_VERT_ONLY("samplerExternalOES", @1);
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
$$.setBasic(EbtSamplerExternalOES, qual, @1);
}
......@@ -1695,12 +1606,10 @@ type_specifier_nonarray
context->error(@1, "unsupported type", "sampler2DRect");
context->recover();
}
FRAG_VERT_ONLY("sampler2DRect", @1);
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
$$.setBasic(EbtSampler2DRect, qual, @1);
}
| struct_specifier {
FRAG_VERT_ONLY("struct", @1);
$$ = $1;
$$.qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
}
......
......@@ -325,14 +325,6 @@ static void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason)
} \
} while (0)
#define FRAG_VERT_ONLY(S, L) { \
if (context->shaderType != SH_FRAGMENT_SHADER && \
context->shaderType != SH_VERTEX_SHADER) { \
context->error(L, " supported in vertex/fragment shaders only ", S); \
context->recover(); \
} \
}
#define VERTEX_ONLY(S, L) { \
if (context->shaderType != SH_VERTEX_SHADER) { \
context->error(L, " supported in vertex shaders only ", S); \
......@@ -721,27 +713,27 @@ static const yytype_int16 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 187, 187, 188, 191, 227, 230, 243, 248, 253,
259, 262, 349, 352, 453, 463, 476, 484, 584, 587,
595, 598, 604, 608, 615, 621, 630, 638, 693, 703,
706, 716, 726, 747, 748, 749, 754, 755, 764, 776,
777, 785, 796, 800, 801, 811, 821, 831, 844, 845,
855, 868, 872, 876, 880, 881, 894, 895, 908, 909,
922, 923, 940, 941, 954, 955, 956, 957, 958, 962,
965, 976, 984, 1011, 1016, 1030, 1067, 1070, 1077, 1085,
1106, 1127, 1137, 1165, 1170, 1180, 1185, 1195, 1198, 1201,
1204, 1210, 1217, 1220, 1242, 1260, 1284, 1307, 1311, 1329,
1337, 1369, 1389, 1478, 1487, 1510, 1513, 1519, 1527, 1535,
1543, 1553, 1560, 1563, 1566, 1572, 1575, 1590, 1594, 1598,
1602, 1611, 1616, 1621, 1626, 1631, 1636, 1641, 1646, 1651,
1656, 1662, 1668, 1674, 1679, 1684, 1693, 1702, 1707, 1720,
1720, 1734, 1734, 1743, 1746, 1762, 1798, 1802, 1808, 1815,
1830, 1834, 1838, 1839, 1845, 1846, 1847, 1848, 1849, 1853,
1854, 1854, 1854, 1864, 1865, 1869, 1869, 1870, 1870, 1875,
1878, 1888, 1891, 1897, 1898, 1902, 1910, 1914, 1924, 1929,
1946, 1946, 1951, 1951, 1958, 1958, 1966, 1969, 1975, 1978,
1984, 1988, 1995, 2002, 2009, 2016, 2027, 2036, 2040, 2047,
2050, 2056, 2056
0, 179, 179, 180, 183, 219, 222, 235, 240, 245,
251, 254, 341, 344, 445, 455, 468, 476, 576, 579,
587, 590, 596, 600, 607, 613, 622, 630, 685, 695,
698, 708, 718, 739, 740, 741, 746, 747, 755, 766,
767, 775, 786, 790, 791, 801, 811, 821, 834, 835,
845, 858, 862, 866, 870, 871, 884, 885, 898, 899,
912, 913, 930, 931, 944, 945, 946, 947, 948, 952,
955, 966, 974, 1001, 1006, 1020, 1057, 1060, 1067, 1075,
1096, 1117, 1127, 1155, 1160, 1170, 1175, 1185, 1188, 1191,
1194, 1200, 1207, 1210, 1232, 1250, 1274, 1297, 1301, 1319,
1327, 1359, 1379, 1400, 1409, 1432, 1435, 1441, 1449, 1457,
1465, 1475, 1482, 1485, 1488, 1494, 1497, 1512, 1516, 1520,
1524, 1528, 1533, 1538, 1543, 1548, 1553, 1558, 1563, 1568,
1573, 1578, 1583, 1588, 1592, 1596, 1604, 1612, 1616, 1629,
1629, 1643, 1643, 1652, 1655, 1671, 1707, 1711, 1717, 1724,
1739, 1743, 1747, 1748, 1754, 1755, 1756, 1757, 1758, 1762,
1763, 1763, 1763, 1773, 1774, 1778, 1778, 1779, 1779, 1784,
1787, 1797, 1800, 1806, 1807, 1811, 1819, 1823, 1833, 1838,
1855, 1855, 1860, 1860, 1867, 1867, 1875, 1878, 1884, 1887,
1893, 1897, 1904, 1911, 1918, 1925, 1936, 1945, 1949, 1956,
1959, 1965, 1965
};
#endif
......@@ -2772,33 +2764,33 @@ yyreduce:
case EbtFloat:
if ((yyvsp[(1) - (1)].interm.type).matrix) {
switch((yyvsp[(1) - (1)].interm.type).size) {
case 2: op = EOpConstructMat2; break;
case 3: op = EOpConstructMat3; break;
case 4: op = EOpConstructMat4; break;
case 2: op = EOpConstructMat2; break;
case 3: op = EOpConstructMat3; break;
case 4: op = EOpConstructMat4; break;
}
} else {
switch((yyvsp[(1) - (1)].interm.type).size) {
case 1: op = EOpConstructFloat; break;
case 2: op = EOpConstructVec2; break;
case 3: op = EOpConstructVec3; break;
case 4: op = EOpConstructVec4; break;
case 1: op = EOpConstructFloat; break;
case 2: op = EOpConstructVec2; break;
case 3: op = EOpConstructVec3; break;
case 4: op = EOpConstructVec4; break;
}
}
break;
case EbtInt:
switch((yyvsp[(1) - (1)].interm.type).size) {
case 1: op = EOpConstructInt; break;
case 2: FRAG_VERT_ONLY("ivec2", (yylsp[(1) - (1)])); op = EOpConstructIVec2; break;
case 3: FRAG_VERT_ONLY("ivec3", (yylsp[(1) - (1)])); op = EOpConstructIVec3; break;
case 4: FRAG_VERT_ONLY("ivec4", (yylsp[(1) - (1)])); op = EOpConstructIVec4; break;
case 1: op = EOpConstructInt; break;
case 2: op = EOpConstructIVec2; break;
case 3: op = EOpConstructIVec3; break;
case 4: op = EOpConstructIVec4; break;
}
break;
case EbtBool:
switch((yyvsp[(1) - (1)].interm.type).size) {
case 1: op = EOpConstructBool; break;
case 2: FRAG_VERT_ONLY("bvec2", (yylsp[(1) - (1)])); op = EOpConstructBVec2; break;
case 3: FRAG_VERT_ONLY("bvec3", (yylsp[(1) - (1)])); op = EOpConstructBVec3; break;
case 4: FRAG_VERT_ONLY("bvec4", (yylsp[(1) - (1)])); op = EOpConstructBVec4; break;
case 1: op = EOpConstructBool; break;
case 2: op = EOpConstructBVec2; break;
case 3: op = EOpConstructBVec3; break;
case 4: op = EOpConstructBVec4; break;
}
break;
default: break;
......@@ -2907,7 +2899,6 @@ yyreduce:
case 37:
{
FRAG_VERT_ONLY("*", (yylsp[(2) - (3)]));
(yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
if ((yyval.interm.intermTypedNode) == 0) {
context->binaryOpError((yylsp[(2) - (3)]), "*", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
......@@ -2920,7 +2911,6 @@ yyreduce:
case 38:
{
FRAG_VERT_ONLY("/", (yylsp[(2) - (3)]));
(yyval.interm.intermTypedNode) = context->intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), context->symbolTable);
if ((yyval.interm.intermTypedNode) == 0) {
context->binaryOpError((yylsp[(2) - (3)]), "/", (yyvsp[(1) - (3)].interm.intermTypedNode)->getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)->getCompleteString());
......@@ -3174,27 +3164,27 @@ yyreduce:
case 64:
{ (yyval.interm).op = EOpAssign; }
{ (yyval.interm).op = EOpAssign; }
break;
case 65:
{ FRAG_VERT_ONLY("*=", (yylsp[(1) - (1)])); (yyval.interm).op = EOpMulAssign; }
{ (yyval.interm).op = EOpMulAssign; }
break;
case 66:
{ FRAG_VERT_ONLY("/=", (yylsp[(1) - (1)])); (yyval.interm).op = EOpDivAssign; }
{ (yyval.interm).op = EOpDivAssign; }
break;
case 67:
{ (yyval.interm).op = EOpAddAssign; }
{ (yyval.interm).op = EOpAddAssign; }
break;
case 68:
{ (yyval.interm).op = EOpSubAssign; }
{ (yyval.interm).op = EOpSubAssign; }
break;
case 69:
......@@ -3998,7 +3988,6 @@ yyreduce:
case 130:
{
FRAG_VERT_ONLY("mat2", (yylsp[(1) - (1)]));
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
(yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setAggregate(2, true);
......@@ -4008,7 +3997,6 @@ yyreduce:
case 131:
{
FRAG_VERT_ONLY("mat3", (yylsp[(1) - (1)]));
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
(yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setAggregate(3, true);
......@@ -4018,7 +4006,6 @@ yyreduce:
case 132:
{
FRAG_VERT_ONLY("mat4", (yylsp[(1) - (1)]));
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
(yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
(yyval.interm.type).setAggregate(4, true);
......@@ -4028,7 +4015,6 @@ yyreduce:
case 133:
{
FRAG_VERT_ONLY("sampler2D", (yylsp[(1) - (1)]));
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
(yyval.interm.type).setBasic(EbtSampler2D, qual, (yylsp[(1) - (1)]));
}
......@@ -4037,7 +4023,6 @@ yyreduce:
case 134:
{
FRAG_VERT_ONLY("samplerCube", (yylsp[(1) - (1)]));
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
(yyval.interm.type).setBasic(EbtSamplerCube, qual, (yylsp[(1) - (1)]));
}
......@@ -4050,7 +4035,6 @@ yyreduce:
context->error((yylsp[(1) - (1)]), "unsupported type", "samplerExternalOES");
context->recover();
}
FRAG_VERT_ONLY("samplerExternalOES", (yylsp[(1) - (1)]));
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
(yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yylsp[(1) - (1)]));
}
......@@ -4063,7 +4047,6 @@ yyreduce:
context->error((yylsp[(1) - (1)]), "unsupported type", "sampler2DRect");
context->recover();
}
FRAG_VERT_ONLY("sampler2DRect", (yylsp[(1) - (1)]));
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
(yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yylsp[(1) - (1)]));
}
......@@ -4072,7 +4055,6 @@ yyreduce:
case 137:
{
FRAG_VERT_ONLY("struct", (yylsp[(1) - (1)]));
(yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
(yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
}
......
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