summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2001-01-04 16:22:18 +0000
committerBrian Paul <[email protected]>2001-01-04 16:22:18 +0000
commitf22c04cdaec47dfef1068af0e90822062478631b (patch)
treef768dd9675dec230bd13141f7ff48dfa6e2f2e8a /src
parent6517211e12c4f19c784b31727f6052561956fb7b (diff)
added underflow check in validate_shine_table()
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/light.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 83a3095726e..1eed79bc2a7 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -1,4 +1,4 @@
-/* $Id: light.c,v 1.32 2001/01/02 22:02:51 brianp Exp $ */
+/* $Id: light.c,v 1.33 2001/01/04 16:22:18 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1072,7 +1072,10 @@ static void validate_shine_table( GLcontext *ctx, GLuint i, GLfloat shininess )
}
else {
for (i = 1 ; i < SHINE_TABLE_SIZE ; i++) {
- GLdouble t = pow(i / (GLfloat)(SHINE_TABLE_SIZE-1), shininess);
+ GLdouble t, x = i / (GLfloat) (SHINE_TABLE_SIZE - 1);
+ if (x < 0.005) /* underflow check */
+ x = 0.005;
+ t = pow(x, shininess);
if (t > 1e-20)
m[i] = t;
else