Vixen
02b45cc4
csharp
public sealed class OpenXrSession

A running OpenXR session: the frame loop, the poses and the input.

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

Remarks

The runtime paces the frame, and that is the single most important thing about this class. BeginFrame calls xrWaitFrame, which blocks until the compositor wants the next frame — that is how it controls latency and how it throttles an application that is running ahead. A game that renders on its own schedule and submits when it happens to finish gets judder that no frame rate fixes.

Every begun frame is ended, including the ones that draw nothing. A runtime waiting for a frame that never arrives stalls the compositor for the whole system, not just for this process.

Fields and properties (6)

  • public XrSessionState State

    Where the session is in its lifecycle.

  • public int ViewCount

    How many views a frame has.

  • public XrSystemInfo System

    What the runtime said about the device.

  • public XrReferenceSpace ReferenceSpace

    What poses are reported relative to.

  • public ReadOnlySpan<XrView> Views

    The views located for the current frame, one per eye.

  • public bool IsPassthrough

    Whether the compositor is blending the scene with the room.

Methods (11)

  • public IXrSwapchain CreateSwapchain(in XrSwapchainDescription description)

    Creates a swapchain for eye buffers.

  • public bool PollEvents()

    Drains the runtime's event queue, moving State on.

  • public bool BeginFrame(out XrFrameState frame)

    Waits for the runtime to want the next frame, and begins it.

  • public ReadOnlySpan<XrView> LocateViews(in XrFrameState frame)

    Asks where the eyes will be when the frame is displayed.

  • public bool LocateSpace(XrReferenceSpace space, in XrFrameState frame, out XrPose pose)

    Locates something the runtime tracks, in the session's reference space.

  • public void EndFrame(in XrFrameState frame, ReadOnlySpan<XrCompositionView> views)

    Submits the frame.

  • public void AttachActionSets(ReadOnlySpan<XrActionSet> sets)

    Attaches the action sets, after which they cannot be changed.

  • public void SyncActions()

    Updates every attached action's state for this frame.

  • public void ApplyHaptics(XrAction action, XrHand hand, in XrHapticPulse request)

    Plays a haptic pulse.

  • public void RequestExit()

    Asks the runtime to end the session.

  • public void Dispose()

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

Used by (2)

  • OpenXrBackendVixen.Xr.OpenXR
  • OpenXrSwapchainVixen.Xr.OpenXR