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 | #if USE_SDL && defined __APPLE__ |
---|

18 | # include <SDL_main.h> |
---|

19 | #endif |
---|

20 | |
---|

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

22 | |
---|

23 | using namespace std; |
---|

24 | using namespace lol; |
---|

25 | |
---|

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

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

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

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

30 | |
---|

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

32 | { |
---|

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

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

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

36 | bench_real(1); |
---|

37 | |
---|

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

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

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

41 | bench_trig(1); |
---|

42 | |
---|

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

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

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

46 | bench_trig(2); |
---|

47 | |
---|

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

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

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

51 | bench_trig(3); |
---|

52 | |
---|

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

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

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

56 | bench_matrix(1); |
---|

57 | |
---|

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

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

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

61 | bench_half(1); |
---|

62 | |
---|

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

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

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

66 | bench_half(2); |
---|

67 | |
---|

68 | #if defined _WIN32 |
---|

69 | getchar(); |
---|

70 | #endif |
---|

71 | |
---|

72 | return EXIT_SUCCESS; |
---|

73 | } |
---|

74 | |
---|