-/* $Id: m_debug_clip.c,v 1.1 2001/05/21 16:33:41 gareth Exp $ */
-
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 6.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
- * Gareth Hughes <gareth@valinux.com>
+ * Gareth Hughes
*/
#include "glheader.h"
#include "context.h"
#include "macros.h"
-#include "mem.h"
+#include "imports.h"
#include "m_matrix.h"
#include "m_xform.h"
#include "m_debug.h"
#include "m_debug_util.h"
-#ifdef DEBUG /* This code only used for debugging */
+#ifdef __UNIXOS2__
+/* The linker doesn't like empty files */
+static char dummy;
+#endif
+
+#ifdef DEBUG_MATH /* This code only used for debugging */
static clip_func *clip_tab[2] = {
_mesa_clip_tab,
"_mesa_clip_tab",
"_mesa_clip_np_tab"
};
+#ifdef RUN_DEBUG_BENCHMARK
static char *cstrings[2] = {
"clip, perspective divide",
"clip, no divide"
};
+#endif
/* =============================================================
* Cliptest tests
*/
-static GLfloat s[TEST_COUNT][4] ALIGN16;
-static GLfloat d[TEST_COUNT][4] ALIGN16;
-static GLfloat r[TEST_COUNT][4] ALIGN16;
+ALIGN16(static GLfloat, s[TEST_COUNT][4]);
+ALIGN16(static GLfloat, d[TEST_COUNT][4]);
+ALIGN16(static GLfloat, r[TEST_COUNT][4]);
+
static int test_cliptest_function( clip_func func, int np,
int psize, long *cycles )
}
if ( dco != rco ) {
- printf( "\n-----------------------------\n" );
- printf( "dco = 0x%02x rco = 0x%02x\n", dco, rco );
+ _mesa_printf( "\n-----------------------------\n" );
+ _mesa_printf( "dco = 0x%02x rco = 0x%02x\n", dco, rco );
return 0;
}
if ( dca != rca ) {
- printf( "\n-----------------------------\n" );
- printf( "dca = 0x%02x rca = 0x%02x\n", dca, rca );
+ _mesa_printf( "\n-----------------------------\n" );
+ _mesa_printf( "dca = 0x%02x rca = 0x%02x\n", dca, rca );
return 0;
}
for ( i = 0 ; i < TEST_COUNT ; i++ ) {
if ( dm[i] != rm[i] ) {
- printf( "\n-----------------------------\n" );
- printf( "(i = %i)\n", i );
- printf( "dm = 0x%02x rm = 0x%02x\n", dm[i], rm[i] );
+ _mesa_printf( "\n-----------------------------\n" );
+ _mesa_printf( "(i = %i)\n", i );
+ _mesa_printf( "dm = 0x%02x rm = 0x%02x\n", dm[i], rm[i] );
return 0;
}
}
for ( i = 0 ; i < TEST_COUNT ; i++ ) {
for ( j = 0 ; j < 4 ; j++ ) {
if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) {
- printf( "\n-----------------------------\n" );
- printf( "(i = %i, j = %i) dm = 0x%02x rm = 0x%02x\n",
+ _mesa_printf( "\n-----------------------------\n" );
+ _mesa_printf( "(i = %i, j = %i) dm = 0x%02x rm = 0x%02x\n",
i, j, dm[i], rm[i] );
- printf( "%f \t %f \t [diff = %e - %i bit missed]\n",
+ _mesa_printf( "%f \t %f \t [diff = %e - %i bit missed]\n",
d[i][0], r[i][0], r[i][0]-d[i][0],
MAX_PRECISION - significand_match( d[i][0], r[i][0] ) );
- printf( "%f \t %f \t [diff = %e - %i bit missed]\n",
+ _mesa_printf( "%f \t %f \t [diff = %e - %i bit missed]\n",
d[i][1], r[i][1], r[i][1]-d[i][1],
MAX_PRECISION - significand_match( d[i][1], r[i][1] ) );
- printf( "%f \t %f \t [diff = %e - %i bit missed]\n",
+ _mesa_printf( "%f \t %f \t [diff = %e - %i bit missed]\n",
d[i][2], r[i][2], r[i][2]-d[i][2],
MAX_PRECISION - significand_match( d[i][2], r[i][2] ) );
- printf( "%f \t %f \t [diff = %e - %i bit missed]\n",
+ _mesa_printf( "%f \t %f \t [diff = %e - %i bit missed]\n",
d[i][3], r[i][3], r[i][3]-d[i][3],
MAX_PRECISION - significand_match( d[i][3], r[i][3] ) );
return 0;
if ( first_time ) {
first_time = 0;
- mesa_profile = getenv( "MESA_PROFILE" );
+ mesa_profile = _mesa_getenv( "MESA_PROFILE" );
}
#ifdef RUN_DEBUG_BENCHMARK
if ( mesa_profile ) {
if ( !counter_overhead ) {
INIT_COUNTER();
- printf( "counter overhead: %ld cycles\n\n", counter_overhead );
+ _mesa_printf( "counter overhead: %ld cycles\n\n", counter_overhead );
}
- printf( "cliptest results after hooking in %s functions:\n", description );
+ _mesa_printf( "cliptest results after hooking in %s functions:\n", description );
}
#endif
#ifdef RUN_DEBUG_BENCHMARK
if ( mesa_profile ) {
- printf( "\n\t" );
+ _mesa_printf( "\n\t" );
for ( psize = 2 ; psize <= 4 ; psize++ ) {
- printf( " p%d\t", psize );
+ _mesa_printf( " p%d\t", psize );
}
- printf( "\n--------------------------------------------------------\n\t" );
+ _mesa_printf( "\n--------------------------------------------------------\n\t" );
}
#endif
if ( test_cliptest_function( func, np, psize, cycles ) == 0 ) {
char buf[100];
- sprintf( buf, "%s[%d] failed test (%s)",
+ _mesa_sprintf( buf, "%s[%d] failed test (%s)",
cnames[np], psize, description );
_mesa_problem( NULL, buf );
}
#ifdef RUN_DEBUG_BENCHMARK
if ( mesa_profile )
- printf( " %li\t", benchmark_tab[np][psize-1] );
+ _mesa_printf( " %li\t", benchmark_tab[np][psize-1] );
#endif
}
#ifdef RUN_DEBUG_BENCHMARK
if ( mesa_profile )
- printf( " | [%s]\n\t", cstrings[np] );
+ _mesa_printf( " | [%s]\n\t", cstrings[np] );
#endif
}
#ifdef RUN_DEBUG_BENCHMARK
if ( mesa_profile )
- printf( "\n" );
+ _mesa_printf( "\n" );
#endif
}
-#endif /* DEBUG */
+#endif /* DEBUG_MATH */