diff options
Diffstat (limited to 'xc/extras/Mesa/src/math')
-rw-r--r-- | xc/extras/Mesa/src/math/m_debug.h | 2 | ||||
-rw-r--r-- | xc/extras/Mesa/src/math/m_debug_clip.c | 54 | ||||
-rw-r--r-- | xc/extras/Mesa/src/math/m_debug_norm.c | 97 | ||||
-rw-r--r-- | xc/extras/Mesa/src/math/m_debug_util.h | 11 | ||||
-rw-r--r-- | xc/extras/Mesa/src/math/m_debug_xform.c | 40 | ||||
-rw-r--r-- | xc/extras/Mesa/src/math/m_matrix.c | 290 | ||||
-rw-r--r-- | xc/extras/Mesa/src/math/m_norm_tmp.h | 161 | ||||
-rw-r--r-- | xc/extras/Mesa/src/math/m_translate.c | 5 | ||||
-rw-r--r-- | xc/extras/Mesa/src/math/m_vector.c | 29 | ||||
-rw-r--r-- | xc/extras/Mesa/src/math/m_xform.c | 3 | ||||
-rw-r--r-- | xc/extras/Mesa/src/math/m_xform.h | 4 |
11 files changed, 392 insertions, 304 deletions
diff --git a/xc/extras/Mesa/src/math/m_debug.h b/xc/extras/Mesa/src/math/m_debug.h index 7cb556e7f..6476b6de2 100644 --- a/xc/extras/Mesa/src/math/m_debug.h +++ b/xc/extras/Mesa/src/math/m_debug.h @@ -23,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Gareth Hughes <gareth@valinux.com> + * Gareth Hughes */ #ifndef __M_DEBUG_H__ diff --git a/xc/extras/Mesa/src/math/m_debug_clip.c b/xc/extras/Mesa/src/math/m_debug_clip.c index cc719ee5d..a5969ead2 100644 --- a/xc/extras/Mesa/src/math/m_debug_clip.c +++ b/xc/extras/Mesa/src/math/m_debug_clip.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 5.0 * * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * @@ -23,13 +23,13 @@ * 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" @@ -47,10 +47,12 @@ static char *cnames[2] = { "_mesa_clip_tab", "_mesa_clip_np_tab" }; +#ifdef RUN_DEBUG_BENCHMARK static char *cstrings[2] = { "clip, perspective divide", "clip, no divide" }; +#endif /* ============================================================= @@ -252,20 +254,20 @@ static int test_cliptest_function( clip_func func, int np, } if ( dco != rco ) { - printf( "\n-----------------------------\n" ); - printf( "dco = 0x%02x rco = 0x%02x\n", dco, rco ); + _mesa_printf(NULL, "\n-----------------------------\n" ); + _mesa_printf(NULL, "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(NULL, "\n-----------------------------\n" ); + _mesa_printf(NULL, "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(NULL, "\n-----------------------------\n" ); + _mesa_printf(NULL, "(i = %i)\n", i ); + _mesa_printf(NULL, "dm = 0x%02x rm = 0x%02x\n", dm[i], rm[i] ); return 0; } } @@ -279,19 +281,19 @@ static int test_cliptest_function( clip_func func, int np, 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(NULL, "\n-----------------------------\n" ); + _mesa_printf(NULL, "(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(NULL, "%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(NULL, "%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(NULL, "%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(NULL, "%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; @@ -310,26 +312,26 @@ void _math_test_all_cliptest_functions( char *description ) 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(NULL, "counter overhead: %ld cycles\n\n", counter_overhead ); } - printf( "cliptest results after hooking in %s functions:\n", description ); + _mesa_printf(NULL, "cliptest results after hooking in %s functions:\n", description ); } #endif #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) { - printf( "\n\t" ); + _mesa_printf(NULL, "\n\t" ); for ( psize = 2 ; psize <= 4 ; psize++ ) { - printf( " p%d\t", psize ); + _mesa_printf(NULL, " p%d\t", psize ); } - printf( "\n--------------------------------------------------------\n\t" ); + _mesa_printf(NULL, "\n--------------------------------------------------------\n\t" ); } #endif @@ -340,23 +342,23 @@ void _math_test_all_cliptest_functions( char *description ) if ( test_cliptest_function( func, np, psize, cycles ) == 0 ) { char buf[100]; - sprintf( buf, "%s[%d] failed test (%s)", + _mesa_sprintf(NULL, 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(NULL, " %li\t", benchmark_tab[np][psize-1] ); #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) - printf( " | [%s]\n\t", cstrings[np] ); + _mesa_printf(NULL, " | [%s]\n\t", cstrings[np] ); #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) - printf( "\n" ); + _mesa_printf(NULL, "\n" ); #endif } diff --git a/xc/extras/Mesa/src/math/m_debug_norm.c b/xc/extras/Mesa/src/math/m_debug_norm.c index 4d9d40bbc..e09b502c1 100644 --- a/xc/extras/Mesa/src/math/m_debug_norm.c +++ b/xc/extras/Mesa/src/math/m_debug_norm.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -23,13 +23,13 @@ * 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 "mmath.h" #include "m_matrix.h" @@ -118,14 +118,14 @@ static char *norm_strings[8] = { static void ref_norm_transform_rescale( const GLmatrix *mat, GLfloat scale, - const GLvector3f *in, + const GLvector4f *in, const GLfloat *lengths, - GLvector3f *dest ) + GLvector4f *dest ) { GLuint i; const GLfloat *s = in->start; const GLfloat *m = mat->inv; - GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; + GLfloat (*out)[4] = (GLfloat (*)[4]) dest->start; (void) lengths; @@ -141,14 +141,14 @@ static void ref_norm_transform_rescale( const GLmatrix *mat, static void ref_norm_transform_normalize( const GLmatrix *mat, GLfloat scale, - const GLvector3f *in, + const GLvector4f *in, const GLfloat *lengths, - GLvector3f *dest ) + GLvector4f *dest ) { GLuint i; const GLfloat *s = in->start; const GLfloat *m = mat->inv; - GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; + GLfloat (*out)[4] = (GLfloat (*)[4]) dest->start; for ( i = 0 ; i < in->count ; i++ ) { GLfloat t[3]; @@ -180,12 +180,21 @@ static void ref_norm_transform_normalize( const GLmatrix *mat, * Normal transformation tests */ +static void init_matrix( GLfloat *m ) +{ + m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0; + m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0; + m[2] = 44.0; m[6] = 9.0; m[10] = 7.0; m[14] = 3.0; + m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0; +} + + static int test_norm_function( normal_func func, int mtype, long *cycles ) { - GLvector3f source[1], dest[1], dest2[1], ref[1], ref2[1]; + GLvector4f source[1], dest[1], dest2[1], ref[1], ref2[1]; GLmatrix mat[1]; - GLfloat s[TEST_COUNT][5], d[TEST_COUNT][3], r[TEST_COUNT][3]; - GLfloat d2[TEST_COUNT][3], r2[TEST_COUNT][3], length[TEST_COUNT]; + GLfloat s[TEST_COUNT][5], d[TEST_COUNT][4], r[TEST_COUNT][4]; + GLfloat d2[TEST_COUNT][4], r2[TEST_COUNT][4], length[TEST_COUNT]; GLfloat scale; GLfloat *m; int i, j; @@ -231,34 +240,34 @@ static int test_norm_function( normal_func func, int mtype, long *cycles ) length[i] = 1 / sqrt( LEN_SQUARED_3FV( s[i] ) ); } - source->data = (GLfloat(*)[3])s; - source->start = (GLfloat *)s; + source->data = (GLfloat(*)[4]) s; + source->start = (GLfloat *) s; source->count = TEST_COUNT; source->stride = sizeof(s[0]); source->flags = 0; - dest->data = (GLfloat(*)[3])d; - dest->start = (GLfloat *)d; + dest->data = d; + dest->start = (GLfloat *) d; dest->count = TEST_COUNT; - dest->stride = sizeof(float[3]); + dest->stride = sizeof(float[4]); dest->flags = 0; - dest2->data = (GLfloat(*)[3])d2; - dest2->start = (GLfloat *)d2; + dest2->data = d2; + dest2->start = (GLfloat *) d2; dest2->count = TEST_COUNT; - dest2->stride = sizeof(float[3]); + dest2->stride = sizeof(float[4]); dest2->flags = 0; - ref->data = (GLfloat(*)[3])r; - ref->start = (GLfloat *)r; + ref->data = r; + ref->start = (GLfloat *) r; ref->count = TEST_COUNT; - ref->stride = sizeof(float[3]); + ref->stride = sizeof(float[4]); ref->flags = 0; - ref2->data = (GLfloat(*)[3])r2; - ref2->start = (GLfloat *)r2; + ref2->data = r2; + ref2->start = (GLfloat *) r2; ref2->count = TEST_COUNT; - ref2->stride = sizeof(float[3]); + ref2->stride = sizeof(float[4]); ref2->flags = 0; if ( norm_normalize_types[mtype] == 0 ) { @@ -281,15 +290,15 @@ static int test_norm_function( normal_func func, int mtype, long *cycles ) for ( i = 0 ; i < TEST_COUNT ; i++ ) { for ( j = 0 ; j < 3 ; j++ ) { if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { - printf( "-----------------------------\n" ); - printf( "(i = %i, j = %i)\n", i, j ); - printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + _mesa_printf(NULL, "-----------------------------\n" ); + _mesa_printf(NULL, "(i = %i, j = %i)\n", i, j ); + _mesa_printf(NULL, "%f \t %f \t [ratio = %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 [ratio = %e - %i bit missed]\n", + _mesa_printf(NULL, "%f \t %f \t [ratio = %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 [ratio = %e - %i bit missed]\n", + _mesa_printf(NULL, "%f \t %f \t [ratio = %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] ) ); return 0; @@ -297,15 +306,15 @@ static int test_norm_function( normal_func func, int mtype, long *cycles ) if ( norm_normalize_types[mtype] != 0 ) { if ( significand_match( d2[i][j], r2[i][j] ) < REQUIRED_PRECISION ) { - printf( "------------------- precalculated length case ------\n" ); - printf( "(i = %i, j = %i)\n", i, j ); - printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + _mesa_printf(NULL, "------------------- precalculated length case ------\n" ); + _mesa_printf(NULL, "(i = %i, j = %i)\n", i, j ); + _mesa_printf(NULL, "%f \t %f \t [ratio = %e - %i bit missed]\n", d2[i][0], r2[i][0], r2[i][0]/d2[i][0], MAX_PRECISION - significand_match( d2[i][0], r2[i][0] ) ); - printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + _mesa_printf(NULL, "%f \t %f \t [ratio = %e - %i bit missed]\n", d2[i][1], r2[i][1], r2[i][1]/d2[i][1], MAX_PRECISION - significand_match( d2[i][1], r2[i][1] ) ); - printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + _mesa_printf(NULL, "%f \t %f \t [ratio = %e - %i bit missed]\n", d2[i][2], r2[i][2], r2[i][2]/d2[i][2], MAX_PRECISION - significand_match( d2[i][2], r2[i][2] ) ); return 0; @@ -333,11 +342,11 @@ void _math_test_all_normal_transform_functions( char *description ) if ( mesa_profile ) { if ( !counter_overhead ) { INIT_COUNTER(); - printf( "counter overhead: %ld cycles\n\n", counter_overhead ); + _mesa_printf(NULL, "counter overhead: %ld cycles\n\n", counter_overhead ); } - printf( "normal transform results after hooking in %s functions:\n", + _mesa_printf(NULL, "normal transform results after hooking in %s functions:\n", description ); - printf( "\n-------------------------------------------------------\n" ); + _mesa_printf(NULL, "\n-------------------------------------------------------\n" ); } #endif @@ -347,21 +356,21 @@ void _math_test_all_normal_transform_functions( char *description ) if ( test_norm_function( func, mtype, cycles ) == 0 ) { char buf[100]; - sprintf( buf, "_mesa_normal_tab[0][%s] failed test (%s)", + _mesa_sprintf(NULL, buf, "_mesa_normal_tab[0][%s] failed test (%s)", norm_strings[mtype], description ); _mesa_problem( NULL, buf ); } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) { - printf( " %li\t", benchmark_tab[mtype] ); - printf( " | [%s]\n", norm_strings[mtype] ); + _mesa_printf(NULL, " %li\t", benchmark_tab[mtype] ); + _mesa_printf(NULL, " | [%s]\n", norm_strings[mtype] ); } #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) { - printf( "\n" ); + _mesa_printf(NULL, "\n" ); fflush( stdout ); } #endif diff --git a/xc/extras/Mesa/src/math/m_debug_util.h b/xc/extras/Mesa/src/math/m_debug_util.h index 4b74b420f..9b89c90e3 100644 --- a/xc/extras/Mesa/src/math/m_debug_util.h +++ b/xc/extras/Mesa/src/math/m_debug_util.h @@ -23,7 +23,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Gareth Hughes <gareth@valinux.com> + * Gareth Hughes */ #ifndef __M_DEBUG_UTIL_H__ @@ -262,15 +262,6 @@ static int significand_match( GLfloat a, GLfloat b ) enum { NIL = 0, ONE = 1, NEG = -1, VAR = 2 }; -static void init_matrix( GLfloat *m ) -{ - m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0; - m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0; - m[2] = 44.0; m[6] = 9.0; m[10] = 7.0; m[14] = 3.0; - m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0; -} - - /* Ensure our arrays are correctly aligned. */ #if defined(__GNUC__) diff --git a/xc/extras/Mesa/src/math/m_debug_xform.c b/xc/extras/Mesa/src/math/m_debug_xform.c index eb81e019d..da65a2205 100644 --- a/xc/extras/Mesa/src/math/m_debug_xform.c +++ b/xc/extras/Mesa/src/math/m_debug_xform.c @@ -30,7 +30,7 @@ #include "glheader.h" #include "context.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "m_matrix.h" #include "m_xform.h" @@ -149,6 +149,14 @@ static void ref_transform( GLvector4f *dst, * Vertex transformation tests */ +static void init_matrix( GLfloat *m ) +{ + m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0; + m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0; + m[2] = 44.0; m[6] = 9.0; m[10] = 7.0; m[14] = 3.0; + 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; @@ -241,18 +249,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 ) { - printf( "-----------------------------\n" ); - printf( "(i = %i, j = %i)\n", i, j ); - printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + _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", 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(NULL, "%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(NULL, "%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(NULL, "%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; @@ -279,19 +287,19 @@ void _math_test_all_transform_functions( char *description ) if ( mesa_profile ) { if ( !counter_overhead ) { INIT_COUNTER(); - printf( "counter overhead: %ld cycles\n\n", counter_overhead ); + _mesa_printf(NULL, "counter overhead: %ld cycles\n\n", counter_overhead ); } - printf( "transform results after hooking in %s functions:\n", description ); + _mesa_printf(NULL, "transform results after hooking in %s functions:\n", description ); } #endif #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) { - printf( "\n" ); + _mesa_printf(NULL, "\n" ); for ( psize = 1 ; psize <= 4 ; psize++ ) { - printf( " p%d\t", psize ); + _mesa_printf(NULL, " p%d\t", psize ); } - printf( "\n--------------------------------------------------------\n" ); + _mesa_printf(NULL, "\n--------------------------------------------------------\n" ); } #endif @@ -302,23 +310,23 @@ void _math_test_all_transform_functions( char *description ) if ( test_transform_function( func, psize, mtype, cycles ) == 0 ) { char buf[100]; - sprintf( buf, "_mesa_transform_tab[0][%d][%s] failed test (%s)", + _mesa_sprintf(NULL, buf, "_mesa_transform_tab[0][%d][%s] failed test (%s)", psize, mstrings[mtype], description ); _mesa_problem( NULL, buf ); } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) - printf( " %li\t", benchmark_tab[psize-1][mtype] ); + _mesa_printf(NULL, " %li\t", benchmark_tab[psize-1][mtype] ); #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) - printf( " | [%s]\n", mstrings[mtype] ); + _mesa_printf(NULL, " | [%s]\n", mstrings[mtype] ); #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) - printf( "\n" ); + _mesa_printf(NULL, "\n" ); #endif } diff --git a/xc/extras/Mesa/src/math/m_matrix.c b/xc/extras/Mesa/src/math/m_matrix.c index c71f7e3b5..9f17e2cfc 100644 --- a/xc/extras/Mesa/src/math/m_matrix.c +++ b/xc/extras/Mesa/src/math/m_matrix.c @@ -1,7 +1,7 @@ /* * Mesa 3-D graphics library - * Version: 4.0.2 + * Version: 4.1 * * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. * @@ -33,11 +33,10 @@ * 3. Transformation of a point p by a matrix M is: p' = M * p */ -#include <math.h> - #include "glheader.h" +#include "imports.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "mmath.h" #include "m_matrix.h" @@ -135,25 +134,25 @@ static void print_matrix_floats( const GLfloat m[16] ) { int i; for (i=0;i<4;i++) { - fprintf(stderr,"\t%f %f %f %f\n", m[i], m[4+i], m[8+i], m[12+i] ); + _mesa_debug(NULL,"\t%f %f %f %f\n", m[i], m[4+i], m[8+i], m[12+i] ); } } void _math_matrix_print( const GLmatrix *m ) { - fprintf(stderr, "Matrix type: %s, flags: %x\n", types[m->type], m->flags); + _mesa_debug(NULL, "Matrix type: %s, flags: %x\n", types[m->type], m->flags); print_matrix_floats(m->m); - fprintf(stderr, "Inverse: \n"); + _mesa_debug(NULL, "Inverse: \n"); if (m->inv) { GLfloat prod[16]; print_matrix_floats(m->inv); matmul4(prod, m->m, m->inv); - fprintf(stderr, "Mat * Inverse:\n"); + _mesa_debug(NULL, "Mat * Inverse:\n"); print_matrix_floats(prod); } else { - fprintf(stderr, " - not available\n"); + _mesa_debug(NULL, " - not available\n"); } } @@ -467,6 +466,8 @@ static GLboolean invert_matrix_2d_no_rot( GLmatrix *mat ) } +#if 0 +/* broken */ static GLboolean invert_matrix_perspective( GLmatrix *mat ) { const GLfloat *in = mat->m; @@ -491,6 +492,7 @@ static GLboolean invert_matrix_perspective( GLmatrix *mat ) return GL_TRUE; } +#endif typedef GLboolean (*inv_mat_func)( GLmatrix *mat ); @@ -534,123 +536,181 @@ static GLboolean matrix_invert( GLmatrix *mat ) /* * Generate a 4x4 transformation matrix from glRotate parameters, and * postmultiply the input matrix by it. + * This function contributed by Erich Boleyn (erich@uruk.org). + * Optimizatios contributed by Rudolf Opalla (rudi@khm.de). */ void _math_matrix_rotate( GLmatrix *mat, GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) { - /* This function contributed by Erich Boleyn (erich@uruk.org) */ - GLfloat mag, s, c; - GLfloat xx, yy, zz, xy, yz, zx, xs, ys, zs, one_c; + GLfloat xx, yy, zz, xy, yz, zx, xs, ys, zs, one_c, s, c; GLfloat m[16]; + GLboolean optimized; s = (GLfloat) sin( angle * DEG2RAD ); c = (GLfloat) cos( angle * DEG2RAD ); - mag = (GLfloat) GL_SQRT( x*x + y*y + z*z ); + MEMCPY(m, Identity, sizeof(GLfloat)*16); + optimized = GL_FALSE; - if (mag <= 1.0e-4) { - /* generate an identity matrix and return */ - MEMCPY(m, Identity, sizeof(GLfloat)*16); - return; - } +#define M(row,col) m[col*4+row] - x /= mag; - y /= mag; - z /= mag; + if (x == 0.0F) { + if (y == 0.0F) { + if (z != 0.0F) { + optimized = GL_TRUE; + /* rotate only around z-axis */ + M(0,0) = c; + M(1,1) = c; + if (z < 0.0F) { + M(0,1) = s; + M(1,0) = -s; + } + else { + M(0,1) = -s; + M(1,0) = s; + } + } + } + else if (z == 0.0F) { + optimized = GL_TRUE; + /* rotate only around y-axis */ + M(0,0) = c; + M(2,2) = c; + if (y < 0.0F) { + M(0,2) = -s; + M(2,0) = s; + } + else { + M(0,2) = s; + M(2,0) = -s; + } + } + } + else if (y == 0.0F) { + if (z == 0.0F) { + optimized = GL_TRUE; + /* rotate only around x-axis */ + M(1,1) = c; + M(2,2) = c; + if (y < 0.0F) { + M(1,2) = s; + M(2,1) = -s; + } + else { + M(1,2) = -s; + M(2,1) = s; + } + } + } -#define M(row,col) m[col*4+row] + if (!optimized) { + const GLfloat mag = (GLfloat) GL_SQRT(x * x + y * y + z * z); - /* - * Arbitrary axis rotation matrix. - * - * This is composed of 5 matrices, Rz, Ry, T, Ry', Rz', multiplied - * like so: Rz * Ry * T * Ry' * Rz'. T is the final rotation - * (which is about the X-axis), and the two composite transforms - * Ry' * Rz' and Rz * Ry are (respectively) the rotations necessary - * from the arbitrary axis to the X-axis then back. They are - * all elementary rotations. - * - * Rz' is a rotation about the Z-axis, to bring the axis vector - * into the x-z plane. Then Ry' is applied, rotating about the - * Y-axis to bring the axis vector parallel with the X-axis. The - * rotation about the X-axis is then performed. Ry and Rz are - * simply the respective inverse transforms to bring the arbitrary - * axis back to it's original orientation. The first transforms - * Rz' and Ry' are considered inverses, since the data from the - * arbitrary axis gives you info on how to get to it, not how - * to get away from it, and an inverse must be applied. - * - * The basic calculation used is to recognize that the arbitrary - * axis vector (x, y, z), since it is of unit length, actually - * represents the sines and cosines of the angles to rotate the - * X-axis to the same orientation, with theta being the angle about - * Z and phi the angle about Y (in the order described above) - * as follows: - * - * cos ( theta ) = x / sqrt ( 1 - z^2 ) - * sin ( theta ) = y / sqrt ( 1 - z^2 ) - * - * cos ( phi ) = sqrt ( 1 - z^2 ) - * sin ( phi ) = z - * - * Note that cos ( phi ) can further be inserted to the above - * formulas: - * - * cos ( theta ) = x / cos ( phi ) - * sin ( theta ) = y / sin ( phi ) - * - * ...etc. Because of those relations and the standard trigonometric - * relations, it is pssible to reduce the transforms down to what - * is used below. It may be that any primary axis chosen will give the - * same results (modulo a sign convention) using thie method. - * - * Particularly nice is to notice that all divisions that might - * have caused trouble when parallel to certain planes or - * axis go away with care paid to reducing the expressions. - * After checking, it does perform correctly under all cases, since - * in all the cases of division where the denominator would have - * been zero, the numerator would have been zero as well, giving - * the expected result. - */ + if (mag <= 1.0e-4) { + /* no rotation, leave mat as-is */ + return; + } - xx = x * x; - yy = y * y; - zz = z * z; - xy = x * y; - yz = y * z; - zx = z * x; - xs = x * s; - ys = y * s; - zs = z * s; - one_c = 1.0F - c; - - M(0,0) = (one_c * xx) + c; - M(0,1) = (one_c * xy) - zs; - M(0,2) = (one_c * zx) + ys; - M(0,3) = 0.0F; - - M(1,0) = (one_c * xy) + zs; - M(1,1) = (one_c * yy) + c; - M(1,2) = (one_c * yz) - xs; - M(1,3) = 0.0F; - - M(2,0) = (one_c * zx) - ys; - M(2,1) = (one_c * yz) + xs; - M(2,2) = (one_c * zz) + c; - M(2,3) = 0.0F; - - M(3,0) = 0.0F; - M(3,1) = 0.0F; - M(3,2) = 0.0F; - M(3,3) = 1.0F; + x /= mag; + y /= mag; + z /= mag; + + + /* + * Arbitrary axis rotation matrix. + * + * This is composed of 5 matrices, Rz, Ry, T, Ry', Rz', multiplied + * like so: Rz * Ry * T * Ry' * Rz'. T is the final rotation + * (which is about the X-axis), and the two composite transforms + * Ry' * Rz' and Rz * Ry are (respectively) the rotations necessary + * from the arbitrary axis to the X-axis then back. They are + * all elementary rotations. + * + * Rz' is a rotation about the Z-axis, to bring the axis vector + * into the x-z plane. Then Ry' is applied, rotating about the + * Y-axis to bring the axis vector parallel with the X-axis. The + * rotation about the X-axis is then performed. Ry and Rz are + * simply the respective inverse transforms to bring the arbitrary + * axis back to it's original orientation. The first transforms + * Rz' and Ry' are considered inverses, since the data from the + * arbitrary axis gives you info on how to get to it, not how + * to get away from it, and an inverse must be applied. + * + * The basic calculation used is to recognize that the arbitrary + * axis vector (x, y, z), since it is of unit length, actually + * represents the sines and cosines of the angles to rotate the + * X-axis to the same orientation, with theta being the angle about + * Z and phi the angle about Y (in the order described above) + * as follows: + * + * cos ( theta ) = x / sqrt ( 1 - z^2 ) + * sin ( theta ) = y / sqrt ( 1 - z^2 ) + * + * cos ( phi ) = sqrt ( 1 - z^2 ) + * sin ( phi ) = z + * + * Note that cos ( phi ) can further be inserted to the above + * formulas: + * + * cos ( theta ) = x / cos ( phi ) + * sin ( theta ) = y / sin ( phi ) + * + * ...etc. Because of those relations and the standard trigonometric + * relations, it is pssible to reduce the transforms down to what + * is used below. It may be that any primary axis chosen will give the + * same results (modulo a sign convention) using thie method. + * + * Particularly nice is to notice that all divisions that might + * have caused trouble when parallel to certain planes or + * axis go away with care paid to reducing the expressions. + * After checking, it does perform correctly under all cases, since + * in all the cases of division where the denominator would have + * been zero, the numerator would have been zero as well, giving + * the expected result. + */ + + xx = x * x; + yy = y * y; + zz = z * z; + xy = x * y; + yz = y * z; + zx = z * x; + xs = x * s; + ys = y * s; + zs = z * s; + one_c = 1.0F - c; + + /* We already hold the identity-matrix so we can skip some statements */ + M(0,0) = (one_c * xx) + c; + M(0,1) = (one_c * xy) - zs; + M(0,2) = (one_c * zx) + ys; +/* M(0,3) = 0.0F; */ + + M(1,0) = (one_c * xy) + zs; + M(1,1) = (one_c * yy) + c; + M(1,2) = (one_c * yz) - xs; +/* M(1,3) = 0.0F; */ + + M(2,0) = (one_c * zx) - ys; + M(2,1) = (one_c * yz) + xs; + M(2,2) = (one_c * zz) + c; +/* M(2,3) = 0.0F; */ +/* + M(3,0) = 0.0F; + M(3,1) = 0.0F; + M(3,2) = 0.0F; + M(3,3) = 1.0F; +*/ + } #undef M matrix_multf( mat, m, MAT_FLAG_ROTATION ); } + void _math_matrix_frustum( GLmatrix *mat, GLfloat left, GLfloat right, @@ -981,11 +1041,10 @@ _math_matrix_loadf( GLmatrix *mat, const GLfloat *m ) void _math_matrix_ctr( GLmatrix *m ) { - if ( m->m == 0 ) { - m->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); - } - MEMCPY( m->m, Identity, sizeof(Identity) ); - m->inv = 0; + m->m = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); + if (m->m) + MEMCPY( m->m, Identity, sizeof(Identity) ); + m->inv = NULL; m->type = MATRIX_IDENTITY; m->flags = 0; } @@ -993,13 +1052,13 @@ _math_matrix_ctr( GLmatrix *m ) void _math_matrix_dtr( GLmatrix *m ) { - if ( m->m != 0 ) { + if (m->m) { ALIGN_FREE( m->m ); - m->m = 0; + m->m = NULL; } - if ( m->inv != 0 ) { + if (m->inv) { ALIGN_FREE( m->inv ); - m->inv = 0; + m->inv = NULL; } } @@ -1007,9 +1066,10 @@ _math_matrix_dtr( GLmatrix *m ) void _math_matrix_alloc_inv( GLmatrix *m ) { - if ( m->inv == 0 ) { + if (!m->inv) { m->inv = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); - MEMCPY( m->inv, Identity, 16 * sizeof(GLfloat) ); + if (m->inv) + MEMCPY( m->inv, Identity, 16 * sizeof(GLfloat) ); } } diff --git a/xc/extras/Mesa/src/math/m_norm_tmp.h b/xc/extras/Mesa/src/math/m_norm_tmp.h index d5f7da409..90ca38093 100644 --- a/xc/extras/Mesa/src/math/m_norm_tmp.h +++ b/xc/extras/Mesa/src/math/m_norm_tmp.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -27,25 +27,34 @@ * New (3.1) transformation code written by Keith Whitwell. */ -#include <math.h> -#include "m_vertices.h" +/* Functions to tranform a vector of normals. This includes applying + * the transformation matrix, rescaling and normalization. + */ +/* + * mat - the 4x4 transformation matrix + * scale - uniform scale factor of the transformation matrix (not always used) + * in - the source vector of normals + * lengths - length of each incoming normal (may be NULL) (a display list + * optimization) + * dest - the destination vector of normals + */ static void _XFORMAPI TAG(transform_normalize_normals)( const GLmatrix *mat, GLfloat scale, - const GLvector3f *in, + const GLvector4f *in, const GLfloat *lengths, - GLvector3f *dest ) + GLvector4f *dest ) { - GLuint i; + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; - GLuint stride = in->stride; - GLuint count = in->count; - GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; - GLfloat *m = mat->inv; + const GLuint stride = in->stride; + const GLuint count = in->count; + const GLfloat *m = mat->inv; GLfloat m0 = m[0], m4 = m[4], m8 = m[8]; GLfloat m1 = m[1], m5 = m[5], m9 = m[9]; GLfloat m2 = m[2], m6 = m[6], m10 = m[10]; + GLuint i; if (!lengths) { STRIDE_LOOP { @@ -64,8 +73,7 @@ TAG(transform_normalize_normals)( const GLmatrix *mat, out[i][1] = (GLfloat) (ty * scale); out[i][2] = (GLfloat) (tz * scale); } - else - { + else { out[i][0] = out[i][1] = out[i][2] = 0; } } @@ -101,19 +109,20 @@ TAG(transform_normalize_normals)( const GLmatrix *mat, static void _XFORMAPI TAG(transform_normalize_normals_no_rot)( const GLmatrix *mat, GLfloat scale, - const GLvector3f *in, + const GLvector4f *in, const GLfloat *lengths, - GLvector3f *dest ) + GLvector4f *dest ) { - GLuint i; + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; - GLuint stride = in->stride; - GLuint count = in->count; - GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; - GLfloat *m = mat->inv; + const GLuint stride = in->stride; + const GLuint count = in->count; + const GLfloat *m = mat->inv; GLfloat m0 = m[0]; GLfloat m5 = m[5]; GLfloat m10 = m[10]; + GLuint i; + if (!lengths) { STRIDE_LOOP { GLfloat tx, ty, tz; @@ -131,8 +140,7 @@ TAG(transform_normalize_normals_no_rot)( const GLmatrix *mat, out[i][1] = (GLfloat) (ty * scale); out[i][2] = (GLfloat) (tz * scale); } - else - { + else { out[i][0] = out[i][1] = out[i][2] = 0; } } @@ -166,20 +174,22 @@ TAG(transform_normalize_normals_no_rot)( const GLmatrix *mat, static void _XFORMAPI TAG(transform_rescale_normals_no_rot)( const GLmatrix *mat, GLfloat scale, - const GLvector3f *in, + const GLvector4f *in, const GLfloat *lengths, - GLvector3f *dest ) + GLvector4f *dest ) { - GLuint i; + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; - GLuint stride = in->stride; - GLuint count = in->count; - GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; + const GLuint stride = in->stride; + const GLuint count = in->count; const GLfloat *m = mat->inv; - GLfloat m0 = scale*m[0]; - GLfloat m5 = scale*m[5]; - GLfloat m10 = scale*m[10]; + const GLfloat m0 = scale*m[0]; + const GLfloat m5 = scale*m[5]; + const GLfloat m10 = scale*m[10]; + GLuint i; + (void) lengths; + STRIDE_LOOP { GLfloat ux = from[0], uy = from[1], uz = from[2]; out[i][0] = ux * m0; @@ -189,26 +199,29 @@ TAG(transform_rescale_normals_no_rot)( const GLmatrix *mat, dest->count = in->count; } + static void _XFORMAPI TAG(transform_rescale_normals)( const GLmatrix *mat, GLfloat scale, - const GLvector3f *in, + const GLvector4f *in, const GLfloat *lengths, - GLvector3f *dest ) + GLvector4f *dest ) { - GLuint i; + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; - GLuint stride = in->stride; - GLuint count = in->count; - GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; + const GLuint stride = in->stride; + const GLuint count = in->count; /* Since we are unlikely to have < 3 vertices in the buffer, * it makes sense to pre-multiply by scale. */ const GLfloat *m = mat->inv; - GLfloat m0 = scale*m[0], m4 = scale*m[4], m8 = scale*m[8]; - GLfloat m1 = scale*m[1], m5 = scale*m[5], m9 = scale*m[9]; - GLfloat m2 = scale*m[2], m6 = scale*m[6], m10 = scale*m[10]; + const GLfloat m0 = scale*m[0], m4 = scale*m[4], m8 = scale*m[8]; + const GLfloat m1 = scale*m[1], m5 = scale*m[5], m9 = scale*m[9]; + const GLfloat m2 = scale*m[2], m6 = scale*m[6], m10 = scale*m[10]; + GLuint i; + (void) lengths; + STRIDE_LOOP { GLfloat ux = from[0], uy = from[1], uz = from[2]; out[i][0] = ux * m0 + uy * m1 + uz * m2; @@ -222,21 +235,23 @@ TAG(transform_rescale_normals)( const GLmatrix *mat, static void _XFORMAPI TAG(transform_normals_no_rot)( const GLmatrix *mat, GLfloat scale, - const GLvector3f *in, + const GLvector4f *in, const GLfloat *lengths, - GLvector3f *dest ) + GLvector4f *dest ) { - GLuint i; + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; - GLuint stride = in->stride; - GLuint count = in->count; - GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; + const GLuint stride = in->stride; + const GLuint count = in->count; const GLfloat *m = mat->inv; - GLfloat m0 = m[0]; - GLfloat m5 = m[5]; - GLfloat m10 = m[10]; + const GLfloat m0 = m[0]; + const GLfloat m5 = m[5]; + const GLfloat m10 = m[10]; + GLuint i; + (void) scale; (void) lengths; + STRIDE_LOOP { GLfloat ux = from[0], uy = from[1], uz = from[2]; out[i][0] = ux * m0; @@ -250,21 +265,23 @@ TAG(transform_normals_no_rot)( const GLmatrix *mat, static void _XFORMAPI TAG(transform_normals)( const GLmatrix *mat, GLfloat scale, - const GLvector3f *in, + const GLvector4f *in, const GLfloat *lengths, - GLvector3f *dest ) + GLvector4f *dest ) { - GLuint i; + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; - GLuint stride = in->stride; - GLuint count = in->count; - GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; + const GLuint stride = in->stride; + const GLuint count = in->count; const GLfloat *m = mat->inv; - GLfloat m0 = m[0], m4 = m[4], m8 = m[8]; - GLfloat m1 = m[1], m5 = m[5], m9 = m[9]; - GLfloat m2 = m[2], m6 = m[6], m10 = m[10]; + const GLfloat m0 = m[0], m4 = m[4], m8 = m[8]; + const GLfloat m1 = m[1], m5 = m[5], m9 = m[9]; + const GLfloat m2 = m[2], m6 = m[6], m10 = m[10]; + GLuint i; + (void) scale; (void) lengths; + STRIDE_LOOP { GLfloat ux = from[0], uy = from[1], uz = from[2]; out[i][0] = ux * m0 + uy * m1 + uz * m2; @@ -278,17 +295,19 @@ TAG(transform_normals)( const GLmatrix *mat, static void _XFORMAPI TAG(normalize_normals)( const GLmatrix *mat, GLfloat scale, - const GLvector3f *in, + const GLvector4f *in, const GLfloat *lengths, - GLvector3f *dest ) + GLvector4f *dest ) { - GLuint i; + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; - GLuint stride = in->stride; - GLuint count = in->count; - GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; + const GLuint stride = in->stride; + const GLuint count = in->count; + GLuint i; + (void) mat; (void) scale; + if (lengths) { STRIDE_LOOP { const GLfloat x = from[0], y = from[1], z = from[2]; @@ -322,17 +341,19 @@ TAG(normalize_normals)( const GLmatrix *mat, static void _XFORMAPI TAG(rescale_normals)( const GLmatrix *mat, GLfloat scale, - const GLvector3f *in, + const GLvector4f *in, const GLfloat *lengths, - GLvector3f *dest ) + GLvector4f *dest ) { - GLuint i; + GLfloat (*out)[4] = (GLfloat (*)[4])dest->start; const GLfloat *from = in->start; - GLuint stride = in->stride; - GLuint count = in->count; - GLfloat (*out)[3] = (GLfloat (*)[3])dest->start; + const GLuint stride = in->stride; + const GLuint count = in->count; + GLuint i; + (void) mat; (void) lengths; + STRIDE_LOOP { SCALE_SCALAR_3V( out[i], scale, from ); } diff --git a/xc/extras/Mesa/src/math/m_translate.c b/xc/extras/Mesa/src/math/m_translate.c index a4305f26c..9cf0c39a3 100644 --- a/xc/extras/Mesa/src/math/m_translate.c +++ b/xc/extras/Mesa/src/math/m_translate.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -31,7 +31,6 @@ #include "glheader.h" #include "mtypes.h" /* GLchan hack */ #include "colormac.h" -#include "mem.h" #include "mmath.h" #include "m_translate.h" diff --git a/xc/extras/Mesa/src/math/m_vector.c b/xc/extras/Mesa/src/math/m_vector.c index 4c5e0ac26..c79e3e1bd 100644 --- a/xc/extras/Mesa/src/math/m_vector.c +++ b/xc/extras/Mesa/src/math/m_vector.c @@ -29,8 +29,9 @@ #include "glheader.h" +#include "imports.h" #include "macros.h" -#include "mem.h" +#include "imports.h" #include "m_vector.h" @@ -366,36 +367,36 @@ void _mesa_vector4f_print( GLvector4f *v, GLubyte *cullmask, GLboolean culling ) GLfloat *d = (GLfloat *)v->data; GLuint j, i = 0, count; - printf("data-start\n"); + _mesa_printf(NULL, "data-start\n"); for ( ; d != v->start ; STRIDE_F(d, v->stride), i++) - printf( t, i, d[0], d[1], d[2], d[3]); + _mesa_printf(NULL, t, i, d[0], d[1], d[2], d[3]); - printf("start-count(%u)\n", v->count); + _mesa_printf(NULL, "start-count(%u)\n", v->count); count = i + v->count; if (culling) { for ( ; i < count ; STRIDE_F(d, v->stride), i++) if (cullmask[i]) - printf( t, i, d[0], d[1], d[2], d[3]); + _mesa_printf(NULL, t, i, d[0], d[1], d[2], d[3]); } else { for ( ; i < count ; STRIDE_F(d, v->stride), i++) - printf( t, i, d[0], d[1], d[2], d[3]); + _mesa_printf(NULL, t, i, d[0], d[1], d[2], d[3]); } for (j = v->size ; j < 4; j++) { if ((v->flags & (1<<j)) == 0) { - printf("checking col %u is clean as advertised ", j); + _mesa_printf(NULL, "checking col %u is clean as advertised ", j); for (i = 0, d = (GLfloat *) v->data ; i < count && d[j] == c[j] ; i++, STRIDE_F(d, v->stride)) {}; if (i == count) - printf(" --> ok\n"); + _mesa_printf(NULL, " --> ok\n"); else - printf(" --> Failed at %u ******\n", i); + _mesa_printf(NULL, " --> Failed at %u ******\n", i); } } } @@ -409,20 +410,20 @@ void _mesa_vector3f_print( GLvector3f *v, GLubyte *cullmask, GLboolean culling ) GLfloat *d = (GLfloat *)v->data; GLuint i = 0, count; - printf("data-start\n"); + _mesa_printf(NULL, "data-start\n"); for ( ; d != v->start ; STRIDE_F(d,v->stride), i++) - printf( "%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); + _mesa_printf(NULL, "%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); - printf("start-count(%u)\n", v->count); + _mesa_printf(NULL, "start-count(%u)\n", v->count); count = i + v->count; if (culling) { for ( ; i < count ; STRIDE_F(d,v->stride), i++) if (cullmask[i]) - printf( "%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); + _mesa_printf(NULL, "%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); } else { for ( ; i < count ; STRIDE_F(d,v->stride), i++) - printf( "%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); + _mesa_printf(NULL, "%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); } } diff --git a/xc/extras/Mesa/src/math/m_xform.c b/xc/extras/Mesa/src/math/m_xform.c index ccfd341b9..be8a74a78 100644 --- a/xc/extras/Mesa/src/math/m_xform.c +++ b/xc/extras/Mesa/src/math/m_xform.c @@ -34,8 +34,6 @@ * 3. Transformation of a point p by a matrix M is: p' = M * p */ -#include <math.h> - #include "glheader.h" #include "macros.h" #include "mmath.h" @@ -219,6 +217,5 @@ _math_init( void ) { _math_init_transformation(); _math_init_translate(); - _math_init_vertices(); _math_init_eval(); } diff --git a/xc/extras/Mesa/src/math/m_xform.h b/xc/extras/Mesa/src/math/m_xform.h index fbd4836e2..badc29eaf 100644 --- a/xc/extras/Mesa/src/math/m_xform.h +++ b/xc/extras/Mesa/src/math/m_xform.h @@ -154,9 +154,9 @@ typedef void (*vec_copy_func)( GLvector4f *to, */ typedef void (_NORMAPIP normal_func)( CONST GLmatrix *mat, GLfloat scale, - CONST GLvector3f *in, + CONST GLvector4f *in, CONST GLfloat lengths[], - GLvector3f *dest ); + GLvector4f *dest ); /* Flags for selecting a normal transformation function. |