From a8d4963fbcfe370a571671a250a1ae8dd894a94a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 29 Mar 2003 16:04:31 +0000 Subject: fix EXP instruction and ARL-relative addressing --- src/mesa/main/nvvertexec.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/mesa/main/nvvertexec.c b/src/mesa/main/nvvertexec.c index 6ef6cce1d7..dcf385d0e3 100644 --- a/src/mesa/main/nvvertexec.c +++ b/src/mesa/main/nvvertexec.c @@ -1,4 +1,4 @@ -/* $Id: nvvertexec.c,v 1.4 2003/03/25 00:00:29 brianp Exp $ */ +/* $Id: nvvertexec.c,v 1.5 2003/03/29 16:04:31 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -231,11 +231,11 @@ fetch_vector4( const struct vp_src_register *source, const GLfloat *src; if (source->RelAddr) { - GLint reg = source->Register + machine->AddressReg; - if (reg < VP_PROG_REG_START || reg > VP_PROG_REG_END) + const GLint reg = source->Register + machine->AddressReg; + if (reg < 0 || reg > MAX_NV_VERTEX_PROGRAM_PARAMS) src = zero; else - src = machine->Registers[reg]; + src = machine->Registers[VP_PROG_REG_START + reg]; } else { src = machine->Registers[source->Register]; @@ -268,11 +268,11 @@ fetch_vector1( const struct vp_src_register *source, const GLfloat *src; if (source->RelAddr) { - GLint reg = source->Register + machine->AddressReg; - if (reg < VP_PROG_REG_START || reg > VP_PROG_REG_END) + const GLint reg = source->Register + machine->AddressReg; + if (reg < 0 || reg > MAX_NV_VERTEX_PROGRAM_PARAMS) src = zero; else - src = machine->Registers[reg]; + src = machine->Registers[VP_PROG_REG_START + reg]; } else { src = machine->Registers[source->Register]; @@ -333,10 +333,6 @@ _mesa_exec_vertex_program(GLcontext *ctx, const struct vertex_program *program) struct vp_machine *machine = &ctx->VertexProgram.Machine; const struct vp_instruction *inst; - /* XXX load vertex fields into input registers */ - /* and do other initialization */ - - for (inst = program->Instructions; inst->Opcode != VP_OPCODE_END; inst++) { switch (inst->Opcode) { case VP_OPCODE_MOV: @@ -392,15 +388,11 @@ _mesa_exec_vertex_program(GLcontext *ctx, const struct vertex_program *program) floor_t0 = (float) floor(t[0]); if (floor_t0 > FLT_MAX_EXP) { SET_POS_INFINITY(q[0]); - q[1] = 0.0F; SET_POS_INFINITY(q[2]); - q[3] = 1.0F; } else if (floor_t0 < FLT_MIN_EXP) { q[0] = 0.0F; - q[1] = 0.0F; q[2] = 0.0F; - q[3] = 0.0F; } else { #ifdef USE_IEEE @@ -411,10 +403,10 @@ _mesa_exec_vertex_program(GLcontext *ctx, const struct vertex_program *program) #else q[0] = (GLfloat) pow(2.0, floor_t0); #endif - q[1] = t[0] - floor_t0; q[2] = (GLfloat) (q[0] * LOG2(q[1])); - q[3] = 1.0F; } + q[1] = t[0] - floor_t0; + q[3] = 1.0F; store_vector4( &inst->DstReg, machine, q ); } break; -- cgit v1.2.3