mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Use async VR presentation code for XRSession
This commit is contained in:
parent
9ddbf68cb3
commit
e2522d36ff
3 changed files with 37 additions and 42 deletions
|
@ -14,6 +14,7 @@ use crate::dom::bindings::reflector::reflect_dom_object;
|
|||
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
|
||||
use crate::dom::eventtarget::EventTarget;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::promise::Promise;
|
||||
use crate::dom::vrdisplay::VRDisplay;
|
||||
use crate::dom::xrlayer::XRLayer;
|
||||
use crate::dom::xrwebgllayer::XRWebGLLayer;
|
||||
|
@ -37,13 +38,15 @@ impl XRSession {
|
|||
}
|
||||
|
||||
pub fn new(global: &GlobalScope, display: &VRDisplay) -> DomRoot<XRSession> {
|
||||
let ret = reflect_dom_object(
|
||||
reflect_dom_object(
|
||||
Box::new(XRSession::new_inherited(display)),
|
||||
global,
|
||||
XRSessionBinding::Wrap,
|
||||
);
|
||||
ret.display.xr_present(&ret, None);
|
||||
ret
|
||||
)
|
||||
}
|
||||
|
||||
pub fn xr_present(&self, p: Rc<Promise>) {
|
||||
self.display.xr_present(self, None, Some(p));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,7 +81,7 @@ impl XRSessionMethods for XRSession {
|
|||
self.base_layer.set(layer);
|
||||
if let Some(layer) = layer {
|
||||
let layer = layer.downcast::<XRWebGLLayer>().unwrap();
|
||||
self.display.xr_present(&self, Some(&layer.Context()));
|
||||
self.display.xr_present(&self, Some(&layer.Context()), None);
|
||||
} else {
|
||||
// steps unknown
|
||||
// https://github.com/immersive-web/webxr/issues/453
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue