summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-02-24 11:14:57 -0700
committerBrian <brian@yutani.localnet.net>2007-02-24 11:14:57 -0700
commit761728afe8b81fc0ff7928f99f8b5668a0a7824d (patch)
treec831f8fe9c9ccf78beab5e2392ff63f203eb353e /src/mesa
parentf183a2d7ea31a4fea89af834dc19c5b232eb1970 (diff)
Fix assertion in get_register_pointer(), fix EXP case.
Note that GL_ARB_v_p and GL_NV_v_p define the z component of the EXP instruction differently. We follow the ARB extension.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/shader/prog_execute.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c
index 91ea52070e..9d5894deb9 100644
--- a/src/mesa/shader/prog_execute.c
+++ b/src/mesa/shader/prog_execute.c
@@ -133,14 +133,12 @@ get_register_pointer(GLcontext * ctx,
else if (source->File == PROGRAM_ENV_PARAM)
return ctx->VertexProgram.Parameters[reg];
else {
- /*
- ASSERT(source->File == PROGRAM_LOCAL_PARAM);
- */
+ ASSERT(source->File == PROGRAM_LOCAL_PARAM ||
+ source->File == PROGRAM_STATE_VAR);
return machine->CurProgram->Parameters->ParameterValues[reg];
}
}
-
switch (source->File) {
case PROGRAM_TEMPORARY:
ASSERT(source->Index < MAX_PROGRAM_TEMPS);
@@ -870,7 +868,6 @@ _mesa_execute_program(GLcontext * ctx,
}
break;
case OPCODE_EXP:
- /* XXX currently broken! */
{
GLfloat t[4], q[4], floor_t0;
fetch_vector1(ctx, &inst->SrcReg[0], machine, t);
@@ -884,15 +881,12 @@ _mesa_execute_program(GLcontext * ctx,
q[2] = 0.0F;
}
else {
-#ifdef USE_IEEE
- GLint ii = (GLint) floor_t0;
- ii = (ii < 23) + 0x3f800000;
- SET_FLOAT_BITS(q[0], ii);
- q[0] = *((GLfloat *) (void *)&ii);
-#else
- q[0] = (GLfloat) pow(2.0, floor_t0);
-#endif
- q[2] = (GLfloat) (q[0] * LOG2(q[1]));
+ q[0] = LDEXPF(1.0, (int) floor_t0);
+ /* Note: GL_NV_vertex_program expects
+ * result.z = result.x * APPX(result.y)
+ * We do what the ARB extension says.
+ */
+ q[2] = pow(2.0, t[0]);
}
q[1] = t[0] - floor_t0;
q[3] = 1.0F;