-
Notifications
You must be signed in to change notification settings - Fork 24
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
openxr: how to properly end session? #47
Comments
The fact that https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#events mentions that events must be polled regularly and we don't do that is a bit worrying. |
Would it be bad to do that in |
One of the problem with wait_for_animation_frame is that it won't be called after Quit, but we still need to pull events afterward. |
@Manishearth we need to loop through the openxr events. Where/How do you recommend we do that? |
My five cents: In theory events from the device are forwarded to script, once Then you could handle the exit event from script, at https://github.com/servo/servo/blob/f21d11606987a4febcb54431c5c4577ab018dec7/components/script/dom/xrsession.rs#L155 and send a message back to the embedder/main-thread to run the final In practice it's not clear to me how events go from the device to Line 105 in 932575d
Since I don't see any polling or handling of events, it seems to only be used at Line 525 in 932575d
it might be that this functionality requires a new hook into a new |
The interesting thing is that I think you'd want a event coming in on You might have to integrate |
In Chromium they poll events inside wait_for_animation_frame.
I can't quite make out what their Quit workflow is. They do catch the |
I think we should poll in rAF but perhaps have a wakeup heartbeat? |
I think the solution is to not actually stop the loop when Line 524 in 932575d
And move the In that case you wouldn't need a heartbeat since you'd continue running animation frames until the runtime itself moved into the
I read that as saying you can't just stop your render loop when the application calls |
@Manishearth Are there any other examples of heartbeats with webxr code? |
Nope. For now just polling in rAF would be fine, it would probably make more sense to have any kind of manual event loop pumping once we have #30. Not pumping the event loop with a heartbeat event only affects sessions without rAF, which are quite rare. |
Ending the session with openxr is a 2 steps process:
session.request_exit()
SessionStateChanged(Stopping)
, callsession.end()
What would be the right way of doing this?
request_exit
should be called indevice.quit()
, but I'm not sure when/where to pull the openxr events. For now I do it inwait_for_animation_frame
. Is there a better way?The text was updated successfully, but these errors were encountered: