You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

75 rivejä
1.9 KiB

  1. //
  2. // Lol Engine - Benchmark program
  3. //
  4. // Copyright: (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the Do What The Fuck You Want To
  7. // Public License, Version 2, as published by Sam Hocevar. See
  8. // http://sam.zoy.org/projects/COPYING.WTFPL for more details.
  9. //
  10. #if defined HAVE_CONFIG_H
  11. # include "config.h"
  12. #endif
  13. #include <cstdio>
  14. #if USE_SDL && defined __APPLE__
  15. # include <SDL_main.h>
  16. #endif
  17. #include "core.h"
  18. using namespace std;
  19. using namespace lol;
  20. void bench_real(int mode);
  21. void bench_trig(int mode);
  22. void bench_matrix(int mode);
  23. void bench_half(int mode);
  24. int main(int argc, char **argv)
  25. {
  26. Log::Info("-----------------------\n");
  27. Log::Info(" High precision floats\n");
  28. Log::Info("-----------------------\n");
  29. bench_real(1);
  30. Log::Info("--------------------------\n");
  31. Log::Info(" Trigonometry [-1e5, 1e5]\n");
  32. Log::Info("--------------------------\n");
  33. bench_trig(1);
  34. Log::Info("------------------------\n");
  35. Log::Info(" Trigonometry [-pi, pi]\n");
  36. Log::Info("------------------------\n");
  37. bench_trig(2);
  38. Log::Info("----------------------------\n");
  39. Log::Info(" Trigonometry [-1e-2, 1e-2]\n");
  40. Log::Info("----------------------------\n");
  41. bench_trig(3);
  42. Log::Info("----------------------------\n");
  43. Log::Info(" Float matrices [-2.0, 2.0]\n");
  44. Log::Info("----------------------------\n");
  45. bench_matrix(1);
  46. Log::Info("-------------------------------------\n");
  47. Log::Info(" Half precision floats (random bits)\n");
  48. Log::Info("-------------------------------------\n");
  49. bench_half(1);
  50. Log::Info("-----------------------------------\n");
  51. Log::Info(" Half precision floats [-2.0, 2.0]\n");
  52. Log::Info("-----------------------------------\n");
  53. bench_half(2);
  54. #if defined _WIN32
  55. getchar();
  56. #endif
  57. return EXIT_SUCCESS;
  58. }