Vixen
02b45cc4
csharp
public sealed class NullXrBackend

A headset that is not there, simulated well enough to develop against.

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

Remarks

What NullAudioBackend and NullDevice are, for XR. Every layer above this — the frame loop, the stereo views, the action sets, the ECS bridge — is exercised without a runtime, a headset, or a person wearing one. That matters more here than anywhere else in the engine: XR is the one subsystem where the hardware is genuinely unavailable on a CI runner and expensive to keep on a desk.

It is a simulation, not a stub. The state machine walks through the same sequence a real runtime does, the two eyes are offset by an interpupillary distance, the poses are whatever the caller says the head is doing, and frames are paced by a counter rather than by a clock — so a test can run four hundred frames in a millisecond and get exactly the timings a headset would have produced.

Fields and properties (6)

  • public static XrSystemInfo DefaultSystem

    A two-eyed headset at a resolution nobody will mistake for a real product's.

  • public XrSystemInfo System

    What it claims to be.

  • public bool PretendUnavailable

    Whether it should pretend there is no headset attached.

  • 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.

Methods (6)

  • public NullXrBackend(IGraphicsDevice? device = null, XrSystemInfo? system = null)

    Creates a simulated backend.

  • 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)

  • NullXrBackendTestsVixen.Xr.Tests
  • XrTrackingSystemTestsVixen.Xr.Tests