stride icon indicating copy to clipboard operation
stride copied to clipboard

[WIP] OpenXR for Stride

Open anotherdevguy opened this issue 2 years ago • 3 comments

PR Details

This will add support for OpenXR, at least for Vulkan. May not support all features provided in Focus Engine, as I'm trying not to modify the overall Stride system as much as possible. I never implemented it for DirectX and have no real experience with that API, so I only feel confident submitting the Vulkan implementation. It shouldn't be too difficult to convert (or add support for) DirectX.

Description

Adds OpenXR as a selectable VR API.

Related Issue

https://github.com/stride3d/stride/issues/957

Motivation and Context

OpenXR is the future of VR support. Also, you guys offered help getting Focus Engine to target .NET Core 5 😄

Types of changes

  • [ ] Docs change / refactoring / dependency upgrade
  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • [x] My change requires a change to the documentation.
  • [ ] I have added tests to cover my changes.
  • [ ] All new and existing tests passed.

anotherdevguy avatar Aug 10 '21 20:08 anotherdevguy

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Aug 10 '21 20:08 CLAassistant

Where this pull request stands:

It builds, and "should work" -- problem is, this dynamic call:

https://github.com/anotherdevguy/stride/blob/openxr/sources/engine/Stride.VirtualReality/OpenXR/OpenXRHmd.cs#L406

... should be telling OpenXR which Vulkan device is in-use in addition to setting a handle to that device in physicalDevice. This code works in my fork, but fails for some reason on Stride (physicalDevice comes back as null). If I try using the Vulkan's physical device from GraphicsDevice.Vulkan.cs, you'll get an OpenXR validation error saying you have to use xrGetVulkanGraphicsDeviceKHR to get the handle.

However, this could all be bypassed by using DirectX instead, which seems more prevalent on Stride. You could use https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrGraphicsRequirementsD3D11KHR instead, and use the XR_KHR_D3D11_enable extension (instead of "XR_KHR_vulkan_enable") up on line 89 of OpenXRHmd.cs (to get started on using DirectX instead of Vulkan).

Eideren has passed on his NET 5 work to me, so I'm going to pick up where he left off (thank you!). As I'm switching back to that, I won't be driving further development on this pull request for now -- but will definitely answer questions and help out where I can.

phr00t avatar Aug 15 '21 15:08 phr00t

Depends on #1425

tebjan avatar May 06 '22 14:05 tebjan

It sounds like #1483 supersedes this one ? Should we close this PR ? @arturoc @tebjan

Eideren avatar Sep 15 '23 16:09 Eideren

Yes!

tebjan avatar Sep 15 '23 17:09 tebjan