From d0f28b6dd967cd74bafb37e1e203b5934981bed0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 31 Mar 2009 16:07:38 -0600 Subject: [PATCH] softpipe: use util_is_inf_or_nan() And print/warn NaN/Inf in print_vertex(). --- src/gallium/drivers/softpipe/sp_setup.c | 17 +++++------------ 1 file 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; -- 2.30.2