Skip to content

Enabling WebXR OpenXR backend in servoshell #32809

Closed

Description

@msub2

Currently servoshell uses the glwindow backend by default. Could we enable the OpenXR backend as well? I've done this locally while working on the WebXR crate so far, so the main changes would be:

  • Controlling the selected backend by pref (dom.webxr.glwindow.enabled or dom.webxr.openxr.enabled), with priority still given to GlWindow if desired.
  • Making the XR discovery object into an enum for glwindow or openxr

The one other consideration for it (which I haven't addressed locally) is that it would only be for Windows as long as the OpenXR backend relies on D3D11.

Activity

  1. wusyong commented on Jul 19, 2024

    @wusyong
    Member

    I think the second seems better. But since you are the main developer working on webxr part recently, I feel like it's okay to update servoshell directly with OpenXR backend. Maybe we can even create another window xrwindow apart from headedwindow and headlesswindow. So you don't need to always create another headed window before creating a window for WebXR.

    But forgive me for not being too familiar with WebXR. What's the OpenXR backend? Is it the same context created from Surfman?

  2. msub2 commented on Jul 19, 2024

    @msub2
    MemberAuthor

    The webxr crate has the concept of backends, interfaces to the runtimes for each respective AR/VR headset. So the OpenXR backend is an interface to the user's OpenXR runtime, which handles taking input from the device that can then be used for rendering. It actually doesn't even need to spawn a new window like the GlWindow backend does, rendering goes directly to the device. It does interface with Surfman, though I'm still not super well versed in the specifics of it. There's a page in the Servo book that helps give a high-level overview of it

  3. wusyong commented on Jul 19, 2024

    @wusyong
    Member

    How does OpenXR instance get the event? For example, GLWindow is essentially a winit window. So, it can rely on Winit's event loop to get the event and update. The headless window in servoshell implements an event loop that tries to mimic it. If there's a way to get the event from OpenXR, I guess it can communicate with embedder.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions