Fix OpenXR on the Meta Quest: XR_KHR_loader_init_android is not reported as available (but it works anyway)

This commit is contained in:
David Snopek 2022-11-29 20:45:01 -06:00
parent 5826e96014
commit aa5b42946c
2 changed files with 6 additions and 1 deletions

View file

@ -47,11 +47,15 @@ OpenXRAndroidExtension *OpenXRAndroidExtension::get_singleton() {
OpenXRAndroidExtension::OpenXRAndroidExtension(OpenXRAPI *p_openxr_api) :
OpenXRExtensionWrapper(p_openxr_api) {
singleton = this;
request_extensions[XR_KHR_LOADER_INIT_ANDROID_EXTENSION_NAME] = nullptr; // must be available
request_extensions[XR_KHR_LOADER_INIT_ANDROID_EXTENSION_NAME] = &loader_init_extension_available;
request_extensions[XR_KHR_ANDROID_CREATE_INSTANCE_EXTENSION_NAME] = &create_instance_extension_available;
}
void OpenXRAndroidExtension::on_before_instance_created() {
if (!loader_init_extension_available) {
print_line("OpenXR: XR_KHR_loader_init_android is not reported as available - trying to initialize anyway...");
}
EXT_INIT_XR_FUNC(xrInitializeLoaderKHR);
JNIEnv *env = get_jni_env();

View file

@ -48,6 +48,7 @@ public:
private:
static OpenXRAndroidExtension *singleton;
bool loader_init_extension_available = false;
bool create_instance_extension_available = false;
// Initialize the loader