summaryrefslogtreecommitdiff
path: root/src/mesa/main/ffvertex_prog.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/ffvertex_prog.c')
-rw-r--r--src/mesa/main/ffvertex_prog.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
index b87c443fecf..ec0a5e3896d 100644
--- a/src/mesa/main/ffvertex_prog.c
+++ b/src/mesa/main/ffvertex_prog.c
@@ -180,12 +180,12 @@ static GLboolean check_active_shininess( GLcontext *ctx,
-static struct state_key *make_state_key( GLcontext *ctx )
+static void make_state_key( GLcontext *ctx, struct state_key *key )
{
const struct gl_fragment_program *fp;
- struct state_key *key = CALLOC_STRUCT(state_key);
GLuint i;
+ memset(key, 0, sizeof(struct state_key));
fp = ctx->FragmentProgram._Current;
/* This now relies on texenvprogram.c being active:
@@ -304,8 +304,6 @@ static struct state_key *make_state_key( GLcontext *ctx )
texUnit->GenModeQ );
}
}
-
- return key;
}
@@ -738,11 +736,16 @@ static void emit_normalize_vec3( struct tnl_program *p,
struct ureg dest,
struct ureg src )
{
+#if 0
+ /* XXX use this when drivers are ready for NRM3 */
+ emit_op1(p, OPCODE_NRM3, dest, WRITEMASK_XYZ, src);
+#else
struct ureg tmp = get_temp(p);
emit_op2(p, OPCODE_DP3, tmp, WRITEMASK_X, src, src);
emit_op1(p, OPCODE_RSQ, tmp, WRITEMASK_X, tmp);
emit_op2(p, OPCODE_MUL, dest, 0, src, swizzle1(tmp, X));
release_temp(p, tmp);
+#endif
}
static void emit_passthrough( struct tnl_program *p,
@@ -1726,16 +1729,16 @@ struct gl_vertex_program *
_mesa_get_fixed_func_vertex_program(GLcontext *ctx)
{
struct gl_vertex_program *prog;
- struct state_key *key;
+ struct state_key key;
/* Grab all the relevent state and put it in a single structure:
*/
- key = make_state_key(ctx);
+ make_state_key(ctx, &key);
/* Look for an already-prepared program for this state:
*/
prog = (struct gl_vertex_program *)
- _mesa_search_program_cache(ctx->VertexProgram.Cache, key, sizeof(*key));
+ _mesa_search_program_cache(ctx->VertexProgram.Cache, &key, sizeof(key));
if (!prog) {
/* OK, we'll have to build a new one */
@@ -1747,7 +1750,7 @@ _mesa_get_fixed_func_vertex_program(GLcontext *ctx)
if (!prog)
return NULL;
- create_new_program( key, prog,
+ create_new_program( &key, prog,
ctx->Const.VertexProgram.MaxTemps );
#if 0
@@ -1756,10 +1759,8 @@ _mesa_get_fixed_func_vertex_program(GLcontext *ctx)
&prog->Base );
#endif
_mesa_program_cache_insert(ctx, ctx->VertexProgram.Cache,
- key, sizeof(*key), &prog->Base);
+ &key, sizeof(key), &prog->Base);
}
- _mesa_free(key);
-
return prog;
}