diff --git a/Cargo.lock b/Cargo.lock index 5d9018aee26..8638425b4bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3307,6 +3307,26 @@ dependencies = [ "vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "openxr" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)", + "openxr-sys 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "shared_library 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "openxr-sys" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ordered-float" version = "1.0.0" @@ -3331,7 +3351,7 @@ name = "osmesa-sys" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "shared_library 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "shared_library 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -4558,7 +4578,7 @@ dependencies = [ [[package]] name = "shared_library" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4594,6 +4614,7 @@ dependencies = [ "libservo 0.0.1", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "servo-media 0.1.0 (git+https://github.com/servo/media)", + "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)", ] @@ -5671,7 +5692,7 @@ dependencies = [ [[package]] name = "webxr" version = "0.0.1" -source = "git+https://github.com/servo/webxr#f67b762424af7c75c0bbce817d0e55ff51baf4cc" +source = "git+https://github.com/servo/webxr#affa222d3c187f40ed3f6e91752f1f2e3f583dc6" dependencies = [ "bindgen 0.49.2 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5679,13 +5700,16 @@ dependencies = [ "gleam 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", "glutin 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "openxr 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "webxr-api 0.0.1 (git+https://github.com/servo/webxr)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "webxr-api" version = "0.0.1" -source = "git+https://github.com/servo/webxr#f67b762424af7c75c0bbce817d0e55ff51baf4cc" +source = "git+https://github.com/servo/webxr#affa222d3c187f40ed3f6e91752f1f2e3f583dc6" dependencies = [ "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5778,6 +5802,14 @@ dependencies = [ "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "wio" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "wr_malloc_size_of" version = "0.0.1" @@ -6150,6 +6182,8 @@ dependencies = [ "checksum opaque-debug 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "51ecbcb821e1bd256d456fe858aaa7f380b63863eab2eb86eee1bd9f33dd6682" "checksum openssl 0.10.11 (registry+https://github.com/rust-lang/crates.io-index)" = "6c24d3508b4fb6da175c10baac54c578b33f09c89ae90c6fe9788b3b4768efdc" "checksum openssl-sys 0.9.35 (registry+https://github.com/rust-lang/crates.io-index)" = "912f301a749394e1025d9dcddef6106ddee9252620e6d0a0e5f8d0681de9b129" +"checksum openxr 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bd30879fa0a4815c204a199a06f08826c892208e6d93617194bd5a9e0b12e9e0" +"checksum openxr-sys 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "875181a679f13b1b7c6b37b7f221c11a9cabc67a51399bc8051165d2c03a17a0" "checksum ordered-float 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e9a3c8db0fca1fdb34404f0b1286db252f23930b9f7a481e376c16c0d5c309d4" "checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" "checksum osmesa-src 0.1.0 (git+https://github.com/servo/osmesa-src)" = "" @@ -6241,7 +6275,7 @@ dependencies = [ "checksum servo_media_derive 0.1.0 (git+https://github.com/servo/media)" = "" "checksum sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "23962131a91661d643c98940b20fcaffe62d776a823247be80a48fcb8b6fce68" "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" -"checksum shared_library 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8254bf098ce4d8d7cc7cc6de438c5488adc5297e5b7ffef88816c0a91bd289c1" +"checksum shared_library 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5a9e7e0f2bfae24d8a5b5a66c5b257a83c7412304311512a0c054cd5e619da11" "checksum shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" "checksum sig 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6567e29578f9bfade6a5d94a32b9a4256348358d2a3f448cab0021f9a02614a2" "checksum signpost 0.1.0 (git+https://github.com/pcwalton/signpost.git)" = "" @@ -6343,6 +6377,7 @@ dependencies = [ "checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" "checksum winit 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d233301129ddd33260b47f76900b50e154b7254546e2edba0e5468a1a5fe4de3" "checksum winres 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "27d9192d6356d7efe8405dec6c5506b67543cf64b6049968f39f4c4623b4f25d" +"checksum wio 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" "checksum wr_malloc_size_of 0.0.1 (git+https://github.com/servo/webrender)" = "" "checksum ws 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ec91ea61b83ce033c43c06c52ddc7532f465c0153281610d44c58b74083aee1a" "checksum x11 2.17.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e5c4ac579b5d324dc4add02312b5d0e3e0218521e2d5779d526ac39ee4bb171" diff --git a/components/script/dom/xr.rs b/components/script/dom/xr.rs index 8deead58b92..a6fb4057e2c 100644 --- a/components/script/dom/xr.rs +++ b/components/script/dom/xr.rs @@ -156,10 +156,6 @@ impl XRMethods for XR { comp: InCompartment, ) -> Rc { let promise = Promise::new_in_current_compartment(&self.global(), comp); - if mode != XRSessionMode::Immersive_vr { - promise.reject_error(Error::NotSupported); - return promise; - } if self.pending_or_active_session() { promise.reject_error(Error::InvalidState); diff --git a/ports/libsimpleservo/api/Cargo.toml b/ports/libsimpleservo/api/Cargo.toml index 4bbdda8545e..e0204f3ebb6 100644 --- a/ports/libsimpleservo/api/Cargo.toml +++ b/ports/libsimpleservo/api/Cargo.toml @@ -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"] diff --git a/ports/libsimpleservo/api/src/lib.rs b/ports/libsimpleservo/api/src/lib.rs index 93e078095ae..e4b065a7b40 100644 --- a/ports/libsimpleservo/api/src/lib.rs +++ b/ports/libsimpleservo/api/src/lib.rs @@ -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, xr_discovery: Option>, vr_init: VRInitOptions, + #[allow(unused)] + gl: Rc, } 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() { diff --git a/support/hololens/.gitignore b/support/hololens/.gitignore new file mode 100644 index 00000000000..83e187f2139 --- /dev/null +++ b/support/hololens/.gitignore @@ -0,0 +1,4 @@ +/Generated Files +ServoApp.vcxproj.user +bin +obj diff --git a/support/hololens/ServoApp/ServoApp.vcxproj b/support/hololens/ServoApp/ServoApp.vcxproj index 096a0a2510e..c725d4b94c2 100644 --- a/support/hololens/ServoApp/ServoApp.vcxproj +++ b/support/hololens/ServoApp/ServoApp.vcxproj @@ -173,6 +173,9 @@ Designer + + true + true diff --git a/tests/wpt/metadata/webxr/xrSession_requestReferenceSpace_features.https.html.ini b/tests/wpt/metadata/webxr/xrSession_requestReferenceSpace_features.https.html.ini index 84a5e1496a8..4f55ce35584 100644 --- a/tests/wpt/metadata/webxr/xrSession_requestReferenceSpace_features.https.html.ini +++ b/tests/wpt/metadata/webxr/xrSession_requestReferenceSpace_features.https.html.ini @@ -26,9 +26,6 @@ [Non-immersive session supports local space when required] expected: FAIL - [Non-immersive session supports viewer space by default] - expected: FAIL - [Non-immersive session rejects local space if not requested] expected: FAIL diff --git a/tests/wpt/metadata/webxr/xrSession_viewer_referenceSpace.https.html.ini b/tests/wpt/metadata/webxr/xrSession_viewer_referenceSpace.https.html.ini index b6af7d5f905..47ad34657e1 100644 --- a/tests/wpt/metadata/webxr/xrSession_viewer_referenceSpace.https.html.ini +++ b/tests/wpt/metadata/webxr/xrSession_viewer_referenceSpace.https.html.ini @@ -2,6 +2,3 @@ [Identity reference space provides correct poses for immersive sessions] expected: FAIL - [Identity reference space provides correct poses for inline sessions] - expected: FAIL - diff --git a/tests/wpt/metadata/webxr/xrWebGLLayer_constructor.https.html.ini b/tests/wpt/metadata/webxr/xrWebGLLayer_constructor.https.html.ini index f9f55152f51..08a51f5b1bc 100644 --- a/tests/wpt/metadata/webxr/xrWebGLLayer_constructor.https.html.ini +++ b/tests/wpt/metadata/webxr/xrWebGLLayer_constructor.https.html.ini @@ -1,4 +1,5 @@ [xrWebGLLayer_constructor.https.html] + expected: ERROR [Ensure that XRWebGLLayer's constructor throws appropriate errors] - expected: FAIL + expected: TIMEOUT