예제 #1
0
void gl_test_all_normal_transform_functions( char *description )
{
   int masked;
   int mtype;
   long benchmark_tab[0xf][0x4];
   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( "normal 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" );
         printf( "\n-------------------------------------------------------\n" );
      }
#endif

      for ( mtype = 0 ; mtype < 8 ; mtype++ ) {
         normal_func func = gl_normal_tab[norm_types[mtype]][cma];
         long *cycles = &(benchmark_tab[mtype][cma]);

         if ( test_norm_function( func, mtype, masked, cycles ) == 0 ) {
            char buf[100];
            sprintf( buf, "gl_normal_tab[%s][%s] failed test (%s)",
                     cmastring, norm_strings[mtype], description );
            gl_problem( NULL, buf );
	 }

#ifdef RUN_XFORM_BENCHMARK
         if ( mesa_profile ) {
            printf( " %li\t", benchmark_tab[mtype][cma] );
            printf( " | [%s]\n", norm_strings[mtype] );
         }
      }
      if ( mesa_profile )
	 printf( "\n" );
#else
      }
#endif
   }
예제 #2
0
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 = _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 );
      }
      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
}