OS 1.3.0-dev1 no longer working with OpenXR in Godot

The 1.2.0 OS works fine with my Godot application but the same APK installed in 1.3.0-dev1 has no display. The app launches and my debug messages say that OpenXR initialized fine, but nothing is on the display.

Unity Editor version (if applicable): n/a
Godot Editor version: 4.0.3 stable
Godot OpenXR Loader: 1.0.0
ML2 OS version: 1.3.0-dev1
MLSDK version: n/a

I've attached my full log output (huge) below but I will highlight what I think are the most relevant errors (there's a lot of repeat errors).

First, my app does log that OpenXR was initialized: PRISM-XR: OpenXR initialised successfully which is not true on ML2 OS versions prior to OpenXR support being added. So my app thinks OpenXR should be working.

The first error that repeats a bunch:

06-02 14:27:53.593  9264  9291 E godot   : USER ERROR: Vulkan Debug Report: object - 131611476538768
06-02 14:27:53.593  9264  9291 E godot   : Validation Error: [ VUID-VkPushConstantRange-stageFlags-parameter ] Object 0: handle = 0x77b32f4eb590, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x22a9262e | vkCreatePipelineLayout: value of pCreateInfo->pPushConstantRanges[0].stageFlags contains flag bits that are not recognized members of VkShaderStageFlagBits The Vulkan spec states: stageFlags must be a valid combination of VkShaderStageFlagBits values (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkPushConstantRange-stageFlags-parameter)
06-02 14:27:53.593  9264  9291 E godot   :    at: _debug_report_callback (drivers/vulkan/vulkan_context.cpp:300)

It's worth noting that I see the error above in OS version 1.2.0 as well where my application works fine.

The next error is not the same as ones I've noticed on OS 1.2.0:

06-02 14:27:54.809  9264  9298 E godot   : USER ERROR: Vulkan Debug Report: object - 131611476570456
06-02 14:27:54.809  9264  9298 E godot   : Validation Error: [ VUID-VkPresentInfoKHR-pImageIndices-01296 ] Object 0: handle = 0x77b32f4f3158, type = VK_OBJECT_TYPE_QUEUE; | MessageID = 0xc7aabc16 | vkQueuePresentKHR(): pSwapchains[0] images passed to present must be in layout VK_IMAGE_LAYOUT_PRESENT_SRC_KHR or VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR but is in VK_IMAGE_LAYOUT_UNDEFINED. The Vulkan spec states: Each element of pImageIndices must be the index of a presentable image acquired from the swapchain specified by the corresponding element of the pSwapchains array, and the presented image subresource must be in the VK_IMAGE_LAYOUT_PRESENT_SRC_KHR layout at the time the operation is executed on a VkDevice (https://github.com/KhronosGroup/Vulkan-Docs/search?q=)VUID-VkPresentInfoKHR-pImageIndices-01296)
06-02 14:27:54.809  9264  9298 E godot   :    at: _debug_report_callback (drivers/vulkan/vulkan_context.cpp:300)

It helps to filter on lines that contain "godot". Lines with "PRISM-XR" are debug logs from my application: logcat-prism.txt (13.9 MB)

Hi @laplante.sean Thank you for your post. We don't officially support Godot yet, though it does work with Magic Leap 2. However we do have internal developers who are working with 4.0.1. That may help if you are able to switch to that version.

We are currently looking at support for Godot.

I just downgraded to Godot 4.0.1 and that did not fix the issue. I get the same behavior (no display) and the same error messages.

Edit: this ticket was just closed and you marked an incorrect solution. 4.0.1 did NOT fix the issue. Please see above, I have the same issue on godot 4.0.1 as I have in 4.0.3. Something must have broken compatibility with the latest ML2 OS release.

Hi there, like we said above we do not yet officially support Godot for Magic Leap 2. Closing the ticket for this reason. Thank you for your post.

@laplante.sean as mentioned we haven't gotten to the point of general availability and openXR support on our platform for Godot. With that said let me look into this issue and I will try to provide a workaround or some scoping on a fix.

Thank you for your patience and letting us know about it, since we have reproduced this internally ill need some time to analyze.

@laplante.sean the Debug messages from the validation layers, though loud, actually are not enforcing.

When using 1.3.0-dev1 with Godot 4.03 on a simple test cube app I am able to see content rendering but the same logs in the error except the following from your own app:
USER ERROR: PRISM-XR: DisplayManager: Got error code 0 from gateway

Not sure if this is a custom DisplayServer you wrote but I can confirm Godot isn't inherently broke, we will work on making the validation layers less spammy soon but I am unsure why your app is breaking currently given our test apps work.

Without understanding what your app is I would try to work back from each piece to narrow down the point of failure which could be come from something on the system but isn't specific to OpenXR.

Thanks so much for the update!

Is there any chance you could upload your test cube app here so I can reference how you're setting up the scene just to make sure I didn't miss anything?

If not, a snippet of gdscript code from how you initialize the scene and the godot .project file settings would be a good start to make sure I'm not missing something simple. Also, which version of the Godot OpenXR loaders are you using? I'm using v1.0.0 from here

The PRISM-XR message about the display manager can be ignored. That's app specific stuff and despite how it sounds, it has nothing to do with what the AR display of the headset.

Hey, It's been a bit. I'm finally getting back to this.

I'm running the latest ML2 official firmware now and building with Godot 4.1.1. I'm still not able to get anything rendering. I'm working with a similar "simple test cube" example so there's nothing complicated at all.

Just curious if you could share your test cube project with me. I think it would help a bunch. I'd be able to quickly see if any settings were different or if I'm missing something simple, or if it's simply just that I need to rollback to Godot 4.03.

  1. Ensure your environment is setup for exporting to Android Exporting for Android โ€” Godot Engine (latest) documentation in English
  2. Unzip the zip file anywhere. This zip contains the Godot OpenXR Loader v1.1.0 Android plugin for Godot 4.1.1-stable
  3. Open the project with Godot 4.1.1-stable
  4. In the editor, click on Project -> Install Android Build Template, then click on Install

There are two ways to export, install, and run

  • Click on the Remote Debug option (top right corner of the editor, next to Run Current Scene) and choose Ml Magic Leap 2.

OR

  • In the editor, click on Project -> Export ..., choose the Android preset, then click Export Project...
  • Then in the terminal (assuming you have access to adb shell)

Install

adb install org.godotengine.godotcube411stable.apk

Launch

adb shell am start -n org.godotengine.godotcube411stable/com.godot.game.GodotApp

Finally, to uninstall

adb uninstall org.godotengine.godotcube411stable

add com.magicleap.permission.HAND_TRACKING to the Custom Permissions section in the Android export preset

2 Likes

Awesome thanks for the reply. I don't see the attachment though. Is there supposed to be a godotcube project zip attached or is that something I can get from somewhere. I don't see it at any of the links.

Oops my apologies. Forgot to attach the zip.
godotcube411stable.zip (10.2 MB)

2 Likes

Thanks so much! I will check this out tomorrow on my headset and see if I can find the difference between the projects.

Alright! I got it. Thanks again! I don't know if I ever would have figured this out because it's such a minor thing. On Godot's current official docs for setting up OpenXR they have this line:

# Turn off v-sync!
DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_DISABLED)

And that is in fact what breaks it on the Magic Leap 2. If I add that line - no display. If I remove that line - everything works. Now, it's important to note that this was not true prior to ML2 OS version 1.3.x since I've had that line in the project since the beginning.

There were a few other differences between our projects that I found interesting as well. I'll highlight them here:

  1. OpenXR > Reference Space is set to stage (the default) but I found in versions prior to 1.3.X that I could suppress one of the very noisy Vulkan errors by setting it to local instead. This seems to not matter though since I've tried it with both now and it works either way.
  2. The project is using the mobile renderer. This could be a change to Godot since when I started working this project I was on 4.0, but when I started this project I needed to set the renderer to forward+ instead of mobile in order for it to properly use Vulkan. That is no longer the case - the mobile renderer works now - which is nice.

Thanks again!
Sean