Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebXR fix overlaping rAF callbacks #6244

Merged
merged 7 commits into from
Apr 12, 2024

Conversation

Maksims
Copy link
Collaborator

@Maksims Maksims commented Apr 11, 2024

Previously in Quest 3 and Emulator as well as the other places when launching the WebXR session, the browser requestAnimationFrame would not trigger, and you would need to queue up rAF from the XRSession instead of window.
But with recent changes, they've changed it, so you can have multiple request animation frames, from the XRSession and from the window, which leads to double application updates per frame. This is an issue of course.

This PR fixes that and avoids overlapping rAF callbacks per frame by cancelling any existing rAF callbacks when calling AppBase.tick.

For rendering in an overlay browser window while in a WebXR session, we would need to figure out how to handle that separately, and ensure we do avoid multiple application update calls per actual frame.

I confirm I have read the contributing guidelines and signed the Contributor License Agreement.

src/framework/app-base.js Outdated Show resolved Hide resolved
@willeastcott willeastcott merged commit 6cb3f3f into playcanvas:main Apr 12, 2024
7 checks passed
@willeastcott
Copy link
Contributor

Nice job, @Maksims! Thanks.

@Maksims Maksims deleted the webxr-fix-multi-raf branch December 16, 2024 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants