-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preliminary WebXR support #22528
Preliminary WebXR support #22528
Conversation
The WebVR spec no longer has a navigator.vr, but there is a navigator.XR in the XR spec. Instead of duplicating work I've combined the two.
Heads up! This PR modifies the following files:
|
[NoInterfaceObject] | ||
interface VR { | ||
[Pref="dom.webvr.enabled"] | ||
Promise<sequence<VRDisplay>> getDisplays(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not clear to me that eliminating WebVR from our implementation is the right choice right now. It's useful to test against the existing WebVR content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not! navigator.vr
is old WebVR (it's not in the spec anymore). I still support navigator.getVRDisplays()
which is the new thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just found it convenient to repurpose the VR object as XR since it has the same purpose and I didn't want to duplicate the messaging/syncing logic
Oh, also, one departure from the spec: we don't support I might try to make it use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
Code looks good on first pass.
|
||
// https://immersive-web.github.io/webxr/#xrframe-interface | ||
|
||
[SecureContext, Exposed=Window] interface XRFrame { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new XR interfaces should be behind a pref [Pref="dom.webxr.enabled"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I'd mentioned in the PR title that this was missing 😄
|
||
callback XRFrameRequestCallback = void (DOMHighResTimeStamp time, XRFrame frame); | ||
|
||
[SecureContext, Exposed=Window] interface XRSession : EventTarget { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Pref="dom.webxr.enabled"]
and in other new interfaces
@@ -266,6 +268,7 @@ impl WebGLRenderingContext { | |||
pub fn recreate(&self, size: Size2D<u32>) { | |||
let (sender, receiver) = webgl_channel().unwrap(); | |||
self.webgl_sender.send_resize(size, sender).unwrap(); | |||
self.size.set(size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we guarantee that rust-offscreen-rendering-context
is going to respect this size? There may be some corner cases such as JS requesting a larger size than the maximum allowed by the GPU. We can check with the existing webgl tests.
If we can guarantee this size you can also optimize DrawingBufferWidth()
and DrawingBufferHeigh()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe when that happens it just doesn't work (throwing a GL error). At least, when I was playing with this in Firefox with Pathfinder that was the case, there's a limit to the texture size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The webgl implementation is allowed to choose a smaller size than what is requested; Servo's implementation does not right now and panics, #21718 tracks implementing this correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it enough to just drop a comment linking to that since that's not implemented yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
3a6a1aa
to
f7eab6e
Compare
☀️ Test successful - linux-rel-css, linux-rel-wpt, status-taskcluster |
@bors-servo try- r=jdm,MortimerGoro |
📌 Commit fc69cd3 has been approved by |
Preliminary WebXR support This implements just enough WebXR to display to 3DOF devices in immersive mode only. Couple missing things: - [ ] Handling reference spaces (even if just supporting eye-level spaces) - [x] Spec links - [ ] We enter immersive mode when baseLayer is set, but it seems like we're supposed to do this when requestSession is called (immersive-web/webxr#453) - [ ] VR/XR should block less (#22505) - [x] More pref-gating - [x] `views` is a method instead of an attribute because we don't support FrozenArray <s>Once I add spec links and pref gating</s> this can be landed as-is for further experimentation. r? @jdm @MortimerGoro <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22528) <!-- Reviewable:end -->
💔 Test failed - status-taskcluster |
|
@bors-servo r=jdm,MortimerGoro |
📌 Commit e544462 has been approved by |
Preliminary WebXR support This implements just enough WebXR to display to 3DOF devices in immersive mode only. Couple missing things: - [ ] Handling reference spaces (even if just supporting eye-level spaces) - [x] Spec links - [ ] We enter immersive mode when baseLayer is set, but it seems like we're supposed to do this when requestSession is called (immersive-web/webxr#453) - [ ] VR/XR should block less (#22505) - [x] More pref-gating - [x] `views` is a method instead of an attribute because we don't support FrozenArray <s>Once I add spec links and pref gating</s> this can be landed as-is for further experimentation. r? @jdm @MortimerGoro <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22528) <!-- Reviewable:end -->
☀️ Test successful - android-mac, arm32, arm64, linux-rel-css, linux-rel-wpt, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, magicleap, status-taskcluster |
This implements just enough WebXR to display to 3DOF devices in
immersive mode only.
Couple missing things:
we're supposed to do this when requestSession is called (Specify when we enter/exit immersive mode and what the baseLayer setter does immersive-web/webxr#453)
views
is a method instead of an attribute because we don't support FrozenArrayOnce I add spec links and pref gatingthis can be landed as-is for further experimentation.r? @jdm @MortimerGoro
This change is