C Specification

The xrCreateAnchorSpaceBD function is defined as:

// Provided by XR_BD_spatial_sensing
XrResult xrCreateAnchorSpaceBD(
    XrSession                                   session,
    const XrAnchorSpaceCreateInfoBD*            createInfo,
    XrSpace*                                    space);

Parameters

Parameter Descriptions
  • session is a handle to the parent XrSession.

  • createInfo is a pointer to an XrAnchorSpaceCreateInfoBD structure containing information about how to create the anchor.

  • space is a pointer to a handle in which the created XrSpace is returned.

Description

The application can create an XrSpace for an anchor using xrCreateAnchorSpaceBD. Using this handle, the application can use calls like xrLocateSpace and xrLocateSpaces to locate the anchor in a given base space at a given time. The createInfo parameter contains the XrAnchorBD as well as a pose offset to apply.

Multiple XrSpace handles for a given XrAnchorBD may exist simultaneously, up to some limit imposed by the runtime. The XrSpace handle must be eventually freed via the xrDestroySpace function or by destroying the parent XrSession handle.

As the parent of all XrSpace handles, including those created with this function, is an XrSession handle, an anchor space may outlive the XrAnchorBD handle used to create it. Additionally, the ability to locate anchor spaces depends on spatial sensing being active. A valid XrSpace handle created for an XrAnchorBD must be unlocatable unless the associated XrSenseDataProviderBD has been started without since being stopped.

Such an unlocatable anchor space behaves the same as an unlocatable action space as discussed in https://registry.khronos.org/OpenXR/specs/1.1/html/xrspec.html#spaces-action-spaces-lifetime.

Note that destroying the XrAnchorBD used in creating an anchor space does not itself make the anchor space unlocatable; it only prevents creation of additional anchor spaces from that anchor. This mirrors the behavior of action spaces and destruction of their corresponding pose actions.

Valid Usage (Implicit)
Return Codes
On success, this command returns
  • XR_SUCCESS

  • XR_SESSION_LOSS_PENDING

On failure, this command returns
  • XR_ERROR_FUNCTION_UNSUPPORTED

  • XR_ERROR_VALIDATION_FAILURE

  • XR_ERROR_HANDLE_INVALID

  • XR_ERROR_INSTANCE_LOST

  • XR_ERROR_SESSION_LOST

  • XR_ERROR_OUT_OF_MEMORY

  • XR_ERROR_LIMIT_REACHED

  • XR_ERROR_SPATIAL_SENSING_SERVICE_UNAVAILABLE_BD

  • XR_ERROR_POSE_INVALID

  • XR_ERROR_FEATURE_UNSUPPORTED

See Also

Document Notes

For more information, see the OpenXR Specification

This page is extracted from the OpenXR Specification. Fixes and changes should be made to the Specification, not directly.

Copyright 2014-2025 The Khronos Group Inc.