You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-05 17:15:09 +00:00
openxr: Revert to 1.0.28, newer versions crash on Windows/Mingw-GCC
Reverts #82582. Works around #83674. Users tested 1.0.29, 1.0.30, and 1.0.31, which all triggered the same issue, with both mingw-gcc from Fedora 36 and Fedora 39.
This commit is contained in:
@@ -237,23 +237,21 @@ XrResult ApiLayerInterface::LoadApiLayers(const std::string& openxr_command, uin
|
||||
for (const auto& layer_name : enabled_explicit_api_layer_names) {
|
||||
bool found_this_layer = false;
|
||||
|
||||
if (layers_already_found.count(layer_name) > 0) {
|
||||
found_this_layer = true;
|
||||
} else {
|
||||
for (auto it = explicit_layer_manifest_files.begin(); it != explicit_layer_manifest_files.end();) {
|
||||
bool erased_layer_manifest_file = false;
|
||||
for (auto it = explicit_layer_manifest_files.begin(); it != explicit_layer_manifest_files.end();) {
|
||||
bool erased_layer_manifest_file = false;
|
||||
|
||||
if (layer_name == (*it)->LayerName()) {
|
||||
found_this_layer = true;
|
||||
layers_already_found.insert(layer_name);
|
||||
enabled_layer_manifest_files_in_init_order.push_back(std::move(*it));
|
||||
it = explicit_layer_manifest_files.erase(it);
|
||||
erased_layer_manifest_file = true;
|
||||
}
|
||||
if (layers_already_found.count(layer_name) > 0) {
|
||||
found_this_layer = true;
|
||||
} else if (layer_name == (*it)->LayerName()) {
|
||||
found_this_layer = true;
|
||||
layers_already_found.insert(layer_name);
|
||||
enabled_layer_manifest_files_in_init_order.push_back(std::move(*it));
|
||||
it = explicit_layer_manifest_files.erase(it);
|
||||
erased_layer_manifest_file = true;
|
||||
}
|
||||
|
||||
if (!erased_layer_manifest_file) {
|
||||
it++;
|
||||
}
|
||||
if (!erased_layer_manifest_file) {
|
||||
it++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
2
thirdparty/openxr/src/loader/loader_core.cpp
vendored
2
thirdparty/openxr/src/loader/loader_core.cpp
vendored
@@ -19,7 +19,7 @@
|
||||
#include "loader_logger.hpp"
|
||||
#include "loader_platform.hpp"
|
||||
#include "runtime_interface.hpp"
|
||||
#include "xr_generated_dispatch_table_core.h"
|
||||
#include "xr_generated_dispatch_table.h"
|
||||
#include "xr_generated_loader.hpp"
|
||||
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "loader_interfaces.h"
|
||||
#include "loader_logger.hpp"
|
||||
#include "runtime_interface.hpp"
|
||||
#include "xr_generated_dispatch_table_core.h"
|
||||
#include "xr_generated_dispatch_table.h"
|
||||
#include "xr_generated_loader.hpp"
|
||||
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
77
thirdparty/openxr/src/loader/manifest_file.cpp
vendored
77
thirdparty/openxr/src/loader/manifest_file.cpp
vendored
@@ -274,45 +274,16 @@ static std::string GetXDGEnvAbsolute(const char *name, const char *fallback_path
|
||||
return fallback_paths;
|
||||
}
|
||||
|
||||
/// @param rt_dir_prefix Directory prefix with a trailing slash
|
||||
static bool FindEitherActiveRuntimeFilename(const char *prefix_desc, const std::string &rt_dir_prefix, uint16_t major_version,
|
||||
std::string &out) {
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "Looking for active_runtime." XR_ARCH_ABI ".json or active_runtime.json in ";
|
||||
oss << prefix_desc;
|
||||
oss << ": ";
|
||||
oss << rt_dir_prefix;
|
||||
|
||||
LoaderLogger::LogInfoMessage("", oss.str());
|
||||
}
|
||||
{
|
||||
auto decorated_path = rt_dir_prefix + std::to_string(major_version) + "/active_runtime." XR_ARCH_ABI ".json";
|
||||
|
||||
if (FileSysUtilsPathExists(decorated_path)) {
|
||||
out = decorated_path;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
{
|
||||
auto undecorated_path = rt_dir_prefix + std::to_string(major_version) + "/active_runtime.json";
|
||||
|
||||
if (FileSysUtilsPathExists(undecorated_path)) {
|
||||
out = undecorated_path;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Return the first instance of relative_path occurring in an XDG config dir according to standard
|
||||
// precedence order.
|
||||
static bool FindXDGConfigFile(const char *relative_dir, uint16_t major_version, std::string &out) {
|
||||
const std::string message{"Looking for active_runtime." XR_ARCH_ABI ".json or active_runtime.json"};
|
||||
std::string dir_prefix = GetXDGEnvHome("XDG_CONFIG_HOME", ".config");
|
||||
if (!dir_prefix.empty()) {
|
||||
dir_prefix += "/";
|
||||
dir_prefix += relative_dir;
|
||||
if (FindEitherActiveRuntimeFilename("XDG_CONFIG_HOME", dir_prefix, major_version, out)) {
|
||||
static bool FindXDGConfigFile(const std::string &relative_path, std::string &out) {
|
||||
out = GetXDGEnvHome("XDG_CONFIG_HOME", ".config");
|
||||
if (!out.empty()) {
|
||||
out += "/";
|
||||
out += relative_path;
|
||||
|
||||
LoaderLogger::LogInfoMessage("", "Looking for " + relative_path + " in XDG_CONFIG_HOME: " + out);
|
||||
if (FileSysUtilsPathExists(out)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -323,26 +294,29 @@ static bool FindXDGConfigFile(const char *relative_dir, uint16_t major_version,
|
||||
if (path.empty()) {
|
||||
continue;
|
||||
}
|
||||
dir_prefix = std::move(path);
|
||||
dir_prefix += "/";
|
||||
dir_prefix += relative_dir;
|
||||
if (FindEitherActiveRuntimeFilename("an entry of XDG_CONFIG_DIRS", dir_prefix, major_version, out)) {
|
||||
out = path;
|
||||
out += "/";
|
||||
out += relative_path;
|
||||
LoaderLogger::LogInfoMessage("", "Looking for " + relative_path + " in an entry of XDG_CONFIG_DIRS: " + out);
|
||||
if (FileSysUtilsPathExists(out)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
dir_prefix = SYSCONFDIR;
|
||||
dir_prefix += "/";
|
||||
dir_prefix += relative_dir;
|
||||
if (FindEitherActiveRuntimeFilename("compiled-in SYSCONFDIR", dir_prefix, major_version, out)) {
|
||||
out = SYSCONFDIR;
|
||||
out += "/";
|
||||
out += relative_path;
|
||||
LoaderLogger::LogInfoMessage("", "Looking for " + relative_path + " in compiled-in SYSCONFDIR: " + out);
|
||||
if (FileSysUtilsPathExists(out)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(EXTRASYSCONFDIR)
|
||||
dir_prefix = EXTRASYSCONFDIR;
|
||||
dir_prefix += "/";
|
||||
dir_prefix += relative_dir;
|
||||
if (FindEitherActiveRuntimeFilename("compiled-in EXTRASYSCONFDIR", dir_prefix, major_version, out)) {
|
||||
out = EXTRASYSCONFDIR;
|
||||
out += "/";
|
||||
out += relative_path;
|
||||
LoaderLogger::LogInfoMessage("", "Looking for " + relative_path + " in compiled-in EXTRASYSCONFDIR: " + out);
|
||||
if (FileSysUtilsPathExists(out)) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
@@ -658,8 +632,9 @@ XrResult RuntimeManifestFile::FindManifestFiles(std::vector<std::unique_ptr<Runt
|
||||
LoaderLogger::LogInfoMessage("",
|
||||
"RuntimeManifestFile::FindManifestFiles - using registry-specified runtime file " + filename);
|
||||
#elif defined(XR_OS_LINUX)
|
||||
|
||||
if (!FindXDGConfigFile("openxr/", XR_VERSION_MAJOR(XR_CURRENT_API_VERSION), filename)) {
|
||||
const std::string relative_path =
|
||||
"openxr/" + std::to_string(XR_VERSION_MAJOR(XR_CURRENT_API_VERSION)) + "/active_runtime.json";
|
||||
if (!FindXDGConfigFile(relative_path, filename)) {
|
||||
LoaderLogger::LogErrorMessage(
|
||||
"", "RuntimeManifestFile::FindManifestFiles - failed to determine active runtime file path for this environment");
|
||||
return XR_ERROR_RUNTIME_UNAVAILABLE;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "loader_interfaces.h"
|
||||
#include "loader_logger.hpp"
|
||||
#include "loader_platform.hpp"
|
||||
#include "xr_generated_dispatch_table_core.h"
|
||||
#include "xr_generated_dispatch_table.h"
|
||||
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
@@ -29,10 +29,6 @@
|
||||
#include "android_utilities.h"
|
||||
#include <android/asset_manager_jni.h>
|
||||
#include <json/value.h>
|
||||
|
||||
// Needed for the loader init struct
|
||||
#include <xr_dependencies.h>
|
||||
#include <openxr/openxr_platform.h>
|
||||
#endif // XR_USE_PLATFORM_ANDROID
|
||||
|
||||
#ifdef XR_KHR_LOADER_INIT_SUPPORT
|
||||
@@ -109,22 +105,33 @@ XrResult LoaderInitData::initialize(const XrLoaderInitInfoBaseHeaderKHR* info) {
|
||||
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;
|
||||
jni::init((jni::JavaVM*)_data.applicationVM);
|
||||
_data.next = nullptr;
|
||||
jni::init(static_cast<jni::JavaVM*>(_data.applicationVM));
|
||||
const jni::Object context = jni::Object{static_cast<jni::jobject>(_data.applicationContext)};
|
||||
JNIEnv* Env;
|
||||
((jni::JavaVM*)(cast_info->applicationVM))->AttachCurrentThread(&Env, nullptr);
|
||||
const jclass contextClass = Env->GetObjectClass((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");
|
||||
const jmethodID getAssetsMethod = Env->GetMethodID(contextClass, "getAssets", "()Landroid/content/res/AssetManager;");
|
||||
const jobject AssetManagerObject = Env->CallObjectMethod((jobject)_data.applicationContext, getAssetsMethod);
|
||||
_android_asset_manager = AAssetManager_fromJava(Env, AssetManagerObject);
|
||||
|
||||
const jmethodID getApplicationContextMethod =
|
||||
Env->GetMethodID(contextClass, "getApplicationContext", "()Landroid/content/Context;");
|
||||
const jobject contextObject = Env->CallObjectMethod((jobject)_data.applicationContext, getApplicationContextMethod);
|
||||
const jmethodID getApplicationInfoMethod =
|
||||
Env->GetMethodID(contextClass, "getApplicationInfo", "()Landroid/content/pm/ApplicationInfo;");
|
||||
const jobject applicationInfoObject = Env->CallObjectMethod(contextObject, getApplicationInfoMethod);
|
||||
const jfieldID nativeLibraryDirField =
|
||||
Env->GetFieldID(Env->GetObjectClass(applicationInfoObject), "nativeLibraryDir", "Ljava/lang/String;");
|
||||
const jobject nativeLibraryDirObject = Env->GetObjectField(applicationInfoObject, nativeLibraryDirField);
|
||||
const jmethodID getBytesMethod =
|
||||
Env->GetMethodID(Env->GetObjectClass(nativeLibraryDirObject), "getBytes", "(Ljava/lang/String;)[B");
|
||||
const auto bytesObject =
|
||||
static_cast<jbyteArray>(Env->CallObjectMethod(nativeLibraryDirObject, getBytesMethod, Env->NewStringUTF("UTF-8")));
|
||||
const size_t length = Env->GetArrayLength(bytesObject);
|
||||
const jbyte* const bytes = Env->GetByteArrayElements(bytesObject, nullptr);
|
||||
_native_library_path = std::string(reinterpret_cast<const char*>(bytes), length);
|
||||
_initialized = true;
|
||||
return XR_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "loader_logger.hpp"
|
||||
#include "loader_platform.hpp"
|
||||
#include "runtime_interface.hpp"
|
||||
#include "xr_generated_dispatch_table_core.h"
|
||||
#include "xr_generated_dispatch_table.h"
|
||||
|
||||
#include "xr_dependencies.h"
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
Reference in New Issue
Block a user