mirror of
https://github.com/servo/servo.git
synced 2025-08-01 19:50:30 +01:00
Init XR present on XR::RequestSession() with empty context
This commit is contained in:
parent
121cbd0078
commit
90e87b97ba
3 changed files with 10 additions and 9 deletions
|
@ -688,12 +688,12 @@ impl VRDisplay {
|
|||
// XR stuff
|
||||
// XXXManishearth eventually we should share as much logic as possible
|
||||
impl VRDisplay {
|
||||
pub fn xr_present(&self, session: &XRSession, ctx: &WebGLRenderingContext) {
|
||||
pub fn xr_present(&self, session: &XRSession, ctx: Option<&WebGLRenderingContext>) {
|
||||
let layer_bounds = WebVRLayer::default();
|
||||
self.xr_session.set(Some(session));
|
||||
if self.presenting.get() {
|
||||
*self.layer.borrow_mut() = layer_bounds;
|
||||
self.layer_ctx.set(Some(&ctx));
|
||||
self.layer_ctx.set(ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -709,7 +709,7 @@ impl VRDisplay {
|
|||
|
||||
if let Ok(()) = receiver.recv().unwrap() {
|
||||
*self.layer.borrow_mut() = layer_bounds;
|
||||
self.layer_ctx.set(Some(&ctx));
|
||||
self.layer_ctx.set(ctx);
|
||||
self.init_present();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,10 +95,9 @@ impl XRMethods for XR {
|
|||
}
|
||||
|
||||
let session = XRSession::new(&self.global(), &displays[0]);
|
||||
// XXXManishearth we should actually xr_present() here instead of
|
||||
// in XRSession::new, and resolve a promise based on it
|
||||
promise.resolve_native(&session);
|
||||
// whether or not we should initiate presentation is unclear
|
||||
// https://github.com/immersive-web/webxr/issues/453
|
||||
|
||||
promise
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,11 +37,13 @@ impl XRSession {
|
|||
}
|
||||
|
||||
pub fn new(global: &GlobalScope, display: &VRDisplay) -> DomRoot<XRSession> {
|
||||
reflect_dom_object(
|
||||
let ret = reflect_dom_object(
|
||||
Box::new(XRSession::new_inherited(display)),
|
||||
global,
|
||||
XRSessionBinding::Wrap,
|
||||
)
|
||||
);
|
||||
ret.display.xr_present(&ret, None);
|
||||
ret
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,7 +78,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, &layer.Context());
|
||||
self.display.xr_present(&self, Some(&layer.Context()));
|
||||
} else {
|
||||
// steps unknown
|
||||
// https://github.com/immersive-web/webxr/issues/453
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue