summaryrefslogtreecommitdiffstats
path: root/thirdparty/openxr/src
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/openxr/src')
-rw-r--r--thirdparty/openxr/src/common/extra_algorithms.h4
-rw-r--r--thirdparty/openxr/src/common/filesystem_utils.cpp2
-rw-r--r--thirdparty/openxr/src/common/filesystem_utils.hpp2
-rw-r--r--thirdparty/openxr/src/common/hex_and_handles.h4
-rw-r--r--thirdparty/openxr/src/common/loader_interfaces.h114
-rw-r--r--thirdparty/openxr/src/common/object_info.cpp4
-rw-r--r--thirdparty/openxr/src/common/object_info.h4
-rw-r--r--thirdparty/openxr/src/common/platform_utils.hpp2
-rw-r--r--thirdparty/openxr/src/common/stdfs_conditions.h2
-rw-r--r--thirdparty/openxr/src/common/unique_asset.h2
-rw-r--r--thirdparty/openxr/src/common/vulkan_debug_object_namer.hpp2
-rw-r--r--thirdparty/openxr/src/common/xr_dependencies.h2
-rw-r--r--thirdparty/openxr/src/common/xr_linear.h2
-rw-r--r--thirdparty/openxr/src/loader/android_utilities.cpp32
-rw-r--r--thirdparty/openxr/src/loader/android_utilities.h4
-rw-r--r--thirdparty/openxr/src/loader/api_layer_interface.cpp69
-rw-r--r--thirdparty/openxr/src/loader/api_layer_interface.hpp4
-rw-r--r--thirdparty/openxr/src/loader/exception_handling.hpp4
-rw-r--r--thirdparty/openxr/src/loader/loader_core.cpp5
-rw-r--r--thirdparty/openxr/src/loader/loader_init_data.cpp59
-rw-r--r--thirdparty/openxr/src/loader/loader_init_data.hpp92
-rw-r--r--thirdparty/openxr/src/loader/loader_instance.cpp6
-rw-r--r--thirdparty/openxr/src/loader/loader_instance.hpp4
-rw-r--r--thirdparty/openxr/src/loader/loader_logger.cpp2
-rw-r--r--thirdparty/openxr/src/loader/loader_logger.hpp2
-rw-r--r--thirdparty/openxr/src/loader/loader_logger_recorders.cpp2
-rw-r--r--thirdparty/openxr/src/loader/loader_logger_recorders.hpp4
-rw-r--r--thirdparty/openxr/src/loader/loader_platform.hpp2
-rw-r--r--thirdparty/openxr/src/loader/manifest_file.cpp7
-rw-r--r--thirdparty/openxr/src/loader/manifest_file.hpp2
-rw-r--r--thirdparty/openxr/src/loader/runtime_interface.cpp117
-rw-r--r--thirdparty/openxr/src/loader/runtime_interface.hpp14
-rw-r--r--thirdparty/openxr/src/loader/xr_generated_loader.cpp4
-rw-r--r--thirdparty/openxr/src/loader/xr_generated_loader.hpp7
-rw-r--r--thirdparty/openxr/src/xr_generated_dispatch_table_core.c4
-rw-r--r--thirdparty/openxr/src/xr_generated_dispatch_table_core.h4
36 files changed, 300 insertions, 296 deletions
diff --git a/thirdparty/openxr/src/common/extra_algorithms.h b/thirdparty/openxr/src/common/extra_algorithms.h
index eec429e12a..bdaa420e9f 100644
--- a/thirdparty/openxr/src/common/extra_algorithms.h
+++ b/thirdparty/openxr/src/common/extra_algorithms.h
@@ -1,11 +1,11 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
// Copyright (c) 2019 Collabora, Ltd.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
-// Initial Author: Ryan Pavlik <ryan.pavlik@collabora.com>
+// Initial Author: Rylie Pavlik <rylie.pavlik@collabora.com>
//
/*!
diff --git a/thirdparty/openxr/src/common/filesystem_utils.cpp b/thirdparty/openxr/src/common/filesystem_utils.cpp
index 16e6ff3292..063c4c4cee 100644
--- a/thirdparty/openxr/src/common/filesystem_utils.cpp
+++ b/thirdparty/openxr/src/common/filesystem_utils.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017 Valve Corporation
// Copyright (c) 2017 LunarG, Inc.
//
diff --git a/thirdparty/openxr/src/common/filesystem_utils.hpp b/thirdparty/openxr/src/common/filesystem_utils.hpp
index 3dea1b2c3e..2a923fac4c 100644
--- a/thirdparty/openxr/src/common/filesystem_utils.hpp
+++ b/thirdparty/openxr/src/common/filesystem_utils.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017 Valve Corporation
// Copyright (c) 2017 LunarG, Inc.
//
diff --git a/thirdparty/openxr/src/common/hex_and_handles.h b/thirdparty/openxr/src/common/hex_and_handles.h
index 300669033f..12bdb3670c 100644
--- a/thirdparty/openxr/src/common/hex_and_handles.h
+++ b/thirdparty/openxr/src/common/hex_and_handles.h
@@ -1,11 +1,11 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
// Copyright (c) 2019 Collabora, Ltd.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
-// Initial Author: Ryan Pavlik <ryan.pavlik@collabora.com>
+// Initial Author: Rylie Pavlik <rylie.pavlik@collabora.com>
//
/*!
diff --git a/thirdparty/openxr/src/common/loader_interfaces.h b/thirdparty/openxr/src/common/loader_interfaces.h
deleted file mode 100644
index 020c3456ea..0000000000
--- a/thirdparty/openxr/src/common/loader_interfaces.h
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
-// Copyright (c) 2017 Valve Corporation
-// Copyright (c) 2017 LunarG, Inc.
-//
-// SPDX-License-Identifier: Apache-2.0 OR MIT
-//
-// Initial Author: Mark Young <marky@lunarg.com>
-//
-
-#pragma once
-
-#include <openxr/openxr.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Forward declare.
-typedef struct XrApiLayerCreateInfo XrApiLayerCreateInfo;
-
-// Function pointer prototype for the xrCreateApiLayerInstance function used in place of xrCreateInstance.
-// This function allows us to pass special API layer information to each layer during the process of creating an Instance.
-typedef XrResult(XRAPI_PTR *PFN_xrCreateApiLayerInstance)(const XrInstanceCreateInfo *info,
- const XrApiLayerCreateInfo *apiLayerInfo, XrInstance *instance);
-
-// Loader/API Layer Interface versions
-// 1 - First version, introduces negotiation structure and functions
-#define XR_CURRENT_LOADER_API_LAYER_VERSION 1
-
-// Loader/Runtime Interface versions
-// 1 - First version, introduces negotiation structure and functions
-#define XR_CURRENT_LOADER_RUNTIME_VERSION 1
-
-// Version negotiation values
-typedef enum XrLoaderInterfaceStructs {
- XR_LOADER_INTERFACE_STRUCT_UNINTIALIZED = 0,
- XR_LOADER_INTERFACE_STRUCT_LOADER_INFO,
- XR_LOADER_INTERFACE_STRUCT_API_LAYER_REQUEST,
- XR_LOADER_INTERFACE_STRUCT_RUNTIME_REQUEST,
- XR_LOADER_INTERFACE_STRUCT_API_LAYER_CREATE_INFO,
- XR_LOADER_INTERFACE_STRUCT_API_LAYER_NEXT_INFO,
-} XrLoaderInterfaceStructs;
-
-#define XR_LOADER_INFO_STRUCT_VERSION 1
-typedef struct XrNegotiateLoaderInfo {
- XrLoaderInterfaceStructs structType; // XR_LOADER_INTERFACE_STRUCT_LOADER_INFO
- uint32_t structVersion; // XR_LOADER_INFO_STRUCT_VERSION
- size_t structSize; // sizeof(XrNegotiateLoaderInfo)
- uint32_t minInterfaceVersion;
- uint32_t maxInterfaceVersion;
- XrVersion minApiVersion;
- XrVersion maxApiVersion;
-} XrNegotiateLoaderInfo;
-
-#define XR_API_LAYER_INFO_STRUCT_VERSION 1
-typedef struct XrNegotiateApiLayerRequest {
- XrLoaderInterfaceStructs structType; // XR_LOADER_INTERFACE_STRUCT_API_LAYER_REQUEST
- uint32_t structVersion; // XR_API_LAYER_INFO_STRUCT_VERSION
- size_t structSize; // sizeof(XrNegotiateApiLayerRequest)
- uint32_t layerInterfaceVersion; // CURRENT_LOADER_API_LAYER_VERSION
- XrVersion layerApiVersion;
- PFN_xrGetInstanceProcAddr getInstanceProcAddr;
- PFN_xrCreateApiLayerInstance createApiLayerInstance;
-} XrNegotiateApiLayerRequest;
-
-#define XR_RUNTIME_INFO_STRUCT_VERSION 1
-typedef struct XrNegotiateRuntimeRequest {
- XrLoaderInterfaceStructs structType; // XR_LOADER_INTERFACE_STRUCT_RUNTIME_REQUEST
- uint32_t structVersion; // XR_RUNTIME_INFO_STRUCT_VERSION
- size_t structSize; // sizeof(XrNegotiateRuntimeRequest)
- uint32_t runtimeInterfaceVersion; // CURRENT_LOADER_RUNTIME_VERSION
- XrVersion runtimeApiVersion;
- PFN_xrGetInstanceProcAddr getInstanceProcAddr;
-} XrNegotiateRuntimeRequest;
-
-// Function used to negotiate an interface betewen the loader and an API layer. Each library exposing one or
-// more API layers needs to expose at least this function.
-typedef XrResult(XRAPI_PTR *PFN_xrNegotiateLoaderApiLayerInterface)(const XrNegotiateLoaderInfo *loaderInfo,
- const char *apiLayerName,
- XrNegotiateApiLayerRequest *apiLayerRequest);
-
-// Function used to negotiate an interface betewen the loader and a runtime. Each runtime should expose
-// at least this function.
-typedef XrResult(XRAPI_PTR *PFN_xrNegotiateLoaderRuntimeInterface)(const XrNegotiateLoaderInfo *loaderInfo,
- XrNegotiateRuntimeRequest *runtimeRequest);
-
-// Forward declare.
-typedef struct XrApiLayerNextInfo XrApiLayerNextInfo;
-
-#define XR_API_LAYER_NEXT_INFO_STRUCT_VERSION 1
-struct XrApiLayerNextInfo {
- XrLoaderInterfaceStructs structType; // XR_LOADER_INTERFACE_STRUCT_API_LAYER_NEXT_INFO
- uint32_t structVersion; // XR_API_LAYER_NEXT_INFO_STRUCT_VERSION
- size_t structSize; // sizeof(XrApiLayerNextInfo)
- char layerName[XR_MAX_API_LAYER_NAME_SIZE]; // Name of API layer which should receive this info
- PFN_xrGetInstanceProcAddr nextGetInstanceProcAddr; // Pointer to next API layer's xrGetInstanceProcAddr
- PFN_xrCreateApiLayerInstance nextCreateApiLayerInstance; // Pointer to next API layer's xrCreateApiLayerInstance
- XrApiLayerNextInfo *next; // Pointer to the next API layer info in the sequence
-};
-
-#define XR_API_LAYER_MAX_SETTINGS_PATH_SIZE 512
-#define XR_API_LAYER_CREATE_INFO_STRUCT_VERSION 1
-typedef struct XrApiLayerCreateInfo {
- XrLoaderInterfaceStructs structType; // XR_LOADER_INTERFACE_STRUCT_API_LAYER_CREATE_INFO
- uint32_t structVersion; // XR_API_LAYER_CREATE_INFO_STRUCT_VERSION
- size_t structSize; // sizeof(XrApiLayerCreateInfo)
- void *loaderInstance; // Pointer to the LoaderInstance class
- char settings_file_location[XR_API_LAYER_MAX_SETTINGS_PATH_SIZE]; // Location to the found settings file (or empty '\0')
- XrApiLayerNextInfo *nextInfo; // Pointer to the next API layer's Info
-} XrApiLayerCreateInfo;
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/thirdparty/openxr/src/common/object_info.cpp b/thirdparty/openxr/src/common/object_info.cpp
index 3f8f96bc6e..d45430a609 100644
--- a/thirdparty/openxr/src/common/object_info.cpp
+++ b/thirdparty/openxr/src/common/object_info.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
// Copyright (c) 2019 Collabora, Ltd.
@@ -6,7 +6,7 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
// Initial Authors: Mark Young <marky@lunarg.com>
-// Ryan Pavlik <ryan.pavlik@collabora.com>
+// Rylie Pavlik <rylie.pavlik@collabora.com>
// Dave Houlton <daveh@lunarg.com>
//
diff --git a/thirdparty/openxr/src/common/object_info.h b/thirdparty/openxr/src/common/object_info.h
index 247ede0dcc..572f06ab15 100644
--- a/thirdparty/openxr/src/common/object_info.h
+++ b/thirdparty/openxr/src/common/object_info.h
@@ -1,11 +1,11 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
// Copyright (c) 2019 Collabora, Ltd.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
-// Initial Authors: Mark Young <marky@lunarg.com>, Ryan Pavlik <ryan.pavlik@collabora.com
+// Initial Authors: Mark Young <marky@lunarg.com>, Rylie Pavlik <rylie.pavlik@collabora.com
//
/*!
* @file
diff --git a/thirdparty/openxr/src/common/platform_utils.hpp b/thirdparty/openxr/src/common/platform_utils.hpp
index 0b295f5cc9..c4d75bf259 100644
--- a/thirdparty/openxr/src/common/platform_utils.hpp
+++ b/thirdparty/openxr/src/common/platform_utils.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
diff --git a/thirdparty/openxr/src/common/stdfs_conditions.h b/thirdparty/openxr/src/common/stdfs_conditions.h
index 0a551f08cd..9e2ba70d42 100644
--- a/thirdparty/openxr/src/common/stdfs_conditions.h
+++ b/thirdparty/openxr/src/common/stdfs_conditions.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017 Valve Corporation
// Copyright (c) 2017 LunarG, Inc.
//
diff --git a/thirdparty/openxr/src/common/unique_asset.h b/thirdparty/openxr/src/common/unique_asset.h
index a8ae8077bc..fd5f8868e3 100644
--- a/thirdparty/openxr/src/common/unique_asset.h
+++ b/thirdparty/openxr/src/common/unique_asset.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
#pragma once
diff --git a/thirdparty/openxr/src/common/vulkan_debug_object_namer.hpp b/thirdparty/openxr/src/common/vulkan_debug_object_namer.hpp
index 451219d20f..885389ce8e 100644
--- a/thirdparty/openxr/src/common/vulkan_debug_object_namer.hpp
+++ b/thirdparty/openxr/src/common/vulkan_debug_object_namer.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
//
// SPDX-License-Identifier: Apache-2.0
diff --git a/thirdparty/openxr/src/common/xr_dependencies.h b/thirdparty/openxr/src/common/xr_dependencies.h
index 6c9cf2d05f..55d93bfbac 100644
--- a/thirdparty/openxr/src/common/xr_dependencies.h
+++ b/thirdparty/openxr/src/common/xr_dependencies.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2023, The Khronos Group Inc.
+// Copyright (c) 2018-2024, The Khronos Group Inc.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
diff --git a/thirdparty/openxr/src/common/xr_linear.h b/thirdparty/openxr/src/common/xr_linear.h
index ce65f8ddfb..2b295ed304 100644
--- a/thirdparty/openxr/src/common/xr_linear.h
+++ b/thirdparty/openxr/src/common/xr_linear.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2016, Oculus VR, LLC.
//
// SPDX-License-Identifier: Apache-2.0
diff --git a/thirdparty/openxr/src/loader/android_utilities.cpp b/thirdparty/openxr/src/loader/android_utilities.cpp
index 9a3ad76ce0..5c9b846b5a 100644
--- a/thirdparty/openxr/src/loader/android_utilities.cpp
+++ b/thirdparty/openxr/src/loader/android_utilities.cpp
@@ -1,9 +1,9 @@
-// Copyright (c) 2020-2023, The Khronos Group Inc.
+// Copyright (c) 2020-2024, The Khronos Group Inc.
// Copyright (c) 2020-2021, Collabora, Ltd.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
-// Initial Author: Ryan Pavlik <ryan.pavlik@collabora.com>
+// Initial Author: Rylie Pavlik <rylie.pavlik@collabora.com>
#include "android_utilities.h"
@@ -245,18 +245,38 @@ static int populateFunctions(wrap::android::content::Context const &context, boo
return 0;
}
+// The current file relies on android-jni-wrappers and jnipp, which may throw on failure.
+// This is problematic when the loader is compiled with exception handling disabled - the consumers can reasonably
+// expect that the compilation with -fno-exceptions will succeed, but the compiler will not accept the code that
+// uses `try` & `catch` keywords. We cannot use the `exception_handling.hpp` here since we're not at an ABI boundary,
+// so we define helper macros here. This is fine for now since the only occurrence of exception-handling code is in this file.
+#ifdef XRLOADER_DISABLE_EXCEPTION_HANDLING
+
+#define ANDROID_UTILITIES_TRY
+#define ANDROID_UTILITIES_CATCH_FALLBACK(...)
+
+#else
+
+#define ANDROID_UTILITIES_TRY try
+#define ANDROID_UTILITIES_CATCH_FALLBACK(...) \
+ catch (const std::exception &e) { \
+ __VA_ARGS__ \
+ }
+
+#endif // XRLOADER_DISABLE_EXCEPTION_HANDLING
+
/// Get cursor for active runtime, parameterized by whether or not we use the system broker
static bool getActiveRuntimeCursor(wrap::android::content::Context const &context, jni::Array<std::string> const &projection,
bool systemBroker, Cursor &cursor) {
auto uri = active_runtime::makeContentUri(systemBroker, XR_VERSION_MAJOR(XR_CURRENT_API_VERSION), ABI);
ALOGI("getActiveRuntimeCursor: Querying URI: %s", uri.toString().c_str());
- try {
- cursor = context.getContentResolver().query(uri, projection);
- } catch (const std::exception &e) {
+
+ ANDROID_UTILITIES_TRY { cursor = context.getContentResolver().query(uri, projection); }
+ ANDROID_UTILITIES_CATCH_FALLBACK({
ALOGW("Exception when querying %s content resolver: %s", getBrokerTypeName(systemBroker), e.what());
cursor = {};
return false;
- }
+ })
if (cursor.isNull()) {
ALOGW("Null cursor when querying %s content resolver.", getBrokerTypeName(systemBroker));
diff --git a/thirdparty/openxr/src/loader/android_utilities.h b/thirdparty/openxr/src/loader/android_utilities.h
index f66c9bf1d0..582a65056e 100644
--- a/thirdparty/openxr/src/loader/android_utilities.h
+++ b/thirdparty/openxr/src/loader/android_utilities.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2020-2023, The Khronos Group Inc.
+// Copyright (c) 2020-2024, The Khronos Group Inc.
// Copyright (c) 2020-2021, Collabora, Ltd.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
-// Initial Author: Ryan Pavlik <ryan.pavlik@collabora.com>
+// Initial Author: Rylie Pavlik <rylie.pavlik@collabora.com>
#pragma once
#ifdef __ANDROID__
diff --git a/thirdparty/openxr/src/loader/api_layer_interface.cpp b/thirdparty/openxr/src/loader/api_layer_interface.cpp
index c9e24ec40b..fb509de270 100644
--- a/thirdparty/openxr/src/loader/api_layer_interface.cpp
+++ b/thirdparty/openxr/src/loader/api_layer_interface.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
@@ -9,13 +9,14 @@
#include "api_layer_interface.hpp"
-#include "loader_interfaces.h"
+#include "loader_init_data.hpp"
#include "loader_logger.hpp"
#include "loader_platform.hpp"
#include "manifest_file.hpp"
#include "platform_utils.hpp"
#include <openxr/openxr.h>
+#include <openxr/openxr_loader_negotiation.h>
#include <cstring>
#include <memory>
@@ -282,6 +283,38 @@ XrResult ApiLayerInterface::LoadApiLayers(const std::string& openxr_command, uin
LoaderLogger::LogWarningMessage(openxr_command, warning_message);
continue;
}
+#ifdef XR_KHR_LOADER_INIT_SUPPORT
+ if (!LoaderInitData::instance().initialized()) {
+ LoaderLogger::LogErrorMessage(openxr_command, "ApiLayerInterface::LoadApiLayers skipping manifest file " +
+ manifest_file->Filename() +
+ " because xrInitializeLoaderKHR was not yet called.");
+
+ LoaderPlatformLibraryClose(layer_library);
+ return XR_ERROR_VALIDATION_FAILURE;
+ }
+ bool forwardedInitLoader = false;
+ {
+ // If we have xrInitializeLoaderKHR exposed as an export, forward call to it.
+ const auto function_name = manifest_file->GetFunctionName("xrInitializeLoaderKHR");
+ auto initLoader =
+ reinterpret_cast<PFN_xrInitializeLoaderKHR>(LoaderPlatformLibraryGetProcAddr(layer_library, function_name));
+ if (initLoader != nullptr) {
+ // we found the entry point one way or another.
+ LoaderLogger::LogInfoMessage(openxr_command,
+ "ApiLayerInterface::LoadApiLayers forwarding xrInitializeLoaderKHR call to API layer "
+ "before calling xrNegotiateLoaderApiLayerInterface.");
+ XrResult res = initLoader(LoaderInitData::instance().getParam());
+ if (!XR_SUCCEEDED(res)) {
+ LoaderLogger::LogErrorMessage(
+ openxr_command, "ApiLayerInterface::LoadApiLayers forwarded call to xrInitializeLoaderKHR failed.");
+
+ LoaderPlatformLibraryClose(layer_library);
+ return res;
+ }
+ forwardedInitLoader = true;
+ }
+ }
+#endif
// Get and settle on an layer interface version (using any provided name if required).
std::string function_name = manifest_file->GetFunctionName("xrNegotiateLoaderApiLayerInterface");
@@ -324,6 +357,38 @@ XrResult ApiLayerInterface::LoadApiLayers(const std::string& openxr_command, uin
LoaderLogger::LogWarningMessage(openxr_command, warning_message);
res = XR_ERROR_FILE_CONTENTS_INVALID;
}
+
+#ifdef XR_KHR_LOADER_INIT_SUPPORT
+ if (XR_SUCCEEDED(res) && !forwardedInitLoader) {
+ // Forward initialize loader call, where possible and if we did not do so before.
+ PFN_xrVoidFunction initializeVoid = nullptr;
+ PFN_xrInitializeLoaderKHR initialize = nullptr;
+
+ // Now we may try asking xrGetInstanceProcAddr on the API layer
+ if (XR_SUCCEEDED(api_layer_info.getInstanceProcAddr(XR_NULL_HANDLE, "xrInitializeLoaderKHR", &initializeVoid))) {
+ if (initializeVoid == nullptr) {
+ LoaderLogger::LogErrorMessage(openxr_command,
+ "ApiLayerInterface::LoadApiLayers got success from xrGetInstanceProcAddr "
+ "for xrInitializeLoaderKHR, but output a null pointer.");
+ res = XR_ERROR_RUNTIME_FAILURE;
+ } else {
+ initialize = reinterpret_cast<PFN_xrInitializeLoaderKHR>(initializeVoid);
+ }
+ }
+ if (initialize != nullptr) {
+ // we found the entry point one way or another.
+ LoaderLogger::LogInfoMessage(openxr_command,
+ "ApiLayerInterface::LoadApiLayers forwarding xrInitializeLoaderKHR call to API layer "
+ "after calling xrNegotiateLoaderApiLayerInterface.");
+ res = initialize(LoaderInitData::instance().getParam());
+ if (!XR_SUCCEEDED(res)) {
+ LoaderLogger::LogErrorMessage(
+ openxr_command, "ApiLayerInterface::LoadApiLayers forwarded call to xrInitializeLoaderKHR failed.");
+ }
+ }
+ }
+#endif
+
if (XR_FAILED(res)) {
if (!any_loaded) {
last_error = res;
diff --git a/thirdparty/openxr/src/loader/api_layer_interface.hpp b/thirdparty/openxr/src/loader/api_layer_interface.hpp
index 98685b0c32..43758b31a4 100644
--- a/thirdparty/openxr/src/loader/api_layer_interface.hpp
+++ b/thirdparty/openxr/src/loader/api_layer_interface.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
@@ -14,9 +14,9 @@
#include <memory>
#include <openxr/openxr.h>
+#include <openxr/openxr_loader_negotiation.h>
#include "loader_platform.hpp"
-#include "loader_interfaces.h"
struct XrGeneratedDispatchTable;
diff --git a/thirdparty/openxr/src/loader/exception_handling.hpp b/thirdparty/openxr/src/loader/exception_handling.hpp
index bc0d9b65e3..62395fdf69 100644
--- a/thirdparty/openxr/src/loader/exception_handling.hpp
+++ b/thirdparty/openxr/src/loader/exception_handling.hpp
@@ -1,8 +1,8 @@
-// Copyright (c) 2019-2023, The Khronos Group Inc.
+// Copyright (c) 2019-2024, The Khronos Group Inc.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
-// Initial Author: Ryan Pavlik <ryan.pavlik@collabora.com>
+// Initial Author: Rylie Pavlik <rylie.pavlik@collabora.com>
//
// Provides protection for C ABI functions if standard library functions may throw.
diff --git a/thirdparty/openxr/src/loader/loader_core.cpp b/thirdparty/openxr/src/loader/loader_core.cpp
index 06e6870053..8bf2609a08 100644
--- a/thirdparty/openxr/src/loader/loader_core.cpp
+++ b/thirdparty/openxr/src/loader/loader_core.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
@@ -14,6 +14,7 @@
#include "api_layer_interface.hpp"
#include "exception_handling.hpp"
#include "hex_and_handles.h"
+#include "loader_init_data.hpp"
#include "loader_instance.hpp"
#include "loader_logger_recorders.hpp"
#include "loader_logger.hpp"
@@ -77,7 +78,7 @@ inline bool IsMissingNullTerminator(const char (&str)[max_length]) {
#ifdef XR_KHR_LOADER_INIT_SUPPORT // platforms that support XR_KHR_loader_init.
XRAPI_ATTR XrResult XRAPI_CALL LoaderXrInitializeLoaderKHR(const XrLoaderInitInfoBaseHeaderKHR *loaderInitInfo) XRLOADER_ABI_TRY {
LoaderLogger::LogVerboseMessage("xrInitializeLoaderKHR", "Entering loader trampoline");
- return InitializeLoader(loaderInitInfo);
+ return InitializeLoaderInitData(loaderInitInfo);
}
XRLOADER_ABI_CATCH_FALLBACK
#endif
diff --git a/thirdparty/openxr/src/loader/loader_init_data.cpp b/thirdparty/openxr/src/loader/loader_init_data.cpp
new file mode 100644
index 0000000000..11d3c4e77b
--- /dev/null
+++ b/thirdparty/openxr/src/loader/loader_init_data.cpp
@@ -0,0 +1,59 @@
+// Copyright (c) 2017-2024, The Khronos Group Inc.
+// Copyright (c) 2017-2019 Valve Corporation
+// Copyright (c) 2017-2019 LunarG, Inc.
+//
+// SPDX-License-Identifier: Apache-2.0 OR MIT
+//
+// Initial Author: Mark Young <marky@lunarg.com>
+//
+
+#include "loader_init_data.hpp"
+
+#ifdef XR_KHR_LOADER_INIT_SUPPORT
+
+#ifdef XR_USE_PLATFORM_ANDROID
+// Check and copy the Android-specific init data.
+XrResult LoaderInitData::initialize(const XrLoaderInitInfoBaseHeaderKHR* info) {
+ if (info->type != XR_TYPE_LOADER_INIT_INFO_ANDROID_KHR) {
+ return XR_ERROR_VALIDATION_FAILURE;
+ }
+ auto cast_info = reinterpret_cast<XrLoaderInitInfoAndroidKHR const*>(info);
+
+ if (cast_info->applicationVM == nullptr) {
+ return XR_ERROR_VALIDATION_FAILURE;
+ }
+ if (cast_info->applicationContext == nullptr) {
+ return XR_ERROR_VALIDATION_FAILURE;
+ }
+
+ // Copy and store the JVM pointer and Android Context, ensuring the JVM is initialised.
+ _data = *cast_info;
+ _data.next = nullptr;
+ jni::init(static_cast<jni::JavaVM*>(_data.applicationVM));
+ const jni::Object context = jni::Object{static_cast<jni::jobject>(_data.applicationContext)};
+
+ // Retrieve a reference to the Android AssetManager.
+ const auto assetManager = context.call<jni::Object>("getAssets()Landroid/content/res/AssetManager;");
+ _android_asset_manager = AAssetManager_fromJava(jni::env(), assetManager.getHandle());
+
+ // Retrieve the path to the native libraries.
+ const auto applicationContext = context.call<jni::Object>("getApplicationContext()Landroid/content/Context;");
+ const auto applicationInfo = context.call<jni::Object>("getApplicationInfo()Landroid/content/pm/ApplicationInfo;");
+ _native_library_path = applicationInfo.get<std::string>("nativeLibraryDir");
+
+ _initialized = true;
+ return XR_SUCCESS;
+}
+#endif // XR_USE_PLATFORM_ANDROID
+
+XrResult InitializeLoaderInitData(const XrLoaderInitInfoBaseHeaderKHR* loaderInitInfo) {
+ return LoaderInitData::instance().initialize(loaderInitInfo);
+}
+
+#ifdef XR_USE_PLATFORM_ANDROID
+std::string GetAndroidNativeLibraryDir() { return LoaderInitData::instance()._native_library_path; }
+
+void* Android_Get_Asset_Manager() { return LoaderInitData::instance()._android_asset_manager; }
+#endif // XR_USE_PLATFORM_ANDROID
+
+#endif // XR_KHR_LOADER_INIT_SUPPORT
diff --git a/thirdparty/openxr/src/loader/loader_init_data.hpp b/thirdparty/openxr/src/loader/loader_init_data.hpp
new file mode 100644
index 0000000000..fe6bc134d3
--- /dev/null
+++ b/thirdparty/openxr/src/loader/loader_init_data.hpp
@@ -0,0 +1,92 @@
+// Copyright (c) 2017-2024, The Khronos Group Inc.
+// Copyright (c) 2017-2019 Valve Corporation
+// Copyright (c) 2017-2019 LunarG, Inc.
+//
+// SPDX-License-Identifier: Apache-2.0 OR MIT
+//
+// Initial Author: Mark Young <marky@lunarg.com>
+//
+
+#pragma once
+
+#include <xr_dependencies.h>
+#include <openxr/openxr_platform.h>
+
+#ifdef XR_USE_PLATFORM_ANDROID
+#include <json/value.h>
+#include <android/asset_manager_jni.h>
+#include "android_utilities.h"
+#endif // XR_USE_PLATFORM_ANDROID
+
+#ifdef XR_KHR_LOADER_INIT_SUPPORT
+
+/*!
+ * Stores a copy of the data passed to the xrInitializeLoaderKHR function in a singleton.
+ */
+class LoaderInitData {
+ public:
+ /*!
+ * Singleton accessor.
+ */
+ static LoaderInitData& instance() {
+ static LoaderInitData obj;
+ return obj;
+ }
+
+#ifdef XR_USE_PLATFORM_ANDROID
+ /*!
+ * Type alias for the platform-specific structure type.
+ */
+ using StructType = XrLoaderInitInfoAndroidKHR;
+ /*!
+ * Native library path.
+ */
+ std::string _native_library_path;
+ /*!
+ * Android asset manager.
+ */
+ AAssetManager* _android_asset_manager;
+#else
+#error "Platform specific XR_KHR_loader_init structure is not defined for this platform."
+#endif
+
+ /*!
+ * Get our copy of the data, casted to pass to the runtime's matching method.
+ */
+ const XrLoaderInitInfoBaseHeaderKHR* getParam() const { return reinterpret_cast<const XrLoaderInitInfoBaseHeaderKHR*>(&_data); }
+
+ /*!
+ * Get the data via its real structure type.
+ */
+ const StructType& getData() const { return _data; }
+
+ /*!
+ * Has this been correctly initialized?
+ */
+ bool initialized() const noexcept { return _initialized; }
+
+ /*!
+ * Initialize loader data - called by InitializeLoaderInitData() and thus ultimately by the loader's xrInitializeLoaderKHR
+ * implementation. Each platform that needs this extension will provide an implementation of this.
+ */
+ XrResult initialize(const XrLoaderInitInfoBaseHeaderKHR* info);
+
+ private:
+ //! Private constructor, forces use of singleton accessor.
+ LoaderInitData() = default;
+ //! Platform-specific init data
+ StructType _data = {};
+ //! Flag for indicating whether _data is valid.
+ bool _initialized = false;
+};
+
+//! Initialize loader init data, where required.
+XrResult InitializeLoaderInitData(const XrLoaderInitInfoBaseHeaderKHR* loaderInitInfo);
+
+#ifdef XR_USE_PLATFORM_ANDROID
+XrResult GetPlatformRuntimeVirtualManifest(Json::Value& out_manifest);
+std::string GetAndroidNativeLibraryDir();
+void* Android_Get_Asset_Manager();
+#endif // XR_USE_PLATFORM_ANDROID
+
+#endif // XR_KHR_LOADER_INIT_SUPPORT
diff --git a/thirdparty/openxr/src/loader/loader_instance.cpp b/thirdparty/openxr/src/loader/loader_instance.cpp
index ce5c205505..f18230087f 100644
--- a/thirdparty/openxr/src/loader/loader_instance.cpp
+++ b/thirdparty/openxr/src/loader/loader_instance.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
@@ -15,13 +15,13 @@
#include "api_layer_interface.hpp"
#include "hex_and_handles.h"
-#include "loader_interfaces.h"
#include "loader_logger.hpp"
#include "runtime_interface.hpp"
#include "xr_generated_dispatch_table_core.h"
#include "xr_generated_loader.hpp"
#include <openxr/openxr.h>
+#include <openxr/openxr_loader_negotiation.h>
#include <cstring>
#include <memory>
@@ -60,7 +60,7 @@ XrResult Get(LoaderInstance** loader_instance, const char* log_function_name) {
bool IsAvailable() { return GetSetCurrentLoaderInstance() != nullptr; }
-void Remove() { GetSetCurrentLoaderInstance().release(); }
+void Remove() { GetSetCurrentLoaderInstance().reset(nullptr); }
} // namespace ActiveLoaderInstance
// Extensions that are supported by the loader, but may not be supported
diff --git a/thirdparty/openxr/src/loader/loader_instance.hpp b/thirdparty/openxr/src/loader/loader_instance.hpp
index a0268a855c..b99e6b047f 100644
--- a/thirdparty/openxr/src/loader/loader_instance.hpp
+++ b/thirdparty/openxr/src/loader/loader_instance.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
@@ -10,9 +10,9 @@
#pragma once
#include "extra_algorithms.h"
-#include "loader_interfaces.h"
#include <openxr/openxr.h>
+#include <openxr/openxr_loader_negotiation.h>
#include <array>
#include <cmath>
diff --git a/thirdparty/openxr/src/loader/loader_logger.cpp b/thirdparty/openxr/src/loader/loader_logger.cpp
index 1c8d64f394..593e19a3ba 100644
--- a/thirdparty/openxr/src/loader/loader_logger.cpp
+++ b/thirdparty/openxr/src/loader/loader_logger.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
diff --git a/thirdparty/openxr/src/loader/loader_logger.hpp b/thirdparty/openxr/src/loader/loader_logger.hpp
index d31fac093a..964aa47962 100644
--- a/thirdparty/openxr/src/loader/loader_logger.hpp
+++ b/thirdparty/openxr/src/loader/loader_logger.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
diff --git a/thirdparty/openxr/src/loader/loader_logger_recorders.cpp b/thirdparty/openxr/src/loader/loader_logger_recorders.cpp
index 32e4687b2f..00392c27bd 100644
--- a/thirdparty/openxr/src/loader/loader_logger_recorders.cpp
+++ b/thirdparty/openxr/src/loader/loader_logger_recorders.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
diff --git a/thirdparty/openxr/src/loader/loader_logger_recorders.hpp b/thirdparty/openxr/src/loader/loader_logger_recorders.hpp
index 7b934202d5..b676c37e93 100644
--- a/thirdparty/openxr/src/loader/loader_logger_recorders.hpp
+++ b/thirdparty/openxr/src/loader/loader_logger_recorders.hpp
@@ -1,10 +1,10 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
-// Initial Author: Ryan Pavlik <ryan.pavlik@collabora.com>
+// Initial Author: Rylie Pavlik <rylie.pavlik@collabora.com>
//
#pragma once
diff --git a/thirdparty/openxr/src/loader/loader_platform.hpp b/thirdparty/openxr/src/loader/loader_platform.hpp
index 0ea80c05b8..964116caa4 100644
--- a/thirdparty/openxr/src/loader/loader_platform.hpp
+++ b/thirdparty/openxr/src/loader/loader_platform.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
diff --git a/thirdparty/openxr/src/loader/manifest_file.cpp b/thirdparty/openxr/src/loader/manifest_file.cpp
index 0683bc166a..f9699ece40 100644
--- a/thirdparty/openxr/src/loader/manifest_file.cpp
+++ b/thirdparty/openxr/src/loader/manifest_file.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
@@ -18,6 +18,7 @@
#endif // OPENXR_HAVE_COMMON_CONFIG
#include "filesystem_utils.hpp"
+#include "loader_init_data.hpp"
#include "loader_platform.hpp"
#include "platform_utils.hpp"
#include "loader_logger.hpp"
@@ -666,14 +667,14 @@ XrResult RuntimeManifestFile::FindManifestFiles(std::vector<std::unique_ptr<Runt
}
#else
-#if defined(XR_KHR_LOADER_INIT_SUPPORT)
+#if defined(XR_USE_PLATFORM_ANDROID)
Json::Value virtualManifest;
result = GetPlatformRuntimeVirtualManifest(virtualManifest);
if (XR_SUCCESS == result) {
RuntimeManifestFile::CreateIfValid(virtualManifest, "", manifest_files);
return result;
}
-#endif // defined(XR_KHR_LOADER_INIT_SUPPORT)
+#endif // defined(XR_USE_PLATFORM_ANDROID)
if (!PlatformGetGlobalRuntimeFileName(XR_VERSION_MAJOR(XR_CURRENT_API_VERSION), filename)) {
LoaderLogger::LogErrorMessage(
"", "RuntimeManifestFile::FindManifestFiles - failed to determine active runtime file path for this environment");
diff --git a/thirdparty/openxr/src/loader/manifest_file.hpp b/thirdparty/openxr/src/loader/manifest_file.hpp
index 46b842c663..52fe3134b0 100644
--- a/thirdparty/openxr/src/loader/manifest_file.hpp
+++ b/thirdparty/openxr/src/loader/manifest_file.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017 Valve Corporation
// Copyright (c) 2017 LunarG, Inc.
//
diff --git a/thirdparty/openxr/src/loader/runtime_interface.cpp b/thirdparty/openxr/src/loader/runtime_interface.cpp
index 8312b15ba4..7812aca987 100644
--- a/thirdparty/openxr/src/loader/runtime_interface.cpp
+++ b/thirdparty/openxr/src/loader/runtime_interface.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
@@ -9,14 +9,15 @@
#include "runtime_interface.hpp"
+#include <openxr/openxr.h>
+#include <openxr/openxr_loader_negotiation.h>
+
#include "manifest_file.hpp"
-#include "loader_interfaces.h"
+#include "loader_init_data.hpp"
#include "loader_logger.hpp"
#include "loader_platform.hpp"
#include "xr_generated_dispatch_table_core.h"
-#include <openxr/openxr.h>
-
#include <cstring>
#include <memory>
#include <mutex>
@@ -26,8 +27,6 @@
#include <vector>
#ifdef XR_USE_PLATFORM_ANDROID
-#include "android_utilities.h"
-#include <android/asset_manager_jni.h>
#include <json/value.h>
// Needed for the loader init struct
@@ -35,112 +34,6 @@
#include <openxr/openxr_platform.h>
#endif // XR_USE_PLATFORM_ANDROID
-#ifdef XR_KHR_LOADER_INIT_SUPPORT
-namespace {
-/*!
- * Stores a copy of the data passed to the xrInitializeLoaderKHR function in a singleton.
- */
-class LoaderInitData {
- public:
- /*!
- * Singleton accessor.
- */
- static LoaderInitData& instance() {
- static LoaderInitData obj;
- return obj;
- }
-
-#ifdef XR_USE_PLATFORM_ANDROID
- /*!
- * Type alias for the platform-specific structure type.
- */
- using StructType = XrLoaderInitInfoAndroidKHR;
- /*!
- * Native library path.
- */
- std::string _native_library_path;
- /*!
- * Android asset manager.
- */
- AAssetManager* _android_asset_manager;
-#endif
-
- /*!
- * Get our copy of the data, casted to pass to the runtime's matching method.
- */
- const XrLoaderInitInfoBaseHeaderKHR* getParam() const { return reinterpret_cast<const XrLoaderInitInfoBaseHeaderKHR*>(&_data); }
-
- /*!
- * Get the data via its real structure type.
- */
- const StructType& getData() const { return _data; }
-
- /*!
- * Has this been correctly initialized?
- */
- bool initialized() const noexcept { return _initialized; }
-
- /*!
- * Initialize loader data - called by InitializeLoader() and thus ultimately by the loader's xrInitializeLoaderKHR
- * implementation. Each platform that needs this extension will provide an implementation of this.
- */
- XrResult initialize(const XrLoaderInitInfoBaseHeaderKHR* info);
-
- private:
- //! Private constructor, forces use of singleton accessor.
- LoaderInitData() = default;
- //! Platform-specific init data
- StructType _data = {};
- //! Flag for indicating whether _data is valid.
- bool _initialized = false;
-};
-
-#ifdef XR_USE_PLATFORM_ANDROID
-// Check and copy the Android-specific init data.
-XrResult LoaderInitData::initialize(const XrLoaderInitInfoBaseHeaderKHR* info) {
- if (info->type != XR_TYPE_LOADER_INIT_INFO_ANDROID_KHR) {
- return XR_ERROR_VALIDATION_FAILURE;
- }
- auto cast_info = reinterpret_cast<XrLoaderInitInfoAndroidKHR const*>(info);
-
- if (cast_info->applicationVM == nullptr) {
- return XR_ERROR_VALIDATION_FAILURE;
- }
- if (cast_info->applicationContext == nullptr) {
- return XR_ERROR_VALIDATION_FAILURE;
- }
-
- // Copy and store the JVM pointer and Android Context, ensuring the JVM is initialised.
- _data = *cast_info;
- _data.next = nullptr;
- jni::init(static_cast<jni::JavaVM*>(_data.applicationVM));
- const jni::Object context = jni::Object{static_cast<jni::jobject>(_data.applicationContext)};
-
- // Retrieve a reference to the Android AssetManager.
- const auto assetManager = context.call<jni::Object>("getAssets()Landroid/content/res/AssetManager;");
- _android_asset_manager = AAssetManager_fromJava(jni::env(), assetManager.getHandle());
-
- // Retrieve the path to the native libraries.
- const auto applicationContext = context.call<jni::Object>("getApplicationContext()Landroid/content/Context;");
- const auto applicationInfo = context.call<jni::Object>("getApplicationInfo()Landroid/content/pm/ApplicationInfo;");
- _native_library_path = applicationInfo.get<std::string>("nativeLibraryDir");
-
- _initialized = true;
- return XR_SUCCESS;
-}
-#endif // XR_USE_PLATFORM_ANDROID
-} // namespace
-
-XrResult InitializeLoader(const XrLoaderInitInfoBaseHeaderKHR* loaderInitInfo) {
- return LoaderInitData::instance().initialize(loaderInitInfo);
-}
-
-std::string GetAndroidNativeLibraryDir() { return LoaderInitData::instance()._native_library_path; }
-
-void* Android_Get_Asset_Manager() { return LoaderInitData::instance()._android_asset_manager; }
-
-#endif // XR_KHR_LOADER_INIT_SUPPORT
-
#ifdef XR_USE_PLATFORM_ANDROID
XrResult GetPlatformRuntimeVirtualManifest(Json::Value& out_manifest) {
using wrap::android::content::Context;
diff --git a/thirdparty/openxr/src/loader/runtime_interface.hpp b/thirdparty/openxr/src/loader/runtime_interface.hpp
index 8d55ec674a..093f8ba767 100644
--- a/thirdparty/openxr/src/loader/runtime_interface.hpp
+++ b/thirdparty/openxr/src/loader/runtime_interface.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
@@ -19,22 +19,10 @@
#include <mutex>
#include <memory>
-#ifdef XR_USE_PLATFORM_ANDROID
-#define XR_KHR_LOADER_INIT_SUPPORT
-#endif
-
namespace Json {
class Value;
}
-#ifdef XR_KHR_LOADER_INIT_SUPPORT
-//! Initialize loader, where required.
-XrResult InitializeLoader(const XrLoaderInitInfoBaseHeaderKHR* loaderInitInfo);
-XrResult GetPlatformRuntimeVirtualManifest(Json::Value& out_manifest);
-std::string GetAndroidNativeLibraryDir();
-void* Android_Get_Asset_Manager();
-#endif
-
class RuntimeManifestFile;
struct XrGeneratedDispatchTable;
diff --git a/thirdparty/openxr/src/loader/xr_generated_loader.cpp b/thirdparty/openxr/src/loader/xr_generated_loader.cpp
index 8c79afddc5..7bddbdc3ea 100644
--- a/thirdparty/openxr/src/loader/xr_generated_loader.cpp
+++ b/thirdparty/openxr/src/loader/xr_generated_loader.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
// SPDX-License-Identifier: Apache-2.0 OR MIT
@@ -6,7 +6,7 @@
// See loader_source_generator.py for modifications
// ************************************************************
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
diff --git a/thirdparty/openxr/src/loader/xr_generated_loader.hpp b/thirdparty/openxr/src/loader/xr_generated_loader.hpp
index e28e35bbcf..68a6b9470d 100644
--- a/thirdparty/openxr/src/loader/xr_generated_loader.hpp
+++ b/thirdparty/openxr/src/loader/xr_generated_loader.hpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
// SPDX-License-Identifier: Apache-2.0 OR MIT
@@ -6,7 +6,7 @@
// See loader_source_generator.py for modifications
// ************************************************************
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
@@ -34,10 +34,9 @@
#include "xr_dependencies.h"
#include "openxr/openxr.h"
+#include "openxr/openxr_loader_negotiation.h"
#include "openxr/openxr_platform.h"
-#include "loader_interfaces.h"
-
#include "loader_instance.hpp"
#include "loader_platform.hpp"
diff --git a/thirdparty/openxr/src/xr_generated_dispatch_table_core.c b/thirdparty/openxr/src/xr_generated_dispatch_table_core.c
index de88ef7e6c..e73e8b2b95 100644
--- a/thirdparty/openxr/src/xr_generated_dispatch_table_core.c
+++ b/thirdparty/openxr/src/xr_generated_dispatch_table_core.c
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019, Valve Corporation
// Copyright (c) 2017-2019, LunarG, Inc.
@@ -8,7 +8,7 @@
// See utility_source_generator.py for modifications
// ************************************************************
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//
diff --git a/thirdparty/openxr/src/xr_generated_dispatch_table_core.h b/thirdparty/openxr/src/xr_generated_dispatch_table_core.h
index 0f3e7e0502..5871231267 100644
--- a/thirdparty/openxr/src/xr_generated_dispatch_table_core.h
+++ b/thirdparty/openxr/src/xr_generated_dispatch_table_core.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019, Valve Corporation
// Copyright (c) 2017-2019, LunarG, Inc.
@@ -8,7 +8,7 @@
// See utility_source_generator.py for modifications
// ************************************************************
-// Copyright (c) 2017-2023, The Khronos Group Inc.
+// Copyright (c) 2017-2024, The Khronos Group Inc.
// Copyright (c) 2017-2019 Valve Corporation
// Copyright (c) 2017-2019 LunarG, Inc.
//