godot_openxr: Godot OpenXR can't target Windows Mixed Reality OpenXR runtime because it relies on DirectX

Hi there, just wanted to say you’ve been doing fantastic work!

Fyi–this OpenXR addon doesn’t work with the Windows Mixed Reality platform out of the box:

ERROR: OpenXRApi::initialiseInstance: OpenXR Runtime does not support OpenGL extension!

Because WMR only support DirectX 😢

But! Preliminary reading found that someone as part of Google Summer of Code made an OpenGL to DirectX compatibility layer for Blender’s OpenXR loader, and it actually (mostly) worked:

https://devtalk.blender.org/t/gsoc-2019-vr-support-through-openxr-weekly-reports/7665 https://devtalk.blender.org/t/gsoc-2019-core-support-of-virtual-reality-headsets-through-openxr/7614/15

The project is, however, 2 years old and skimming his last update parts of the workaround seem to have broken because of API changes.

Nonetheless, if WMR compatibility is a priority, @julianeisel 's foundational work is likely helpful.

Cheers!

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 19 (5 by maintainers)

Most upvoted comments

Hello,

I’ve written an OpenXR API layer that will let Vulkan apps run on top of Direct3D 12 support on WMR (PCVR):

https://github.com/mbucchia/OpenXR-Vk-D3D12

I’ve tested it with the Godot 4 Alpha 10 demo scene, and it worked well on my HP Reverb G2. This can be installed system-wide (the API layer will load automatically) or bundled with the engine (need to load the API layer with xrCreateInstance()).

This won’t help you on HoloLens 2, because the GPU driver itself does not support Vulkan, so texture interop (which is the end of the line) will not help here.

@GeorgeS2019 cool huh! There are still a few things to be solved but this is making WMR support and Hololens support within reach.

I’m talking with Pedro about the missing bits, I hope to have time in the near future to help him out and see if we can get WMR to work on Windows.

… exporting a single function (something non standard) to retrieve the resource directly. But the latter might not be acceptable by the Mesa developers.

Something like this in Dozen:

ID3D12Resource* getUnderlyingD3D12Resource(VkImage image) {
  return dzn_image_from_handle(image)->res;
}

This will then allow you to create a thin interop layer between Dozen and D3D12 for OpenXR, when you would just need to write the code to initialize OpenXR using D3D12, and substitute the D3D12 swapchain images returned by xrEnumerateSwapchainImages with Vulkan textures, and eventually perform a copy between the underlying D3D12 Dozen texture (retrieved with getUnderlyingD3D12Resource()) into the actual D3D12 swapchain images. Don’t forget to also signal a fence to the D3D12 command queue after doing the copy.

There may also be a way to wrap a D3D12 swapchain image directly into a Dozen texture and avoid the need for a copy, but this requires more surgery into Dozen than just the one line of code.

Hey Alex,

Well we don’t have control over whether people install the WMR component for Steam, though they likely will because thats the only way to play most of the SteamVR games when you have a WMR headset.

The official take from OpenXR is that it should be the user who sets the default OpenXR runtime but you can override it. If you enable the OpenXR plugin in your project settings you’ll see a dropdown menu is added to the editor that allows you to select teh runtimes. As there is no way to detect which runtimes are installed this only works for the main runtime types and only when they are installed in their default locations.

The script for this dropdown is in the plugin so you can see how this works but basically its all about setting an environment variable before Godot starts.

Yup it’s a sad sad thing, I so want to see Godot running on a hololens.

It’s mostly a matter of people not having the time to spend on it. Godot can be compiled using Angle so it runs on DirectX but every since Microsoft abandoned Angle it’s been a pain in the … It requires this in the UWP build so Godot can run on XBox, and incidentally also on Hololens 😃

Google has now picked it up and there have been a few trials to get Godot running with that version but I don’t know the state of that. In theory if you compile Godot with Angle and make the necessary changes to this plugin it should work.

But someone has to find the time to do it. I will get to it eventually but right now there are other things higher on the priority list.