-
Notifications
You must be signed in to change notification settings - Fork 544
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
Support for OpenXR #3219
Comments
I'm beginning to experiment with OpenXR integration on my own and curious to see where this goes. I'm happy to help as well but by far not an expert with gfx or graphics in general and don't have a solid grasp on all the concepts to propose a clean abstraction between the two. I think there would need to be some clear definition of what support would mean. It could range from providing structures and functions bridge the gap and leave the rest to the user all the way to embedding OpenXR in gfx-hal so that things like the swapchain creation and management are pure gfx-hal and it doesn't appear to the user as an external API. Curious to get input from the gfx maintainers on this and see if there has been any other efforts in to this. |
Yes, I think making it mostly transparent for the user is the right way to go. OpenXR will take some vulkan or opengl instance data and present you will swapchains to render onto. Hiding all the configuration will be complex, as there's a lot of various vr-specific things, like positioning in space and whatnot that probably should not be hidden. Maybe it'd be a good idea to port WebXR over to native as a wrapper over openxr, just as WebGPU has been ported to native. |
Servo has developed a webxr crate with an openxr backend, if that helps at all: https://github.com/servo/webxr/ |
The OpenXR backend in In the meantime, I've been poking around at the Vulkan backend using the Thus I think a good starting question is how to structure this integration. Some possibilities:
|
It seems to me that |
There's a D3D12 extension that is supported on the HoloLens 2 AFAIK. I am not aware of Metal support. |
OpenXR has extensions for Vulkan, OpenGL, OpenGL ES, D3D11, and D3D12. It might be possible to use https://github.com/KhronosGroup/MoltenVK as a pathway to XR support on macOS. |
@str4d err... there is nothing for us in MoltenVK. It's just a library. If there is no way to work with OpenXR on Metal, then it's not possible with MoltenVK either. |
@kvark Ah, okay. I had interpreted it as providing a Vulkan runtime, and thus maybe being usable with |
Hi, friendly neighborhood rust beginner here. Any movement in this area since October? This is where my optimistic quest for doing VR in Rust has lead me - I'm assuming its impossible to do VR with gfx-rs without this feature? Or is there some hacky workaround I could do that you know of? Maybe like rendering to a framebuffer and then giving that to openxr myself? |
I have an early-stage attempt at this locally, which is currently blocked on me learning more about how graphics pipelines work. I'm planning this week to clean up the commits a bit and then open a draft PR so others can give feedback on the direction. |
(As a note, some continued discussion related to looser coupling going on also at blaind/xrbevy#1) |
This is one take at what's needed for XR rendering example between an app, openxrs and gfx crates. Note the raw handles usage in GFX, which are not included it in any of the PR's above. This is not a suggestion for implementation, but rather depicts the dependencies and required flow between components. Flow modeled after openxrs crate, OpenXR spec for vulkan2 initialization flow can be found at https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XR_KHR_vulkan_enable2 |
Some initial thoughts about the requirements for each component in the above sequence diagram.
|
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 usegfx-hal
, likewgpu
, 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?
The text was updated successfully, but these errors were encountered: