Merge pull request #107460 from adamscott/fix-emscripten-webxr

[Web] Fix Emscripten for WebXR and update minimum version
This commit is contained in:
Thaddeus Crews 2025-07-23 13:27:01 -05:00
commit cc4e6dd612
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC
4 changed files with 35 additions and 23 deletions

View file

@ -29,7 +29,7 @@
/**************************************************************************/
const GodotWebXR = {
$GodotWebXR__deps: ['$Browser', '$GL', '$GodotRuntime', '$runtimeKeepalivePush', '$runtimeKeepalivePop'],
$GodotWebXR__deps: ['$MainLoop', '$GL', '$GodotRuntime', '$runtimeKeepalivePush', '$runtimeKeepalivePop'],
$GodotWebXR: {
gl: null,
@ -64,9 +64,9 @@ const GodotWebXR = {
},
monkeyPatchRequestAnimationFrame: (enable) => {
if (GodotWebXR.orig_requestAnimationFrame === null) {
GodotWebXR.orig_requestAnimationFrame = Browser.requestAnimationFrame;
GodotWebXR.orig_requestAnimationFrame = MainLoop.requestAnimationFrame;
}
Browser.requestAnimationFrame = enable
MainLoop.requestAnimationFrame = enable
? GodotWebXR.requestAnimationFrame
: GodotWebXR.orig_requestAnimationFrame;
},
@ -76,11 +76,11 @@ const GodotWebXR = {
// enabled or disabled. When using the WebXR API Emulator, this
// gets picked up automatically, however, in the Oculus Browser
// on the Quest, we need to pause and resume the main loop.
Browser.mainLoop.pause();
MainLoop.pause();
runtimeKeepalivePush();
window.setTimeout(function () {
runtimeKeepalivePop();
Browser.mainLoop.resume();
MainLoop.resume();
}, 0);
},