X Tutup
Skip to content

OpenXR: Add core support for Khronos loader#106891

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
BastiaanOlij:openxr_core_android_loader
Nov 20, 2025
Merged

OpenXR: Add core support for Khronos loader#106891
Repiteo merged 1 commit intogodotengine:masterfrom
BastiaanOlij:openxr_core_android_loader

Conversation

@BastiaanOlij
Copy link
Contributor

@BastiaanOlij BastiaanOlij commented May 28, 2025

This PR adds support for the Khronos OpenXR loader to the core of Godot.

This means that as long as the headset supports it, and you don't use any vendor features or have features locked behind vendor specific manifest entries, Godot can export to a headset without needing the vendor plugin.

All you need to do is enabled Use Gradle Build:
image

And set the XR Mode to OpenXR:
image

And your game can be successfully exported to AOSP devices.

Tested on:

  • Quest 3
  • Pico 4 Ultra

Contributed by Khronos Group through the Godot Integration Project

@BastiaanOlij
Copy link
Contributor Author

cc @dsnopek @m4gr3d

@BastiaanOlij BastiaanOlij force-pushed the openxr_core_android_loader branch 4 times, most recently from e16eb1d to 15ecdbd Compare May 28, 2025 06:04
@BastiaanOlij BastiaanOlij modified the milestones: 4.5, 4.6 May 30, 2025
@BastiaanOlij BastiaanOlij force-pushed the openxr_core_android_loader branch from 15ecdbd to 918d224 Compare June 2, 2025 06:14
@BastiaanOlij BastiaanOlij marked this pull request as ready for review June 2, 2025 06:14
@BastiaanOlij BastiaanOlij requested review from a team as code owners June 2, 2025 06:14
@BastiaanOlij
Copy link
Contributor Author

I'm taking this out of draft as it is working. This should not be merged until after we've updated the OpenXR version in the thirdparty folder to atleast 1.1.46

Opinion among the XR team is to also hold off merging until Godot 4.5 has been released as accompanying changes on the vendor plugin side will require some guidance.

@BastiaanOlij BastiaanOlij force-pushed the openxr_core_android_loader branch from 918d224 to f1de29a Compare June 4, 2025 05:47
@BastiaanOlij
Copy link
Contributor Author

Rebased so it should now automatically pick up the OpenXR loader for 1.1.47 :)

@BastiaanOlij
Copy link
Contributor Author

Just discussed with @m4gr3d , need to rebase this and we're planning on removing the custom loader option as there currently is no scenario where we need this.

@BastiaanOlij BastiaanOlij force-pushed the openxr_core_android_loader branch from 10503d6 to ebfdd7b Compare November 5, 2025 02:10
@BastiaanOlij BastiaanOlij self-assigned this Nov 5, 2025
@BastiaanOlij
Copy link
Contributor Author

This has now been rebased and I've removed the custom option. PR still works as expected.

Also as expected, with the current vendor plugin installed gradlew complains that we're including the loader twice. While we plan to remove the loader code from the vendor plugin, we want to be backwards compatible so we're looking into manifest changes that tell gradlew to ignore the loader from the vendor plugin.

Once that is resolved this can be merged.

@BastiaanOlij
Copy link
Contributor Author

XR Meeting: Fredia to detail his solution for prioritising loader between core and vendor plugin, then this should be ready to merge.

@insanepure
Copy link

insanepure commented Nov 14, 2025

Have not particular tested this one, but if it works the same as khronos loader of the vendor plugin, it works for focus 3 for sure, as I tested it on there.

@BastiaanOlij
Copy link
Contributor Author

Have not particular tested this one, but if it works the same as khronos loader of the vendor plugin, it works for focus 3 for sure, as I tested it on there.

Thats the basic idea, it replaces the part of the vendor plugin where the khronos loader is included. This means that for any platform that doesn't require any additional manifest changes, you can create an APK that is deployable on all those platforms without requiring any additional plugins.

@BastiaanOlij BastiaanOlij force-pushed the openxr_core_android_loader branch from ebfdd7b to 4a64c22 Compare November 14, 2025 13:08
@BastiaanOlij BastiaanOlij force-pushed the openxr_core_android_loader branch 2 times, most recently from 16e33b3 to 6d9df62 Compare November 14, 2025 21:39
@dsnopek
Copy link
Contributor

dsnopek commented Nov 14, 2025

I'm not sure the pickFirst thing is working to get the libopenxr_loader.so from the Khronos package, rather than the godot_openxr_vendor plugin.

I tested exporting with this PR and godot_openxr_vendor v4.2.0 installed in my project, then I unzipped the APK file and took an MD5 hash of the jni/arm64-v8a/libopenxr_loader.so and compared that with the one from godot_openxr_vendors and the openxr_loader_for_android package. It had the one from godot_openxr_vendors!

When I remove the godot_openxr_vendors plugin, and export again - then I see the right libopenxr_loader.so inside the APK

@BastiaanOlij BastiaanOlij force-pushed the openxr_core_android_loader branch from 6d9df62 to e10dbf7 Compare November 15, 2025 02:57
@BastiaanOlij
Copy link
Contributor Author

I'm not sure the pickFirst thing is working to get the libopenxr_loader.so from the Khronos package, rather than the godot_openxr_vendor plugin.

I tested exporting with this PR and godot_openxr_vendor v4.2.0 installed in my project, then I unzipped the APK file and took an MD5 hash of the jni/arm64-v8a/libopenxr_loader.so and compared that with the one from godot_openxr_vendors and the openxr_loader_for_android package. It had the one from godot_openxr_vendors!

When I remove the godot_openxr_vendors plugin, and export again - then I see the right libopenxr_loader.so inside the APK

Well, its still better than completely breaking :)

Right now I don't think it matters much which one is included, as long as we're not doubling up. We're not really using the loader beyond connecting to the runtime, we obtain all function pointers ourselves so even if we're using an older loader, things still work.

It's probably going to matter once OpenXR 1.2 is available but by that time we'll have removed the loader from the vendors plugin.

@dsnopek
Copy link
Contributor

dsnopek commented Nov 15, 2025

Right now I don't think it matters much which one is included, as long as we're not doubling up.

I guess that's OK, so long as it's predictable which one gets used

But if we did want to have it favor the loader from the Khronos package, we might be able to make that happen by switching to pickLast or changing the order the dependencies are listed?

@BastiaanOlij
Copy link
Contributor Author

But if we did want to have it favor the loader from the Khronos package, we might be able to make that happen by switching to pickLast or changing the order the dependencies are listed?

Worth testing, but I'm out today so unless you have a moment to verify it'll have to wait. Also I'd like to know what determines the order :)

@m4gr3d
Copy link
Contributor

m4gr3d commented Nov 16, 2025

@BastiaanOlij
Copy link
Contributor Author

If we want to be specific, we can try the approach described in https://stackoverflow.com/questions/74258902/how-to-define-which-so-file-to-use-in-gradle-packaging-options/74279439#74279439

To be honest, that feels like waaaaay overkill for a temporary situation.

Honestly, I don't think it matters which version of the loader is added, and as long as we remove the loaders from the vendor plugins from v5.0.0 onwards, we're gonne be good.

Copy link
Contributor

@m4gr3d m4gr3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Performed a couple rounds of tests and it works as expected!

@BastiaanOlij BastiaanOlij force-pushed the openxr_core_android_loader branch from e10dbf7 to 5d2df61 Compare November 17, 2025 23:55
@Repiteo Repiteo requested a review from dsnopek November 18, 2025 01:08
@BastiaanOlij BastiaanOlij force-pushed the openxr_core_android_loader branch from 5d2df61 to 4720691 Compare November 18, 2025 07:20
@BastiaanOlij BastiaanOlij force-pushed the openxr_core_android_loader branch from 4720691 to 3065449 Compare November 19, 2025 00:51
@BastiaanOlij BastiaanOlij force-pushed the openxr_core_android_loader branch from 3065449 to c056cae Compare November 19, 2025 00:54
Copy link
Contributor

@m4gr3d m4gr3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good. I'll perform a few rounds of tests.

@m4gr3d
Copy link
Contributor

m4gr3d commented Nov 19, 2025

The code looks good. I'll perform a few rounds of tests.

Finished testing, and things build as expected!

Copy link
Contributor

@dsnopek dsnopek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I just retested exporting a project using both godot_openxr_vendors v3 and v4, and everything seems to be working as expected now :-)

@Repiteo Repiteo merged commit b0a03ed into godotengine:master Nov 20, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Nov 20, 2025

Thanks!

@BastiaanOlij BastiaanOlij deleted the openxr_core_android_loader branch November 24, 2025 22:33
@akien-mga akien-mga changed the title OpenXR add core support for Khronos loader OpenXR: Add core support for Khronos loader Nov 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

X Tutup