wgpu icon indicating copy to clipboard operation
wgpu copied to clipboard

Support for OpenXR

Open lachlansneff opened this issue 5 years ago • 3 comments

I opened an issue on gfx-rs for adding OpenXR support (https://github.com/gfx-rs/gfx/issues/3219).

OpenXR is pretty new, but there are basic bindings for it in rust already https://docs.rs/openxr. Eventually, supporting this would enable applications that use gfx-hal directly or libraries that use gfx-hal, like wgpu, to transparently support most vr and ar headsets on most architectures.

I'm proposing that support gets added to gfx-hal. I can contribute to this, but I don't know where to start.

OpenXR also adds support for grabbing events from peripherals specific to XR environments. That might have to be supported in winit maybe?

lachlansneff avatar Apr 19 '20 20:04 lachlansneff

Looks like there was some progress towards this in #1609, #1850, and #2186.

#1609 links sample usage (potentially outdated) and #2186 mentions:

With the recent move to wgpu-hal, and now being able to access the raw backing types, it has become possible to use OpenXR with the current released version of WGPU. (It works pretty well too!)

If anyone using the above would like to share example usage here, some would definitely appreciate it. I've seen a few questions about wgpu OpenXR support in various chats, which led me to these ^^

memoryruins avatar Feb 10 '22 03:02 memoryruins

I am also extremely interested in this! I currently have no clue how to use the openxr bindings with wgpu - the only two graphics trait implementations there are for opengl and vulkan. I assume having the graphics trait implemented for webgpu would be necessary for support?

https://docs.rs/openxr/latest/openxr/trait.Graphics.html

TheButlah avatar Mar 11 '22 01:03 TheButlah

Any updates on this?

thejudge156 avatar Sep 16 '22 16:09 thejudge156

I have a sneaking suspicion that one could accomplish joining wgpu and openxr by using wgpu (backed by vulkan) to render to textures which are then composited by openxr, but that conclusion is not well-researched on my part. Is there a specific reason wgpu would need openxr things in its code?

schell avatar Sep 27 '22 20:09 schell

Hi all! Over the last few weekends, I've implemented a barebones example of wiring up OpenXR to wgpu (Vulkan). Here's the link.

It should have everything you need to get going, including working without a headset, getting controller positions, and rendering to both the headset and the window simultaneously. It's designed to easily exclude the XR code, so you can see what needs to be added to bring up XR in an existing wgpu codebase.

There's still a few quirks and bugs that I haven't ironed out, but given it's served its purpose for me (a worked example of implementing XR in a wgpu application), I figure now is as good a time as any to release it!

Hope it helps 🥳

philpax avatar Oct 23 '22 22:10 philpax