Update OpenXR SDK to 1.1.38

Following the OpenXR Tutorial, the OpenXR SDK version which is build on is 1.0.34. I want to use later versions, at least 1.1.36, which contains the extension that I need, XR_META_environment_depth.

I have updated both lines of URL_HASH and URL in CMakeLists.txt to download without a problem the newer versions, as well as the line implementation in app/build.gradle to get the newer SDK version. The new version downloads without a problem, however the function xrCreateInstance returns an XrResult of -4 (XR_ERROR_API_VERSION_UNSUPPORTED). What is happening here? I have the new runtime downloaded.

I can skip this error, if before that function I manually set the version to be the previous working runtime like this

//AI.apiVersion = XR_CURRENT_API_VERSION;
AI.apiVersion = XR_MAKE_VERSION(1, 0, 34);

xrCreateInstance returns XR_SUCCEEDED, however I don’t think this is the right solution, as further down the road I get strange errors related to functions specific to newer versions of the runtime, like xrCreateEnvironmentDepthSwapchainMETA not working at all.

I think the issue is that the runtime does not support OpenXR 1.1 (none of them seem to officially support it yet). From the spec, it seems that the correct solution is to use the macro XR_API_VERSION_1_0 instead, which does something similar to what you tried, except it sets the patch version to the latest one (1.0.38).

Not sure if using extensions specified in OpenXR 1.1 is allowed when using 1.0, the spec doesn’t seem to say anything about it.

1 Like

Yes, this is fine - Each extension says its requirements in the spec:

Extension and Version Dependencies

OpenXR 1.0

In theory somebody could write an extension that required 1.1, but I don’t think we have any yet.

Meta’s new OpenXR SDK version 67, released 5 days ago, specifies that the OpenXR version it uses is 1.1.36, however, when looking at the code, it manually sets the version to 1.0.34, exactly as I’ve commented here more than a month ago.

I don’t understand why they need to comment that the SDK works with the new version when it doesn’t, and they had to patch it because if I set the apiVersion to XR_CURRENT_API_VERSION, xrCreateInstance fails just like it’s been failing for more than a month.

They have to update to the latest SDK in order to use any new extensions. Properly updating the runtime to OpenXR 1.1 is a lot of work, since Meta would have to re-certify the runtime for that version. It’s probably going to take a long time, and they’ll want to be able to provide support for their new extensions in the mean time.

FYI we have a new constant to use instead of XR_CURRENT_API_VERSION to get a 1.0 instance: XR_API_VERSION_1_0 - see also The OpenXR™ 1.1.38 Specification (with all registered extensions)

It uses the same “patch” (third component) version with major and minor set to 1.0, so if you’re using 1.1.38 as the SDK, XR_API_VERSION_1_0 would have the value corresponding to 1.0.38. Some vendors use the patch version reported to infer things about compatibility fixes, so it’s important to populate it and keep up to date for the most conformant behavior.