Vixen
02b45cc4
csharp
public sealed class OpenXrBackend

The OpenXR runtime, if this machine has one.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Constructing this is safe on a machine with no runtime, no headset and no loader. That is the point of the shape: IsAvailable answers "could this process open a session" and UnavailableReason says why not in a sentence, because "VR did not start" has half a dozen completely different causes and the person reading the log needs to know which.

The order of operations is dictated by the runtime. An OpenXR instance exists before the graphics device does, because the runtime names the Vulkan extensions the device must be created with and the physical device it must be created on — and neither can be applied afterwards. So: construct this, ask GetVulkanRequirements, create VulkanDevice with what it said, then CreateSession.

XR_KHR_vulkan_enable rather than _enable2. The second revision has the runtime create the Vulkan instance and device itself, which would mean handing this module the job of building the engine's device — and VulkanDevice is where that lives. The first revision's contract is exactly the one this engine wants: the runtime says what it needs, the engine creates the device, the runtime is handed it.

Fields and properties (4)

  • public string Name

    What to call it in a log — OpenXR, Null.

  • public bool IsAvailable

    Whether this process could open a session through it.

  • public string UnavailableReason

    Why not, when it is not. Empty when it is.

  • public XrSystemInfo System

    The runtime's own name for the system, when there is one.

Methods (6)

  • public OpenXrBackend(OpenXrOptions options = default(OpenXrOptions))

    Connects to the runtime, or reports why it could not.

  • public bool TryGetSystem(out XrSystemInfo system)

    What the runtime says about the attached headset.

  • public XrVulkanRequirements GetVulkanRequirements()

    What the runtime needs of the Vulkan device before one is created.

  • public nint GetVulkanPhysicalDevice(nint vulkanInstance)

    Which physical device the runtime insists on.

  • public IXrSession CreateSession(in XrVulkanBinding binding, in XrSessionOptions options, IXrImageImporter? importer = null)

    Opens a session.

  • public void Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Used by (2)

  • OpenXrBackendTestsVixen.Xr.OpenXR.Tests
  • OpenXrSessionVixen.Xr.OpenXR