diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2004-06-29 00:03:59 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2004-06-29 00:03:59 +0000 |
commit | 80cc018a68e1b07689e329635951de72c5c0c65d (patch) | |
tree | 9c47ab1f6da1928e468b259d83a548c0ee5d9648 /src | |
parent | ac33dd1312530e0bab0c7e5d25c9d70f4e884753 (diff) |
the get_register_pointer() function was pretty well broken in a few ways
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/shader/nvvertexec.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/src/mesa/shader/nvvertexec.c b/src/mesa/shader/nvvertexec.c index 91577d319a..30e925e6e2 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 && |