API

Interface XrSessionContext

Handle to an active WebGPU XR session. Pure state; drive lifecycle with exitXr.

interface XrSessionContext {
    binding: XrGpuBinding;
    cameras: readonly XrCamera[];
    colorFormat: GPUTextureFormat;
    depthFormat: GPUTextureFormat | null;
    engine: EngineContext;
    input: XrInputManager | null;
    layer: XRProjectionLayer;
    mode: XrSessionMode;
    referenceSpace: XRReferenceSpace;
    scene: SceneContext;
    session: XRSession;
}
Index
binding: XrGpuBinding
cameras: readonly XrCamera[]

Per-eye cameras, in XRViewerPose.views order. Populated on the first frame.

colorFormat: GPUTextureFormat
depthFormat: GPUTextureFormat | null
input: XrInputManager | null

Input manager, or null when input tracking is disabled.

layer: XRProjectionLayer
referenceSpace: XRReferenceSpace

Active reference space the session renders + tracks input against. Teleportation swaps this for an offset space to move the viewer.

session: XRSession