-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
OpenXR: Support composition layers based on Android surfaces #96185
OpenXR: Support composition layers based on Android surfaces #96185
Conversation
835c18f
to
2a58c28
Compare
9fc5611
to
a01b75c
Compare
Taking out of draft now that PR #96182 is merged! |
What does adding compositional layers look like? Can you make a video? I don't know how to test this. Edited: There's a temporary failure, so I'll trigger a Github actions build again.
|
A composition layer is basically a floating panel with some 2D content on it (although, the panel can be a flat quad, or a slice of a cylinder or sphere which curves). Testing is fairly simple:
Rather than making a new project, you could also modify the OpenXR composition layer demo. There's also some good docs on composition layers - the difference here is that rather than getting the content from a |
Does this work with the HTCVive XR-Elite we have? |
@fire I just tested it, and, it turns out that it does! However, it only supports quad composition layers (that is the |
a01b75c
to
864851b
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.
Tested and seems to be working well! Code looks good to me, just have some extremely minor nits.
modules/openxr/extensions/openxr_composition_layer_extension.cpp
Outdated
Show resolved
Hide resolved
modules/openxr/extensions/openxr_composition_layer_extension.cpp
Outdated
Show resolved
Hide resolved
864851b
to
988d5ad
Compare
@devloglogan Thanks for the testing and review! I've made all the suggested changes in my latest push |
988d5ad
to
804b3c9
Compare
OpenXRAPI *openxr_api = OpenXRAPI::get_singleton(); | ||
ERR_FAIL_NULL_V(openxr_api, false); | ||
|
||
// @todo We need a way to add to the next pointer chain. |
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.
Do we have a capability that depends on chaining or is it for future proofing?
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.
Specifically to support XR_FB_android_surface_swapchain_create
, which we'll want to be able to add from the vendor extension
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.
Look great!
804b3c9
to
3afa268
Compare
Thanks! |
This adds support for composition layers that get their 2D content from Android surfaces.
It depends on PR #96182 in order to allow GDScript to get the Android surface as a
JavaObject
, and then either directly interact with it viaJavaClassWrapper
, or, more likely, pass it to aJNISingleton
registered by a custom Godot Android Plugin.This could be used to, for example, play a video via Android libraries, and have the output displayed on a composition layer in XR.
You enable it by simply checking "Use Android Surface" on the
OpenXRCompositionLayer
, which will hide the "Viewport Layer" property, and show the "Android Surface Size" property:Here's a GDScript example that simply fills the Android surface with red, which can be used to test that it's working:
Again, in a real app you'd probably pass the surface to your Godot Android Plugin, but this is much easier to test. :-)
Marking as a DRAFT until PR #96182 is merged.