math: remove unused debug classes

Signed-off-by: António Monteiro <antonio.fmr.monteiro@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19428>
This commit is contained in:
António Monteiro
2022-11-03 18:14:35 +00:00
committed by Marge Bot
parent 94e10ced83
commit 2d4d4df57a
7 changed files with 0 additions and 1480 deletions
@@ -135,8 +135,6 @@
#include <mesa/main/varray.h>
#include <mesa/main/version.h>
#include <mesa/main/viewport.h>
#include <mesa/math/m_debug.h>
#include <mesa/math/m_debug_util.h>
#include <mesa/math/m_eval.h>
#include <mesa/math/m_matrix.h>
#include <mesa/math/m_vector.h>
-36
View File
@@ -1,36 +0,0 @@
/*
* Mesa 3-D graphics library
*
* Copyright (C) 1999-2001 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
* Gareth Hughes
*/
#ifndef __M_DEBUG_H__
#define __M_DEBUG_H__
extern void _math_test_all_transform_functions( char *description );
extern void _math_test_all_normal_transform_functions( char *description );
extern void _math_test_all_cliptest_functions( char *description );
#endif
-409
View File
@@ -1,409 +0,0 @@
/*
* Mesa 3-D graphics library
*
* 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
* Gareth Hughes
*/
#include "util/glheader.h"
#include "main/context.h"
#include "main/macros.h"
#include "m_matrix.h"
#include "m_xform.h"
#include "m_debug.h"
#include "m_debug_util.h"
#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_np_tab
};
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
/* =============================================================
* Reference cliptests
*/
static GLvector4f *ref_cliptest_points4( GLvector4f *clip_vec,
GLvector4f *proj_vec,
GLubyte clipMask[],
GLubyte *orMask,
GLubyte *andMask,
GLboolean viewport_z_clip )
{
const GLuint stride = clip_vec->stride;
const GLuint count = clip_vec->count;
const GLfloat *from = (GLfloat *)clip_vec->start;
GLuint c = 0;
GLfloat (*vProj)[4] = (GLfloat (*)[4])proj_vec->start;
GLubyte tmpAndMask = *andMask;
GLubyte tmpOrMask = *orMask;
GLuint i;
for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) {
const GLfloat cx = from[0];
const GLfloat cy = from[1];
const GLfloat cz = from[2];
const GLfloat cw = from[3];
GLubyte mask = 0;
if ( -cx + cw < 0 ) mask |= CLIP_RIGHT_BIT;
if ( cx + cw < 0 ) mask |= CLIP_LEFT_BIT;
if ( -cy + cw < 0 ) mask |= CLIP_TOP_BIT;
if ( cy + cw < 0 ) mask |= CLIP_BOTTOM_BIT;
if (viewport_z_clip) {
if ( -cz + cw < 0 ) mask |= CLIP_FAR_BIT;
if ( cz + cw < 0 ) mask |= CLIP_NEAR_BIT;
}
clipMask[i] = mask;
if ( mask ) {
c++;
tmpAndMask &= mask;
tmpOrMask |= mask;
vProj[i][0] = 0;
vProj[i][1] = 0;
vProj[i][2] = 0;
vProj[i][3] = 1;
} else {
GLfloat oow = 1.0F / cw;
vProj[i][0] = cx * oow;
vProj[i][1] = cy * oow;
vProj[i][2] = cz * oow;
vProj[i][3] = oow;
}
}
*orMask = tmpOrMask;
*andMask = (GLubyte) (c < count ? 0 : tmpAndMask);
proj_vec->flags |= VEC_SIZE_4;
proj_vec->size = 4;
proj_vec->count = clip_vec->count;
return proj_vec;
}
/* Keep these here for now, even though we don't use them...
*/
static GLvector4f *ref_cliptest_points3( GLvector4f *clip_vec,
GLvector4f *proj_vec,
GLubyte clipMask[],
GLubyte *orMask,
GLubyte *andMask,
GLboolean viewport_z_clip )
{
const GLuint stride = clip_vec->stride;
const GLuint count = clip_vec->count;
const GLfloat *from = (GLfloat *)clip_vec->start;
GLubyte tmpOrMask = *orMask;
GLubyte tmpAndMask = *andMask;
GLuint i;
for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) {
const GLfloat cx = from[0], cy = from[1], cz = from[2];
GLubyte mask = 0;
if ( cx > 1.0 ) mask |= CLIP_RIGHT_BIT;
else if ( cx < -1.0 ) mask |= CLIP_LEFT_BIT;
if ( cy > 1.0 ) mask |= CLIP_TOP_BIT;
else if ( cy < -1.0 ) mask |= CLIP_BOTTOM_BIT;
if (viewport_z_clip) {
if ( cz > 1.0 ) mask |= CLIP_FAR_BIT;
else if ( cz < -1.0 ) mask |= CLIP_NEAR_BIT;
}
clipMask[i] = mask;
tmpOrMask |= mask;
tmpAndMask &= mask;
}
*orMask = tmpOrMask;
*andMask = tmpAndMask;
return clip_vec;
}
static GLvector4f * ref_cliptest_points2( GLvector4f *clip_vec,
GLvector4f *proj_vec,
GLubyte clipMask[],
GLubyte *orMask,
GLubyte *andMask,
GLboolean viewport_z_clip )
{
const GLuint stride = clip_vec->stride;
const GLuint count = clip_vec->count;
const GLfloat *from = (GLfloat *)clip_vec->start;
GLubyte tmpOrMask = *orMask;
GLubyte tmpAndMask = *andMask;
GLuint i;
(void) viewport_z_clip;
for ( i = 0 ; i < count ; i++, STRIDE_F(from, stride) ) {
const GLfloat cx = from[0], cy = from[1];
GLubyte mask = 0;
if ( cx > 1.0 ) mask |= CLIP_RIGHT_BIT;
else if ( cx < -1.0 ) mask |= CLIP_LEFT_BIT;
if ( cy > 1.0 ) mask |= CLIP_TOP_BIT;
else if ( cy < -1.0 ) mask |= CLIP_BOTTOM_BIT;
clipMask[i] = mask;
tmpOrMask |= mask;
tmpAndMask &= mask;
}
*orMask = tmpOrMask;
*andMask = tmpAndMask;
return clip_vec;
}
static clip_func ref_cliptest[5] = {
0,
0,
ref_cliptest_points2,
ref_cliptest_points3,
ref_cliptest_points4
};
/* =============================================================
* Cliptest tests
*/
ALIGN16 static GLfloat s[TEST_COUNT][4];
ALIGN16 static GLfloat d[TEST_COUNT][4];
ALIGN16 static GLfloat r[TEST_COUNT][4];
/**
* Check if X, Y or Z component of the coordinate is close to W, in terms
* of the clip test.
*/
static GLboolean
xyz_close_to_w(const GLfloat c[4])
{
float k = 0.0001;
return (fabs(c[0] - c[3]) < k ||
fabs(c[1] - c[3]) < k ||
fabs(c[2] - c[3]) < k ||
fabs(-c[0] - c[3]) < k ||
fabs(-c[1] - c[3]) < k ||
fabs(-c[2] - c[3]) < k);
}
static int test_cliptest_function( clip_func func, int np,
int psize, long *cycles )
{
GLvector4f source[1], dest[1], ref[1];
GLubyte dm[TEST_COUNT], dco, dca;
GLubyte rm[TEST_COUNT], rco, rca;
int i, j;
#ifdef RUN_DEBUG_BENCHMARK
int cycle_i; /* the counter for the benchmarks we run */
#endif
GLboolean viewport_z_clip = GL_TRUE;
(void) cycles;
if ( psize > 4 ) {
_mesa_problem( NULL, "test_cliptest_function called with psize > 4\n" );
return 0;
}
for ( i = 0 ; i < TEST_COUNT ; i++) {
ASSIGN_4V( d[i], 0.0, 0.0, 0.0, 1.0 );
ASSIGN_4V( s[i], 0.0, 0.0, 0.0, 1.0 );
for ( j = 0 ; j < psize ; j++ )
s[i][j] = rnd();
}
source->data = (GLfloat(*)[4])s;
source->start = (GLfloat *)s;
source->count = TEST_COUNT;
source->stride = sizeof(s[0]);
source->size = 4;
source->flags = 0;
dest->data = (GLfloat(*)[4])d;
dest->start = (GLfloat *)d;
dest->count = TEST_COUNT;
dest->stride = sizeof(float[4]);
dest->size = 0;
dest->flags = 0;
ref->data = (GLfloat(*)[4])r;
ref->start = (GLfloat *)r;
ref->count = TEST_COUNT;
ref->stride = sizeof(float[4]);
ref->size = 0;
ref->flags = 0;
dco = rco = 0;
dca = rca = CLIP_FRUSTUM_BITS;
ref_cliptest[psize]( source, ref, rm, &rco, &rca, viewport_z_clip );
if ( mesa_profile ) {
BEGIN_RACE( *cycles );
func( source, dest, dm, &dco, &dca, viewport_z_clip );
END_RACE( *cycles );
}
else {
func( source, dest, dm, &dco, &dca, viewport_z_clip );
}
if ( dco != rco ) {
printf( "\n-----------------------------\n" );
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 );
return 0;
}
for ( i = 0 ; i < TEST_COUNT ; i++ ) {
if ( dm[i] != rm[i] ) {
GLfloat *c = source->start;
STRIDE_F(c, source->stride * i);
if (psize == 4 && xyz_close_to_w(c)) {
/* The coordinate is very close to the clip plane. The clipmask
* may vary depending on code path, but that's OK.
*/
continue;
}
printf( "\n-----------------------------\n" );
printf( "mask[%d] = 0x%02x ref mask[%d] = 0x%02x\n", i, dm[i], i,rm[i] );
printf(" coord = %f, %f, %f, %f\n",
c[0], c[1], c[2], c[3]);
return 0;
}
}
/* Only verify output on projected points4 case. FIXME: Do we need
* to test other cases?
*/
if ( np || psize < 4 )
return 1;
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",
i, j, dm[i], rm[i] );
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",
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",
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",
d[i][3], r[i][3], r[i][3]-d[i][3],
MAX_PRECISION - significand_match( d[i][3], r[i][3] ) );
return 0;
}
}
}
return 1;
}
void _math_test_all_cliptest_functions( char *description )
{
int np, psize;
long benchmark_tab[2][4];
static int first_time = 1;
if ( first_time ) {
first_time = 0;
mesa_profile = getenv( "MESA_PROFILE" );
}
#ifdef RUN_DEBUG_BENCHMARK
if ( mesa_profile ) {
if ( !counter_overhead ) {
INIT_COUNTER();
printf( "counter overhead: %ld cycles\n\n", counter_overhead );
}
printf( "cliptest results after hooking in %s functions:\n", description );
}
#endif
#ifdef RUN_DEBUG_BENCHMARK
if ( mesa_profile ) {
printf( "\n\t" );
for ( psize = 2 ; psize <= 4 ; psize++ ) {
printf( " p%d\t", psize );
}
printf( "\n--------------------------------------------------------\n\t" );
}
#endif
for ( np = 0 ; np < 2 ; np++ ) {
for ( psize = 2 ; psize <= 4 ; psize++ ) {
clip_func func = clip_tab[np][psize];
long *cycles = &(benchmark_tab[np][psize-1]);
if ( test_cliptest_function( func, np, psize, cycles ) == 0 ) {
char buf[100];
sprintf( buf, "%s[%d] failed test (%s)",
cnames[np], psize, description );
_mesa_problem( NULL, "%s", buf );
}
#ifdef RUN_DEBUG_BENCHMARK
if ( mesa_profile )
printf( " %li\t", benchmark_tab[np][psize-1] );
#endif
}
#ifdef RUN_DEBUG_BENCHMARK
if ( mesa_profile )
printf( " | [%s]\n\t", cstrings[np] );
#endif
}
#ifdef RUN_DEBUG_BENCHMARK
if ( mesa_profile )
printf( "\n" );
#endif
}
#endif /* DEBUG_MATH */
-383
View File
@@ -1,383 +0,0 @@
/*
* Mesa 3-D graphics library
*
* Copyright (C) 1999-2003 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
* Gareth Hughes
*/
#include "util/glheader.h"
#include "main/context.h"
#include "main/macros.h"
#include "m_matrix.h"
#include "m_xform.h"
#include "m_debug.h"
#include "m_debug_util.h"
#include <math.h>
#ifdef __UNIXOS2__
/* The linker doesn't like empty files */
static char dummy;
#endif
#ifdef DEBUG_MATH /* This code only used for debugging */
static int m_norm_identity[16] = {
ONE, NIL, NIL, NIL,
NIL, ONE, NIL, NIL,
NIL, NIL, ONE, NIL,
NIL, NIL, NIL, NIL
};
static int m_norm_general[16] = {
VAR, VAR, VAR, NIL,
VAR, VAR, VAR, NIL,
VAR, VAR, VAR, NIL,
NIL, NIL, NIL, NIL
};
static int m_norm_no_rot[16] = {
VAR, NIL, NIL, NIL,
NIL, VAR, NIL, NIL,
NIL, NIL, VAR, NIL,
NIL, NIL, NIL, NIL
};
static int *norm_templates[8] = {
m_norm_no_rot,
m_norm_no_rot,
m_norm_no_rot,
m_norm_general,
m_norm_general,
m_norm_general,
m_norm_identity,
m_norm_identity
};
static int norm_types[8] = {
NORM_TRANSFORM_NO_ROT,
NORM_TRANSFORM_NO_ROT | NORM_RESCALE,
NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE,
NORM_TRANSFORM,
NORM_TRANSFORM | NORM_RESCALE,
NORM_TRANSFORM | NORM_NORMALIZE,
NORM_RESCALE,
NORM_NORMALIZE
};
static int norm_scale_types[8] = { /* rescale factor */
NIL, /* NIL disables rescaling */
VAR,
NIL,
NIL,
VAR,
NIL,
VAR,
NIL
};
static int norm_normalize_types[8] = { /* normalizing ?? (no = 0) */
0,
0,
1,
0,
0,
1,
0,
1
};
static char *norm_strings[8] = {
"NORM_TRANSFORM_NO_ROT",
"NORM_TRANSFORM_NO_ROT | NORM_RESCALE",
"NORM_TRANSFORM_NO_ROT | NORM_NORMALIZE",
"NORM_TRANSFORM",
"NORM_TRANSFORM | NORM_RESCALE",
"NORM_TRANSFORM | NORM_NORMALIZE",
"NORM_RESCALE",
"NORM_NORMALIZE"
};
/* =============================================================
* Reference transformations
*/
static void ref_norm_transform_rescale( const GLmatrix *mat,
GLfloat scale,
const GLvector4f *in,
const GLfloat *lengths,
GLvector4f *dest )
{
GLuint i;
const GLfloat *s = in->start;
const GLfloat *m = mat->inv;
GLfloat (*out)[4] = (GLfloat (*)[4]) dest->start;
(void) lengths;
for ( i = 0 ; i < in->count ; i++ ) {
GLfloat t[3];
TRANSFORM_NORMAL( t, s, m );
SCALE_SCALAR_3V( out[i], scale, t );
s = (GLfloat *)((char *)s + in->stride);
}
}
static void ref_norm_transform_normalize( const GLmatrix *mat,
GLfloat scale,
const GLvector4f *in,
const GLfloat *lengths,
GLvector4f *dest )
{
GLuint i;
const GLfloat *s = in->start;
const GLfloat *m = mat->inv;
GLfloat (*out)[4] = (GLfloat (*)[4]) dest->start;
for ( i = 0 ; i < in->count ; i++ ) {
GLfloat t[3];
TRANSFORM_NORMAL( t, s, m );
if ( !lengths ) {
GLfloat len = LEN_SQUARED_3FV( t );
if ( len > 1e-20 ) {
/* Hmmm, don't know how we could test the precalculated
* length case...
*/
scale = 1.0f / sqrtf(len);
SCALE_SCALAR_3V( out[i], scale, t );
} else {
out[i][0] = out[i][1] = out[i][2] = 0;
}
} else {
scale = lengths[i];
SCALE_SCALAR_3V( out[i], scale, t );
}
s = (GLfloat *)((char *)s + in->stride);
}
}
/* =============================================================
* 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 )
{
GLvector4f source[1], dest[1], dest2[1], ref[1], ref2[1];
GLmatrix mat[1];
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;
#ifdef RUN_DEBUG_BENCHMARK
int cycle_i; /* the counter for the benchmarks we run */
#endif
(void) cycles;
mat->m = align_malloc( 16 * sizeof(GLfloat), 16 );
mat->inv = m = mat->m;
init_matrix( m );
scale = 1.0F + rnd () * norm_scale_types[mtype];
for ( i = 0 ; i < 4 ; i++ ) {
for ( j = 0 ; j < 4 ; j++ ) {
switch ( norm_templates[mtype][i * 4 + j] ) {
case NIL:
m[j * 4 + i] = 0.0;
break;
case ONE:
m[j * 4 + i] = 1.0;
break;
case NEG:
m[j * 4 + i] = -1.0;
break;
case VAR:
break;
default:
exit(1);
}
}
}
for ( i = 0 ; i < TEST_COUNT ; i++ ) {
ASSIGN_3V( d[i], 0.0, 0.0, 0.0 );
ASSIGN_3V( s[i], 0.0, 0.0, 0.0 );
ASSIGN_3V( d2[i], 0.0, 0.0, 0.0 );
for ( j = 0 ; j < 3 ; j++ )
s[i][j] = rnd();
length[i] = 1.0f / sqrtf( LEN_SQUARED_3FV( s[i] ) );
}
source->data = (GLfloat(*)[4]) s;
source->start = (GLfloat *) s;
source->count = TEST_COUNT;
source->stride = sizeof(s[0]);
source->flags = 0;
dest->data = d;
dest->start = (GLfloat *) d;
dest->count = TEST_COUNT;
dest->stride = sizeof(float[4]);
dest->flags = 0;
dest2->data = d2;
dest2->start = (GLfloat *) d2;
dest2->count = TEST_COUNT;
dest2->stride = sizeof(float[4]);
dest2->flags = 0;
ref->data = r;
ref->start = (GLfloat *) r;
ref->count = TEST_COUNT;
ref->stride = sizeof(float[4]);
ref->flags = 0;
ref2->data = r2;
ref2->start = (GLfloat *) r2;
ref2->count = TEST_COUNT;
ref2->stride = sizeof(float[4]);
ref2->flags = 0;
if ( norm_normalize_types[mtype] == 0 ) {
ref_norm_transform_rescale( mat, scale, source, NULL, ref );
} else {
ref_norm_transform_normalize( mat, scale, source, NULL, ref );
ref_norm_transform_normalize( mat, scale, source, length, ref2 );
}
if ( mesa_profile ) {
BEGIN_RACE( *cycles );
func( mat, scale, source, NULL, dest );
END_RACE( *cycles );
func( mat, scale, source, length, dest2 );
} else {
func( mat, scale, source, NULL, dest );
func( mat, scale, source, length, dest2 );
}
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",
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",
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",
d[i][2], r[i][2], r[i][2]/d[i][2],
MAX_PRECISION - significand_match( d[i][2], r[i][2] ) );
return 0;
}
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",
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",
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",
d2[i][2], r2[i][2], r2[i][2]/d2[i][2],
MAX_PRECISION - significand_match( d2[i][2], r2[i][2] ) );
return 0;
}
}
}
}
align_free( mat->m );
return 1;
}
void _math_test_all_normal_transform_functions( char *description )
{
int mtype;
long benchmark_tab[0xf];
static int first_time = 1;
if ( first_time ) {
first_time = 0;
mesa_profile = getenv( "MESA_PROFILE" );
}
#ifdef RUN_DEBUG_BENCHMARK
if ( mesa_profile ) {
if ( !counter_overhead ) {
INIT_COUNTER();
printf( "counter overhead: %ld cycles\n\n", counter_overhead );
}
printf( "normal transform results after hooking in %s functions:\n",
description );
printf( "\n-------------------------------------------------------\n" );
}
#endif
for ( mtype = 0 ; mtype < 8 ; mtype++ ) {
normal_func func = _mesa_normal_tab[norm_types[mtype]];
long *cycles = &benchmark_tab[mtype];
if ( test_norm_function( func, mtype, cycles ) == 0 ) {
char buf[100];
sprintf( buf, "_mesa_normal_tab[0][%s] failed test (%s)",
norm_strings[mtype], description );
_mesa_problem( NULL, "%s", buf );
}
#ifdef RUN_DEBUG_BENCHMARK
if ( mesa_profile ) {
printf( " %li\t", benchmark_tab[mtype] );
printf( " | [%s]\n", norm_strings[mtype] );
}
#endif
}
#ifdef RUN_DEBUG_BENCHMARK
if ( mesa_profile ) {
printf( "\n" );
}
#endif
}
#endif /* DEBUG_MATH */
-307
View File
@@ -1,307 +0,0 @@
/*
* Mesa 3-D graphics library
*
* 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
* Gareth Hughes
*/
#ifndef __M_DEBUG_UTIL_H__
#define __M_DEBUG_UTIL_H__
#ifdef DEBUG_MATH /* This code only used for debugging */
#include <math.h>
/* Comment this out to deactivate the cycle counter.
* NOTE: it works only on CPUs which know the 'rdtsc' command (586 or higher)
* (hope, you don't try to debug Mesa on a 386 ;)
*/
#if defined(__GNUC__) && \
((defined(__i386__) && defined(USE_X86_ASM)) || \
(defined(__sparc__) && defined(USE_SPARC_ASM)))
#define RUN_DEBUG_BENCHMARK
#endif
#define TEST_COUNT 128 /* size of the tested vector array */
#define REQUIRED_PRECISION 10 /* allow 4 bits to miss */
#define MAX_PRECISION 24 /* max. precision possible */
#ifdef RUN_DEBUG_BENCHMARK
/* Overhead of profiling counter in cycles. Automatically adjusted to
* your machine at run time - counter initialization should give very
* consistent results.
*/
extern long counter_overhead;
/* This is the value of the environment variable MESA_PROFILE, and is
* used to determine if we should benchmark the functions as well as
* verify their correctness.
*/
extern char *mesa_profile;
/* Modify the number of tests if you like.
* We take the minimum of all results, because every error should be
* positive (time used by other processes, task switches etc).
* It is assumed that all calculations are done in the cache.
*/
#if defined(__i386__)
#if 1 /* PPro, PII, PIII version */
/* Profiling on the P6 architecture requires a little more work, due to
* the internal out-of-order execution. We must perform a serializing
* 'cpuid' instruction before and after the 'rdtsc' instructions to make
* sure no other uops are executed when we sample the timestamp counter.
*/
#define INIT_COUNTER() \
do { \
int cycle_i; \
counter_overhead = LONG_MAX; \
for ( cycle_i = 0 ; cycle_i < 8 ; cycle_i++ ) { \
long cycle_tmp1 = 0, cycle_tmp2 = 0; \
__asm__ __volatile__ ( "push %%ebx \n" \
"xor %%eax, %%eax \n" \
"cpuid \n" \
"rdtsc \n" \
"mov %%eax, %0 \n" \
"xor %%eax, %%eax \n" \
"cpuid \n" \
"pop %%ebx \n" \
"push %%ebx \n" \
"xor %%eax, %%eax \n" \
"cpuid \n" \
"rdtsc \n" \
"mov %%eax, %1 \n" \
"xor %%eax, %%eax \n" \
"cpuid \n" \
"pop %%ebx \n" \
: "=m" (cycle_tmp1), "=m" (cycle_tmp2) \
: : "eax", "ecx", "edx" ); \
if ( counter_overhead > (cycle_tmp2 - cycle_tmp1) ) { \
counter_overhead = cycle_tmp2 - cycle_tmp1; \
} \
} \
} while (0)
#define BEGIN_RACE(x) \
x = LONG_MAX; \
for ( cycle_i = 0 ; cycle_i < 10 ; cycle_i++ ) { \
long cycle_tmp1 = 0, cycle_tmp2 = 0; \
__asm__ __volatile__ ( "push %%ebx \n" \
"xor %%eax, %%eax \n" \
"cpuid \n" \
"rdtsc \n" \
"mov %%eax, %0 \n" \
"xor %%eax, %%eax \n" \
"cpuid \n" \
"pop %%ebx \n" \
: "=m" (cycle_tmp1) \
: : "eax", "ecx", "edx" );
#define END_RACE(x) \
__asm__ __volatile__ ( "push %%ebx \n" \
"xor %%eax, %%eax \n" \
"cpuid \n" \
"rdtsc \n" \
"mov %%eax, %0 \n" \
"xor %%eax, %%eax \n" \
"cpuid \n" \
"pop %%ebx \n" \
: "=m" (cycle_tmp2) \
: : "eax", "ecx", "edx" ); \
if ( x > (cycle_tmp2 - cycle_tmp1) ) { \
x = cycle_tmp2 - cycle_tmp1; \
} \
} \
x -= counter_overhead;
#else /* PPlain, PMMX version */
/* To ensure accurate results, we stall the pipelines with the
* non-pairable 'cdq' instruction. This ensures all the code being
* profiled is complete when the 'rdtsc' instruction executes.
*/
#define INIT_COUNTER(x) \
do { \
int cycle_i; \
x = LONG_MAX; \
for ( cycle_i = 0 ; cycle_i < 32 ; cycle_i++ ) { \
long cycle_tmp1, cycle_tmp2, dummy; \
__asm__ ( "mov %%eax, %0" : "=a" (cycle_tmp1) ); \
__asm__ ( "mov %%eax, %0" : "=a" (cycle_tmp2) ); \
__asm__ ( "cdq" ); \
__asm__ ( "cdq" ); \
__asm__ ( "rdtsc" : "=a" (cycle_tmp1), "=d" (dummy) ); \
__asm__ ( "cdq" ); \
__asm__ ( "cdq" ); \
__asm__ ( "rdtsc" : "=a" (cycle_tmp2), "=d" (dummy) ); \
if ( x > (cycle_tmp2 - cycle_tmp1) ) \
x = cycle_tmp2 - cycle_tmp1; \
} \
} while (0)
#define BEGIN_RACE(x) \
x = LONG_MAX; \
for ( cycle_i = 0 ; cycle_i < 16 ; cycle_i++ ) { \
long cycle_tmp1, cycle_tmp2, dummy; \
__asm__ ( "mov %%eax, %0" : "=a" (cycle_tmp1) ); \
__asm__ ( "mov %%eax, %0" : "=a" (cycle_tmp2) ); \
__asm__ ( "cdq" ); \
__asm__ ( "cdq" ); \
__asm__ ( "rdtsc" : "=a" (cycle_tmp1), "=d" (dummy) );
#define END_RACE(x) \
__asm__ ( "cdq" ); \
__asm__ ( "cdq" ); \
__asm__ ( "rdtsc" : "=a" (cycle_tmp2), "=d" (dummy) ); \
if ( x > (cycle_tmp2 - cycle_tmp1) ) \
x = cycle_tmp2 - cycle_tmp1; \
} \
x -= counter_overhead;
#endif
#elif defined(__x86_64__)
#define rdtscll(val) do { \
unsigned int a,d; \
__asm__ volatile("rdtsc" : "=a" (a), "=d" (d)); \
(val) = ((unsigned long)a) | (((unsigned long)d)<<32); \
} while(0)
/* Copied from i386 PIII version */
#define INIT_COUNTER() \
do { \
int cycle_i; \
counter_overhead = LONG_MAX; \
for ( cycle_i = 0 ; cycle_i < 16 ; cycle_i++ ) { \
unsigned long cycle_tmp1, cycle_tmp2; \
rdtscll(cycle_tmp1); \
rdtscll(cycle_tmp2); \
if ( counter_overhead > (cycle_tmp2 - cycle_tmp1) ) { \
counter_overhead = cycle_tmp2 - cycle_tmp1; \
} \
} \
} while (0)
#define BEGIN_RACE(x) \
x = LONG_MAX; \
for ( cycle_i = 0 ; cycle_i < 10 ; cycle_i++ ) { \
unsigned long cycle_tmp1, cycle_tmp2; \
rdtscll(cycle_tmp1);
#define END_RACE(x) \
rdtscll(cycle_tmp2); \
if ( x > (cycle_tmp2 - cycle_tmp1) ) { \
x = cycle_tmp2 - cycle_tmp1; \
} \
} \
x -= counter_overhead;
#elif defined(__sparc__)
#define INIT_COUNTER() \
do { counter_overhead = 5; } while(0)
#define BEGIN_RACE(x) \
x = LONG_MAX; \
for (cycle_i = 0; cycle_i <10; cycle_i++) { \
register long cycle_tmp1 __asm__("l0"); \
register long cycle_tmp2 __asm__("l1"); \
/* rd %tick, %l0 */ \
__asm__ __volatile__ (".word 0xa1410000" : "=r" (cycle_tmp1)); /* save timestamp */
#define END_RACE(x) \
/* rd %tick, %l1 */ \
__asm__ __volatile__ (".word 0xa3410000" : "=r" (cycle_tmp2)); \
if (x > (cycle_tmp2-cycle_tmp1)) x = cycle_tmp2 - cycle_tmp1; \
} \
x -= counter_overhead;
#else
#error Your processor is not supported for RUN_XFORM_BENCHMARK
#endif
#else
#define BEGIN_RACE(x)
#define END_RACE(x)
#endif
/* =============================================================
* Helper functions
*/
static GLfloat rnd( void )
{
GLfloat f = (GLfloat)rand() / (GLfloat)RAND_MAX;
GLfloat gran = (GLfloat)(1 << 13);
f = (GLfloat)(GLint)(f * gran) / gran;
return f * 2.0 - 1.0;
}
static int significand_match( GLfloat a, GLfloat b )
{
GLfloat d = a - b;
int a_ex, b_ex, d_ex;
if ( d == 0.0F ) {
return MAX_PRECISION; /* Exact match */
}
if ( a == 0.0F || b == 0.0F ) {
/* It would probably be better to check if the
* non-zero number is denormalized and return
* the index of the highest set bit here.
*/
return 0;
}
frexpf( a, &a_ex );
frexpf( b, &b_ex );
frexpf( d, &d_ex );
if ( a_ex < b_ex ) {
return a_ex - d_ex;
} else {
return b_ex - d_ex;
}
}
enum { NIL = 0, ONE = 1, NEG = -1, VAR = 2 };
#endif /* DEBUG_MATH */
#endif /* __M_DEBUG_UTIL_H__ */
-338
View File
@@ -1,338 +0,0 @@
/*
* Mesa 3-D graphics library
*
* 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* Updated for P6 architecture by Gareth Hughes.
*/
#include "util/glheader.h"
#include "main/context.h"
#include "main/macros.h"
#include "m_matrix.h"
#include "m_xform.h"
#include "m_debug.h"
#include "m_debug_util.h"
#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
* your machine at run time - counter initialization should give very
* consistent results.
*/
long counter_overhead = 0;
/* This is the value of the environment variable MESA_PROFILE, and is
* used to determine if we should benchmark the functions as well as
* verify their correctness.
*/
char *mesa_profile = NULL;
static int m_general[16] = {
VAR, VAR, VAR, VAR,
VAR, VAR, VAR, VAR,
VAR, VAR, VAR, VAR,
VAR, VAR, VAR, VAR
};
static int m_identity[16] = {
ONE, NIL, NIL, NIL,
NIL, ONE, NIL, NIL,
NIL, NIL, ONE, NIL,
NIL, NIL, NIL, ONE
};
static int m_2d[16] = {
VAR, VAR, NIL, VAR,
VAR, VAR, NIL, VAR,
NIL, NIL, ONE, NIL,
NIL, NIL, NIL, ONE
};
static int m_2d_no_rot[16] = {
VAR, NIL, NIL, VAR,
NIL, VAR, NIL, VAR,
NIL, NIL, ONE, NIL,
NIL, NIL, NIL, ONE
};
static int m_3d[16] = {
VAR, VAR, VAR, VAR,
VAR, VAR, VAR, VAR,
VAR, VAR, VAR, VAR,
NIL, NIL, NIL, ONE
};
static int m_3d_no_rot[16] = {
VAR, NIL, NIL, VAR,
NIL, VAR, NIL, VAR,
NIL, NIL, VAR, VAR,
NIL, NIL, NIL, ONE
};
static int m_perspective[16] = {
VAR, NIL, VAR, NIL,
NIL, VAR, VAR, NIL,
NIL, NIL, VAR, VAR,
NIL, NIL, NEG, NIL
};
static int *templates[7] = {
m_general,
m_identity,
m_3d_no_rot,
m_perspective,
m_2d,
m_2d_no_rot,
m_3d
};
static enum GLmatrixtype mtypes[7] = {
MATRIX_GENERAL,
MATRIX_IDENTITY,
MATRIX_3D_NO_ROT,
MATRIX_PERSPECTIVE,
MATRIX_2D,
MATRIX_2D_NO_ROT,
MATRIX_3D
};
static char *mstrings[7] = {
"MATRIX_GENERAL",
"MATRIX_IDENTITY",
"MATRIX_3D_NO_ROT",
"MATRIX_PERSPECTIVE",
"MATRIX_2D",
"MATRIX_2D_NO_ROT",
"MATRIX_3D"
};
/* =============================================================
* Reference transformations
*/
static void ref_transform( GLvector4f *dst,
const GLmatrix *mat,
const GLvector4f *src )
{
GLuint i;
GLfloat *s = (GLfloat *)src->start;
GLfloat (*d)[4] = (GLfloat (*)[4])dst->start;
const GLfloat *m = mat->m;
for ( i = 0 ; i < src->count ; i++ ) {
TRANSFORM_POINT( d[i], m, s );
s = (GLfloat *)((char *)s + src->stride);
}
}
/* =============================================================
* 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;
}
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, unsigned long *cycles )
{
GLvector4f source[1], dest[1], ref[1];
GLmatrix mat[1];
GLfloat *m;
int i, j;
#ifdef RUN_DEBUG_BENCHMARK
int cycle_i; /* the counter for the benchmarks we run */
#endif
(void) cycles;
if ( psize > 4 ) {
_mesa_problem( NULL, "test_transform_function called with psize > 4\n" );
return 0;
}
mat->m = align_malloc( 16 * sizeof(GLfloat), 16 );
mat->type = mtypes[mtype];
m = mat->m;
assert( ((long)m & 15) == 0 );
init_matrix( m );
for ( i = 0 ; i < 4 ; i++ ) {
for ( j = 0 ; j < 4 ; j++ ) {
switch ( templates[mtype][i * 4 + j] ) {
case NIL:
m[j * 4 + i] = 0.0;
break;
case ONE:
m[j * 4 + i] = 1.0;
break;
case NEG:
m[j * 4 + i] = -1.0;
break;
case VAR:
break;
default:
assert(0);
return 0;
}
}
}
for ( i = 0 ; i < TEST_COUNT ; i++) {
ASSIGN_4V( d[i], 0.0, 0.0, 0.0, 1.0 );
ASSIGN_4V( s[i], 0.0, 0.0, 0.0, 1.0 );
for ( j = 0 ; j < psize ; j++ )
s[i][j] = rnd();
}
source->data = (GLfloat(*)[4])s;
source->start = (GLfloat *)s;
source->count = TEST_COUNT;
source->stride = sizeof(s[0]);
source->size = 4;
source->flags = 0;
dest->data = (GLfloat(*)[4])d;
dest->start = (GLfloat *)d;
dest->count = TEST_COUNT;
dest->stride = sizeof(float[4]);
dest->size = 0;
dest->flags = 0;
ref->data = (GLfloat(*)[4])r;
ref->start = (GLfloat *)r;
ref->count = TEST_COUNT;
ref->stride = sizeof(float[4]);
ref->size = 0;
ref->flags = 0;
ref_transform( ref, mat, source );
if ( mesa_profile ) {
BEGIN_RACE( *cycles );
func( dest, mat->m, source );
END_RACE( *cycles );
}
else {
func( dest, mat->m, source );
}
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",
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",
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",
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",
d[i][3], r[i][3], r[i][3]-d[i][3],
MAX_PRECISION - significand_match( d[i][3], r[i][3] ) );
return 0;
}
}
}
align_free( mat->m );
return 1;
}
void _math_test_all_transform_functions( char *description )
{
int psize, mtype;
unsigned long benchmark_tab[4][7];
static int first_time = 1;
if ( first_time ) {
first_time = 0;
mesa_profile = getenv( "MESA_PROFILE" );
}
#ifdef RUN_DEBUG_BENCHMARK
if ( mesa_profile ) {
if ( !counter_overhead ) {
INIT_COUNTER();
printf("counter overhead: %lu cycles\n\n", counter_overhead );
}
printf("transform results after hooking in %s functions:\n", description );
}
#endif
#ifdef RUN_DEBUG_BENCHMARK
if ( mesa_profile ) {
printf("\n" );
for ( psize = 1 ; psize <= 4 ; psize++ ) {
printf(" p%d\t", psize );
}
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]];
unsigned long *cycles = &(benchmark_tab[psize-1][mtype]);
if ( test_transform_function( func, psize, mtype, cycles ) == 0 ) {
char buf[100];
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 )
printf(" %li\t", benchmark_tab[psize-1][mtype] );
#endif
}
#ifdef RUN_DEBUG_BENCHMARK
if ( mesa_profile )
printf(" | [%s]\n", mstrings[mtype] );
#endif
}
#ifdef RUN_DEBUG_BENCHMARK
if ( mesa_profile )
printf( "\n" );
#endif
}
#endif /* DEBUG_MATH */
-5
View File
@@ -254,11 +254,6 @@ files_libmesa = files(
'main/viewport.c',
'main/viewport.h',
'main/es1_conversion.c',
'math/m_debug.h',
'math/m_debug_clip.c',
'math/m_debug_norm.c',
'math/m_debug_util.h',
'math/m_debug_xform.c',
'math/m_eval.c',
'math/m_eval.h',
'math/m_matrix.c',