aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Adams <70986246+msub2@users.noreply.github.com>2024-08-21 16:18:58 -1000
committerGitHub <noreply@github.com>2024-08-22 02:18:58 +0000
commit562d32c0519d58052cea681a696546fd4818bd3a (patch)
tree99a4ea2c114d5d8e305473f997a978780e5d19ba
parentcde10241c32208fbce0cb87f2d6a6deeca2c74a4 (diff)
downloadservo-562d32c0519d58052cea681a696546fd4818bd3a.tar.gz
servo-562d32c0519d58052cea681a696546fd4818bd3a.zip
webxr: Update XRWebGLLayer interface to latest spec (#33157)
* Update XRWebGLLayer interface to latest spec Signed-off-by: Daniel Adams <msub2official@gmail.com> * Add missing spec links Signed-off-by: Daniel Adams <msub2official@gmail.com> --------- Signed-off-by: Daniel Adams <msub2official@gmail.com>
-rw-r--r--components/script/dom/webidls/XRWebGLLayer.webidl5
-rw-r--r--components/script/dom/xrwebgllayer.rs19
-rw-r--r--tests/wpt/meta-legacy-layout/webxr/idlharness.https.window.js.ini6
-rw-r--r--tests/wpt/meta/webxr/idlharness.https.window.js.ini6
4 files changed, 22 insertions, 14 deletions
diff --git a/components/script/dom/webidls/XRWebGLLayer.webidl b/components/script/dom/webidls/XRWebGLLayer.webidl
index 0007b457f8e..5b26716ebd2 100644
--- a/components/script/dom/webidls/XRWebGLLayer.webidl
+++ b/components/script/dom/webidls/XRWebGLLayer.webidl
@@ -24,6 +24,7 @@ interface XRWebGLLayer: XRLayer {
// Attributes
readonly attribute boolean antialias;
readonly attribute boolean ignoreDepthValues;
+ attribute float? fixedFoveation;
[SameObject] readonly attribute WebGLFramebuffer? framebuffer;
readonly attribute unsigned long framebufferWidth;
@@ -32,8 +33,8 @@ interface XRWebGLLayer: XRLayer {
// Methods
XRViewport? getViewport(XRView view);
- // // Static Methods
- // static double getNativeFramebufferScaleFactor(XRSession session);
+ // Static Methods
+ static double getNativeFramebufferScaleFactor(XRSession session);
};
partial interface mixin WebGLRenderingContextBase {
diff --git a/components/script/dom/xrwebgllayer.rs b/components/script/dom/xrwebgllayer.rs
index 933e8537f1d..6a86671ccff 100644
--- a/components/script/dom/xrwebgllayer.rs
+++ b/components/script/dom/xrwebgllayer.rs
@@ -17,6 +17,7 @@ use crate::dom::bindings::codegen::Bindings::XRWebGLLayerBinding::{
};
use crate::dom::bindings::error::{Error, Fallible};
use crate::dom::bindings::inheritance::Castable;
+use crate::dom::bindings::num::Finite;
use crate::dom::bindings::reflector::{reflect_dom_object_with_proto, DomObject};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::globalscope::GlobalScope;
@@ -156,6 +157,13 @@ impl XRWebGLLayer {
))
}
+ /// <https://www.w3.org/TR/webxr/#dom-xrwebgllayer-getnativeframebufferscalefactor>
+ #[allow(non_snake_case)]
+ pub fn GetNativeFramebufferScaleFactor(_window: &Window, session: &XRSession) -> Finite<f64> {
+ let value: f64 = if session.is_ended() { 0.0 } else { 1.0 };
+ Finite::wrap(value)
+ }
+
pub fn layer_id(&self) -> Option<LayerId> {
self.xr_layer.layer_id()
}
@@ -292,6 +300,17 @@ impl XRWebGLLayerMethods for XRWebGLLayer {
self.ignore_depth_values
}
+ /// <https://www.w3.org/TR/webxr/#dom-xrwebgllayer-fixedfoveation>
+ fn GetFixedFoveation(&self) -> Option<Finite<f32>> {
+ // Fixed foveation is only available on Quest/Pico headset runtimes
+ None
+ }
+
+ /// <https://www.w3.org/TR/webxr/#dom-xrwebgllayer-fixedfoveation>
+ fn SetFixedFoveation(&self, _value: Option<Finite<f32>>) {
+ // no-op until fixed foveation is supported
+ }
+
/// <https://immersive-web.github.io/webxr/#dom-xrwebgllayer-framebuffer>
fn GetFramebuffer(&self) -> Option<DomRoot<WebGLFramebuffer>> {
self.framebuffer.as_ref().map(|x| DomRoot::from_ref(&**x))
diff --git a/tests/wpt/meta-legacy-layout/webxr/idlharness.https.window.js.ini b/tests/wpt/meta-legacy-layout/webxr/idlharness.https.window.js.ini
index 4a83da3fb77..f7d261b8002 100644
--- a/tests/wpt/meta-legacy-layout/webxr/idlharness.https.window.js.ini
+++ b/tests/wpt/meta-legacy-layout/webxr/idlharness.https.window.js.ini
@@ -20,9 +20,6 @@
[XRBoundedReferenceSpace interface object length]
expected: FAIL
- [XRWebGLLayer interface: operation getNativeFramebufferScaleFactor(XRSession)]
- expected: FAIL
-
[XRRay interface: attribute matrix]
expected: FAIL
@@ -314,9 +311,6 @@
[XRSession interface: calling cancelAnimationFrame(unsigned long) on xrSession with too few arguments must throw TypeError]
expected: FAIL
- [XRWebGLLayer interface: attribute fixedFoveation]
- expected: FAIL
-
[XRWebGLLayer interface: xrWebGLLayer must inherit property "fixedFoveation" with the proper type]
expected: FAIL
diff --git a/tests/wpt/meta/webxr/idlharness.https.window.js.ini b/tests/wpt/meta/webxr/idlharness.https.window.js.ini
index 47f46135676..15162e81c1c 100644
--- a/tests/wpt/meta/webxr/idlharness.https.window.js.ini
+++ b/tests/wpt/meta/webxr/idlharness.https.window.js.ini
@@ -56,9 +56,6 @@
[XRBoundedReferenceSpace interface object length]
expected: FAIL
- [XRWebGLLayer interface: operation getNativeFramebufferScaleFactor(XRSession)]
- expected: FAIL
-
[XRWebGLLayer interface: xrWebGLLayer must inherit property "framebuffer" with the proper type]
expected: FAIL
@@ -257,9 +254,6 @@
[XRSession interface: calling cancelAnimationFrame(unsigned long) on xrSession with too few arguments must throw TypeError]
expected: FAIL
- [XRWebGLLayer interface: attribute fixedFoveation]
- expected: FAIL
-
[XRWebGLLayer interface: xrWebGLLayer must inherit property "fixedFoveation" with the proper type]
expected: FAIL