From: Brian Paul Date: Tue, 29 Jun 2004 00:03:59 +0000 (+0000) Subject: the get_register_pointer() function was pretty well broken in a few ways X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=80cc018a68e1b07689e329635951de72c5c0c65d;p=mesa.git the get_register_pointer() function was pretty well broken in a few ways --- diff --git a/src/mesa/shader/nvvertexec.c b/src/mesa/shader/nvvertexec.c index 91577d319ab..30e925e6e29 100644 --- a/src/mesa/shader/nvvertexec.c +++ b/src/mesa/shader/nvvertexec.c @@ -163,19 +163,9 @@ _mesa_init_vp_per_primitive_registers(GLcontext *ctx) else { /* Using and ARB vertex program */ if (ctx->VertexProgram.Current->Parameters) { - GLuint i; - - /* Grab the state */ + /* Grab the state GL state and put into registers */ _mesa_load_state_parameters(ctx, ctx->VertexProgram.Current->Parameters); - - /* And copy it into the program state */ - for (i = 0; i < ctx->VertexProgram.Current->Parameters->NumParameters; - i++) { - MEMCPY(ctx->VertexProgram.Parameters[i], - &ctx->VertexProgram.Current->Parameters->Parameters[i].Values, - 4 * sizeof(GLfloat)); - } } } } @@ -252,19 +242,23 @@ get_register_pointer( const struct vp_src_register *source, else { switch (source->File) { case PROGRAM_TEMPORARY: + ASSERT(source->Index < MAX_NV_VERTEX_PROGRAM_TEMPS); return state->Temporaries[source->Index]; case PROGRAM_INPUT: + ASSERT(source->Index < MAX_NV_VERTEX_PROGRAM_INPUTS); return state->Inputs[source->Index]; case PROGRAM_LOCAL_PARAM: - /* XXX fix */ - return state->Temporaries[source->Index]; + ASSERT(source->Index < MAX_PROGRAM_LOCAL_PARAMS); + return state->Current->Base.LocalParams[source->Index]; case PROGRAM_ENV_PARAM: + ASSERT(source->Index < MAX_NV_VERTEX_PROGRAM_PARAMS); return state->Parameters[source->Index]; case PROGRAM_STATE_VAR: - return state->Parameters[source->Index]; + ASSERT(source->Index < state->Current->Parameters->NumParameters); + return state->Current->Parameters->Parameters[source->Index].Values; default: _mesa_problem(NULL, - "Bad source register file in fetch_vector4(vp)"); + "Bad source register file in get_register_pointer"); return NULL; } } @@ -397,7 +391,6 @@ _mesa_exec_vertex_program(GLcontext *ctx, const struct vertex_program *program) /* XXX: This could go elsewhere */ ctx->VertexProgram.Current->OutputsWritten |= 0x1; } - for (inst = program->Instructions; ; inst++) { if (ctx->VertexProgram.CallbackEnabled &&