OpenXR 1.1.36 - crash

Did anyone have a chance yet to try the newest version 1.1.36 of OpenXR? The OpenXR tests compile just fine, but when running them, there’s a vtkOutputWindow showing

ERROR: In vtkOpenXRManager.cxx, line 546
(nullptr): Failed to create XR instance. (???????...)

Warning: In vtkOpenXRManager.cxx, line 104
(nullptr): Initialize failed to CreateInstance

ERROR: In vtkOpenXRRenderWindow.cxx, line 118
vtkOpenXRRenderWindow (...): Failed to initialize OpenXRManager

and in the console, the following line is printed over and over:

Error [GENERAL | xrPollEvent | OpenXR-Loader] : No active XrInstance handle.

(and in our own program using OpenXR via VTK, I see the same problem).

The OpenXR loader release notes for that version to me sound like - despite making an updated version 1.1 of OpenXR available - they should be backwards compatible with 1.0:

This is a substantial update to the OpenXR specification. The OpenXR loader in this release supports both OpenXR 1.0 and 1.1, and sample applications such as hello_xr continue to only require OpenXR 1.0.

If I have time I’ll look into this further, but just wanted to know first whether somebody has an idea on this, or maybe is even already working on a fix?

1 Like

We have exactly the same error messages. We have tried to start OpenXR manually via the vtkOpenXRManager class, but this did not result in any changes.

Are there any updates?

Turns out there is a very simple solution for this problem!

Fix: Add

createInfo.applicationInfo.apiVersion = 
      XR_MAKE_VERSION(XR_VERSION_MAJOR(XR_CURRENT_API_VERSION),
          0, XR_VERSION_PATCH(XR_CURRENT_API_VERSION));

before the calls to xrCreateInstance in vtkOpenXRManager.cxx (Rendering/OpenXR).


How did I find out: I looked into the hello_xr example from the OpenXR SDK for changes between 1.0(.34) and 1.1(.36) and the only thing I could find was that the version in the info struct passed to xrCreateInstance is set differently, now it is explicitly setting the minor part of the api version to 0.

Not sure what other changes would come with switching to 1.1, but for now, replicating this change is the easiest to make VTK compatible with the OpenXR SDK >= 1.1.36. Applying the fix as described above to VTK leads to applications running again without crash; I still see an error in the output:

2024-07-16 15:11:35.190 ( 2.077s) [63BA4D4551CFE43C] vtkOpenXRManager.cxx:547 ERR| (nullptr): Failed to wait frame. [XR_ERROR_SESSION_NOT_RUNNING].

but I don’t think this affects the functionality.

I have submitted a merge request, so this should hopefully also be fixed in future VTK releases.

1 Like