aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2001-12-05 10:24:31 +0000
committerKeith Whitwell <[email protected]>2001-12-05 10:24:31 +0000
commitef4f5b391e560e535b25b372f797e41edeef09f1 (patch)
treee7da9cecd378bc946646b4211e003f0ffc39a01d /src/mesa
parentaecfb51c304a6d71810ba5ae6ab9c4e344b816a9 (diff)
add inf and nan tests to swrast functions
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/swrast/s_aalinetemp.h4
-rw-r--r--src/mesa/swrast/s_aatritemp.h4
-rw-r--r--src/mesa/swrast/s_linetemp.h9
-rw-r--r--src/mesa/swrast/s_pointtemp.h10
-rw-r--r--src/mesa/swrast/s_tritemp.h4
5 files changed, 23 insertions, 8 deletions
diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h
index 2d8f8492e0e..f645e552417 100644
--- a/src/mesa/swrast/s_aalinetemp.h
+++ b/src/mesa/swrast/s_aalinetemp.h
@@ -1,4 +1,4 @@
-/* $Id: s_aalinetemp.h,v 1.14 2001/09/19 20:30:44 kschultz Exp $ */
+/* $Id: s_aalinetemp.h,v 1.15 2001/12/05 10:24:31 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -162,7 +162,7 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
line.len = (GLfloat) sqrt(line.dx * line.dx + line.dy * line.dy);
line.halfWidth = 0.5F * ctx->Line.Width;
- if (line.len == 0.0)
+ if (line.len == 0.0 || IS_INF_OR_NAN(line.len))
return;
line.xAdj = line.dx / line.len * line.halfWidth;
diff --git a/src/mesa/swrast/s_aatritemp.h b/src/mesa/swrast/s_aatritemp.h
index 69f102858f6..dac2111051e 100644
--- a/src/mesa/swrast/s_aatritemp.h
+++ b/src/mesa/swrast/s_aatritemp.h
@@ -1,4 +1,4 @@
-/* $Id: s_aatritemp.h,v 1.21 2001/09/19 20:30:44 kschultz Exp $ */
+/* $Id: s_aatritemp.h,v 1.22 2001/12/05 10:24:31 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -149,7 +149,7 @@
const GLfloat area = majDx * botDy - botDx * majDy;
ltor = (GLboolean) (area < 0.0F);
/* Do backface culling */
- if (area * bf < 0 || area * area < .0025)
+ if (area * bf < 0 || area == 0 || IS_INF_OR_NAN(area))
return;
}
diff --git a/src/mesa/swrast/s_linetemp.h b/src/mesa/swrast/s_linetemp.h
index 06356943408..a305a45d58d 100644
--- a/src/mesa/swrast/s_linetemp.h
+++ b/src/mesa/swrast/s_linetemp.h
@@ -1,4 +1,4 @@
-/* $Id: s_linetemp.h,v 1.9 2001/07/13 20:07:37 brianp Exp $ */
+/* $Id: s_linetemp.h,v 1.10 2001/12/05 10:24:31 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -180,6 +180,13 @@
}
#endif
+ /* Cull primitives with malformed coordinates.
+ */
+ {
+ float tmp = vert0->win[0] + vert0->win[1] + vert1->win[0] + vert1->win[1];
+ if (IS_INF_OR_NAN(tmp))
+ return;
+ }
/*
* Despite being clipped to the view volume, the line's window coordinates
diff --git a/src/mesa/swrast/s_pointtemp.h b/src/mesa/swrast/s_pointtemp.h
index 482f42b8eb6..4c843b3f84e 100644
--- a/src/mesa/swrast/s_pointtemp.h
+++ b/src/mesa/swrast/s_pointtemp.h
@@ -1,4 +1,4 @@
-/* $Id: s_pointtemp.h,v 1.10 2001/09/19 20:30:44 kschultz Exp $ */
+/* $Id: s_pointtemp.h,v 1.11 2001/12/05 10:24:31 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -119,6 +119,14 @@ NAME ( GLcontext *ctx, const SWvertex *vert )
size = ctx->Point._Size;
#endif
+ /* Cull primitives with malformed coordinates.
+ */
+ {
+ float tmp = vert->win[0] + vert->win[1];
+ if (IS_INF_OR_NAN(tmp))
+ return;
+ }
+
#if FLAGS & SPRITE
{
SWcontext *swctx = SWRAST_CONTEXT(ctx);
diff --git a/src/mesa/swrast/s_tritemp.h b/src/mesa/swrast/s_tritemp.h
index 5c9d79d5f1f..4940dab17ea 100644
--- a/src/mesa/swrast/s_tritemp.h
+++ b/src/mesa/swrast/s_tritemp.h
@@ -1,4 +1,4 @@
-/* $Id: s_tritemp.h,v 1.27 2001/09/19 20:30:44 kschultz Exp $ */
+/* $Id: s_tritemp.h,v 1.28 2001/12/05 10:24:31 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -199,7 +199,7 @@
if (area * bf < 0.0)
return;
- if (area == 0.0F)
+ if (area == 0.0F || IS_INF_OR_NAN(area))
return;
oneOverArea = 1.0F / area;