summaryrefslogtreecommitdiff
path: root/modules/openxr
diff options
context:
space:
mode:
Diffstat (limited to 'modules/openxr')
-rw-r--r--modules/openxr/config.py2
-rw-r--r--modules/openxr/extensions/openxr_android_extension.cpp6
-rw-r--r--modules/openxr/extensions/openxr_android_extension.h1
-rw-r--r--modules/openxr/extensions/openxr_opengl_extension.cpp4
-rw-r--r--modules/openxr/openxr_api.cpp4
5 files changed, 11 insertions, 6 deletions
diff --git a/modules/openxr/config.py b/modules/openxr/config.py
index 279168cc59..e503f12739 100644
--- a/modules/openxr/config.py
+++ b/modules/openxr/config.py
@@ -1,6 +1,6 @@
def can_build(env, platform):
if platform in ("linuxbsd", "windows", "android"):
- return env["openxr"]
+ return env["openxr"] and not env["disable_3d"]
else:
# not supported on these platforms
return False
diff --git a/modules/openxr/extensions/openxr_android_extension.cpp b/modules/openxr/extensions/openxr_android_extension.cpp
index ea539f2053..753fc5fa89 100644
--- a/modules/openxr/extensions/openxr_android_extension.cpp
+++ b/modules/openxr/extensions/openxr_android_extension.cpp
@@ -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();
diff --git a/modules/openxr/extensions/openxr_android_extension.h b/modules/openxr/extensions/openxr_android_extension.h
index ca6011559a..087b634756 100644
--- a/modules/openxr/extensions/openxr_android_extension.h
+++ b/modules/openxr/extensions/openxr_android_extension.h
@@ -48,6 +48,7 @@ public:
private:
static OpenXRAndroidExtension *singleton;
+ bool loader_init_extension_available = false;
bool create_instance_extension_available = false;
// Initialize the loader
diff --git a/modules/openxr/extensions/openxr_opengl_extension.cpp b/modules/openxr/extensions/openxr_opengl_extension.cpp
index 569030cc11..3b7c130149 100644
--- a/modules/openxr/extensions/openxr_opengl_extension.cpp
+++ b/modules/openxr/extensions/openxr_opengl_extension.cpp
@@ -136,9 +136,9 @@ void *OpenXROpenGLExtension::set_session_create_and_get_next_pointer(void *p_nex
graphics_binding_gl.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_ES_ANDROID_KHR;
graphics_binding_gl.next = p_next_pointer;
- graphics_binding_gl.display = eglGetCurrentDisplay();
+ graphics_binding_gl.display = (void *)display_server->window_get_native_handle(DisplayServer::DISPLAY_HANDLE);
graphics_binding_gl.config = (EGLConfig)0; // https://github.com/KhronosGroup/OpenXR-SDK-Source/blob/master/src/tests/hello_xr/graphicsplugin_opengles.cpp#L122
- graphics_binding_gl.context = eglGetCurrentContext();
+ graphics_binding_gl.context = (void *)display_server->window_get_native_handle(DisplayServer::OPENGL_CONTEXT);
#else
graphics_binding_gl.type = XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR;
graphics_binding_gl.next = p_next_pointer;
diff --git a/modules/openxr/openxr_api.cpp b/modules/openxr/openxr_api.cpp
index d6580ebfa6..59d3865acd 100644
--- a/modules/openxr/openxr_api.cpp
+++ b/modules/openxr/openxr_api.cpp
@@ -51,7 +51,7 @@
#define XR_USE_GRAPHICS_API_VULKAN
#endif
#ifdef GLES3_ENABLED
-#ifdef ANDROID
+#ifdef ANDROID_ENABLED
#define XR_USE_GRAPHICS_API_OPENGL_ES
#include <EGL/egl.h>
#include <EGL/eglext.h>
@@ -59,7 +59,7 @@
#include <GLES3/gl3ext.h>
#else
#define XR_USE_GRAPHICS_API_OPENGL
-#endif // ANDROID
+#endif // ANDROID_ENABLED
#ifdef X11_ENABLED
#include OPENGL_INCLUDE_H
#define GL_GLEXT_PROTOTYPES 1