mesa: Avoid setting _NEW_VARYING_VP_INPUTS in non fixed function mode.
[mesa.git] / src / mesa / main / ffvertex_prog.c
index 976b6f46b9f3aeb56385cb8621d39042d48376c7..04126fe9b9034bb5f1e133e98efd4353ab93c736 100644 (file)
@@ -33,6 +33,7 @@
  */
 
 
+#include "main/errors.h"
 #include "main/glheader.h"
 #include "main/mtypes.h"
 #include "main/macros.h"
@@ -413,7 +414,7 @@ static struct ureg register_param5(struct tnl_program *p,
                                   GLint s3,
                                    GLint s4)
 {
-   gl_state_index tokens[STATE_LENGTH];
+   gl_state_index16 tokens[STATE_LENGTH];
    GLint idx;
    tokens[0] = s0;
    tokens[1] = s1;
@@ -1296,12 +1297,14 @@ static void build_fog( struct tnl_program *p )
    struct ureg input;
 
    switch (p->state->fog_distance_mode) {
-   case FDM_EYE_RADIAL: /* Z = sqrt(Xe*Xe + Ye*Ye + Ze*Ze) */
+   case FDM_EYE_RADIAL: { /* Z = sqrt(Xe*Xe + Ye*Ye + Ze*Ze) */
+      struct ureg tmp = get_temp(p);
       input = get_eye_position(p);
-      emit_op2(p, OPCODE_DP3, fog, WRITEMASK_X, input, input);
-      emit_op1(p, OPCODE_RSQ, fog, WRITEMASK_X, fog);
-      emit_op1(p, OPCODE_RCP, fog, WRITEMASK_X, fog);
+      emit_op2(p, OPCODE_DP3, tmp, WRITEMASK_X, input, input);
+      emit_op1(p, OPCODE_RSQ, tmp, WRITEMASK_X, tmp);
+      emit_op1(p, OPCODE_RCP, fog, WRITEMASK_X, tmp);
       break;
+   }
    case FDM_EYE_PLANE: /* Z = Ze */
       input = get_eye_position_z(p);
       emit_op1(p, OPCODE_MOV, fog, WRITEMASK_X, input);
@@ -1647,6 +1650,9 @@ _mesa_get_fixed_func_vertex_program(struct gl_context *ctx)
    struct gl_program *prog;
    struct state_key key;
 
+   /* We only update ctx->varying_vp_inputs when in VP_MODE_FF _VPMode */
+   assert(VP_MODE_FF == ctx->VertexProgram._VPMode);
+
    /* Grab all the relevant state and put it in a single structure:
     */
    make_state_key(ctx, &key);