You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are still many more to convert.. perhaps we should
be more systematic about it. For now I'm just doing them
in batches by hand to keep the reviews of reasonable size.
Copy file name to clipboardExpand all lines: tests/emscripten_main_loop.cpp
+4-11Lines changed: 4 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -13,10 +13,8 @@ int frame = 0;
13
13
14
14
voidfinal(void*) {
15
15
assert(frame == 110);
16
-
#ifdef REPORT_RESULT
17
16
printf("Test passed.\n");
18
-
REPORT_RESULT(0);
19
-
#endif
17
+
exit(0);
20
18
}
21
19
22
20
voidlooper() {
@@ -29,11 +27,8 @@ void looper() {
29
27
timesTooSoon++;
30
28
if (timesTooSoon >= 10) {
31
29
printf("Abort: main loop tick was called too quickly after the previous frame, too many times!\n");
32
-
#ifdef REPORT_RESULT
33
-
REPORT_RESULT(1);
34
-
#endif
35
30
emscripten_cancel_main_loop();
36
-
exit(0);
31
+
exit(1);
37
32
}
38
33
}
39
34
prevTime = curTime;
@@ -42,11 +37,8 @@ void looper() {
42
37
timesTooSoon++;
43
38
if (timesTooSoon >= 2) {
44
39
printf("Abort: With swap interval of 4, we should be running at most 15fps! (or 30fps on 120Hz displays) but seems like swap control is not working and we are running at 60fps!\n");
Copy file name to clipboardExpand all lines: tests/emscripten_main_loop_setimmediate.cpp
+6-4Lines changed: 6 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
// University of Illinois/NCSA Open Source License. Both these licenses can be
4
4
// found in the LICENSE file.
5
5
6
+
#include<stdbool.h>
6
7
#include<stdlib.h>
7
8
#include<stdio.h>
8
9
#include<assert.h>
@@ -21,15 +22,16 @@ void looper() {
21
22
double now = emscripten_get_now();
22
23
double msecsPerFrame = (now - frame0) / (numFrames-1); // Sub one to account for intervals vs endpoints
23
24
printf("Avg. msecs/frame: %f\n", msecsPerFrame);
24
-
#ifdef REPORT_RESULT
25
-
int result = (msecsPerFrame < 5); // Expecting to run extremely fast unthrottled, and certainly not bounded by vsync, so less than common 16.667 msecs per frame (this is assuming 60hz display)
26
-
REPORT_RESULT(result);
27
-
#endif
28
25
emscripten_cancel_main_loop();
26
+
// Expecting to run extremely fast unthrottled, and certainly not bounded by
27
+
// vsync, so less than common 16.667 msecs per frame (this is assuming 60hz
0 commit comments