mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Add support for OpenXR hololens backend
This commit is contained in:
parent
9b4b02275e
commit
acfe1ee0dd
9 changed files with 70 additions and 19 deletions
|
@ -10,7 +10,9 @@ publish = false
|
|||
libservo = { path = "../../../components/servo" }
|
||||
log = "0.4"
|
||||
servo-media = { git = "https://github.com/servo/media" }
|
||||
webxr-api = { git = "https://github.com/servo/webxr" }
|
||||
|
||||
webxr-api = { git = "https://github.com/servo/webxr", features = ["ipc"] }
|
||||
webxr = { git = "https://github.com/servo/webxr" , optional = true}
|
||||
|
||||
[target.'cfg(not(target_os = "macos"))'.dependencies]
|
||||
libc = "0.2"
|
||||
|
@ -44,5 +46,5 @@ no_static_freetype = ["libservo/no_static_freetype"]
|
|||
no_wgl = ["libservo/no_wgl"]
|
||||
oculusvr = ["libservo/oculusvr"]
|
||||
webdriver = ["libservo/webdriver"]
|
||||
uwp = ["libservo/uwp"]
|
||||
uwp = ["libservo/uwp", "webxr", "webxr/openxr-api"]
|
||||
webgl_backtrace = ["libservo/webgl_backtrace"]
|
||||
|
|
|
@ -189,8 +189,8 @@ pub fn init(
|
|||
gl.finish();
|
||||
|
||||
let window_callbacks = Rc::new(ServoWindowCallbacks {
|
||||
gl: gl.clone(),
|
||||
host_callbacks: callbacks,
|
||||
gl: gl.clone(),
|
||||
coordinates: RefCell::new(init_opts.coordinates),
|
||||
density: init_opts.density,
|
||||
gl_context_pointer: init_opts.gl_context_pointer,
|
||||
|
@ -201,6 +201,7 @@ pub fn init(
|
|||
vr_init: init_opts.vr_init,
|
||||
xr_discovery: init_opts.xr_discovery,
|
||||
waker,
|
||||
gl: gl.clone(),
|
||||
});
|
||||
|
||||
let servo = Servo::new(embedder_callbacks, window_callbacks.clone());
|
||||
|
@ -581,6 +582,8 @@ struct ServoEmbedderCallbacks {
|
|||
waker: Box<dyn EventLoopWaker>,
|
||||
xr_discovery: Option<Box<dyn webxr_api::Discovery>>,
|
||||
vr_init: VRInitOptions,
|
||||
#[allow(unused)]
|
||||
gl: Rc<dyn gl::Gl>,
|
||||
}
|
||||
|
||||
struct ServoWindowCallbacks {
|
||||
|
@ -611,6 +614,19 @@ impl EmbedderMethods for ServoEmbedderCallbacks {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "uwp")]
|
||||
fn register_webxr(&mut self, registry: &mut webxr_api::MainThreadRegistry) {
|
||||
debug!("EmbedderMethods::register_xr");
|
||||
assert!(
|
||||
self.xr_discovery.is_none(),
|
||||
"UWP builds should not be initialized with a WebXR Discovery object"
|
||||
);
|
||||
let gl = self.gl.clone();
|
||||
let discovery = webxr::openxr::OpenXrDiscovery::new(gl);
|
||||
registry.register(discovery);
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "uwp"))]
|
||||
fn register_webxr(&mut self, registry: &mut webxr_api::MainThreadRegistry) {
|
||||
debug!("EmbedderMethods::register_xr");
|
||||
if let Some(discovery) = self.xr_discovery.take() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue