diff options
Diffstat (limited to 'src/mesa/shader')
-rw-r--r-- | src/mesa/shader/nvprogram.c | 72 | ||||
-rw-r--r-- | src/mesa/shader/nvprogram.h | 6 | ||||
-rw-r--r-- | src/mesa/shader/nvvertparse.c | 27 | ||||
-rw-r--r-- | src/mesa/shader/prog_execute.c | 7 | ||||
-rw-r--r-- | src/mesa/shader/prog_instruction.h | 1 | ||||
-rw-r--r-- | src/mesa/shader/prog_parameter.c | 1 | ||||
-rw-r--r-- | src/mesa/shader/program.c | 8 | ||||
-rw-r--r-- | src/mesa/shader/program_parse.tab.c | 410 | ||||
-rw-r--r-- | src/mesa/shader/program_parse.y | 12 | ||||
-rw-r--r-- | src/mesa/shader/shader_api.c | 15 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_builtin.c | 4 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_codegen.c | 2 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_link.c | 28 |
13 files changed, 369 insertions, 224 deletions
diff --git a/src/mesa/shader/nvprogram.c b/src/mesa/shader/nvprogram.c index d6469b17be..471a7358a2 100644 --- a/src/mesa/shader/nvprogram.c +++ b/src/mesa/shader/nvprogram.c @@ -509,7 +509,79 @@ _mesa_GetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid **pointer) *pointer = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[index].Ptr; } +void +_mesa_emit_nv_temp_initialization(GLcontext *ctx, + struct gl_program *program) +{ + struct prog_instruction *inst; + int i; + + if (!ctx->Shader.EmitNVTempInitialization) + return; + + /* We'll swizzle up a zero temporary so we can use it for the + * ARL. + */ + if (program->NumTemporaries == 0) + program->NumTemporaries = 1; + + _mesa_insert_instructions(program, 0, program->NumTemporaries + 1); + + for (i = 0; i < program->NumTemporaries; i++) { + struct prog_instruction *inst = &program->Instructions[i]; + + inst->Opcode = OPCODE_SWZ; + inst->DstReg.File = PROGRAM_TEMPORARY; + inst->DstReg.Index = i; + inst->DstReg.WriteMask = WRITEMASK_XYZW; + inst->SrcReg[0].File = PROGRAM_TEMPORARY; + inst->SrcReg[0].Index = 0; + inst->SrcReg[0].Swizzle = MAKE_SWIZZLE4(SWIZZLE_ZERO, + SWIZZLE_ZERO, + SWIZZLE_ZERO, + SWIZZLE_ZERO); + } + + inst = &program->Instructions[i]; + inst->Opcode = OPCODE_ARL; + inst->DstReg.File = PROGRAM_ADDRESS; + inst->DstReg.Index = 0; + inst->DstReg.WriteMask = WRITEMASK_XYZW; + inst->SrcReg[0].File = PROGRAM_TEMPORARY; + inst->SrcReg[0].Index = 0; + inst->SrcReg[0].Swizzle = SWIZZLE_XXXX; + + if (program->NumAddressRegs == 0) + program->NumAddressRegs = 1; +} + +void +_mesa_setup_nv_temporary_count(GLcontext *ctx, struct gl_program *program) +{ + int i; + program->NumTemporaries = 0; + for (i = 0; i < program->NumInstructions; i++) { + struct prog_instruction *inst = &program->Instructions[i]; + + if (inst->DstReg.File == PROGRAM_TEMPORARY) { + program->NumTemporaries = MAX2(program->NumTemporaries, + inst->DstReg.Index + 1); + } + if (inst->SrcReg[0].File == PROGRAM_TEMPORARY) { + program->NumTemporaries = MAX2(program->NumTemporaries, + inst->SrcReg[0].Index + 1); + } + if (inst->SrcReg[1].File == PROGRAM_TEMPORARY) { + program->NumTemporaries = MAX2(program->NumTemporaries, + inst->SrcReg[1].Index + 1); + } + if (inst->SrcReg[2].File == PROGRAM_TEMPORARY) { + program->NumTemporaries = MAX2(program->NumTemporaries, + inst->SrcReg[2].Index + 1); + } + } +} /** * Load/parse/compile a program. diff --git a/src/mesa/shader/nvprogram.h b/src/mesa/shader/nvprogram.h index bfac165b5e..8ee59661bd 100644 --- a/src/mesa/shader/nvprogram.h +++ b/src/mesa/shader/nvprogram.h @@ -103,5 +103,11 @@ extern void GLAPIENTRY _mesa_GetProgramNamedParameterdvNV(GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); +extern void +_mesa_setup_nv_temporary_count(GLcontext *ctx, struct gl_program *program); + +extern void +_mesa_emit_nv_temp_initialization(GLcontext *ctx, + struct gl_program *program); #endif diff --git a/src/mesa/shader/nvvertparse.c b/src/mesa/shader/nvvertparse.c index f5e2df2670..8574016050 100644 --- a/src/mesa/shader/nvvertparse.c +++ b/src/mesa/shader/nvvertparse.c @@ -44,6 +44,7 @@ #include "nvprogram.h" #include "nvvertparse.h" #include "prog_instruction.h" +#include "prog_parameter.h" #include "prog_print.h" #include "program.h" @@ -1345,6 +1346,9 @@ _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget, if (Parse_Program(&parseState, instBuffer)) { + gl_state_index state_tokens[STATE_LENGTH] = {0, 0, 0, 0, 0}; + int i; + /* successful parse! */ if (parseState.isStateProgram) { @@ -1398,6 +1402,29 @@ _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget, _mesa_fprint_program_opt(stdout, &program->Base, PROG_PRINT_NV, 0); _mesa_printf("------------------------------\n"); #endif + + if (program->Base.Parameters) + _mesa_free_parameter_list(program->Base.Parameters); + + program->Base.Parameters = _mesa_new_parameter_list (); + program->Base.NumParameters = 0; + + state_tokens[0] = STATE_VERTEX_PROGRAM; + state_tokens[1] = STATE_ENV; + /* Add refs to all of the potential params, in order. If we want to not + * upload everything, _mesa_layout_parameters is the answer. + */ + for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS; i++) { + GLint index; + state_tokens[2] = i; + index = _mesa_add_state_reference(program->Base.Parameters, + state_tokens); + assert(index == i); + } + program->Base.NumParameters = program->Base.Parameters->NumParameters; + + _mesa_setup_nv_temporary_count(ctx, &program->Base); + _mesa_emit_nv_temp_initialization(ctx, &program->Base); } else { /* Error! */ diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c index c8a762f8ff..69b81e724a 100644 --- a/src/mesa/shader/prog_execute.c +++ b/src/mesa/shader/prog_execute.c @@ -1555,17 +1555,12 @@ _mesa_execute_program(GLcontext * ctx, case OPCODE_TXB: /* GL_ARB_fragment_program only */ /* Texel lookup with LOD bias */ { - const GLuint unit = machine->Samplers[inst->TexSrcUnit]; - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; GLfloat texcoord[4], color[4], lodBias; fetch_vector4(&inst->SrcReg[0], machine, texcoord); /* texcoord[3] is the bias to add to lambda */ - lodBias = texUnit->LodBias + texcoord[3]; - if (texUnit->_Current) { - lodBias += texUnit->_Current->LodBias; - } + lodBias = texcoord[3]; fetch_texel(ctx, machine, inst, texcoord, lodBias, color); diff --git a/src/mesa/shader/prog_instruction.h b/src/mesa/shader/prog_instruction.h index 39a221eeab..1c687bc16c 100644 --- a/src/mesa/shader/prog_instruction.h +++ b/src/mesa/shader/prog_instruction.h @@ -121,7 +121,6 @@ /*@{*/ #define SATURATE_OFF 0 #define SATURATE_ZERO_ONE 1 -#define SATURATE_PLUS_MINUS_ONE 2 /*@}*/ diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c index 6b9e73b2cb..2f029b02e5 100644 --- a/src/mesa/shader/prog_parameter.c +++ b/src/mesa/shader/prog_parameter.c @@ -100,6 +100,7 @@ _mesa_free_parameter_list(struct gl_program_parameter_list *paramList) * \param type type of parameter, such as * \param name the parameter name, will be duplicated/copied! * \param size number of elements in 'values' vector (1..4, or more) + * \param datatype GL_FLOAT, GL_FLOAT_VECx, GL_INT, GL_INT_VECx or GL_NONE. * \param values initial parameter value, up to 4 GLfloats, or NULL * \param state state indexes, or NULL * \return index of new parameter in the list, or -1 if error (out of mem) diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 963478fccd..532adf4d36 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -351,13 +351,6 @@ _mesa_delete_program(GLcontext *ctx, struct gl_program *prog) _mesa_free_parameter_list(prog->Attributes); } - /* XXX this is a little ugly */ - if (prog->Target == GL_VERTEX_PROGRAM_ARB) { - struct gl_vertex_program *vprog = (struct gl_vertex_program *) prog; - if (vprog->TnlData) - _mesa_free(vprog->TnlData); - } - _mesa_free(prog); } @@ -502,6 +495,7 @@ _mesa_clone_program(GLcontext *ctx, const struct gl_program *prog) = (const struct gl_vertex_program *) prog; struct gl_vertex_program *vpc = (struct gl_vertex_program *) clone; vpc->IsPositionInvariant = vp->IsPositionInvariant; + vpc->IsNVProgram = vp->IsNVProgram; } break; case GL_FRAGMENT_PROGRAM_ARB: diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c index c51b4d2f28..c0f50147bd 100644 --- a/src/mesa/shader/program_parse.tab.c +++ b/src/mesa/shader/program_parse.tab.c @@ -789,28 +789,28 @@ static const yytype_uint16 yyrline[] = 517, 518, 519, 520, 521, 522, 523, 526, 538, 546, 563, 570, 589, 600, 620, 645, 654, 687, 694, 709, 759, 801, 812, 833, 843, 849, 880, 897, 897, 899, - 906, 918, 919, 920, 923, 935, 947, 965, 976, 988, - 990, 991, 992, 993, 996, 996, 996, 996, 997, 1000, - 1004, 1009, 1016, 1023, 1030, 1053, 1076, 1077, 1078, 1079, - 1080, 1081, 1084, 1102, 1106, 1112, 1116, 1120, 1124, 1133, - 1142, 1146, 1151, 1157, 1168, 1168, 1169, 1171, 1175, 1179, - 1183, 1189, 1189, 1191, 1207, 1230, 1233, 1244, 1250, 1256, - 1257, 1264, 1270, 1276, 1284, 1290, 1296, 1304, 1310, 1316, - 1324, 1325, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, - 1336, 1337, 1338, 1341, 1350, 1354, 1358, 1364, 1373, 1377, - 1381, 1390, 1394, 1400, 1406, 1413, 1418, 1426, 1436, 1438, - 1446, 1452, 1456, 1460, 1466, 1477, 1486, 1490, 1495, 1499, - 1503, 1507, 1513, 1520, 1524, 1530, 1538, 1549, 1556, 1560, - 1566, 1576, 1587, 1591, 1609, 1618, 1621, 1627, 1631, 1635, - 1641, 1652, 1657, 1662, 1667, 1672, 1677, 1685, 1688, 1693, - 1706, 1714, 1725, 1733, 1733, 1735, 1735, 1737, 1747, 1752, - 1759, 1769, 1778, 1783, 1790, 1800, 1810, 1822, 1822, 1823, - 1823, 1825, 1835, 1843, 1853, 1861, 1869, 1878, 1889, 1893, - 1899, 1900, 1901, 1904, 1904, 1907, 1942, 1946, 1946, 1949, - 1955, 1963, 1976, 1985, 1994, 1998, 2007, 2016, 2027, 2034, - 2039, 2048, 2060, 2063, 2072, 2083, 2084, 2085, 2088, 2089, - 2090, 2093, 2094, 2097, 2098, 2101, 2102, 2105, 2116, 2127, - 2138, 2159, 2160 + 906, 918, 919, 920, 923, 937, 951, 969, 980, 992, + 994, 995, 996, 997, 1000, 1000, 1000, 1000, 1001, 1004, + 1008, 1013, 1020, 1027, 1034, 1057, 1080, 1081, 1082, 1083, + 1084, 1085, 1088, 1106, 1110, 1116, 1120, 1124, 1128, 1137, + 1146, 1150, 1155, 1161, 1172, 1172, 1173, 1175, 1179, 1183, + 1187, 1193, 1193, 1195, 1211, 1234, 1237, 1248, 1254, 1260, + 1261, 1268, 1274, 1280, 1288, 1294, 1300, 1308, 1314, 1320, + 1328, 1329, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, + 1340, 1341, 1342, 1345, 1354, 1358, 1362, 1368, 1377, 1381, + 1385, 1394, 1398, 1404, 1410, 1417, 1422, 1430, 1440, 1442, + 1450, 1456, 1460, 1464, 1470, 1481, 1490, 1494, 1499, 1503, + 1507, 1511, 1517, 1524, 1528, 1534, 1542, 1553, 1560, 1564, + 1570, 1580, 1591, 1595, 1613, 1622, 1625, 1631, 1635, 1639, + 1645, 1656, 1661, 1666, 1671, 1676, 1681, 1689, 1692, 1697, + 1710, 1718, 1729, 1737, 1737, 1739, 1739, 1741, 1751, 1756, + 1763, 1773, 1782, 1787, 1794, 1804, 1814, 1826, 1826, 1827, + 1827, 1829, 1839, 1847, 1857, 1865, 1873, 1882, 1893, 1897, + 1903, 1904, 1905, 1908, 1908, 1911, 1946, 1950, 1950, 1953, + 1959, 1967, 1980, 1989, 1998, 2002, 2011, 2020, 2031, 2038, + 2043, 2052, 2064, 2067, 2076, 2087, 2088, 2089, 2092, 2093, + 2094, 2097, 2098, 2101, 2102, 2105, 2106, 2109, 2120, 2131, + 2142, 2163, 2164 }; #endif @@ -2971,8 +2971,10 @@ yyreduce: #line 924 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 63)) { - yyerror(& (yylsp[(1) - (1)]), state, - "relative address offset too large (positive)"); + char s[100]; + _mesa_snprintf(s, sizeof(s), + "relative address offset too large (%d)", (yyvsp[(1) - (1)].integer)); + yyerror(& (yylsp[(1) - (1)]), state, s); YYERROR; } else { (yyval.integer) = (yyvsp[(1) - (1)].integer); @@ -2983,11 +2985,13 @@ yyreduce: case 75: /* Line 1455 of yacc.c */ -#line 936 "program_parse.y" +#line 938 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 64)) { - yyerror(& (yylsp[(1) - (1)]), state, - "relative address offset too large (negative)"); + char s[100]; + _mesa_snprintf(s, sizeof(s), + "relative address offset too large (%d)", (yyvsp[(1) - (1)].integer)); + yyerror(& (yylsp[(1) - (1)]), state, s); YYERROR; } else { (yyval.integer) = (yyvsp[(1) - (1)].integer); @@ -2998,7 +3002,7 @@ yyreduce: case 76: /* Line 1455 of yacc.c */ -#line 948 "program_parse.y" +#line 952 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -3019,7 +3023,7 @@ yyreduce: case 77: /* Line 1455 of yacc.c */ -#line 966 "program_parse.y" +#line 970 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, "invalid address component selector"); @@ -3033,7 +3037,7 @@ yyreduce: case 78: /* Line 1455 of yacc.c */ -#line 977 "program_parse.y" +#line 981 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, @@ -3048,21 +3052,21 @@ yyreduce: case 83: /* Line 1455 of yacc.c */ -#line 993 "program_parse.y" +#line 997 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; case 88: /* Line 1455 of yacc.c */ -#line 997 "program_parse.y" +#line 1001 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; case 89: /* Line 1455 of yacc.c */ -#line 1001 "program_parse.y" +#line 1005 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(2) - (3)].dst_reg); ;} @@ -3071,7 +3075,7 @@ yyreduce: case 90: /* Line 1455 of yacc.c */ -#line 1005 "program_parse.y" +#line 1009 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(2) - (3)].dst_reg); ;} @@ -3080,7 +3084,7 @@ yyreduce: case 91: /* Line 1455 of yacc.c */ -#line 1009 "program_parse.y" +#line 1013 "program_parse.y" { (yyval.dst_reg).CondMask = COND_TR; (yyval.dst_reg).CondSwizzle = SWIZZLE_NOOP; @@ -3091,7 +3095,7 @@ yyreduce: case 92: /* Line 1455 of yacc.c */ -#line 1017 "program_parse.y" +#line 1021 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg); (yyval.dst_reg).CondSwizzle = (yyvsp[(2) - (2)].swiz_mask).swizzle; @@ -3101,7 +3105,7 @@ yyreduce: case 93: /* Line 1455 of yacc.c */ -#line 1024 "program_parse.y" +#line 1028 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg); (yyval.dst_reg).CondSwizzle = (yyvsp[(2) - (2)].swiz_mask).swizzle; @@ -3111,7 +3115,7 @@ yyreduce: case 94: /* Line 1455 of yacc.c */ -#line 1031 "program_parse.y" +#line 1035 "program_parse.y" { const int cond = _mesa_parse_cc((yyvsp[(1) - (1)].string)); if ((cond == 0) || ((yyvsp[(1) - (1)].string)[2] != '\0')) { @@ -3137,7 +3141,7 @@ yyreduce: case 95: /* Line 1455 of yacc.c */ -#line 1054 "program_parse.y" +#line 1058 "program_parse.y" { const int cond = _mesa_parse_cc((yyvsp[(1) - (1)].string)); if ((cond == 0) || ((yyvsp[(1) - (1)].string)[2] != '\0')) { @@ -3163,7 +3167,7 @@ yyreduce: case 102: /* Line 1455 of yacc.c */ -#line 1085 "program_parse.y" +#line 1089 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (4)].string), at_attrib, & (yylsp[(2) - (4)])); @@ -3184,7 +3188,7 @@ yyreduce: case 103: /* Line 1455 of yacc.c */ -#line 1103 "program_parse.y" +#line 1107 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} @@ -3193,7 +3197,7 @@ yyreduce: case 104: /* Line 1455 of yacc.c */ -#line 1107 "program_parse.y" +#line 1111 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} @@ -3202,7 +3206,7 @@ yyreduce: case 105: /* Line 1455 of yacc.c */ -#line 1113 "program_parse.y" +#line 1117 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_POS; ;} @@ -3211,7 +3215,7 @@ yyreduce: case 106: /* Line 1455 of yacc.c */ -#line 1117 "program_parse.y" +#line 1121 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_WEIGHT; ;} @@ -3220,7 +3224,7 @@ yyreduce: case 107: /* Line 1455 of yacc.c */ -#line 1121 "program_parse.y" +#line 1125 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_NORMAL; ;} @@ -3229,7 +3233,7 @@ yyreduce: case 108: /* Line 1455 of yacc.c */ -#line 1125 "program_parse.y" +#line 1129 "program_parse.y" { if (!state->ctx->Extensions.EXT_secondary_color) { yyerror(& (yylsp[(2) - (2)]), state, "GL_EXT_secondary_color not supported"); @@ -3243,7 +3247,7 @@ yyreduce: case 109: /* Line 1455 of yacc.c */ -#line 1134 "program_parse.y" +#line 1138 "program_parse.y" { if (!state->ctx->Extensions.EXT_fog_coord) { yyerror(& (yylsp[(1) - (1)]), state, "GL_EXT_fog_coord not supported"); @@ -3257,7 +3261,7 @@ yyreduce: case 110: /* Line 1455 of yacc.c */ -#line 1143 "program_parse.y" +#line 1147 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} @@ -3266,7 +3270,7 @@ yyreduce: case 111: /* Line 1455 of yacc.c */ -#line 1147 "program_parse.y" +#line 1151 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; @@ -3276,7 +3280,7 @@ yyreduce: case 112: /* Line 1455 of yacc.c */ -#line 1152 "program_parse.y" +#line 1156 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_GENERIC0 + (yyvsp[(3) - (4)].integer); ;} @@ -3285,7 +3289,7 @@ yyreduce: case 113: /* Line 1455 of yacc.c */ -#line 1158 "program_parse.y" +#line 1162 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxAttribs) { yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex attribute reference"); @@ -3299,7 +3303,7 @@ yyreduce: case 117: /* Line 1455 of yacc.c */ -#line 1172 "program_parse.y" +#line 1176 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_WPOS; ;} @@ -3308,7 +3312,7 @@ yyreduce: case 118: /* Line 1455 of yacc.c */ -#line 1176 "program_parse.y" +#line 1180 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_COL0 + (yyvsp[(2) - (2)].integer); ;} @@ -3317,7 +3321,7 @@ yyreduce: case 119: /* Line 1455 of yacc.c */ -#line 1180 "program_parse.y" +#line 1184 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_FOGC; ;} @@ -3326,7 +3330,7 @@ yyreduce: case 120: /* Line 1455 of yacc.c */ -#line 1184 "program_parse.y" +#line 1188 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} @@ -3335,7 +3339,7 @@ yyreduce: case 123: /* Line 1455 of yacc.c */ -#line 1192 "program_parse.y" +#line 1196 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (3)].string), at_param, & (yylsp[(2) - (3)])); @@ -3354,7 +3358,7 @@ yyreduce: case 124: /* Line 1455 of yacc.c */ -#line 1208 "program_parse.y" +#line 1212 "program_parse.y" { if (((yyvsp[(4) - (6)].integer) != 0) && ((unsigned) (yyvsp[(4) - (6)].integer) != (yyvsp[(6) - (6)].temp_sym).param_binding_length)) { yyerror(& (yylsp[(4) - (6)]), state, @@ -3379,7 +3383,7 @@ yyreduce: case 125: /* Line 1455 of yacc.c */ -#line 1230 "program_parse.y" +#line 1234 "program_parse.y" { (yyval.integer) = 0; ;} @@ -3388,7 +3392,7 @@ yyreduce: case 126: /* Line 1455 of yacc.c */ -#line 1234 "program_parse.y" +#line 1238 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 1) || ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxParameters)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid parameter array size"); @@ -3402,7 +3406,7 @@ yyreduce: case 127: /* Line 1455 of yacc.c */ -#line 1245 "program_parse.y" +#line 1249 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(2) - (2)].temp_sym); ;} @@ -3411,7 +3415,7 @@ yyreduce: case 128: /* Line 1455 of yacc.c */ -#line 1251 "program_parse.y" +#line 1255 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(3) - (4)].temp_sym); ;} @@ -3420,7 +3424,7 @@ yyreduce: case 130: /* Line 1455 of yacc.c */ -#line 1258 "program_parse.y" +#line 1262 "program_parse.y" { (yyvsp[(1) - (3)].temp_sym).param_binding_length += (yyvsp[(3) - (3)].temp_sym).param_binding_length; (yyval.temp_sym) = (yyvsp[(1) - (3)].temp_sym); @@ -3430,7 +3434,7 @@ yyreduce: case 131: /* Line 1455 of yacc.c */ -#line 1265 "program_parse.y" +#line 1269 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3441,7 +3445,7 @@ yyreduce: case 132: /* Line 1455 of yacc.c */ -#line 1271 "program_parse.y" +#line 1275 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3452,7 +3456,7 @@ yyreduce: case 133: /* Line 1455 of yacc.c */ -#line 1277 "program_parse.y" +#line 1281 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3463,7 +3467,7 @@ yyreduce: case 134: /* Line 1455 of yacc.c */ -#line 1285 "program_parse.y" +#line 1289 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3474,7 +3478,7 @@ yyreduce: case 135: /* Line 1455 of yacc.c */ -#line 1291 "program_parse.y" +#line 1295 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3485,7 +3489,7 @@ yyreduce: case 136: /* Line 1455 of yacc.c */ -#line 1297 "program_parse.y" +#line 1301 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3496,7 +3500,7 @@ yyreduce: case 137: /* Line 1455 of yacc.c */ -#line 1305 "program_parse.y" +#line 1309 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3507,7 +3511,7 @@ yyreduce: case 138: /* Line 1455 of yacc.c */ -#line 1311 "program_parse.y" +#line 1315 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3518,7 +3522,7 @@ yyreduce: case 139: /* Line 1455 of yacc.c */ -#line 1317 "program_parse.y" +#line 1321 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3529,98 +3533,98 @@ yyreduce: case 140: /* Line 1455 of yacc.c */ -#line 1324 "program_parse.y" +#line 1328 "program_parse.y" { memcpy((yyval.state), (yyvsp[(1) - (1)].state), sizeof((yyval.state))); ;} break; case 141: /* Line 1455 of yacc.c */ -#line 1325 "program_parse.y" +#line 1329 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 142: /* Line 1455 of yacc.c */ -#line 1328 "program_parse.y" +#line 1332 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 143: /* Line 1455 of yacc.c */ -#line 1329 "program_parse.y" +#line 1333 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 144: /* Line 1455 of yacc.c */ -#line 1330 "program_parse.y" +#line 1334 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 145: /* Line 1455 of yacc.c */ -#line 1331 "program_parse.y" +#line 1335 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 146: /* Line 1455 of yacc.c */ -#line 1332 "program_parse.y" +#line 1336 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 147: /* Line 1455 of yacc.c */ -#line 1333 "program_parse.y" +#line 1337 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 148: /* Line 1455 of yacc.c */ -#line 1334 "program_parse.y" +#line 1338 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 149: /* Line 1455 of yacc.c */ -#line 1335 "program_parse.y" +#line 1339 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 150: /* Line 1455 of yacc.c */ -#line 1336 "program_parse.y" +#line 1340 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 151: /* Line 1455 of yacc.c */ -#line 1337 "program_parse.y" +#line 1341 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 152: /* Line 1455 of yacc.c */ -#line 1338 "program_parse.y" +#line 1342 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 153: /* Line 1455 of yacc.c */ -#line 1342 "program_parse.y" +#line 1346 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_MATERIAL; @@ -3632,7 +3636,7 @@ yyreduce: case 154: /* Line 1455 of yacc.c */ -#line 1351 "program_parse.y" +#line 1355 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -3641,7 +3645,7 @@ yyreduce: case 155: /* Line 1455 of yacc.c */ -#line 1355 "program_parse.y" +#line 1359 "program_parse.y" { (yyval.integer) = STATE_EMISSION; ;} @@ -3650,7 +3654,7 @@ yyreduce: case 156: /* Line 1455 of yacc.c */ -#line 1359 "program_parse.y" +#line 1363 "program_parse.y" { (yyval.integer) = STATE_SHININESS; ;} @@ -3659,7 +3663,7 @@ yyreduce: case 157: /* Line 1455 of yacc.c */ -#line 1365 "program_parse.y" +#line 1369 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHT; @@ -3671,7 +3675,7 @@ yyreduce: case 158: /* Line 1455 of yacc.c */ -#line 1374 "program_parse.y" +#line 1378 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -3680,7 +3684,7 @@ yyreduce: case 159: /* Line 1455 of yacc.c */ -#line 1378 "program_parse.y" +#line 1382 "program_parse.y" { (yyval.integer) = STATE_POSITION; ;} @@ -3689,7 +3693,7 @@ yyreduce: case 160: /* Line 1455 of yacc.c */ -#line 1382 "program_parse.y" +#line 1386 "program_parse.y" { if (!state->ctx->Extensions.EXT_point_parameters) { yyerror(& (yylsp[(1) - (1)]), state, "GL_ARB_point_parameters not supported"); @@ -3703,7 +3707,7 @@ yyreduce: case 161: /* Line 1455 of yacc.c */ -#line 1391 "program_parse.y" +#line 1395 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} @@ -3712,7 +3716,7 @@ yyreduce: case 162: /* Line 1455 of yacc.c */ -#line 1395 "program_parse.y" +#line 1399 "program_parse.y" { (yyval.integer) = STATE_HALF_VECTOR; ;} @@ -3721,7 +3725,7 @@ yyreduce: case 163: /* Line 1455 of yacc.c */ -#line 1401 "program_parse.y" +#line 1405 "program_parse.y" { (yyval.integer) = STATE_SPOT_DIRECTION; ;} @@ -3730,7 +3734,7 @@ yyreduce: case 164: /* Line 1455 of yacc.c */ -#line 1407 "program_parse.y" +#line 1411 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (2)].state)[1]; @@ -3740,7 +3744,7 @@ yyreduce: case 165: /* Line 1455 of yacc.c */ -#line 1414 "program_parse.y" +#line 1418 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_AMBIENT; @@ -3750,7 +3754,7 @@ yyreduce: case 166: /* Line 1455 of yacc.c */ -#line 1419 "program_parse.y" +#line 1423 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_SCENECOLOR; @@ -3761,7 +3765,7 @@ yyreduce: case 167: /* Line 1455 of yacc.c */ -#line 1427 "program_parse.y" +#line 1431 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTPROD; @@ -3774,7 +3778,7 @@ yyreduce: case 169: /* Line 1455 of yacc.c */ -#line 1439 "program_parse.y" +#line 1443 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(3) - (3)].integer); @@ -3785,7 +3789,7 @@ yyreduce: case 170: /* Line 1455 of yacc.c */ -#line 1447 "program_parse.y" +#line 1451 "program_parse.y" { (yyval.integer) = STATE_TEXENV_COLOR; ;} @@ -3794,7 +3798,7 @@ yyreduce: case 171: /* Line 1455 of yacc.c */ -#line 1453 "program_parse.y" +#line 1457 "program_parse.y" { (yyval.integer) = STATE_AMBIENT; ;} @@ -3803,7 +3807,7 @@ yyreduce: case 172: /* Line 1455 of yacc.c */ -#line 1457 "program_parse.y" +#line 1461 "program_parse.y" { (yyval.integer) = STATE_DIFFUSE; ;} @@ -3812,7 +3816,7 @@ yyreduce: case 173: /* Line 1455 of yacc.c */ -#line 1461 "program_parse.y" +#line 1465 "program_parse.y" { (yyval.integer) = STATE_SPECULAR; ;} @@ -3821,7 +3825,7 @@ yyreduce: case 174: /* Line 1455 of yacc.c */ -#line 1467 "program_parse.y" +#line 1471 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxLights) { yyerror(& (yylsp[(1) - (1)]), state, "invalid light selector"); @@ -3835,7 +3839,7 @@ yyreduce: case 175: /* Line 1455 of yacc.c */ -#line 1478 "program_parse.y" +#line 1482 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_TEXGEN; @@ -3847,7 +3851,7 @@ yyreduce: case 176: /* Line 1455 of yacc.c */ -#line 1487 "program_parse.y" +#line 1491 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S; ;} @@ -3856,7 +3860,7 @@ yyreduce: case 177: /* Line 1455 of yacc.c */ -#line 1491 "program_parse.y" +#line 1495 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_OBJECT_S; ;} @@ -3865,7 +3869,7 @@ yyreduce: case 178: /* Line 1455 of yacc.c */ -#line 1496 "program_parse.y" +#line 1500 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S; ;} @@ -3874,7 +3878,7 @@ yyreduce: case 179: /* Line 1455 of yacc.c */ -#line 1500 "program_parse.y" +#line 1504 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S; ;} @@ -3883,7 +3887,7 @@ yyreduce: case 180: /* Line 1455 of yacc.c */ -#line 1504 "program_parse.y" +#line 1508 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S; ;} @@ -3892,7 +3896,7 @@ yyreduce: case 181: /* Line 1455 of yacc.c */ -#line 1508 "program_parse.y" +#line 1512 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S; ;} @@ -3901,7 +3905,7 @@ yyreduce: case 182: /* Line 1455 of yacc.c */ -#line 1514 "program_parse.y" +#line 1518 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); @@ -3911,7 +3915,7 @@ yyreduce: case 183: /* Line 1455 of yacc.c */ -#line 1521 "program_parse.y" +#line 1525 "program_parse.y" { (yyval.integer) = STATE_FOG_COLOR; ;} @@ -3920,7 +3924,7 @@ yyreduce: case 184: /* Line 1455 of yacc.c */ -#line 1525 "program_parse.y" +#line 1529 "program_parse.y" { (yyval.integer) = STATE_FOG_PARAMS; ;} @@ -3929,7 +3933,7 @@ yyreduce: case 185: /* Line 1455 of yacc.c */ -#line 1531 "program_parse.y" +#line 1535 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_CLIPPLANE; @@ -3940,7 +3944,7 @@ yyreduce: case 186: /* Line 1455 of yacc.c */ -#line 1539 "program_parse.y" +#line 1543 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxClipPlanes) { yyerror(& (yylsp[(1) - (1)]), state, "invalid clip plane selector"); @@ -3954,7 +3958,7 @@ yyreduce: case 187: /* Line 1455 of yacc.c */ -#line 1550 "program_parse.y" +#line 1554 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); @@ -3964,7 +3968,7 @@ yyreduce: case 188: /* Line 1455 of yacc.c */ -#line 1557 "program_parse.y" +#line 1561 "program_parse.y" { (yyval.integer) = STATE_POINT_SIZE; ;} @@ -3973,7 +3977,7 @@ yyreduce: case 189: /* Line 1455 of yacc.c */ -#line 1561 "program_parse.y" +#line 1565 "program_parse.y" { (yyval.integer) = STATE_POINT_ATTENUATION; ;} @@ -3982,7 +3986,7 @@ yyreduce: case 190: /* Line 1455 of yacc.c */ -#line 1567 "program_parse.y" +#line 1571 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (5)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (5)].state)[1]; @@ -3995,7 +3999,7 @@ yyreduce: case 191: /* Line 1455 of yacc.c */ -#line 1577 "program_parse.y" +#line 1581 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (2)].state)[1]; @@ -4008,7 +4012,7 @@ yyreduce: case 192: /* Line 1455 of yacc.c */ -#line 1587 "program_parse.y" +#line 1591 "program_parse.y" { (yyval.state)[2] = 0; (yyval.state)[3] = 3; @@ -4018,7 +4022,7 @@ yyreduce: case 193: /* Line 1455 of yacc.c */ -#line 1592 "program_parse.y" +#line 1596 "program_parse.y" { /* It seems logical that the matrix row range specifier would have * to specify a range or more than one row (i.e., $5 > $3). @@ -4039,7 +4043,7 @@ yyreduce: case 194: /* Line 1455 of yacc.c */ -#line 1610 "program_parse.y" +#line 1614 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (3)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (3)].state)[1]; @@ -4050,7 +4054,7 @@ yyreduce: case 195: /* Line 1455 of yacc.c */ -#line 1618 "program_parse.y" +#line 1622 "program_parse.y" { (yyval.integer) = 0; ;} @@ -4059,7 +4063,7 @@ yyreduce: case 196: /* Line 1455 of yacc.c */ -#line 1622 "program_parse.y" +#line 1626 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -4068,7 +4072,7 @@ yyreduce: case 197: /* Line 1455 of yacc.c */ -#line 1628 "program_parse.y" +#line 1632 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVERSE; ;} @@ -4077,7 +4081,7 @@ yyreduce: case 198: /* Line 1455 of yacc.c */ -#line 1632 "program_parse.y" +#line 1636 "program_parse.y" { (yyval.integer) = STATE_MATRIX_TRANSPOSE; ;} @@ -4086,7 +4090,7 @@ yyreduce: case 199: /* Line 1455 of yacc.c */ -#line 1636 "program_parse.y" +#line 1640 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVTRANS; ;} @@ -4095,7 +4099,7 @@ yyreduce: case 200: /* Line 1455 of yacc.c */ -#line 1642 "program_parse.y" +#line 1646 "program_parse.y" { if ((yyvsp[(1) - (1)].integer) > 3) { yyerror(& (yylsp[(1) - (1)]), state, "invalid matrix row reference"); @@ -4109,7 +4113,7 @@ yyreduce: case 201: /* Line 1455 of yacc.c */ -#line 1653 "program_parse.y" +#line 1657 "program_parse.y" { (yyval.state)[0] = STATE_MODELVIEW_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); @@ -4119,7 +4123,7 @@ yyreduce: case 202: /* Line 1455 of yacc.c */ -#line 1658 "program_parse.y" +#line 1662 "program_parse.y" { (yyval.state)[0] = STATE_PROJECTION_MATRIX; (yyval.state)[1] = 0; @@ -4129,7 +4133,7 @@ yyreduce: case 203: /* Line 1455 of yacc.c */ -#line 1663 "program_parse.y" +#line 1667 "program_parse.y" { (yyval.state)[0] = STATE_MVP_MATRIX; (yyval.state)[1] = 0; @@ -4139,7 +4143,7 @@ yyreduce: case 204: /* Line 1455 of yacc.c */ -#line 1668 "program_parse.y" +#line 1672 "program_parse.y" { (yyval.state)[0] = STATE_TEXTURE_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); @@ -4149,7 +4153,7 @@ yyreduce: case 205: /* Line 1455 of yacc.c */ -#line 1673 "program_parse.y" +#line 1677 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; @@ -4159,7 +4163,7 @@ yyreduce: case 206: /* Line 1455 of yacc.c */ -#line 1678 "program_parse.y" +#line 1682 "program_parse.y" { (yyval.state)[0] = STATE_PROGRAM_MATRIX; (yyval.state)[1] = (yyvsp[(3) - (4)].integer); @@ -4169,7 +4173,7 @@ yyreduce: case 207: /* Line 1455 of yacc.c */ -#line 1685 "program_parse.y" +#line 1689 "program_parse.y" { (yyval.integer) = 0; ;} @@ -4178,7 +4182,7 @@ yyreduce: case 208: /* Line 1455 of yacc.c */ -#line 1689 "program_parse.y" +#line 1693 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} @@ -4187,7 +4191,7 @@ yyreduce: case 209: /* Line 1455 of yacc.c */ -#line 1694 "program_parse.y" +#line 1698 "program_parse.y" { /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix * zero is valid. @@ -4204,7 +4208,7 @@ yyreduce: case 210: /* Line 1455 of yacc.c */ -#line 1707 "program_parse.y" +#line 1711 "program_parse.y" { /* Since GL_ARB_matrix_palette isn't supported, just let any value * through here. The error will be generated later. @@ -4216,7 +4220,7 @@ yyreduce: case 211: /* Line 1455 of yacc.c */ -#line 1715 "program_parse.y" +#line 1719 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxProgramMatrices) { yyerror(& (yylsp[(1) - (1)]), state, "invalid program matrix selector"); @@ -4230,7 +4234,7 @@ yyreduce: case 212: /* Line 1455 of yacc.c */ -#line 1726 "program_parse.y" +#line 1730 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_DEPTH_RANGE; @@ -4240,7 +4244,7 @@ yyreduce: case 217: /* Line 1455 of yacc.c */ -#line 1738 "program_parse.y" +#line 1742 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4253,7 +4257,7 @@ yyreduce: case 218: /* Line 1455 of yacc.c */ -#line 1748 "program_parse.y" +#line 1752 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); @@ -4263,7 +4267,7 @@ yyreduce: case 219: /* Line 1455 of yacc.c */ -#line 1753 "program_parse.y" +#line 1757 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); @@ -4273,7 +4277,7 @@ yyreduce: case 220: /* Line 1455 of yacc.c */ -#line 1760 "program_parse.y" +#line 1764 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4286,7 +4290,7 @@ yyreduce: case 221: /* Line 1455 of yacc.c */ -#line 1770 "program_parse.y" +#line 1774 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4299,7 +4303,7 @@ yyreduce: case 222: /* Line 1455 of yacc.c */ -#line 1779 "program_parse.y" +#line 1783 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); @@ -4309,7 +4313,7 @@ yyreduce: case 223: /* Line 1455 of yacc.c */ -#line 1784 "program_parse.y" +#line 1788 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); @@ -4319,7 +4323,7 @@ yyreduce: case 224: /* Line 1455 of yacc.c */ -#line 1791 "program_parse.y" +#line 1795 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4332,7 +4336,7 @@ yyreduce: case 225: /* Line 1455 of yacc.c */ -#line 1801 "program_parse.y" +#line 1805 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxEnvParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid environment parameter reference"); @@ -4345,7 +4349,7 @@ yyreduce: case 226: /* Line 1455 of yacc.c */ -#line 1811 "program_parse.y" +#line 1815 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxLocalParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid local parameter reference"); @@ -4358,7 +4362,7 @@ yyreduce: case 231: /* Line 1455 of yacc.c */ -#line 1826 "program_parse.y" +#line 1830 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4371,7 +4375,7 @@ yyreduce: case 232: /* Line 1455 of yacc.c */ -#line 1836 "program_parse.y" +#line 1840 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4384,7 +4388,7 @@ yyreduce: case 233: /* Line 1455 of yacc.c */ -#line 1844 "program_parse.y" +#line 1848 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (float) (yyvsp[(1) - (1)].integer); @@ -4397,7 +4401,7 @@ yyreduce: case 234: /* Line 1455 of yacc.c */ -#line 1854 "program_parse.y" +#line 1858 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (3)].real); @@ -4410,7 +4414,7 @@ yyreduce: case 235: /* Line 1455 of yacc.c */ -#line 1862 "program_parse.y" +#line 1866 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (5)].real); @@ -4423,7 +4427,7 @@ yyreduce: case 236: /* Line 1455 of yacc.c */ -#line 1871 "program_parse.y" +#line 1875 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (7)].real); @@ -4436,7 +4440,7 @@ yyreduce: case 237: /* Line 1455 of yacc.c */ -#line 1880 "program_parse.y" +#line 1884 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (9)].real); @@ -4449,7 +4453,7 @@ yyreduce: case 238: /* Line 1455 of yacc.c */ -#line 1890 "program_parse.y" +#line 1894 "program_parse.y" { (yyval.real) = ((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].real) : (yyvsp[(2) - (2)].real); ;} @@ -4458,7 +4462,7 @@ yyreduce: case 239: /* Line 1455 of yacc.c */ -#line 1894 "program_parse.y" +#line 1898 "program_parse.y" { (yyval.real) = (float)(((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].integer) : (yyvsp[(2) - (2)].integer)); ;} @@ -4467,35 +4471,35 @@ yyreduce: case 240: /* Line 1455 of yacc.c */ -#line 1899 "program_parse.y" +#line 1903 "program_parse.y" { (yyval.negate) = FALSE; ;} break; case 241: /* Line 1455 of yacc.c */ -#line 1900 "program_parse.y" +#line 1904 "program_parse.y" { (yyval.negate) = TRUE; ;} break; case 242: /* Line 1455 of yacc.c */ -#line 1901 "program_parse.y" +#line 1905 "program_parse.y" { (yyval.negate) = FALSE; ;} break; case 243: /* Line 1455 of yacc.c */ -#line 1904 "program_parse.y" +#line 1908 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; case 245: /* Line 1455 of yacc.c */ -#line 1908 "program_parse.y" +#line 1912 "program_parse.y" { /* NV_fragment_program_option defines the size qualifiers in a * fairly broken way. "SHORT" or "LONG" can optionally be used @@ -4534,7 +4538,7 @@ yyreduce: case 246: /* Line 1455 of yacc.c */ -#line 1942 "program_parse.y" +#line 1946 "program_parse.y" { ;} break; @@ -4542,14 +4546,14 @@ yyreduce: case 247: /* Line 1455 of yacc.c */ -#line 1946 "program_parse.y" +#line 1950 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; case 249: /* Line 1455 of yacc.c */ -#line 1950 "program_parse.y" +#line 1954 "program_parse.y" { if (!declare_variable(state, (yyvsp[(3) - (3)].string), (yyvsp[(0) - (3)].integer), & (yylsp[(3) - (3)]))) { YYERROR; @@ -4560,7 +4564,7 @@ yyreduce: case 250: /* Line 1455 of yacc.c */ -#line 1956 "program_parse.y" +#line 1960 "program_parse.y" { if (!declare_variable(state, (yyvsp[(1) - (1)].string), (yyvsp[(0) - (1)].integer), & (yylsp[(1) - (1)]))) { YYERROR; @@ -4571,7 +4575,7 @@ yyreduce: case 251: /* Line 1455 of yacc.c */ -#line 1964 "program_parse.y" +#line 1968 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(3) - (5)].string), at_output, & (yylsp[(3) - (5)])); @@ -4587,7 +4591,7 @@ yyreduce: case 252: /* Line 1455 of yacc.c */ -#line 1977 "program_parse.y" +#line 1981 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_HPOS; @@ -4601,7 +4605,7 @@ yyreduce: case 253: /* Line 1455 of yacc.c */ -#line 1986 "program_parse.y" +#line 1990 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_FOGC; @@ -4615,7 +4619,7 @@ yyreduce: case 254: /* Line 1455 of yacc.c */ -#line 1995 "program_parse.y" +#line 1999 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (2)].result); ;} @@ -4624,7 +4628,7 @@ yyreduce: case 255: /* Line 1455 of yacc.c */ -#line 1999 "program_parse.y" +#line 2003 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_PSIZ; @@ -4638,7 +4642,7 @@ yyreduce: case 256: /* Line 1455 of yacc.c */ -#line 2008 "program_parse.y" +#line 2012 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_TEX0 + (yyvsp[(3) - (3)].integer); @@ -4652,7 +4656,7 @@ yyreduce: case 257: /* Line 1455 of yacc.c */ -#line 2017 "program_parse.y" +#line 2021 "program_parse.y" { if (state->mode == ARB_fragment) { (yyval.result) = FRAG_RESULT_DEPTH; @@ -4666,7 +4670,7 @@ yyreduce: case 258: /* Line 1455 of yacc.c */ -#line 2028 "program_parse.y" +#line 2032 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (3)].integer) + (yyvsp[(3) - (3)].integer); ;} @@ -4675,7 +4679,7 @@ yyreduce: case 259: /* Line 1455 of yacc.c */ -#line 2034 "program_parse.y" +#line 2038 "program_parse.y" { (yyval.integer) = (state->mode == ARB_vertex) ? VERT_RESULT_COL0 @@ -4686,7 +4690,7 @@ yyreduce: case 260: /* Line 1455 of yacc.c */ -#line 2040 "program_parse.y" +#line 2044 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_COL0; @@ -4700,7 +4704,7 @@ yyreduce: case 261: /* Line 1455 of yacc.c */ -#line 2049 "program_parse.y" +#line 2053 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_BFC0; @@ -4714,7 +4718,7 @@ yyreduce: case 262: /* Line 1455 of yacc.c */ -#line 2060 "program_parse.y" +#line 2064 "program_parse.y" { (yyval.integer) = 0; ;} @@ -4723,7 +4727,7 @@ yyreduce: case 263: /* Line 1455 of yacc.c */ -#line 2064 "program_parse.y" +#line 2068 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 0; @@ -4737,7 +4741,7 @@ yyreduce: case 264: /* Line 1455 of yacc.c */ -#line 2073 "program_parse.y" +#line 2077 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 1; @@ -4751,91 +4755,91 @@ yyreduce: case 265: /* Line 1455 of yacc.c */ -#line 2083 "program_parse.y" +#line 2087 "program_parse.y" { (yyval.integer) = 0; ;} break; case 266: /* Line 1455 of yacc.c */ -#line 2084 "program_parse.y" +#line 2088 "program_parse.y" { (yyval.integer) = 0; ;} break; case 267: /* Line 1455 of yacc.c */ -#line 2085 "program_parse.y" +#line 2089 "program_parse.y" { (yyval.integer) = 1; ;} break; case 268: /* Line 1455 of yacc.c */ -#line 2088 "program_parse.y" +#line 2092 "program_parse.y" { (yyval.integer) = 0; ;} break; case 269: /* Line 1455 of yacc.c */ -#line 2089 "program_parse.y" +#line 2093 "program_parse.y" { (yyval.integer) = 0; ;} break; case 270: /* Line 1455 of yacc.c */ -#line 2090 "program_parse.y" +#line 2094 "program_parse.y" { (yyval.integer) = 1; ;} break; case 271: /* Line 1455 of yacc.c */ -#line 2093 "program_parse.y" +#line 2097 "program_parse.y" { (yyval.integer) = 0; ;} break; case 272: /* Line 1455 of yacc.c */ -#line 2094 "program_parse.y" +#line 2098 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 273: /* Line 1455 of yacc.c */ -#line 2097 "program_parse.y" +#line 2101 "program_parse.y" { (yyval.integer) = 0; ;} break; case 274: /* Line 1455 of yacc.c */ -#line 2098 "program_parse.y" +#line 2102 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 275: /* Line 1455 of yacc.c */ -#line 2101 "program_parse.y" +#line 2105 "program_parse.y" { (yyval.integer) = 0; ;} break; case 276: /* Line 1455 of yacc.c */ -#line 2102 "program_parse.y" +#line 2106 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 277: /* Line 1455 of yacc.c */ -#line 2106 "program_parse.y" +#line 2110 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureCoordUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture coordinate unit selector"); @@ -4849,7 +4853,7 @@ yyreduce: case 278: /* Line 1455 of yacc.c */ -#line 2117 "program_parse.y" +#line 2121 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureImageUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture image unit selector"); @@ -4863,7 +4867,7 @@ yyreduce: case 279: /* Line 1455 of yacc.c */ -#line 2128 "program_parse.y" +#line 2132 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture unit selector"); @@ -4877,7 +4881,7 @@ yyreduce: case 280: /* Line 1455 of yacc.c */ -#line 2139 "program_parse.y" +#line 2143 "program_parse.y" { struct asm_symbol *exist = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(2) - (4)].string)); @@ -4901,7 +4905,7 @@ yyreduce: /* Line 1455 of yacc.c */ -#line 4905 "program_parse.tab.c" +#line 4909 "program_parse.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -5120,7 +5124,7 @@ yyreturn: /* Line 1675 of yacc.c */ -#line 2163 "program_parse.y" +#line 2167 "program_parse.y" void diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y index f70ea92cb0..9703e8e670 100644 --- a/src/mesa/shader/program_parse.y +++ b/src/mesa/shader/program_parse.y @@ -923,8 +923,10 @@ addrRegRelOffset: { $$ = 0; } addrRegPosOffset: INTEGER { if (($1 < 0) || ($1 > 63)) { - yyerror(& @1, state, - "relative address offset too large (positive)"); + char s[100]; + _mesa_snprintf(s, sizeof(s), + "relative address offset too large (%d)", $1); + yyerror(& @1, state, s); YYERROR; } else { $$ = $1; @@ -935,8 +937,10 @@ addrRegPosOffset: INTEGER addrRegNegOffset: INTEGER { if (($1 < 0) || ($1 > 64)) { - yyerror(& @1, state, - "relative address offset too large (negative)"); + char s[100]; + _mesa_snprintf(s, sizeof(s), + "relative address offset too large (%d)", $1); + yyerror(& @1, state, s); YYERROR; } else { $$ = $1; diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 54a25dfaf0..178b7d0dba 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -1474,6 +1474,21 @@ _mesa_link_program(GLcontext *ctx, GLuint program) FLUSH_VERTICES(ctx, _NEW_PROGRAM); _slang_link(ctx, program, shProg); + + /* debug code */ + if (0) { + GLuint i; + + _mesa_printf("Link %u shaders in program %u: %s\n", + shProg->NumShaders, shProg->Name, + shProg->LinkStatus ? "Success" : "Failed"); + + for (i = 0; i < shProg->NumShaders; i++) { + _mesa_printf(" shader %u, type 0x%x\n", + shProg->Shaders[i]->Name, + shProg->Shaders[i]->Type); + } + } } diff --git a/src/mesa/shader/slang/slang_builtin.c b/src/mesa/shader/slang/slang_builtin.c index bef0f85653..e5809509c9 100644 --- a/src/mesa/shader/slang/slang_builtin.c +++ b/src/mesa/shader/slang/slang_builtin.c @@ -741,7 +741,7 @@ static const struct input_info vertInputs[] = { { "gl_MultiTexCoord5", VERT_ATTRIB_TEX5, GL_FLOAT_VEC4, SWIZZLE_NOOP }, { "gl_MultiTexCoord6", VERT_ATTRIB_TEX6, GL_FLOAT_VEC4, SWIZZLE_NOOP }, { "gl_MultiTexCoord7", VERT_ATTRIB_TEX7, GL_FLOAT_VEC4, SWIZZLE_NOOP }, - { NULL, 0, SWIZZLE_NOOP } + { NULL, 0, GL_NONE, SWIZZLE_NOOP } }; /** Predefined fragment shader inputs */ @@ -754,7 +754,7 @@ static const struct input_info fragInputs[] = { { "gl_FogFragCoord", FRAG_ATTRIB_FOGC, GL_FLOAT, SWIZZLE_XXXX }, { "gl_FrontFacing", FRAG_ATTRIB_FACE, GL_FLOAT, SWIZZLE_XXXX }, { "gl_PointCoord", FRAG_ATTRIB_PNTC, GL_FLOAT_VEC2, SWIZZLE_XYZW }, - { NULL, 0, SWIZZLE_NOOP } + { NULL, 0, GL_NONE, SWIZZLE_NOOP } }; diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 349f432dec..703af9f874 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -2775,7 +2775,7 @@ _slang_gen_while(slang_assemble_ctx * A, slang_operation *oper) * body code (child[1]) */ slang_ir_node *loop, *breakIf, *body; - GLboolean isConst, constTrue; + GLboolean isConst, constTrue = GL_FALSE; if (!A->EmitContReturn) { /* We don't want to emit CONT instructions. If this while-loop has diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 169c07f8ce..8f2b40d5df 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -546,6 +546,32 @@ _slang_update_inputs_outputs(struct gl_program *prog) +/** + * Remove extra #version directives from the concatenated source string. + * Disable the extra ones by converting first two chars to //, a comment. + * This is a bit of hack to work around a preprocessor bug that only + * allows one #version directive per source. + */ +static void +remove_extra_version_directives(GLchar *source) +{ + GLuint verCount = 0; + while (1) { + char *ver = _mesa_strstr(source, "#version"); + if (ver) { + verCount++; + if (verCount > 1) { + ver[0] = '/'; + ver[1] = '/'; + } + source += 8; + } + else { + break; + } + } +} + /** @@ -593,6 +619,8 @@ concat_shaders(struct gl_shader_program *shProg, GLenum shaderType) _mesa_printf("---NEW CONCATENATED SHADER---:\n%s\n------------\n", source); */ + remove_extra_version_directives(source); + newShader = CALLOC_STRUCT(gl_shader); newShader->Type = shaderType; newShader->Source = source; |