C Specification
The xrCreateApiLayerInstance function is defined as:
// Provided by XR_LOADER_VERSION_1_0
XrResult xrCreateApiLayerInstance(
const XrInstanceCreateInfo* info,
const XrApiLayerCreateInfo* layerInfo,
XrInstance* instance);
Parameters
Description
An API layer’s implementation of the xrCreateApiLayerInstance function is invoked during the loader’s implementation of xrCreateInstance, if the layer in question is enabled.
An API layer needs additional information during xrCreateInstance calls, so each API layer must implement the xrCreateApiLayerInstance function, which is a special API layer function.
An API layer must not implement xrCreateInstance.
xrCreateApiLayerInstance must be called by the loader during its implementation of the xrCreateInstance function.
The loader must call the first API layer’s xrCreateApiLayerInstance function passing in the pointer to the created XrApiLayerCreateInfo.
The XrApiLayerCreateInfo::nextInfo
must be a linked-list of
XrApiLayerNextInfo structures with information about each of the API
layers that are to be enabled.
Note that this does not operate like a next
chain in the OpenXR
application API, but instead describes the enabled API layers from outermost
to innermost.
The API layer may validate that it is getting the correct next information
by checking that the XrApiLayerNextInfo::layerName
matches the
expected value.
The API layer must use the information in its XrApiLayerNextInfo to call down the call chain to the next xrCreateApiLayerInstance:
-
The API layer must copy the XrApiLayerCreateInfo structure into its own structure.
-
The API layer must then update its copy of the XrApiLayerCreateInfo structure, setting XrApiLayerCreateInfo::XrApiLayerCreateInfo::
nextInfo
to point to the XrApiLayerNextInfo for the next API layer (e.g.layerInfoCopy→nextInfo = layerInfo→nextInfo→next;
). -
The API layer must then use the pointer to its XrApiLayerCreateInfo structure (instead of the one that was passed in) when it makes a call to the xrCreateApiLayerInstance function.
-
If the nested xrCreateApiLayerInstance call succeeds, the API layer may choose to setup its own dispatch table to the next API layer’s functions using the returned XrInstance and the next API layer’s xrGetInstanceProcAddr.
-
The API layer must return the XrResult returned from the next API layer.
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
Copyright 2014-2024, The Khronos Group Inc.
This work is licensed under a Creative Commons Attribution 4.0 International License.