X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmath%2Fm_debug_xform.c;h=7d815664a149f10d21354db08d24ee86ad38c727;hb=dd6aafcf72e79d7caacd4406528da9b2003915da;hp=f556a4a333103dbc72e1412b137ad955938735c7;hpb=3c63452e64df7e10aa073c6c3b9492b1d7dabbb8;p=mesa.git diff --git a/src/mesa/math/m_debug_xform.c b/src/mesa/math/m_debug_xform.c index f556a4a3331..7d815664a14 100644 --- a/src/mesa/math/m_debug_xform.c +++ b/src/mesa/math/m_debug_xform.c @@ -1,10 +1,8 @@ -/* $Id: m_debug_xform.c,v 1.10 2002/10/24 23:57:24 brianp Exp $ */ - /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 6.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2004 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"), @@ -28,10 +26,10 @@ * Updated for P6 architecture by Gareth Hughes. */ -#include "glheader.h" -#include "context.h" -#include "macros.h" -#include "imports.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/macros.h" +#include "main/imports.h" #include "m_matrix.h" #include "m_xform.h" @@ -39,7 +37,12 @@ #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 */ /* Overhead of profiling counter in cycles. Automatically adjusted to @@ -106,7 +109,7 @@ static int *templates[7] = { m_2d_no_rot, m_3d }; -static int mtypes[7] = { +static enum GLmatrixtype mtypes[7] = { MATRIX_GENERAL, MATRIX_IDENTITY, MATRIX_3D_NO_ROT, @@ -158,12 +161,12 @@ static void init_matrix( GLfloat *m ) m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0; } -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_transform_function( transform_func func, int psize, - int mtype, long *cycles ) + int mtype, unsigned long *cycles ) { GLvector4f source[1], dest[1], ref[1]; GLmatrix mat[1]; @@ -180,11 +183,11 @@ static int test_transform_function( transform_func func, int psize, return 0; } - mat->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); + mat->m = (GLfloat *) _mesa_align_malloc( 16 * sizeof(GLfloat), 16 ); mat->type = mtypes[mtype]; m = mat->m; - ASSERT( ((GLuint)m & 15) == 0 ); + ASSERT( ((long)m & 15) == 0 ); init_matrix( m ); @@ -203,7 +206,8 @@ static int test_transform_function( transform_func func, int psize, case VAR: break; default: - abort(); + ASSERT(0); + return 0; } } } @@ -250,18 +254,18 @@ static int test_transform_function( transform_func func, int psize, for ( i = 0 ; i < TEST_COUNT ; i++ ) { for ( j = 0 ; j < 4 ; j++ ) { if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { - _mesa_printf(NULL, "-----------------------------\n" ); - _mesa_printf(NULL, "(i = %i, j = %i)\n", i, j ); - _mesa_printf(NULL, "%f \t %f \t [diff = %e - %i bit missed]\n", + printf("-----------------------------\n" ); + printf("(i = %i, j = %i)\n", i, j ); + 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] ) ); - _mesa_printf(NULL, "%f \t %f \t [diff = %e - %i bit missed]\n", + 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] ) ); - _mesa_printf(NULL, "%f \t %f \t [diff = %e - %i bit missed]\n", + 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] ) ); - _mesa_printf(NULL, "%f \t %f \t [diff = %e - %i bit missed]\n", + 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; @@ -269,67 +273,67 @@ static int test_transform_function( transform_func func, int psize, } } - ALIGN_FREE( mat->m ); + _mesa_align_free( mat->m ); return 1; } void _math_test_all_transform_functions( char *description ) { int psize, mtype; - long benchmark_tab[4][7]; + unsigned long benchmark_tab[4][7]; static int first_time = 1; 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(); - _mesa_printf(NULL, "counter overhead: %ld cycles\n\n", counter_overhead ); + printf("counter overhead: %lu cycles\n\n", counter_overhead ); } - _mesa_printf(NULL, "transform results after hooking in %s functions:\n", description ); + printf("transform results after hooking in %s functions:\n", description ); } #endif #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) { - _mesa_printf(NULL, "\n" ); + printf("\n" ); for ( psize = 1 ; psize <= 4 ; psize++ ) { - _mesa_printf(NULL, " p%d\t", psize ); + printf(" p%d\t", psize ); } - _mesa_printf(NULL, "\n--------------------------------------------------------\n" ); + printf("\n--------------------------------------------------------\n" ); } #endif for ( mtype = 0 ; mtype < 7 ; mtype++ ) { for ( psize = 1 ; psize <= 4 ; psize++ ) { transform_func func = _mesa_transform_tab[psize][mtypes[mtype]]; - long *cycles = &(benchmark_tab[psize-1][mtype]); + unsigned long *cycles = &(benchmark_tab[psize-1][mtype]); if ( test_transform_function( func, psize, mtype, cycles ) == 0 ) { char buf[100]; - _mesa_sprintf(NULL, buf, "_mesa_transform_tab[0][%d][%s] failed test (%s)", - psize, mstrings[mtype], description ); - _mesa_problem( NULL, buf ); + sprintf(buf, "_mesa_transform_tab[0][%d][%s] failed test (%s)", + psize, mstrings[mtype], description ); + _mesa_problem( NULL, "%s", buf ); } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) - _mesa_printf(NULL, " %li\t", benchmark_tab[psize-1][mtype] ); + printf(" %li\t", benchmark_tab[psize-1][mtype] ); #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) - _mesa_printf(NULL, " | [%s]\n", mstrings[mtype] ); + printf(" | [%s]\n", mstrings[mtype] ); #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) - _mesa_printf(NULL, "\n" ); + printf( "\n" ); #endif } -#endif /* DEBUG */ +#endif /* DEBUG_MATH */