Register a glwindow test XR device

This commit is contained in:
Alan Jeffrey 2019-07-05 15:32:23 -05:00
parent 39ec04a065
commit 8e535857c2
3 changed files with 21 additions and 3 deletions

5
Cargo.lock generated
View file

@ -4119,6 +4119,7 @@ dependencies = [
"sig 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tinyfiledialogs 3.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"webxr 0.0.1 (git+https://github.com/servo/webxr)",
"webxr-api 0.0.1 (git+https://github.com/servo/webxr)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"winres 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"x11 2.17.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -5510,7 +5511,7 @@ dependencies = [
[[package]]
name = "webxr"
version = "0.0.1"
source = "git+https://github.com/servo/webxr#f8bfa261bcd54bfeb47f68f23043e547153d7491"
source = "git+https://github.com/servo/webxr#39600af83b714e910389c912706d7cd06406c7bb"
dependencies = [
"euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)",
@ -5521,7 +5522,7 @@ dependencies = [
[[package]]
name = "webxr-api"
version = "0.0.1"
source = "git+https://github.com/servo/webxr#f8bfa261bcd54bfeb47f68f23043e547153d7491"
source = "git+https://github.com/servo/webxr#39600af83b714e910389c912706d7cd06406c7bb"
dependencies = [
"euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -59,7 +59,8 @@ log = "0.4"
rust-webvr = { version = "0.13", features = ["glwindow"] }
servo-media = {git = "https://github.com/servo/media"}
tinyfiledialogs = "3.0"
webxr = { git = "https://github.com/servo/webxr", features = ["glwindow"] }
webxr-api = { git = "https://github.com/servo/webxr", features = ["ipc"] }
webxr = { git = "https://github.com/servo/webxr", features = ["ipc", "glwindow"] }
[target.'cfg(any(target_os = "linux", target_os = "windows"))'.dependencies]
image = "0.21"

View file

@ -71,4 +71,20 @@ impl EmbedderMethods for EmbedderCallbacks {
// FIXME: support headless mode
}
}
fn register_webxr(&mut self, xr: &mut webxr_api::MainThreadRegistry) {
if !opts::get().headless {
if pref!(dom.webxr.test) {
warn!("Creating test XR device");
let gl = self.gl.clone();
let events_loop_clone = self.events_loop.clone();
let events_loop_factory = Box::new(move || {
events_loop_clone.borrow_mut().take().ok_or(EventsLoopClosed)
});
let gl_version = app::gl_version();
let discovery = webxr::glwindow::GlWindowDiscovery::new(gl, events_loop_factory, gl_version);
xr.register(discovery);
}
}
}
}