Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions src/lib/libeventloop.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ LibraryJSEventLoop = {
$MainLoop: {
running: false,
scheduler: null,
method: '',
// Each main loop is numbered with a ID in sequence order. Only one main
// loop can run at a time. This variable stores the ordinal number of the
// main loop that is currently allowed to run. All previous main loops
Expand Down Expand Up @@ -333,12 +332,10 @@ LibraryJSEventLoop = {
var timeUntilNextTick = Math.max(0, MainLoop.tickStartTime + value - _emscripten_get_now())|0;
setTimeout(MainLoop.runner, timeUntilNextTick); // doing this each time means that on exception, we stop
};
MainLoop.method = 'timeout';
} else if (mode == {{{ cDefs.EM_TIMING_RAF }}}) {
MainLoop.scheduler = function MainLoop_scheduler_rAF() {
MainLoop.requestAnimationFrame(MainLoop.runner);
};
MainLoop.method = 'rAF';
} else {
#if ASSERTIONS
assert(mode == {{{ cDefs.EM_TIMING_SETIMMEDIATE}}});
Expand Down Expand Up @@ -373,7 +370,6 @@ LibraryJSEventLoop = {
MainLoop.scheduler = function MainLoop_scheduler_setImmediate() {
MainLoop.setImmediate(MainLoop.runner);
};
MainLoop.method = 'immediate';
}
return 0;
},
Expand Down Expand Up @@ -465,14 +461,12 @@ LibraryJSEventLoop = {
return;
} else if (MainLoop.timingMode == {{{ cDefs.EM_TIMING_SETTIMEOUT }}}) {
MainLoop.tickStartTime = _emscripten_get_now();
}

#if ASSERTIONS
if (MainLoop.method === 'timeout' && Module['ctx']) {
warnOnce('Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!');
MainLoop.method = ''; // just warn once per call to set main loop
}
if (Module['ctx']) {
warnOnce('Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!');
}
#endif
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks wrong - now the warning only happens for timingMode = SETTIMEOUT?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but that was true before this change too.

Before: check MainLoop.method === 'timeout'
After: check MainLoop.timingMode == EM_TIMING_SETTIMEOUT

But these checks are the same thing since method is only set to timeout then timeingMode is EM_TIMING_SETTIMEOUT

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right, now I see.


MainLoop.runIter(iterFunc);

Expand Down