summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-03-31 16:07:38 -0600
committerBrian Paul <[email protected]>2009-03-31 16:21:51 -0600
commitd0f28b6dd967cd74bafb37e1e203b5934981bed0 (patch)
treefce9bfb4cad64fd999f7d7f5ac17151b4fb2309e
parent3705d03b0fbe349dee0221d982965a0590bc7cb0 (diff)
softpipe: use util_is_inf_or_nan()
And print/warn NaN/Inf in print_vertex().
-rw-r--r--src/gallium/drivers/softpipe/sp_setup.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c
index 711343abe67..accc692b66f 100644
--- a/src/gallium/drivers/softpipe/sp_setup.c
+++ b/src/gallium/drivers/softpipe/sp_setup.c
@@ -252,16 +252,6 @@ static PIPE_THREAD_ROUTINE( quad_thread, param )
#endif
-/**
- * Test if x is NaN or +/- infinity.
- */
-static INLINE boolean
-is_inf_or_nan(float x)
-{
- union fi tmp;
- tmp.f = x;
- return !(int)((unsigned int)((tmp.i & 0x7fffffff)-0x7f800000) >> 31);
-}
/**
@@ -506,6 +496,9 @@ static void print_vertex(const struct setup_context *setup,
for (i = 0; i < setup->quad.nr_attrs; i++) {
debug_printf(" %d: %f %f %f %f\n", i,
v[i][0], v[i][1], v[i][2], v[i][3]);
+ if (util_is_inf_or_nan(v[i][0])) {
+ debug_printf(" NaN!\n");
+ }
}
}
#endif
@@ -595,7 +588,7 @@ static boolean setup_sort_vertices( struct setup_context *setup,
debug_printf("%s one-over-area %f area %f det %f\n",
__FUNCTION__, setup->oneoverarea, area, det );
*/
- if (is_inf_or_nan(setup->oneoverarea))
+ if (util_is_inf_or_nan(setup->oneoverarea))
return FALSE;
}
@@ -1065,7 +1058,7 @@ setup_line_coefficients(struct setup_context *setup,
/* NOTE: this is not really area but something proportional to it */
area = setup->emaj.dx * setup->emaj.dx + setup->emaj.dy * setup->emaj.dy;
- if (area == 0.0f || is_inf_or_nan(area))
+ if (area == 0.0f || util_is_inf_or_nan(area))
return FALSE;
setup->oneoverarea = 1.0f / area;