diff options
author | Brian Paul <[email protected]> | 2001-02-07 18:44:55 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2001-02-07 18:44:55 +0000 |
commit | b4736f5e17b23d82ab369c26370c8ff26c45d1d1 (patch) | |
tree | 1a165e12b6b7254617adca079405a8e60fefb62b | |
parent | 5c55aa4e61adcf136a18f2aea08a44f69840c4a0 (diff) |
added divide by zero checks
-rw-r--r-- | src/mesa/swrast/s_triangle.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index d268b2e754d..9f3f2fe54b1 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -1,4 +1,4 @@ -/* $Id: s_triangle.c,v 1.11 2001/02/06 21:42:49 brianp Exp $ */ +/* $Id: s_triangle.c,v 1.12 2001/02/07 18:44:55 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1618,7 +1618,7 @@ static void general_textured_triangle( GLcontext *ctx, if (n>0) { \ if (flat_shade) { \ for (i=0;i<n;i++) { \ - GLdouble invQ = 1.0 / vv; \ + GLdouble invQ = vv ? (1.0 / vv) : 1.0; \ zspan[i] = FixedToDepth(ffz); \ fogspan[i] = fffog / 256; \ rgba[i][RCOMP] = r; \ @@ -1638,7 +1638,7 @@ static void general_textured_triangle( GLcontext *ctx, } \ else { \ for (i=0;i<n;i++) { \ - GLdouble invQ = 1.0 / vv; \ + GLdouble invQ = vv ? (1.0 / vv) : 1.0; \ zspan[i] = FixedToDepth(ffz); \ rgba[i][RCOMP] = FixedToInt(ffr); \ rgba[i][GCOMP] = FixedToInt(ffg); \ @@ -1713,7 +1713,7 @@ static void general_textured_spec_triangle1( GLcontext *ctx, if (n>0) { \ if (flat_shade) { \ for (i=0;i<n;i++) { \ - GLdouble invQ = 1.0 / vv; \ + GLdouble invQ = vv ? (1.0 / vv) : 1.0; \ zspan[i] = FixedToDepth(ffz); \ fogspan[i] = fffog / 256; \ rgba[i][RCOMP] = r; \ @@ -1736,7 +1736,7 @@ static void general_textured_spec_triangle1( GLcontext *ctx, } \ else { \ for (i=0;i<n;i++) { \ - GLdouble invQ = 1.0 / vv; \ + GLdouble invQ = vv ? (1.0 / vv) : 1.0; \ zspan[i] = FixedToDepth(ffz); \ fogspan[i] = fffog / 256; \ rgba[i][RCOMP] = FixedToInt(ffr); \ @@ -1844,7 +1844,7 @@ static void lambda_textured_triangle1( GLcontext *ctx, if (n>0) { \ if (flat_shade) { \ for (i=0;i<n;i++) { \ - GLdouble invQ = 1.0 / vv; \ + GLdouble invQ = vv ? (1.0 / vv) : 1.0; \ zspan[i] = FixedToDepth(ffz); \ fogspan[i] = fffog / 256; \ rgba[i][RCOMP] = r; \ @@ -1865,7 +1865,7 @@ static void lambda_textured_triangle1( GLcontext *ctx, } \ else { \ for (i=0;i<n;i++) { \ - GLdouble invQ = 1.0 / vv; \ + GLdouble invQ = vv ? (1.0 / vv) : 1.0; \ zspan[i] = FixedToDepth(ffz); \ fogspan[i] = fffog / 256; \ rgba[i][RCOMP] = FixedToInt(ffr); \ @@ -1952,7 +1952,7 @@ static void lambda_textured_spec_triangle1( GLcontext *ctx, if (n>0) { \ if (flat_shade) { \ for (i=0;i<n;i++) { \ - GLdouble invQ = 1.0 / vv; \ + GLdouble invQ = vv ? (1.0 / vv) : 1.0; \ zspan[i] = FixedToDepth(ffz); \ fogspan[i] = fffog / 256; \ rgba[i][RCOMP] = r; \ @@ -1976,7 +1976,7 @@ static void lambda_textured_spec_triangle1( GLcontext *ctx, } \ else { \ for (i=0;i<n;i++) { \ - GLdouble invQ = 1.0 / vv; \ + GLdouble invQ = vv ? (1.0 / vv) : 1.0; \ zspan[i] = FixedToDepth(ffz); \ fogspan[i] = fffog / 256; \ rgba[i][RCOMP] = FixedToInt(ffr); \ |