diff options
author | Keith Whitwell <[email protected]> | 2001-12-05 10:22:55 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2001-12-05 10:22:55 +0000 |
commit | 51aa3d2f3000aa01bfac7a4df7bb9245dba45e59 (patch) | |
tree | 10aca8d9146f9c99b810e6e13a37437108c92c2c | |
parent | 0c1f42ef2903bef2708475c735374870b7a81c5c (diff) |
Add INF_OR_NAN tests to swrast functions
-rw-r--r-- | src/mesa/swrast/s_aalinetemp.h | 4 | ||||
-rw-r--r-- | src/mesa/swrast/s_aatritemp.h | 4 | ||||
-rw-r--r-- | src/mesa/swrast/s_linetemp.h | 9 | ||||
-rw-r--r-- | src/mesa/swrast/s_pointtemp.h | 10 | ||||
-rw-r--r-- | src/mesa/swrast/s_tritemp.h | 4 |
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..4960615b75f 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.14.2.1 2001/12/05 10:22:55 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..5c1e9e9fb87 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.21.2.1 2001/12/05 10:22:55 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..880c25a9d35 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.9.2.1 2001/12/05 10:22:55 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..f4831f3a0bf 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.10.2.1 2001/12/05 10:22:55 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..ebfb324df48 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.27.2.1 2001/12/05 10:22:55 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; |