Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OpenXR] Fixes crashes when no device is present (stride3d#2121)
The essential part here is that `OpenXRHmd.CanInitialize` will now return false if no device is present. This ensures that the `VRDeviceSystem` sets up a dummy device which in turn prevents many parts from crashing. To truly know whether or not an actual device is connected we first need to establish contact with the OpenXR runtime. Therefor code has been moved around a bit to be able to call various parts individually. Tested on two machines, one without any VR related things installed and another one with an actual device. This commit also contains a bunch of code cleanups: - Enables C# nullable feature on OpenXR files - Adds null checks to various places - Disposes XR API after shutting down the device - Makes various fields and methods private - Moves initialization code to a `OpenXRUtils` class to make dependencies more visible - Turns OpenXRInput into a normal class holding a reference to the device - Turns `CheckResult` into a extension method and simplifies its usage by letting C# infer the called method - Introduced `OpenXRException` exception class carrying the inferred method and XR error code
- Loading branch information