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://www.wtfpl.net/ for more details. |
---|

9 | // |
---|

10 | |
---|

11 | #if defined HAVE_CONFIG_H |
---|

12 | # include "config.h" |
---|

13 | #endif |
---|

14 | |
---|

15 | #include <cstdio> |
---|

16 | |
---|

17 | #include "core.h" |
---|

18 | |
---|

19 | using namespace std; |
---|

20 | using namespace lol; |
---|

21 | |
---|

22 | void bench_real(int mode); |
---|

23 | void bench_trig(int mode); |
---|

24 | void bench_matrix(int mode); |
---|

25 | void bench_half(int mode); |
---|

26 | |
---|

27 | int main(int argc, char **argv) |
---|

28 | { |
---|

29 | UNUSED(argc, argv); |
---|

30 | |
---|

31 | Log::Info("-----------------------\n"); |
---|

32 | Log::Info(" High precision floats\n"); |
---|

33 | Log::Info("-----------------------\n"); |
---|

34 | bench_real(1); |
---|

35 | |
---|

36 | Log::Info("--------------------------\n"); |
---|

37 | Log::Info(" Trigonometry [-1e5, 1e5]\n"); |
---|

38 | Log::Info("--------------------------\n"); |
---|

39 | bench_trig(1); |
---|

40 | |
---|

41 | Log::Info("------------------------\n"); |
---|

42 | Log::Info(" Trigonometry [-pi, pi]\n"); |
---|

43 | Log::Info("------------------------\n"); |
---|

44 | bench_trig(2); |
---|

45 | |
---|

46 | Log::Info("----------------------------\n"); |
---|

47 | Log::Info(" Trigonometry [-1e-2, 1e-2]\n"); |
---|

48 | Log::Info("----------------------------\n"); |
---|

49 | bench_trig(3); |
---|

50 | |
---|

51 | Log::Info("----------------------------\n"); |
---|

52 | Log::Info(" Float matrices [-2.0, 2.0]\n"); |
---|

53 | Log::Info("----------------------------\n"); |
---|

54 | bench_matrix(1); |
---|

55 | |
---|

56 | Log::Info("-------------------------------------\n"); |
---|

57 | Log::Info(" Half precision floats (random bits)\n"); |
---|

58 | Log::Info("-------------------------------------\n"); |
---|

59 | bench_half(1); |
---|

60 | |
---|

61 | Log::Info("-----------------------------------\n"); |
---|

62 | Log::Info(" Half precision floats [-2.0, 2.0]\n"); |
---|

63 | Log::Info("-----------------------------------\n"); |
---|

64 | bench_half(2); |
---|

65 | |
---|

66 | #if defined _WIN32 |
---|

67 | getchar(); |
---|

68 | #endif |
---|

69 | |
---|

70 | return EXIT_SUCCESS; |
---|

71 | } |
---|

72 | |
---|