diff options
-rw-r--r-- | Cargo.lock | 30 | ||||
-rw-r--r-- | Cargo.toml | 4 | ||||
-rw-r--r-- | components/canvas/webgl_mode/inprocess.rs | 13 | ||||
-rw-r--r-- | components/script/dom/xrsession.rs | 20 | ||||
-rw-r--r-- | components/script/dom/xrwebgllayer.rs | 4 | ||||
-rw-r--r-- | tests/wpt/metadata/webxr/xrBoundedReferenceSpace_updates.https.html.ini | 2 | ||||
-rw-r--r-- | tests/wpt/metadata/webxr/xrSession_end.https.html.ini | 3 | ||||
-rw-r--r-- | tests/wpt/metadata/webxr/xrSession_input_events_end.https.html.ini | 1 | ||||
-rw-r--r-- | tests/wpt/metadata/webxr/xrSession_prevent_multiple_exclusive.https.html.ini | 4 |
9 files changed, 47 insertions, 34 deletions
diff --git a/Cargo.lock b/Cargo.lock index 8c691485ce5..914e577b4a2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -411,7 +411,7 @@ dependencies = [ "webrender 0.60.0 (git+https://github.com/servo/webrender)", "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", "webrender_traits 0.0.1", - "webxr-api 0.0.1 (git+https://github.com/asajeffrey/webxr?branch=optional-glsync)", + "webxr-api 0.0.1 (git+https://github.com/servo/webxr)", ] [[package]] @@ -432,7 +432,7 @@ dependencies = [ "typetag 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", "webvr_traits 0.0.1", - "webxr-api 0.0.1 (git+https://github.com/asajeffrey/webxr?branch=optional-glsync)", + "webxr-api 0.0.1 (git+https://github.com/servo/webxr)", ] [[package]] @@ -622,7 +622,7 @@ dependencies = [ "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", "webvr 0.0.1", "webvr_traits 0.0.1", - "webxr-api 0.0.1 (git+https://github.com/asajeffrey/webxr?branch=optional-glsync)", + "webxr-api 0.0.1 (git+https://github.com/servo/webxr)", ] [[package]] @@ -665,7 +665,7 @@ dependencies = [ "style_traits 0.0.1", "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", "webvr_traits 0.0.1", - "webxr-api 0.0.1 (git+https://github.com/asajeffrey/webxr?branch=optional-glsync)", + "webxr-api 0.0.1 (git+https://github.com/servo/webxr)", ] [[package]] @@ -1088,7 +1088,7 @@ dependencies = [ "servo_url 0.0.1", "style_traits 0.0.1", "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", - "webxr-api 0.0.1 (git+https://github.com/asajeffrey/webxr?branch=optional-glsync)", + "webxr-api 0.0.1 (git+https://github.com/servo/webxr)", ] [[package]] @@ -2538,7 +2538,7 @@ dependencies = [ "webrender_traits 0.0.1", "webvr 0.0.1", "webvr_traits 0.0.1", - "webxr-api 0.0.1 (git+https://github.com/asajeffrey/webxr?branch=optional-glsync)", + "webxr-api 0.0.1 (git+https://github.com/servo/webxr)", ] [[package]] @@ -3913,7 +3913,7 @@ dependencies = [ "uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", "webvr_traits 0.0.1", - "webxr-api 0.0.1 (git+https://github.com/asajeffrey/webxr?branch=optional-glsync)", + "webxr-api 0.0.1 (git+https://github.com/servo/webxr)", "xml5ever 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -4005,7 +4005,7 @@ dependencies = [ "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", "webvr_traits 0.0.1", - "webxr-api 0.0.1 (git+https://github.com/asajeffrey/webxr?branch=optional-glsync)", + "webxr-api 0.0.1 (git+https://github.com/servo/webxr)", ] [[package]] @@ -4102,8 +4102,8 @@ dependencies = [ "servo-media 0.1.0 (git+https://github.com/servo/media)", "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/asajeffrey/webxr?branch=optional-glsync)", - "webxr-api 0.0.1 (git+https://github.com/asajeffrey/webxr?branch=optional-glsync)", + "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)", @@ -5496,19 +5496,19 @@ dependencies = [ [[package]] name = "webxr" version = "0.0.1" -source = "git+https://github.com/asajeffrey/webxr?branch=optional-glsync#da820a3ab266fce07c9a8abee3e6e9231cb93ec5" +source = "git+https://github.com/servo/webxr#96c964c8939ca3ee8425fb8b29dd6fa6096a0bdd" 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)", "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)", - "webxr-api 0.0.1 (git+https://github.com/asajeffrey/webxr?branch=optional-glsync)", + "webxr-api 0.0.1 (git+https://github.com/servo/webxr)", ] [[package]] name = "webxr-api" version = "0.0.1" -source = "git+https://github.com/asajeffrey/webxr?branch=optional-glsync#da820a3ab266fce07c9a8abee3e6e9231cb93ec5" +source = "git+https://github.com/servo/webxr#96c964c8939ca3ee8425fb8b29dd6fa6096a0bdd" 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)", @@ -6142,8 +6142,8 @@ dependencies = [ "checksum webrender 0.60.0 (git+https://github.com/servo/webrender)" = "<none>" "checksum webrender_api 0.60.0 (git+https://github.com/servo/webrender)" = "<none>" "checksum webrender_build 0.0.1 (git+https://github.com/servo/webrender)" = "<none>" -"checksum webxr 0.0.1 (git+https://github.com/asajeffrey/webxr?branch=optional-glsync)" = "<none>" -"checksum webxr-api 0.0.1 (git+https://github.com/asajeffrey/webxr?branch=optional-glsync)" = "<none>" +"checksum webxr 0.0.1 (git+https://github.com/servo/webxr)" = "<none>" +"checksum webxr-api 0.0.1 (git+https://github.com/servo/webxr)" = "<none>" "checksum weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bb43f70885151e629e2a19ce9e50bd730fd436cfd4b666894c9ce4de9141164" "checksum which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b57acb10231b9493c8472b20cb57317d0679a49e0bdbee44b3b803a6473af164" "checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" diff --git a/Cargo.toml b/Cargo.toml index b802517ea5e..060be41a5d2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,3 @@ opt-level = 3 mio = { git = "https://github.com/servo/mio.git", branch = "servo" } iovec = { git = "https://github.com/servo/iovec.git", branch = "servo" } cmake = { git = "https://github.com/alexcrichton/cmake-rs" } - -[patch."https://github.com/servo/webxr"] -webxr = { git = "https://github.com/asajeffrey/webxr", branch = "optional-glsync" } -webxr-api = { git = "https://github.com/asajeffrey/webxr", branch = "optional-glsync" } diff --git a/components/canvas/webgl_mode/inprocess.rs b/components/canvas/webgl_mode/inprocess.rs index 1ca4e9c53cb..b7b7189bd96 100644 --- a/components/canvas/webgl_mode/inprocess.rs +++ b/components/canvas/webgl_mode/inprocess.rs @@ -117,8 +117,8 @@ impl SendableWebGLExternalImages { } } -impl webxr_api::WebGLExternalImageApi for SendableWebGLExternalImages { - fn lock(&self, id: usize) -> (u32, Size2D<i32>, Option<gl::GLsync>) { +impl SendableWebGLExternalImages { + fn lock_and_get_current_texture(&self, id: usize) -> (u32, Size2D<i32>, Option<gl::GLsync>) { if let Some(main_thread) = WebGLMainThread::on_current_thread() { // If we're on the same thread as WebGL, we can get the data directly let (image_id, size) = main_thread @@ -141,6 +141,13 @@ impl webxr_api::WebGLExternalImageApi for SendableWebGLExternalImages { (image_id, size, Some(gl_sync as gl::GLsync)) } } +} + +impl webxr_api::WebGLExternalImageApi for SendableWebGLExternalImages { + fn lock(&self, id: usize) -> Option<gl::GLsync> { + let (_, _, gl_sync) = self.lock_and_get_current_texture(id); + gl_sync + } fn unlock(&self, id: usize) { if let Some(main_thread) = WebGLMainThread::on_current_thread() { @@ -178,7 +185,7 @@ impl WebGLExternalImages { impl WebrenderExternalImageApi for WebGLExternalImages { fn lock(&mut self, id: u64) -> (u32, Size2D<i32>) { - let (image_id, size, gl_sync) = self.sendable.lock(id as usize); + let (image_id, size, gl_sync) = self.sendable.lock_and_get_current_texture(id as usize); // The next glWaitSync call is run on the WR thread and it's used to synchronize the two // flows of OpenGL commands in order to avoid WR using a semi-ready WebGL texture. // glWaitSync doesn't block WR thread, it affects only internal OpenGL subsystem. diff --git a/components/script/dom/xrsession.rs b/components/script/dom/xrsession.rs index 0a9712bb92b..60d93d4e5e0 100644 --- a/components/script/dom/xrsession.rs +++ b/components/script/dom/xrsession.rs @@ -6,6 +6,7 @@ use crate::compartments::InCompartment; use crate::dom::bindings::callback::ExceptionHandling; use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorBinding::NavigatorMethods; +use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use crate::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use crate::dom::bindings::codegen::Bindings::XRBinding::XRSessionMode; @@ -29,6 +30,7 @@ use crate::dom::globalscope::GlobalScope; use crate::dom::node::Node; use crate::dom::node::NodeDamage; use crate::dom::promise::Promise; +use crate::dom::webglframebuffer::WebGLFramebufferAttachmentRoot; use crate::dom::xrframe::XRFrame; use crate::dom::xrinputsource::XRInputSource; use crate::dom::xrreferencespace::XRReferenceSpace; @@ -38,6 +40,7 @@ use crate::dom::xrspace::XRSpace; use crate::dom::xrwebgllayer::XRWebGLLayer; use crate::task_source::TaskSource; use dom_struct::dom_struct; +use euclid::default::Size2D; use euclid::RigidTransform3D; use ipc_channel::ipc::IpcSender; use ipc_channel::router::ROUTER; @@ -182,10 +185,19 @@ impl XRSession { // Step 6-7: XXXManishearth handle inlineVerticalFieldOfView // XXXManishearth handle inline sessions and composition disabled flag - let context = pending - .GetBaseLayer() - .map(|layer| layer.Context().context_id().0); - self.session.borrow_mut().set_webgl_context(context); + if let Some(layer) = pending.GetBaseLayer() { + let attachment = layer.framebuffer().attachment(constants::COLOR_ATTACHMENT0); + if let Some(WebGLFramebufferAttachmentRoot::Texture(texture)) = attachment { + let context = layer.Context().context_id().0; + let texture_id = texture.id().get(); + if let Some((width, height)) = layer.framebuffer().size() { + let size = Size2D::new(width, height); + self.session + .borrow_mut() + .set_texture(context, texture_id, size); + } + } + } } // Step 2 diff --git a/components/script/dom/xrwebgllayer.rs b/components/script/dom/xrwebgllayer.rs index 148d773fe6f..713546e1129 100644 --- a/components/script/dom/xrwebgllayer.rs +++ b/components/script/dom/xrwebgllayer.rs @@ -149,6 +149,10 @@ impl XRWebGLLayer { pub fn session(&self) -> &XRSession { &self.session } + + pub fn framebuffer(&self) -> &WebGLFramebuffer { + &self.framebuffer + } } impl XRWebGLLayerMethods for XRWebGLLayer { diff --git a/tests/wpt/metadata/webxr/xrBoundedReferenceSpace_updates.https.html.ini b/tests/wpt/metadata/webxr/xrBoundedReferenceSpace_updates.https.html.ini index 6ff00c31bef..27f6c5ed7a2 100644 --- a/tests/wpt/metadata/webxr/xrBoundedReferenceSpace_updates.https.html.ini +++ b/tests/wpt/metadata/webxr/xrBoundedReferenceSpace_updates.https.html.ini @@ -1,5 +1,5 @@ [xrBoundedReferenceSpace_updates.https.html] - expected: TIMEOUT + expected: ERROR ['XRBoundedReferenceSpace updates properly when the changes are applied] expected: TIMEOUT diff --git a/tests/wpt/metadata/webxr/xrSession_end.https.html.ini b/tests/wpt/metadata/webxr/xrSession_end.https.html.ini index d03914bcd66..edfc5ae795a 100644 --- a/tests/wpt/metadata/webxr/xrSession_end.https.html.ini +++ b/tests/wpt/metadata/webxr/xrSession_end.https.html.ini @@ -1,5 +1,4 @@ [xrSession_end.https.html] - expected: ERROR [end event fires when non-immersive session ends] - expected: NOTRUN + expected: FAIL diff --git a/tests/wpt/metadata/webxr/xrSession_input_events_end.https.html.ini b/tests/wpt/metadata/webxr/xrSession_input_events_end.https.html.ini index fba510c47e9..739e7b4c112 100644 --- a/tests/wpt/metadata/webxr/xrSession_input_events_end.https.html.ini +++ b/tests/wpt/metadata/webxr/xrSession_input_events_end.https.html.ini @@ -1,5 +1,4 @@ [xrSession_input_events_end.https.html] - expected: ERROR [Calling end during an input callback stops processing at the right time] expected: FAIL diff --git a/tests/wpt/metadata/webxr/xrSession_prevent_multiple_exclusive.https.html.ini b/tests/wpt/metadata/webxr/xrSession_prevent_multiple_exclusive.https.html.ini deleted file mode 100644 index d97e34090f9..00000000000 --- a/tests/wpt/metadata/webxr/xrSession_prevent_multiple_exclusive.https.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[xrSession_prevent_multiple_exclusive.https.html] - [Test prevention of multiple simultaneous immersive sessions] - expected: FAIL - |