aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/xrwebglbinding.rs
diff options
context:
space:
mode:
authorAlan Jeffrey <ajeffrey@mozilla.com>2020-04-15 18:04:32 -0500
committerAlan Jeffrey <ajeffrey@mozilla.com>2020-06-28 16:37:45 -0500
commit349619ed2d741312e34924aabc3e6abcc3c468ed (patch)
tree1cf963eeca8cdf9ba914a2da7a5bedbae7b9d77f /components/script/dom/xrwebglbinding.rs
parentaf110ac21fcf1e108c919f5e9d724b2441996ed6 (diff)
downloadservo-349619ed2d741312e34924aabc3e6abcc3c468ed.tar.gz
servo-349619ed2d741312e34924aabc3e6abcc3c468ed.zip
Support for webxr layer management
Diffstat (limited to 'components/script/dom/xrwebglbinding.rs')
-rw-r--r--components/script/dom/xrwebglbinding.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/components/script/dom/xrwebglbinding.rs b/components/script/dom/xrwebglbinding.rs
index 27435aa3ddc..4f5efaa3cf7 100644
--- a/components/script/dom/xrwebglbinding.rs
+++ b/components/script/dom/xrwebglbinding.rs
@@ -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>> {