API

Function enableXrCompatibleAdapter

  • Request an XR-compatible GPU adapter for engines created after this call.

    Call this once, before createDevice (or createEngine when it creates its own device), if you intend to enter an immersive WebGPU XR session with that engine. The draft WebXR/WebGPU binding throws InvalidStateError when XRGPUBinding is constructed with a device whose adapter was not XR-compatible, and WebGPU offers no way to upgrade an existing device (unlike WebGL's makeXRCompatible()), so the adapter must be requested with { xrCompatible: true } up front.

    Implemented as an explicit opt-in installer (not a createEngine option) so non-XR apps that never import this stay byte-identical — createEngine's adapter request folds to its default when no hook is installed. The choice persists across device-lost recovery. See enterXr.

    Returns void