X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fffvertex_prog.c;h=57026793ea155ea3f13ee99a19b835d2daa1e257;hb=HEAD;hp=976b6f46b9f3aeb56385cb8621d39042d48376c7;hpb=07c10cc59c164ddd0109e061dac8edf47437d8ca;p=mesa.git diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 976b6f46b9f..57026793ea1 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -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); @@ -1661,7 +1667,7 @@ _mesa_get_fixed_func_vertex_program(struct gl_context *ctx) if (0) printf("Build new TNL program\n"); - prog = ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0, true); + prog = ctx->Driver.NewProgram(ctx, MESA_SHADER_VERTEX, 0, true); if (!prog) return NULL;