phr00t / FocusEngine

Focus Game Engine. This is Stride/Xenko fast-tracked for Phr00t's Software games. Improvements over the original Focus on Vulkan support, PC platforms, VR, performance & ease. Cherry-picks commits from other forks as needed.
MIT License
97 stars 11 forks source link

Vulkan support for OpenVR #14

Closed phr00t closed 5 years ago

phr00t commented 5 years ago

OpenVR seems to work on DirectX textures:

https://github.com/phr00t/xenko/blob/master/sources/engine/Xenko.VirtualReality/OpenVR/OpenVR.cs#L232

Vulkan should be used instead.

However, can't make much progress on this until this issue is resolved: https://github.com/xenko3d/xenko/issues/370

phr00t commented 5 years ago

Should be done with this commit: https://github.com/phr00t/xenko/commit/3853a47e7d0f73ba96f32279c234989ffce1d18b

However, needs proper testing.

phr00t commented 5 years ago

Lots of OpenVR code in Xenko is not built due to compiler flags requiring DirectX11... work in progress

phr00t commented 5 years ago

Looks like there is no Vulkan equivalent for getting a mirror texture...?

https://github.com/ValveSoftware/openvr/issues/1053

phr00t commented 5 years ago

This commit: https://github.com/phr00t/xenko/commit/b20e0e54125b9cde95bcec9b23f02808968a0be1

Allows OpenVR to build for Vulkan. However, openvr_api.dll doesn't get copied automatically to the win-vulkan/x64 library folder of a built project for some reason... also, I don't think texture.SharedHandle is functional as the Vulkan texture pointer

phr00t commented 5 years ago

I have SharedHandle being set, but it looks like there is more required here:

https://github.com/ValveSoftware/openvr/wiki/Vulkan

phr00t commented 5 years ago

This sets SharedHandle:

https://github.com/phr00t/xenko/commit/e3c9e32b0602a4788406600a5b02debea4bfcb5a

...but lots of stuff needs to be done according to the wiki above

phr00t commented 5 years ago

Significant progress: https://github.com/phr00t/xenko/commit/3a87b36e5785e2bf526083cfd9b0a602a99142b5

Currently compiling & running. The OpenVR.Submit function is getting a compositor error that the app doesn't have focus, which is happening because WaitGetPoses isn't being called. This is because the VR system isn't being drawn, because it is considered disabled and not visible when checked in GameSystemsCollection.cs line 126

Why is it disabled? Not sure, but that is the next thing to fix...

phr00t commented 5 years ago

Got some useful information from the vrclient__log.txt in the SteamVR logs directory. It said there was a missing Vulkan instance extension, which was added in this commit: https://github.com/phr00t/xenko/commit/712ef39276f34881f659ec1b752f0380a39172b0

Now OpenVR & Vulkan WORKS!