ADTast-experimental
Last change
on this file since ed52dd5 was
1188195,
checked in by Dmitry Kobets <dkobets@…>, 5 years ago
|
Finished floating point vec2
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | #include <glm/glm.hpp> |
---|
2 | #include <iostream> |
---|
3 | #define BENCH_N 1000000000 |
---|
4 | #include "../bench.h" |
---|
5 | |
---|
6 | using namespace glm; |
---|
7 | |
---|
8 | |
---|
9 | int main(int argc, char* argv[]) { |
---|
10 | tvec2<volatile float> v1(1,2); |
---|
11 | tvec2<volatile float> v2(20.5f, 30.2f); |
---|
12 | |
---|
13 | { |
---|
14 | BENCH( |
---|
15 | for (int i = 0; i < n; i ++) { |
---|
16 | volatile float res = dot(v1, v2); |
---|
17 | asm volatile ("":::"memory"); |
---|
18 | }, |
---|
19 | dot_b |
---|
20 | ); |
---|
21 | std::cout << "dot: " << dot_b << std::endl; |
---|
22 | } |
---|
23 | |
---|
24 | { |
---|
25 | BENCH( |
---|
26 | for (int i = 0; i < n; i ++) { |
---|
27 | volatile vec2 res = v1 + v2; |
---|
28 | asm volatile ("":::"memory"); |
---|
29 | }, |
---|
30 | add_b |
---|
31 | ); |
---|
32 | std::cout << "vector addition: " << add_b << std::endl; |
---|
33 | } |
---|
34 | |
---|
35 | { |
---|
36 | BENCH( |
---|
37 | for (int i = 0; i < n; i ++) { |
---|
38 | volatile vec2 res = normalize((tvec2<float>)v1); |
---|
39 | asm volatile ("":::"memory"); |
---|
40 | }, |
---|
41 | normalize_b |
---|
42 | ); |
---|
43 | std::cout << "normalize: " << normalize_b << std::endl; |
---|
44 | } |
---|
45 | |
---|
46 | { |
---|
47 | BENCH( |
---|
48 | for (int i = 0; i < n; i ++) { |
---|
49 | volatile vec2 res = reflect((vec2)v1, (vec2)v2); |
---|
50 | asm volatile ("":::"memory"); |
---|
51 | }, |
---|
52 | reflect_b |
---|
53 | ); |
---|
54 | std::cout << "reflect: " << reflect_b << std::endl; |
---|
55 | } |
---|
56 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.