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 | |
---|

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_trig(int mode); |
---|

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

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

25 | |
---|

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

27 | { |
---|

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

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

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

31 | bench_trig(1); |
---|

32 | |
---|

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

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

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

36 | bench_trig(2); |
---|

37 | |
---|

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

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

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

41 | bench_trig(3); |
---|

42 | |
---|

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

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

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

46 | bench_matrix(1); |
---|

47 | |
---|

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

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

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

51 | bench_half(1); |
---|

52 | |
---|

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

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

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

56 | bench_half(2); |
---|

57 | |
---|

58 | #if defined _WIN32 |
---|

59 | getchar(); |
---|

60 | #endif |
---|

61 | |
---|

62 | return EXIT_SUCCESS; |
---|

63 | } |
---|

64 | |
---|