diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2020-03-09 19:58:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-09 19:58:21 -0400 |
commit | b4d7ec1c99259f936c9e34de157b652707d308de (patch) | |
tree | 29ce20cb86641f45243bf7cad41e50ca8becea1c /components/script | |
parent | 95f3d46644243b24b5c7c25b6b5d1dc50c34f0d3 (diff) | |
parent | fbcf2bbc3ef4ba0c37a6a8d77bfee96b08f3cccc (diff) | |
download | servo-b4d7ec1c99259f936c9e34de157b652707d308de.tar.gz servo-b4d7ec1c99259f936c9e34de157b652707d308de.zip |
Auto merge of #25855 - jdm:surface-inversion, r=Manishearth,asajeffrey
Remove GL->d3d blit in HoloLens immersive mode
Depends on:
* https://github.com/servo/surfman/pull/151
* https://github.com/asajeffrey/surfman-chains/pull/7
* https://github.com/servo/webxr/pull/133
These changes add two extra APIs for embedders to use when registering a WebXR device - one to allow running any closure as a task in the webgl thread, and one to register an arbitrary surface provider for a particular webxr session. When an openxr session is started, it can then obtain the webgl thread's d3d device from that thread's surfman device and ensure that openxr uses it.
Surface providers are traits that have their methods invoked by the webgl thread as part of the the normal swapchain operations. This allows the openxr surface provider to return surfaces that wrap the underlying openxr textures, which are valid in the webgl thread and can be used as the target of an opaque framebuffer.
---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #25735
- [x] These changes do not require tests because there are no windows immersive mode tests
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/webglframebuffer.rs | 8 | ||||
-rw-r--r-- | components/script/dom/webglrenderingcontext.rs | 4 | ||||
-rw-r--r-- | components/script/dom/xrsession.rs | 6 |
3 files changed, 13 insertions, 5 deletions
diff --git a/components/script/dom/webglframebuffer.rs b/components/script/dom/webglframebuffer.rs index c285145d994..2d6fcf9122d 100644 --- a/components/script/dom/webglframebuffer.rs +++ b/components/script/dom/webglframebuffer.rs @@ -142,9 +142,11 @@ impl WebGLFramebuffer { size: Size2D<i32, Viewport>, ) -> Option<(WebXRSwapChainId, DomRoot<Self>)> { let (sender, receiver) = webgl_channel().unwrap(); - let _ = context - .webgl_sender() - .send_create_webxr_swap_chain(size.to_untyped(), sender); + let _ = context.webgl_sender().send_create_webxr_swap_chain( + size.to_untyped(), + sender, + session.session_id(), + ); let swap_chain_id = receiver.recv().unwrap()?; let framebuffer_id = WebGLFramebufferId::Opaque(WebGLOpaqueFramebufferId::WebXR(swap_chain_id)); diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index ca5c08b25e3..65134a631e1 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -81,6 +81,7 @@ use std::cell::Cell; use std::cmp; use std::ptr::{self, NonNull}; use std::rc::Rc; +use webxr_api::SessionId; use webxr_api::SwapChainId as WebXRSwapChainId; // From the GLES 2.0.25 spec, page 85: @@ -4576,8 +4577,9 @@ impl WebGLMessageSender { &self, size: Size2D<i32>, sender: WebGLSender<Option<WebXRSwapChainId>>, + id: SessionId, ) -> WebGLSendResult { - self.wake_after_send(|| self.sender.send_create_webxr_swap_chain(size, sender)) + self.wake_after_send(|| self.sender.send_create_webxr_swap_chain(size, sender, id)) } pub fn send_resize( diff --git a/components/script/dom/xrsession.rs b/components/script/dom/xrsession.rs index ec51c910a17..ecb78615897 100644 --- a/components/script/dom/xrsession.rs +++ b/components/script/dom/xrsession.rs @@ -51,7 +51,7 @@ use std::mem; use std::rc::Rc; use webxr_api::{ self, util, Display, EnvironmentBlendMode, Event as XREvent, Frame, SelectEvent, SelectKind, - Session, View, Viewer, Visibility, + Session, SessionId, View, Viewer, Visibility, }; #[dom_struct] @@ -462,6 +462,10 @@ impl XRSession { viewport: Rect::from_size(size.to_i32()), } } + + pub fn session_id(&self) -> SessionId { + self.session.borrow().id() + } } impl XRSessionMethods for XRSession { |