Support for webxr layer management

This commit is contained in:
Alan Jeffrey 2020-04-15 18:04:32 -05:00
parent af110ac21f
commit 349619ed2d
34 changed files with 949 additions and 642 deletions

View file

@ -16,6 +16,7 @@ use crate::dom::xrlayer::XRLayer;
use crate::dom::xrsession::XRSession;
use crate::dom::xrview::XRView;
use crate::dom::xrwebglsubimage::XRWebGLSubImage;
use canvas_traits::webgl::WebGLContextId;
use dom_struct::dom_struct;
#[dom_struct]
@ -53,6 +54,19 @@ impl WebGLRenderingContextOrWebGL2RenderingContext {
}
}
impl RootedWebGLRenderingContextOrWebGL2RenderingContext {
pub(crate) fn context_id(&self) -> WebGLContextId {
match self {
RootedWebGLRenderingContextOrWebGL2RenderingContext::WebGLRenderingContext(
ref context,
) => context.context_id(),
RootedWebGLRenderingContextOrWebGL2RenderingContext::WebGL2RenderingContext(
ref context,
) => context.base_context().context_id(),
}
}
}
impl XRWebGLBindingMethods for XRWebGLBinding {
/// https://immersive-web.github.io/layers/#dom-xrwebglbinding-getsubimage
fn GetSubImage(&self, _layer: &XRLayer, _frame: &XRFrame) -> Option<DomRoot<XRWebGLSubImage>> {