servo / rust-webvr

UNMAINTAINED - WebVR API implementation for servo.
Mozilla Public License 2.0
106 stars 23 forks source link

Supporting devices that require code to run on the main thread #52

Closed asajeffrey closed 5 years ago

asajeffrey commented 5 years ago

Currently the API has no concept of the "main thread" of an application, and assumes that VRServiceManager::new() and VRServiceManager::register_defaults() can be safely called from any thread (in servo, they're called from the WebVRThread). This has a mismatch with devices (such as MagicLeap) which have a main thread, and where the APIs to access the device capabilities aren't thread-safe.

asajeffrey commented 5 years ago

An attempt at doing this... https://github.com/asajeffrey/rust-webvr/blob/glwindow/rust-webvr-api/src/vr_main_thread_heartbeat.rs.

asajeffrey commented 5 years ago

This is also needed when rendering to a window on MacOS, which requires windows to live on the main thread. https://github.com/asajeffrey/rust-webvr/blob/glwindow/rust-webvr/src/api/glwindow/heartbeat.rs