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

Merged
merged 25 commits into from Jan 4, 2019

Conversation

Projects
None yet
5 participants
@Manishearth
Copy link
Member

Manishearth commented Dec 22, 2018

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)
  • 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)
  • More pref-gating
  • views is a method instead of an attribute because we don't support FrozenArray

Once I add spec links and pref gating this can be landed as-is for further experimentation.

r? @jdm @MortimerGoro


This change is Reviewable

@highfive

This comment has been minimized.

Copy link

highfive commented Dec 22, 2018

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/webidls/XRSession.webidl, components/script/dom/navigator.rs, components/script/dom/webidls/XRViewport.webidl, components/script/dom/vrdisplay.rs, components/script/dom/webidls/XRStationaryReferenceSpace.webidl and 27 more
  • @KiChjang: components/script/dom/webidls/XRSession.webidl, components/script/dom/navigator.rs, components/script/dom/webidls/XRViewport.webidl, components/script/dom/vrdisplay.rs, components/script/dom/webidls/XRStationaryReferenceSpace.webidl and 27 more
@highfive

This comment has been minimized.

Copy link

highfive commented Dec 22, 2018

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
  • These commits modify script code, but no tests are modified. Please consider adding a test!
[NoInterfaceObject]
interface VR {
[Pref="dom.webvr.enabled"]
Promise<sequence<VRDisplay>> getDisplays();

This comment has been minimized.

@jdm

jdm Dec 22, 2018

Member

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.

This comment has been minimized.

@Manishearth

Manishearth Dec 22, 2018

Member

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.

This comment has been minimized.

@Manishearth

Manishearth Dec 22, 2018

Member

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

@Manishearth

This comment has been minimized.

Copy link
Member

Manishearth commented Dec 22, 2018

Oh, also, one departure from the spec: we don't support FrozenArray and attributes can't be sequences so currently the views attribute is a function.

I might try to make it use any instead so that it works the same.

@MortimerGoro
Copy link
Contributor

MortimerGoro left a comment

Great work!

Code looks good on first pass.


// https://immersive-web.github.io/webxr/#xrframe-interface

[SecureContext, Exposed=Window] interface XRFrame {

This comment has been minimized.

@MortimerGoro

MortimerGoro Dec 22, 2018

Contributor

The new XR interfaces should be behind a pref [Pref="dom.webxr.enabled"]

This comment has been minimized.

@Manishearth

Manishearth Dec 23, 2018

Member

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 {

This comment has been minimized.

@MortimerGoro

MortimerGoro Dec 22, 2018

Contributor

[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);

This comment has been minimized.

@MortimerGoro

MortimerGoro Dec 22, 2018

Contributor

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()

This comment has been minimized.

@Manishearth

Manishearth Dec 23, 2018

Member

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.

This comment has been minimized.

@jdm

jdm Jan 3, 2019

Member

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.

This comment has been minimized.

@Manishearth

Manishearth Jan 3, 2019

Member

Is it enough to just drop a comment linking to that since that's not implemented yet?

This comment has been minimized.

@jdm

jdm Jan 3, 2019

Member

Sure.

@Manishearth Manishearth force-pushed the Manishearth:webxr branch from 917a9d5 to 68469d7 Dec 23, 2018

@Manishearth Manishearth force-pushed the Manishearth:webxr branch from 68469d7 to 5a6ecef Dec 23, 2018

@Manishearth Manishearth force-pushed the Manishearth:webxr branch 2 times, most recently from 3a6a1aa to f7eab6e Dec 23, 2018

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Jan 4, 2019

☀️ Test successful - linux-rel-css, linux-rel-wpt, status-taskcluster
State: approved= try=True

@Manishearth

This comment has been minimized.

Copy link
Member

Manishearth commented Jan 4, 2019

@bors-servo try- r=jdm,MortimerGoro

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Jan 4, 2019

📌 Commit fc69cd3 has been approved by jdm,MortimerGoro

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Jan 4, 2019

⌛️ Testing commit fc69cd3 with merge be035df...

bors-servo added a commit that referenced this pull request Jan 4, 2019

Auto merge of #22528 - Manishearth:webxr, r=jdm,MortimerGoro
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 -->
@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Jan 4, 2019

💔 Test failed - status-taskcluster

@jdm

This comment has been minimized.

Copy link
Member

jdm commented Jan 4, 2019

Diff in /home/travis/build/servo/servo/components/script/dom/xrwebgllayer.rs at line 18:
 use crate::dom::xrviewport::XRViewport;
 use dom_struct::dom_struct;
 
-
 #[dom_struct]
 pub struct XRWebGLLayer {
     xrlayer: XRLayer,
Run `./mach fmt` to fix the formatting

@Manishearth Manishearth force-pushed the Manishearth:webxr branch from fc69cd3 to e544462 Jan 4, 2019

@Manishearth

This comment has been minimized.

Copy link
Member

Manishearth commented Jan 4, 2019

@bors-servo r=jdm,MortimerGoro

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Jan 4, 2019

📌 Commit e544462 has been approved by jdm,MortimerGoro

@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Jan 4, 2019

⌛️ Testing commit e544462 with merge c4a6dcf...

bors-servo added a commit that referenced this pull request Jan 4, 2019

Auto merge of #22528 - Manishearth:webxr, r=jdm,MortimerGoro
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 -->
@bors-servo

This comment has been minimized.

Copy link
Contributor

bors-servo commented Jan 4, 2019

☀️ 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
Approved by: jdm,MortimerGoro
Pushing c4a6dcf to master...

@bors-servo bors-servo merged commit e544462 into servo:master Jan 4, 2019

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

@Manishearth Manishearth deleted the Manishearth:webxr branch Jan 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment