C Specification

When submitting motion vector buffer and depth buffers along with projection layers, add an XrCompositionLayerSpaceWarpInfoFB structure to the XrCompositionLayerProjectionView::next chain, for each XrCompositionLayerProjectionView structure in the given layer.

The XrCompositionLayerSpaceWarpInfoFB structure is defined as:

typedef struct XrCompositionLayerSpaceWarpInfoFB {
    XrStructureType                           type;
    const void*                               next;
    XrCompositionLayerSpaceWarpInfoFlagsFB    layerFlags;
    XrSwapchainSubImage                       motionVectorSubImage;
    XrPosef                                   appSpaceDeltaPose;
    XrSwapchainSubImage                       depthSubImage;
    float                                     minDepth;
    float                                     maxDepth;
    float                                     nearZ;
    float                                     farZ;
} XrCompositionLayerSpaceWarpInfoFB;


Member Descriptions
  • type is the XrStructureType of this structure.

  • next is NULL or a pointer to the next structure in a structure chain.

  • layerFlags is a bitmask of XrCompositionLayerSpaceWarpInfoFlagsFB.

  • motionVectorSubImage identifies the motion vector image XrSwapchainSubImage to be associated with the submitted layer XrCompositionLayerProjection.

  • appSpaceDeltaPose is the incremental application-applied transform, if any, since the previous frame that affects the view. When artificial locomotion (scripted movement, teleportation, etc.) happens, the application might transform the whole XrCompositionLayerProjection::space from one application space pose to another pose between frames. The pose should be identity when there is no XrCompositionLayerProjection::space transformation in application.

  • depthSubImage identifies the depth image XrSwapchainSubImage to be associated with motionVectorSubImage. The swapchain should be created with XR_SWAPCHAIN_USAGE_SAMPLED_BIT | XR_SWAPCHAIN_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT.

  • minDepth and maxDepth are the range of depth values the depthSwapchain could have, in the range of [0.0,1.0]. This is akin to min and max values of OpenGL’s glDepthRange, but with the requirement here that maxDepth ≥ minDepth.

  • nearZ is the positive distance in meters of the minDepth value in the depth swapchain. Applications may use a nearZ that is greater than farZ to indicate depth values are reversed. nearZ can be infinite.

  • farZ is the positive distance in meters of the maxDepth value in the depth swapchain. farZ can be infinite.

The motion vector data is stored in the motionVectorSubImage’s RGB channels, defined in NDC (normalized device coordinates) space, for example, the same surface point’s NDC is PrevNDC in previous frame, CurrNDC in current frame, then the motion vector value is "highp vec3 motionVector = ( CurrNDC - PrevNDC ).xyz;". Signed 16 bit float pixel format is recommended for this image.


The runtime must return error XR_ERROR_VALIDATION_FAILURE if nearZ == farZ.

Valid Usage (Implicit)

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 (c) 2014-2021, The Khronos Group Inc.