Reputation: 111
How to query the OpenXR runtime library's API version?
xrCreateInstance requires a value for XrInstanceCreateInfo::applicationInfo.apiVersion
"If the runtime does not support the requested apiVersion [xrCreateInstance] must return XR_ERROR_API_VERSION_UNSUPPORTED"
Is there a way to query the runtime's API version? The Windows Mixed Reality "OpenXR Tools" application displays it, so I guess the answer should be "yes", but I haven't found how.
I've seen a suggestion to set XrInstanceCreateInfo::applicationInfo.apiVersion = 0 to supposedly guarantee that xrCreateInstance will not fail with XR_ERROR_API_VERSION_UNSUPPORTED, but I see nothing in the specification that supports that. Moreover, even if xrCreateInstance succeeds, the value returned in XrInstanceProperties::runtimeVersion is "not necessarily related to an OpenXR API version".
Thanks for any suggestions.
Side note: I just updated my OpenXR SDK (headers and loader library) to 1.1.41, but now I'm getting XR_ERROR_API_VERSION_UNSUPPORTED. The WMR OpenXR tools reveals that the runtime library API version is 1.0.28 -- for the Oculus (Meta Quest Link) runtime as well as the Microsoft WMR runtime on both the PC and the HoloLens.
Upvotes: 0
Views: 111
Reputation: 111
I posted this question in a Khronos forum and was informed that there is no way to "to query the OpenXR runtime library's API version". Since a "1.1.41" version of the SDK was recently posted in GitHub, but many (most?) runtime libraries are still at "1.0", the former advice to create an XrInstance using XR_CURRENT_API_VERSION is liable to fail with XR_ERROR_API_VERSION_UNSUPPORTED. A workaround for that error is to iteratively decrement the patch, minor, and major version fields and try again, until xrCreateInstance either succeeds, or fails for other reasons. The application should either record and adapt to whatever API version the runtime supports, or fail with something like "version unsupported".
Upvotes: 0