diff options
Diffstat (limited to 'src/mesa/shader')
-rw-r--r-- | src/mesa/shader/arbprogparse.c | 14 | ||||
-rw-r--r-- | src/mesa/shader/prog_print.c | 8 | ||||
-rw-r--r-- | src/mesa/shader/program.c | 7 | ||||
-rw-r--r-- | src/mesa/shader/programopt.c | 21 |
4 files changed, 29 insertions, 21 deletions
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 9a5290d920..d662e0b8b5 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -1695,7 +1695,7 @@ parse_attrib (GLcontext * ctx, const GLubyte ** inst, struct var_cache **vc_head if (found) { error_msg = (char *) _mesa_malloc (_mesa_strlen ((char *) attrib_var->name) + 40); - _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + _mesa_sprintf (error_msg, "Duplicate Variable Declaration: %s", attrib_var->name); program_error(ctx, Program->Position, error_msg); _mesa_free (error_msg); @@ -1825,12 +1825,14 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst, break; case PARAM_CONSTANT: + /* parsing something like {1.0, 2.0, 3.0, 4.0} */ parse_constant (inst, const_values, Program, use); idx = _mesa_add_named_constant(Program->Base.Parameters, (char *) param_var->name, const_values, 4); if (param_var->param_binding_begin == ~0U) param_var->param_binding_begin = idx; + param_var->param_binding_type = PROGRAM_CONSTANT; param_var->param_binding_length++; Program->Base.NumParameters++; break; @@ -1878,7 +1880,7 @@ parse_param (GLcontext * ctx, const GLubyte ** inst, struct var_cache **vc_head, if (found) { char *error_msg = (char *) _mesa_malloc (_mesa_strlen ((char *) param_var->name) + 40); - _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + _mesa_sprintf (error_msg, "Duplicate Variable Declaration: %s", param_var->name); program_error (ctx, Program->Position, error_msg); _mesa_free (error_msg); @@ -1978,7 +1980,7 @@ parse_temp (GLcontext * ctx, const GLubyte ** inst, struct var_cache **vc_head, if (found) { char *error_msg = (char *) _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40); - _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + _mesa_sprintf (error_msg, "Duplicate Variable Declaration: %s", temp_var->name); program_error(ctx, Program->Position, error_msg); _mesa_free (error_msg); @@ -2024,7 +2026,7 @@ parse_output (GLcontext * ctx, const GLubyte ** inst, struct var_cache **vc_head if (found) { char *error_msg = (char *) _mesa_malloc (_mesa_strlen ((char *) output_var->name) + 40); - _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + _mesa_sprintf (error_msg, "Duplicate Variable Declaration: %s", output_var->name); program_error (ctx, Program->Position, error_msg); _mesa_free (error_msg); @@ -2055,7 +2057,7 @@ parse_alias (GLcontext * ctx, const GLubyte ** inst, struct var_cache **vc_head, if (found) { char *error_msg = (char *) _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40); - _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + _mesa_sprintf (error_msg, "Duplicate Variable Declaration: %s", temp_var->name); program_error(ctx, Program->Position, error_msg); _mesa_free (error_msg); @@ -2098,7 +2100,7 @@ parse_address (GLcontext * ctx, const GLubyte ** inst, struct var_cache **vc_hea if (found) { char *error_msg = (char *) _mesa_malloc (_mesa_strlen ((char *) temp_var->name) + 40); - _mesa_sprintf (error_msg, "Duplicate Varible Declaration: %s", + _mesa_sprintf (error_msg, "Duplicate Variable Declaration: %s", temp_var->name); program_error (ctx, Program->Position, error_msg); _mesa_free (error_msg); diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index 969b9757cc..1145f0c7a4 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -304,7 +304,7 @@ _mesa_swizzle_string(GLuint swizzle, GLuint negateBase, GLboolean extended) if (!extended) s[i++] = '.'; - if (negateBase & 0x1) + if (negateBase & NEGATE_X) s[i++] = '-'; s[i++] = swz[GET_SWZ(swizzle, 0)]; @@ -312,7 +312,7 @@ _mesa_swizzle_string(GLuint swizzle, GLuint negateBase, GLboolean extended) s[i++] = ','; } - if (negateBase & 0x2) + if (negateBase & NEGATE_Y) s[i++] = '-'; s[i++] = swz[GET_SWZ(swizzle, 1)]; @@ -320,7 +320,7 @@ _mesa_swizzle_string(GLuint swizzle, GLuint negateBase, GLboolean extended) s[i++] = ','; } - if (negateBase & 0x4) + if (negateBase & NEGATE_Z) s[i++] = '-'; s[i++] = swz[GET_SWZ(swizzle, 2)]; @@ -328,7 +328,7 @@ _mesa_swizzle_string(GLuint swizzle, GLuint negateBase, GLboolean extended) s[i++] = ','; } - if (negateBase & 0x8) + if (negateBase & NEGATE_W) s[i++] = '-'; s[i++] = swz[GET_SWZ(swizzle, 3)]; diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index fc53b5737c..3869e31714 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -497,6 +497,13 @@ _mesa_combine_programs(GLcontext *ctx, newProg->NumInstructions = newLength; if (newProg->Target == GL_FRAGMENT_PROGRAM_ARB) { + struct gl_fragment_program *fprogA, *fprogB, *newFprog; + fprogA = (struct gl_fragment_program *) progA; + fprogB = (struct gl_fragment_program *) progB; + newFprog = (struct gl_fragment_program *) newProg; + + newFprog->UsesKill = fprogA->UsesKill || fprogB->UsesKill; + /* connect color outputs/inputs */ if ((progA->OutputsWritten & (1 << FRAG_RESULT_COLR)) && (progB->InputsRead & (1 << FRAG_ATTRIB_COL0))) { diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c index fc5b0497fe..9eeb71db1b 100644 --- a/src/mesa/shader/programopt.c +++ b/src/mesa/shader/programopt.c @@ -192,13 +192,13 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog) inst->DstReg.WriteMask = WRITEMASK_X; inst->SrcReg[0].File = PROGRAM_INPUT; inst->SrcReg[0].Index = FRAG_ATTRIB_FOGC; - inst->SrcReg[0].Swizzle = SWIZZLE_X; + inst->SrcReg[0].Swizzle = SWIZZLE_XXXX; inst->SrcReg[1].File = PROGRAM_STATE_VAR; inst->SrcReg[1].Index = fogPRefOpt; - inst->SrcReg[1].Swizzle = SWIZZLE_X; + inst->SrcReg[1].Swizzle = SWIZZLE_XXXX; inst->SrcReg[2].File = PROGRAM_STATE_VAR; inst->SrcReg[2].Index = fogPRefOpt; - inst->SrcReg[2].Swizzle = SWIZZLE_Y; + inst->SrcReg[2].Swizzle = SWIZZLE_YYYY; inst->SaturateMode = SATURATE_ZERO_ONE; inst++; } @@ -214,10 +214,10 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog) inst->SrcReg[0].File = PROGRAM_STATE_VAR; inst->SrcReg[0].Index = fogPRefOpt; inst->SrcReg[0].Swizzle - = (fprog->FogOption == GL_EXP) ? SWIZZLE_Z : SWIZZLE_W; + = (fprog->FogOption == GL_EXP) ? SWIZZLE_ZZZZ : SWIZZLE_WWWW; inst->SrcReg[1].File = PROGRAM_INPUT; inst->SrcReg[1].Index = FRAG_ATTRIB_FOGC; - inst->SrcReg[1].Swizzle = SWIZZLE_X; + inst->SrcReg[1].Swizzle = SWIZZLE_XXXX; inst++; if (fprog->FogOption == GL_EXP2) { /* MUL fogFactorTemp.x, fogFactorTemp.x, fogFactorTemp.x; */ @@ -227,10 +227,10 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog) inst->DstReg.WriteMask = WRITEMASK_X; inst->SrcReg[0].File = PROGRAM_TEMPORARY; inst->SrcReg[0].Index = fogFactorTemp; - inst->SrcReg[0].Swizzle = SWIZZLE_X; + inst->SrcReg[0].Swizzle = SWIZZLE_XXXX; inst->SrcReg[1].File = PROGRAM_TEMPORARY; inst->SrcReg[1].Index = fogFactorTemp; - inst->SrcReg[1].Swizzle = SWIZZLE_X; + inst->SrcReg[1].Swizzle = SWIZZLE_XXXX; inst++; } /* EX2_SAT fogFactorTemp.x, -fogFactorTemp.x; */ @@ -240,8 +240,8 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog) inst->DstReg.WriteMask = WRITEMASK_X; inst->SrcReg[0].File = PROGRAM_TEMPORARY; inst->SrcReg[0].Index = fogFactorTemp; - inst->SrcReg[0].NegateBase = GL_TRUE; - inst->SrcReg[0].Swizzle = SWIZZLE_X; + inst->SrcReg[0].NegateBase = NEGATE_XYZW; + inst->SrcReg[0].Swizzle = SWIZZLE_XXXX; inst->SaturateMode = SATURATE_ZERO_ONE; inst++; } @@ -252,8 +252,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog) inst->DstReg.WriteMask = WRITEMASK_XYZ; inst->SrcReg[0].File = PROGRAM_TEMPORARY; inst->SrcReg[0].Index = fogFactorTemp; - inst->SrcReg[0].Swizzle - = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X); + inst->SrcReg[0].Swizzle = SWIZZLE_XXXX; inst->SrcReg[1].File = PROGRAM_TEMPORARY; inst->SrcReg[1].Index = colorTemp; inst->SrcReg[1].Swizzle = SWIZZLE_NOOP; |