diff options
author | Brian Paul <[email protected]> | 2004-12-15 01:07:52 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2004-12-15 01:07:52 +0000 |
commit | 55481b3a2977179f47b6d8cec0700e0991dba462 (patch) | |
tree | 8e2bc21358a3b5dd3a7cfa9d5af92b64303e3532 /src/mesa/shader/nvvertexec.c | |
parent | 244adeb639cf13c531bcce78734b911fc19b943d (diff) |
tweaks to the LIT instructions
Diffstat (limited to 'src/mesa/shader/nvvertexec.c')
-rw-r--r-- | src/mesa/shader/nvvertexec.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/mesa/shader/nvvertexec.c b/src/mesa/shader/nvvertexec.c index 79929f14a5a..269c4c93d8c 100644 --- a/src/mesa/shader/nvvertexec.c +++ b/src/mesa/shader/nvvertexec.c @@ -412,17 +412,12 @@ _mesa_exec_vertex_program(GLcontext *ctx, const struct vertex_program *program) break; case VP_OPCODE_LIT: { - const GLfloat epsilon = 1.0e-5F; /* XXX fix? */ + const GLfloat epsilon = 1.0F / 256.0F; /* per NV spec */ GLfloat t[4], lit[4]; fetch_vector4( &inst->SrcReg[0], state, t ); - if (t[3] < -(128.0F - epsilon)) - t[3] = - (128.0F - epsilon); - else if (t[3] > 128.0F - epsilon) - t[3] = 128.0F - epsilon; - if (t[0] < 0.0) - t[0] = 0.0; - if (t[1] < 0.0) - t[1] = 0.0; + t[0] = MAX2(t[0], 0.0F); + t[1] = MAX2(t[1], 0.0F); + t[3] = CLAMP(t[3], -(128.0F - epsilon), (128.0F - epsilon)); lit[0] = 1.0; lit[1] = t[0]; lit[2] = (t[0] > 0.0) ? (GLfloat) exp(t[3] * log(t[1])) : 0.0F; |