# OpenXR 1.1.36 - crash

**URL:** https://discourse.vtk.org/t/openxr-1-1-36-crash/13744
**Category:** VR/AR
**Created:** [April 19, 2024, 6:28am UTC](https://discourse.vtk.org/t/openxr-1-1-36-crash/13744 "2024-04-19T06:28:49Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![codeling](https://discourse.vtk.org/user_avatar/discourse.vtk.org/codeling/32/3792_2.png) [@codeling](https://discourse.vtk.org/u/codeling)
#### Post date: [April 19, 2024, 6:28am UTC](https://discourse.vtk.org/t/openxr-1-1-36-crash/13744/1 "2024-04-19T06:28:49Z")

</div>

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

```plaintext
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:

```plaintext
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](https://github.com/KhronosGroup/OpenXR-SDK-Source/releases) 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?

---

<div class="post-metadata">

### Author: ![AlexG](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/ecc23a/32.png) [@AlexG](https://discourse.vtk.org/u/AlexG)
#### Post date: [July 8, 2024, 9:47am UTC](https://discourse.vtk.org/t/openxr-1-1-36-crash/13744/2 "2024-07-08T09:47:48Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![codeling](https://discourse.vtk.org/user_avatar/discourse.vtk.org/codeling/32/3792_2.png) [@codeling](https://discourse.vtk.org/u/codeling)
#### Post date: [July 16, 2024, 1:49pm UTC](https://discourse.vtk.org/t/openxr-1-1-36-crash/13744/3 "2024-07-16T13:49:08Z")

</div>

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

**Fix:** Add

```auto
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](https://github.com/KhronosGroup/OpenXR-SDK-Source/tree/main/src/tests/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](https://gitlab.kitware.com/vtk/vtk/-/merge_requests/11318), so this should hopefully also be fixed in future VTK releases.
