diff options
Diffstat (limited to 'thirdparty/openxr/src/loader')
19 files changed, 57 insertions, 45 deletions
diff --git a/thirdparty/openxr/src/loader/android_utilities.cpp b/thirdparty/openxr/src/loader/android_utilities.cpp index 59d9a99b74..9a3ad76ce0 100644 --- a/thirdparty/openxr/src/loader/android_utilities.cpp +++ b/thirdparty/openxr/src/loader/android_utilities.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2022, The Khronos Group Inc. +// Copyright (c) 2020-2023, The Khronos Group Inc. // Copyright (c) 2020-2021, Collabora, Ltd. // // SPDX-License-Identifier: Apache-2.0 OR MIT @@ -19,10 +19,10 @@ #include <vector> #include <android/log.h> -#define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, "openxr_loader", __VA_ARGS__) -#define ALOGW(...) __android_log_print(ANDROID_LOG_WARN, "openxr_loader", __VA_ARGS__) -#define ALOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, "openxr_loader", __VA_ARGS__) -#define ALOGI(...) __android_log_print(ANDROID_LOG_INFO, "openxr_loader", __VA_ARGS__) +#define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, "OpenXR-Loader", __VA_ARGS__) +#define ALOGW(...) __android_log_print(ANDROID_LOG_WARN, "OpenXR-Loader", __VA_ARGS__) +#define ALOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, "OpenXR-Loader", __VA_ARGS__) +#define ALOGI(...) __android_log_print(ANDROID_LOG_INFO, "OpenXR-Loader", __VA_ARGS__) namespace openxr_android { using wrap::android::content::ContentUris; diff --git a/thirdparty/openxr/src/loader/android_utilities.h b/thirdparty/openxr/src/loader/android_utilities.h index adb8abaf1f..f66c9bf1d0 100644 --- a/thirdparty/openxr/src/loader/android_utilities.h +++ b/thirdparty/openxr/src/loader/android_utilities.h @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2022, The Khronos Group Inc. +// Copyright (c) 2020-2023, The Khronos Group Inc. // Copyright (c) 2020-2021, Collabora, Ltd. // // SPDX-License-Identifier: Apache-2.0 OR MIT diff --git a/thirdparty/openxr/src/loader/api_layer_interface.cpp b/thirdparty/openxr/src/loader/api_layer_interface.cpp index b946e09402..5560c31a52 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-2022, The Khronos Group Inc. +// Copyright (c) 2017-2023, The Khronos Group Inc. // Copyright (c) 2017-2019 Valve Corporation // Copyright (c) 2017-2019 LunarG, Inc. // @@ -82,6 +82,12 @@ XrResult ApiLayerInterface::GetApiLayerProperties(const std::string& openxr_comm return result; } + // check for potential overflow before static_cast<uint32_t> + if (manifest_files.size() >= UINT32_MAX) { + LoaderLogger::LogErrorMessage(openxr_command, "ApiLayerInterface::GetApiLayerProperties - too many API layers found"); + return XR_ERROR_RUNTIME_FAILURE; + } + manifest_count = static_cast<uint32_t>(manifest_files.size()); if (nullptr == outgoing_count) { LoaderLogger::LogErrorMessage("xrEnumerateInstanceExtensionProperties", @@ -131,8 +137,8 @@ XrResult ApiLayerInterface::GetInstanceExtensionProperties(const std::string& op } bool found = false; - auto num_files = static_cast<uint32_t>(manifest_files.size()); - for (uint32_t man_file = 0; man_file < num_files; ++man_file) { + size_t num_files = manifest_files.size(); + for (size_t man_file = 0; man_file < num_files; ++man_file) { // If a layer with the provided name exists, get it's instance extension information. if (manifest_files[man_file]->LayerName() == layer_name) { manifest_files[man_file]->GetInstanceExtensionProperties(extension_properties); @@ -172,8 +178,8 @@ XrResult ApiLayerInterface::GetInstanceExtensionProperties(const std::string& op } // Grab the layer instance extensions information - auto num_files = static_cast<uint32_t>(manifest_files.size()); - for (uint32_t man_file = 0; man_file < num_files; ++man_file) { + size_t num_files = manifest_files.size(); + for (size_t man_file = 0; man_file < num_files; ++man_file) { manifest_files[man_file]->GetInstanceExtensionProperties(extension_properties); } } diff --git a/thirdparty/openxr/src/loader/api_layer_interface.hpp b/thirdparty/openxr/src/loader/api_layer_interface.hpp index b93e44584e..98685b0c32 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-2022, The Khronos Group Inc. +// Copyright (c) 2017-2023, The Khronos Group Inc. // Copyright (c) 2017-2019 Valve Corporation // Copyright (c) 2017-2019 LunarG, Inc. // diff --git a/thirdparty/openxr/src/loader/exception_handling.hpp b/thirdparty/openxr/src/loader/exception_handling.hpp index 428dd00279..bc0d9b65e3 100644 --- a/thirdparty/openxr/src/loader/exception_handling.hpp +++ b/thirdparty/openxr/src/loader/exception_handling.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2022, The Khronos Group Inc. +// Copyright (c) 2019-2023, The Khronos Group Inc. // // SPDX-License-Identifier: Apache-2.0 OR MIT // diff --git a/thirdparty/openxr/src/loader/loader_core.cpp b/thirdparty/openxr/src/loader/loader_core.cpp index f2bc87d1fa..98d3fa971a 100644 --- a/thirdparty/openxr/src/loader/loader_core.cpp +++ b/thirdparty/openxr/src/loader/loader_core.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, The Khronos Group Inc. +// Copyright (c) 2017-2023, The Khronos Group Inc. // Copyright (c) 2017-2019 Valve Corporation // Copyright (c) 2017-2019 LunarG, Inc. // diff --git a/thirdparty/openxr/src/loader/loader_instance.cpp b/thirdparty/openxr/src/loader/loader_instance.cpp index b24c8de53b..badd39193c 100644 --- a/thirdparty/openxr/src/loader/loader_instance.cpp +++ b/thirdparty/openxr/src/loader/loader_instance.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, The Khronos Group Inc. +// Copyright (c) 2017-2023, The Khronos Group Inc. // Copyright (c) 2017-2019 Valve Corporation // Copyright (c) 2017-2019 LunarG, Inc. // @@ -200,8 +200,8 @@ XrResult LoaderInstance::CreateInstance(PFN_xrGetInstanceProcAddr get_instance_p if (!api_layer_interfaces.empty()) { // Initialize an array of ApiLayerNextInfo structs std::unique_ptr<XrApiLayerNextInfo[]> next_info_list(new XrApiLayerNextInfo[api_layer_interfaces.size()]); - auto ni_index = static_cast<uint32_t>(api_layer_interfaces.size() - 1); - for (uint32_t i = 0; i <= ni_index; i++) { + size_t ni_index = api_layer_interfaces.size() - 1; + for (size_t i = 0; i <= ni_index; i++) { next_info_list[i].structType = XR_LOADER_INTERFACE_STRUCT_API_LAYER_NEXT_INFO; next_info_list[i].structVersion = XR_API_LAYER_NEXT_INFO_STRUCT_VERSION; next_info_list[i].structSize = sizeof(XrApiLayerNextInfo); diff --git a/thirdparty/openxr/src/loader/loader_instance.hpp b/thirdparty/openxr/src/loader/loader_instance.hpp index 1d43ed758d..a0268a855c 100644 --- a/thirdparty/openxr/src/loader/loader_instance.hpp +++ b/thirdparty/openxr/src/loader/loader_instance.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, The Khronos Group Inc. +// Copyright (c) 2017-2023, 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.cpp b/thirdparty/openxr/src/loader/loader_logger.cpp index dba46aa92d..1c8d64f394 100644 --- a/thirdparty/openxr/src/loader/loader_logger.cpp +++ b/thirdparty/openxr/src/loader/loader_logger.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, The Khronos Group Inc. +// Copyright (c) 2017-2023, The Khronos Group Inc. // Copyright (c) 2017-2019 Valve Corporation // Copyright (c) 2017-2019 LunarG, Inc. // @@ -26,6 +26,9 @@ #include <utility> #include <vector> +// For routing platform_utils.hpp messages into the LoaderLogger. +void LogPlatformUtilsError(const std::string& message) { LoaderLogger::LogErrorMessage("platform_utils", message); } + bool LoaderLogRecorder::LogDebugUtilsMessage(XrDebugUtilsMessageSeverityFlagsEXT /*message_severity*/, XrDebugUtilsMessageTypeFlagsEXT /*message_type*/, const XrDebugUtilsMessengerCallbackDataEXT* /*callback_data*/) { diff --git a/thirdparty/openxr/src/loader/loader_logger.hpp b/thirdparty/openxr/src/loader/loader_logger.hpp index 260ebe354a..d31fac093a 100644 --- a/thirdparty/openxr/src/loader/loader_logger.hpp +++ b/thirdparty/openxr/src/loader/loader_logger.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, The Khronos Group Inc. +// Copyright (c) 2017-2023, 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 7673678c60..32e4687b2f 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-2022, The Khronos Group Inc. +// Copyright (c) 2017-2023, The Khronos Group Inc. // Copyright (c) 2017-2019 Valve Corporation // Copyright (c) 2017-2019 LunarG, Inc. // @@ -160,16 +160,16 @@ bool DebugUtilsLogRecorder::LogMessage(XrLoaderLogMessageSeverityFlagBits messag XrDebugUtilsMessageTypeFlagsEXT utils_type = LoaderLogMessageTypesToDebugUtilsMessageTypes(message_type); // Convert the loader log message into the debug utils log message information - XrDebugUtilsMessengerCallbackDataEXT utils_callback_data = {}; + XrDebugUtilsMessengerCallbackDataEXT utils_callback_data{}; utils_callback_data.type = XR_TYPE_DEBUG_UTILS_MESSENGER_CALLBACK_DATA_EXT; utils_callback_data.messageId = callback_data->message_id; utils_callback_data.functionName = callback_data->command_name; utils_callback_data.message = callback_data->message; - std::vector<XrDebugUtilsObjectNameInfoEXT> utils_objects; - utils_objects.resize(callback_data->object_count); + + XrDebugUtilsObjectNameInfoEXT example_utils_info{}; + example_utils_info.type = XR_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; + std::vector<XrDebugUtilsObjectNameInfoEXT> utils_objects(callback_data->object_count, example_utils_info); for (uint8_t object = 0; object < callback_data->object_count; ++object) { - utils_objects[object].type = XR_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; - utils_objects[object].next = nullptr; utils_objects[object].objectHandle = callback_data->objects[object].handle; utils_objects[object].objectType = callback_data->objects[object].type; utils_objects[object].objectName = callback_data->objects[object].name.c_str(); diff --git a/thirdparty/openxr/src/loader/loader_logger_recorders.hpp b/thirdparty/openxr/src/loader/loader_logger_recorders.hpp index 31e5243c45..7b934202d5 100644 --- a/thirdparty/openxr/src/loader/loader_logger_recorders.hpp +++ b/thirdparty/openxr/src/loader/loader_logger_recorders.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, The Khronos Group Inc. +// Copyright (c) 2017-2023, The Khronos Group Inc. // Copyright (c) 2017-2019 Valve Corporation // Copyright (c) 2017-2019 LunarG, Inc. // diff --git a/thirdparty/openxr/src/loader/loader_platform.hpp b/thirdparty/openxr/src/loader/loader_platform.hpp index e2757fffb9..0ea80c05b8 100644 --- a/thirdparty/openxr/src/loader/loader_platform.hpp +++ b/thirdparty/openxr/src/loader/loader_platform.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, The Khronos Group Inc. +// Copyright (c) 2017-2023, 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 1b0ef07848..99f4e84104 100644 --- a/thirdparty/openxr/src/loader/manifest_file.cpp +++ b/thirdparty/openxr/src/loader/manifest_file.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, The Khronos Group Inc. +// Copyright (c) 2017-2023, The Khronos Group Inc. // Copyright (c) 2017-2019 Valve Corporation // Copyright (c) 2017-2019 LunarG, Inc. // @@ -27,13 +27,13 @@ #include <openxr/openxr.h> #include <algorithm> +#include <cstdlib> +#include <cstdio> #include <cstring> #include <fstream> #include <memory> #include <sstream> #include <stdexcept> -#include <stdio.h> -#include <stdlib.h> #include <string> #include <unordered_map> #include <utility> @@ -233,6 +233,12 @@ static void ReadDataFilesInSearchPaths(const std::string &override_env_var, cons relative_home_path += relative_path; CopyIncludedPaths(true, home, relative_home_path, search_path); } +#elif defined(XR_OS_ANDROID) + CopyIncludedPaths(true, "/product/etc", relative_path, search_path); + CopyIncludedPaths(true, "/odm/etc", relative_path, search_path); + CopyIncludedPaths(true, "/oem/etc", relative_path, search_path); + CopyIncludedPaths(true, "/vendor/etc", relative_path, search_path); + CopyIncludedPaths(true, "/system/etc", relative_path, search_path); #else (void)relative_path; #endif @@ -447,9 +453,8 @@ static void GetExtensionProperties(const std::vector<ExtensionListing> &extensio if (it != props.end()) { it->extensionVersion = std::max(it->extensionVersion, ext.extension_version); } else { - XrExtensionProperties prop = {}; + XrExtensionProperties prop{}; prop.type = XR_TYPE_EXTENSION_PROPERTIES; - prop.next = nullptr; strncpy(prop.extensionName, ext.name.c_str(), XR_MAX_EXTENSION_NAME_SIZE - 1); prop.extensionName[XR_MAX_EXTENSION_NAME_SIZE - 1] = '\0'; prop.extensionVersion = ext.extension_version; diff --git a/thirdparty/openxr/src/loader/manifest_file.hpp b/thirdparty/openxr/src/loader/manifest_file.hpp index de0aab65c2..46b842c663 100644 --- a/thirdparty/openxr/src/loader/manifest_file.hpp +++ b/thirdparty/openxr/src/loader/manifest_file.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017-2023, 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 0f081ff9b2..d9ab86bb58 100644 --- a/thirdparty/openxr/src/loader/runtime_interface.cpp +++ b/thirdparty/openxr/src/loader/runtime_interface.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, The Khronos Group Inc. +// Copyright (c) 2017-2023, The Khronos Group Inc. // Copyright (c) 2017-2019 Valve Corporation // Copyright (c) 2017-2019 LunarG, Inc. // @@ -430,12 +430,10 @@ void RuntimeInterface::GetInstanceExtensionProperties(std::vector<XrExtensionPro // Get the count from the runtime rt_xrEnumerateInstanceExtensionProperties(nullptr, count, &count_output, nullptr); if (count_output > 0) { - runtime_extension_properties.resize(count_output); + XrExtensionProperties example_properties{}; + example_properties.type = XR_TYPE_EXTENSION_PROPERTIES; + runtime_extension_properties.resize(count_output, example_properties); count = count_output; - for (XrExtensionProperties& ext_prop : runtime_extension_properties) { - ext_prop.type = XR_TYPE_EXTENSION_PROPERTIES; - ext_prop.next = nullptr; - } rt_xrEnumerateInstanceExtensionProperties(nullptr, count, &count_output, runtime_extension_properties.data()); } size_t ext_count = runtime_extension_properties.size(); diff --git a/thirdparty/openxr/src/loader/runtime_interface.hpp b/thirdparty/openxr/src/loader/runtime_interface.hpp index fa53ee03f2..8d55ec674a 100644 --- a/thirdparty/openxr/src/loader/runtime_interface.hpp +++ b/thirdparty/openxr/src/loader/runtime_interface.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, The Khronos Group Inc. +// Copyright (c) 2017-2023, 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.cpp b/thirdparty/openxr/src/loader/xr_generated_loader.cpp index 2ce323e51f..e7767fd30a 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-2022, The Khronos Group Inc. +// Copyright (c) 2017-2023, 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-2022, The Khronos Group Inc. +// Copyright (c) 2017-2023, 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 482cf1e83e..e28e35bbcf 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-2022, The Khronos Group Inc. +// Copyright (c) 2017-2023, 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-2022, The Khronos Group Inc. +// Copyright (c) 2017-2023, The Khronos Group Inc. // Copyright (c) 2017-2019 Valve Corporation // Copyright (c) 2017-2019 LunarG, Inc. // |