1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-06 17:25:19 +00:00

Updated thirdparty OpenXR library to 1.0.33

This commit is contained in:
Bastiaan Olij
2024-01-09 11:47:45 +11:00
parent 84e205b5a1
commit 3747cf2ffa
45 changed files with 1240 additions and 309 deletions

View File

@@ -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));