summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2004-12-15 01:07:52 +0000
committerBrian Paul <[email protected]>2004-12-15 01:07:52 +0000
commit55481b3a2977179f47b6d8cec0700e0991dba462 (patch)
tree8e2bc21358a3b5dd3a7cfa9d5af92b64303e3532 /src/mesa/swrast
parent244adeb639cf13c531bcce78734b911fc19b943d (diff)
tweaks to the LIT instructions
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_nvfragprog.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/mesa/swrast/s_nvfragprog.c b/src/mesa/swrast/s_nvfragprog.c
index 88a6593aff4..d083f83645d 100644
--- a/src/mesa/swrast/s_nvfragprog.c
+++ b/src/mesa/swrast/s_nvfragprog.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.1
+ * Version: 6.3
*
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
@@ -805,14 +805,16 @@ execute_program( GLcontext *ctx,
break;
case FP_OPCODE_LIT:
{
+ const GLfloat epsilon = 1.0F / 256.0F; /* from NV VP spec */
GLfloat a[4], result[4];
fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
- if (a[0] < 0.0F)
- a[0] = 0.0F;
- if (a[1] < 0.0F)
- a[1] = 0.0F;
+ a[0] = MAX2(a[0], 0.0F);
+ a[1] = MAX2(a[1], 0.0F);
+ /* XXX ARB version clamps a[3], NV version doesn't */
+ a[3] = CLAMP(a[3], -(128.0F - epsilon), (128.0F - epsilon));
result[0] = 1.0F;
result[1] = a[0];
+ /* XXX we could probably just use pow() here */
result[2] = (a[0] > 0.0F) ? (GLfloat) exp(a[3] * log(a[1])) : 0.0F;
result[3] = 1.0F;
store_vector4( inst, machine, result );