예제 #1
0
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 = _mesa_getenv( "MESA_PROFILE" );
   }

#ifdef RUN_DEBUG_BENCHMARK
   if ( mesa_profile ) {
      if ( !counter_overhead ) {
	 INIT_COUNTER();
	 _mesa_printf("counter overhead: %lu cycles\n\n", counter_overhead );
      }
      _mesa_printf("transform results after hooking in %s functions:\n", description );
   }
#endif

#ifdef RUN_DEBUG_BENCHMARK
   if ( mesa_profile ) {
      _mesa_printf("\n" );
      for ( psize = 1 ; psize <= 4 ; psize++ ) {
	 _mesa_printf(" p%d\t", psize );
      }
      _mesa_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];
	    _mesa_sprintf(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 )
	    _mesa_printf(" %li\t", benchmark_tab[psize-1][mtype] );
#endif
      }
#ifdef RUN_DEBUG_BENCHMARK
      if ( mesa_profile )
	 _mesa_printf(" | [%s]\n", mstrings[mtype] );
#endif
   }
#ifdef RUN_DEBUG_BENCHMARK
   if ( mesa_profile )
      _mesa_printf( "\n" );
#endif
}
예제 #2
0
void gl_test_all_transform_functions( char *description )
{
   int masked, psize, mtype;
   long benchmark_tab[2][4][7];
   static int first_time = 1;

   if ( first_time ) {
      first_time = 0;
      mesa_profile = getenv( "MESA_PROFILE" );
   }

#ifdef RUN_XFORM_BENCHMARK
   if ( mesa_profile ) {
      if ( need_counter ) {
	 need_counter = 0;
	 INIT_COUNTER();
	 printf( "counter overhead: %ld cycles\n\n", counter_overhead );
      }
      printf( "transform results after hooking in %s functions:\n", description );
   }
#endif

   for ( masked = 0 ; masked <= 1 ; masked++ ) {
      int cma = masked ? CULL_MASK_ACTIVE : 0;
      char *cmastring = masked ? "CULL_MASK_ACTIVE" : "0";

#ifdef RUN_XFORM_BENCHMARK
      if ( mesa_profile ) {
         printf( "\n culling: %s \n", masked ? "CULL_MASK_ACTIVE" : "0" );
         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 = gl_transform_tab[cma][psize][mtypes[mtype]];
            long *cycles = &(benchmark_tab[cma][psize-1][mtype]);

            if ( test_transform_function( func, psize, mtype,
					  masked, cycles ) == 0 ) {
               char buf[100];
               sprintf( buf, "gl_transform_tab[%s][%d][%s] failed test (%s)",
                        cmastring, psize, mstrings[mtype], description );
               gl_problem( NULL, buf );
            }
#ifdef RUN_XFORM_BENCHMARK
            if ( mesa_profile )
               printf( " %li\t", benchmark_tab[cma][psize-1][mtype] );
#endif
         }
#ifdef RUN_XFORM_BENCHMARK
         if ( mesa_profile )
            printf( " | [%s]\n", mstrings[mtype] );
#endif
      }
#ifdef RUN_XFORM_BENCHMARK
      if ( mesa_profile )
         printf( "\n" );
#endif
   }
}