-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add OpenXR support to the core #56394
Conversation
c29ae09
to
5cbc0e4
Compare
7d60d1c
to
1e9fba6
Compare
This is starting to work, it now is based on #51179, while there are some issues still around updating the framebuffers. Two major problems at the moment:
I have a number of things to polish up on 51179 first, but we're getting somewhere with this port. |
@BastiaanOlij It may be worth splitting the |
It's in a separate commit, so if you just look at the last commit only, those are the real changes.
edit no longer using 51179 |
Thanks for the clarification! |
1e9fba6
to
efced20
Compare
I've redone the last bit of this so it no longer used 51179 but does a copy of Godots results into the textures provided by OpenXR. This is slightly slower but it doesn't require us to do really ugly stuff. Once I improve 51179 we'll revisit that. I'm still having the timing issues, I may try and move part of Also I think Steam now doesn't like us providing the data in sRGB when its expecting linear color space so things are too bright. Still looking into that. |
e4f7823
to
391e820
Compare
Noticed that changing vulkan vsync to mailbox moves the fps from 60fps to 90fps (HMD). Hope that helps. |
Yeah we need to find out how to turn vsync off all together. OpenXR will set the pace. |
391e820
to
8700227
Compare
Sent you the branch for tracker velocity including the head. I think the bug is the engine tick is not the tracker (head) tick from the openxr runtime. |
8a53ce1
to
a3a34e8
Compare
@reduz @m4gr3d , after talking this over with Reduz last night I spend today moving everything into modules and changing the way things are mixed in to other parts of the system. I'm not done yet because I want to look into merging openxr_device into openxr_interface, I'm not sure about this just yet. Also note that I moved the flag that enables the XR shaders into the XR area of the project settings, you must turn this on or your project won't run. Defo need to improve the error handling here. Btw @akien-mga , any idea how to make the CI happy about |
fd28c94
to
4994196
Compare
After trying out a few things I've decided to keep the split between the 'OpenXRInterface' class and the Things got really messy trying to combine it especially around the action map and controller logic. This nicely splits it in logic that faces OpenXR and logic that focuses on the Godot side. |
7d60543
to
47a7615
Compare
@SaracenOne made a small change making the Vulkan version check a warning for now. Godot checks with the Vulkan driver what version of Vulkan is supported on the host system, we select the highest v1.x.x version of Vulkan that is supported by the host (currently usually 1.2.0 on desktop). We then have an extra check with the OpenXR runtime as OpenXR will also tell us which version of Vulkan the runtime wishes to use. The weird thing here is that Oculus reports it only supports Vulkan 1.0.0. We believe we can safely ignore this, 1.2.0 is backwards compatible with 1.0.0 so anything the OpenXR runtime wants to use should work, but we don't want to limit ourselves in using newer Vulkan features (if available) just because the OpenXR runtime doesn't want to use those. So far this seems to work fine. |
e329e98
to
f470fcd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Added some minor feedback.
wrapper->on_state_ready(); | ||
} | ||
|
||
// TODO emit signal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this to be added in a follow-up PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I wanted to get the base line working first, there are a bunch of things we're doing in the plugin that either need to still be ported but are waiting on something (like Meta adopting the Khronos loader) and things that need to change.
But seeing this PR already covers a whole bunch of things, plus that this will allow us to divide some of the work
f470fcd
to
361ac9e
Compare
Getting this warning when compiling on Linux:
We should either add a |
Added a commit to remove all the stuff we don't need and don't care about:
Should be squashed with the first commit eventually so that we don't add files to remove them and make the repository history needlessly bigger. But I kept it separate for now for review. (And I'm not done reviewing the rest of the changes.) |
93acbae
to
1d8b7a7
Compare
Fixed, Edit: Restricted it to Linux for now as we only compiled for Linux and Windows right now. I'm not sure if it's available on Android (might need recent enough API level), and it might not be available on macOS and iOS. |
Will be compiled and used in the next commit. Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
1d8b7a7
to
931ae65
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thirdparty library integration is good now 👍
I removed everything we don't need currently, and fixed the bug with not defining HAVE_SECURE_GETENV
on Unix (#56394 (comment)).
Didn't review the Vulkan context changes and OpenXR integration code, but @reduz did, so it should be good to go.
931ae65
to
a78a9fe
Compare
Thanks! |
What can cause this error? :
Samsung HMD Odyssey Plus.
|
This is a port of the OpenXR plugin to core, the main reason for this is the way OpenXR ties into Vulkan, with OpenXR wanting to take ownership of creating the Vulkan instance and managing the creation of swap chains for use in XR.
This requires OpenXR to be started and initialized at startup, for this reason new project settings have been added to ensure OpenXR is loaded. More settings will be added soon to further configure this. There is also a placeholder setting for running OpenXR in the editor, this for future plans to enable XR functionality within the editor.
The main OpenXR logic is implemented in the
drivers
folder through a new OpenXR device. This handles the OpenXR implementation itself. Just like our original plugin the driver is implemented with extensions that implement specific parts of the implementation. There is for instance a Vulkan extension that implements the Vulkan bits of the solution. In due time we can create an OpenGL extension if the OpenGL renderer is used.The Vulkan driver has been modified to use the Vulkan extension, when available, to set things up.
There is also an
OpenXRInterface
implementation in modules that implements the XRServer components.I think this PR is ready for review and start doing the cleanup to get this to be merged. There are a few things left to do but I think these can have their own follow up PRs
A demo project to test this work with can be found here: https://github.com/BastiaanOlij/godot4_openxr_demo