OpenXR: Add Metal support#98872
Conversation
|
I know this is a work-in-progress and not finished, but I wanted to share my experience in testing it so far! When I first tried using the Meta XR Simulator with this PR on my M2 Mac Mini, it would crash with this stacktrace: So, then I tried:
I'm not sure if the MoltenVK update was actually required. However, I don't actually see anything rendered in either the Godot window, or the XR Simulator window (like I do when using Vulkan). Anyway, I'm looking forward to testing this again as it progresses! |
That's pretty much what I experienced as well, I couldn't get it to work with 69, it did stop crashing with 71 beta (which has MoltenVK linked in statically if I understand correctly). I am still at a loss on why we're not getting output however, I think we need @stuartcarnie input here. |
a11c88b to
ead587a
Compare
|
@stuartcarnie @dsnopek I think I figured out what we're missing and why this is not working. I finally managed to get Xcode playing ball (thanks @clayjohn !!). OpenXR requires us to create our swapchain using an Off course, our renderer uses a normal non sRGB texture format because we do our own sRGB conversion in a shader (which btw on Metal/Apple is a problem because Apple uses a different display gamma compared to what we use, thats been a constant bane for graphics artists and webdesigners for decades :P ). Our rendering pipeline is thus being constructed using I did try to see if I could go down the same route as we do with Vulkan (behind the scenes) and create a shared texture with the format |
b1c0315 to
fb1ca10
Compare
On OpenGL, we're able to create the swapchain with an sRGB format, but then disable the automatic conversion to sRGB (via Is there a way to do that in Vulkan or Metal too? |
In Vulkan you do this by creating a texture view for the non-sRGB format and attaching that to the framebuffer, you do that by calling I tried forcing that here as well but to no avail though talking to @stuartcarnie I got the impression the same applies to Metal. |
fb1ca10 to
a117dab
Compare
|
The latest version of this PR (which includes PR #99905) is working for me on my Mac Mini, with Meta's XR Simulator 71.0.0-beta.2! Rendering works, and I can move the camera and hands around, and see it update in the XR Simulator window |
|
I'm pretty convinced the issue I'm having is localised to my Mac. likely an old version of the Vulkan SDK still kicking around (the XR simulator is still using MoltenVK). |
a117dab to
3024eef
Compare
dsnopek
left a comment
There was a problem hiding this comment.
Thanks! This is working great in my testing.
I'll make a follow-up PR to remove the swapchain fallback thing we were discussing above.
c7607ea to
6b4f7d8
Compare
6b4f7d8 to
08ced81
Compare
stuartcarnie
left a comment
There was a problem hiding this comment.
I tested the Metal changes previously, and worked as expected. Nice work!
|
Thanks! |


This PR adds support for the metal backend to our OpenXR module.
Depends on: #98803
This can be tested using Metas XR simulator on Mac: https://github.com/Oculus-VR/homebrew-repo/blob/main/meta-xr-simulator.md
Issues still to be resolved:
Contributed by Khronos Group through the Godot Integration Project