feat: updated engine version to 4.4-rc1
This commit is contained in:
parent
ee00efde1f
commit
21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions
|
|
@ -47,7 +47,7 @@
|
|||
#define XR_ARCH_ABI "aarch64"
|
||||
#elif (defined(__ARM_ARCH) && __ARM_ARCH >= 7 && (defined(__ARM_PCS_VFP) || defined(__ANDROID__))) || defined(_M_ARM)
|
||||
#define XR_ARCH_ABI "armv7a-vfp"
|
||||
#elif defined(__ARM_ARCH_5TE__)
|
||||
#elif defined(__ARM_ARCH_5TE__) || (defined(__ARM_ARCH) && __ARM_ARCH > 5)
|
||||
#define XR_ARCH_ABI "armv5te"
|
||||
#elif defined(__mips64)
|
||||
#define XR_ARCH_ABI "mips64"
|
||||
|
|
@ -91,23 +91,22 @@ namespace detail {
|
|||
|
||||
static inline char* ImplGetEnv(const char* name) { return getenv(name); }
|
||||
|
||||
static inline int ImplSetEnv(const char* name, const char* value, int overwrite) { return setenv(name, value, overwrite); }
|
||||
|
||||
// clang-format off
|
||||
static inline char* ImplGetSecureEnv(const char* name) {
|
||||
#ifdef HAVE_SECURE_GETENV
|
||||
return secure_getenv(name);
|
||||
#elif defined(HAVE___SECURE_GETENV)
|
||||
return __secure_getenv(name);
|
||||
#else
|
||||
// clang-format off
|
||||
#pragma message( \
|
||||
"Warning: Falling back to non-secure getenv for environmental" \
|
||||
"lookups! Consider updating to a different libc.")
|
||||
// clang-format on
|
||||
|
||||
return ImplGetEnv(name);
|
||||
#endif
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
} // namespace detail
|
||||
|
||||
#endif // defined(XR_OS_LINUX) || defined(XR_OS_APPLE)
|
||||
|
|
@ -162,12 +161,6 @@ static inline std::string PlatformUtilsGetSecureEnv(const char* name) {
|
|||
|
||||
static inline bool PlatformUtilsGetEnvSet(const char* name) { return detail::ImplGetEnv(name) != nullptr; }
|
||||
|
||||
static inline bool PlatformUtilsSetEnv(const char* name, const char* value) {
|
||||
const int shouldOverwrite = 1;
|
||||
int result = detail::ImplSetEnv(name, value, shouldOverwrite);
|
||||
return (result == 0);
|
||||
}
|
||||
|
||||
#elif defined(XR_OS_APPLE)
|
||||
|
||||
static inline std::string PlatformUtilsGetEnv(const char* name) {
|
||||
|
|
@ -188,12 +181,6 @@ static inline std::string PlatformUtilsGetSecureEnv(const char* name) {
|
|||
|
||||
static inline bool PlatformUtilsGetEnvSet(const char* name) { return detail::ImplGetEnv(name) != nullptr; }
|
||||
|
||||
static inline bool PlatformUtilsSetEnv(const char* name, const char* value) {
|
||||
const int shouldOverwrite = 1;
|
||||
int result = detail::ImplSetEnv(name, value, shouldOverwrite);
|
||||
return (result == 0);
|
||||
}
|
||||
|
||||
static inline bool PlatformGetGlobalRuntimeFileName(uint16_t major_version, std::string& file_name) {
|
||||
return detail::ImplTryRuntimeFilename("/usr/local/share/openxr/", major_version, file_name);
|
||||
}
|
||||
|
|
@ -337,19 +324,10 @@ static inline std::string PlatformUtilsGetSecureEnv(const char* name) {
|
|||
return envValue;
|
||||
}
|
||||
|
||||
// Sets an environment variable via UTF8 strings.
|
||||
// The name is case-sensitive.
|
||||
// Overwrites the variable if it already exists.
|
||||
// Returns true if it could be set.
|
||||
static inline bool PlatformUtilsSetEnv(const char* name, const char* value) {
|
||||
const std::wstring wname = utf8_to_wide(name);
|
||||
const std::wstring wvalue = utf8_to_wide(value);
|
||||
BOOL result = ::SetEnvironmentVariableW(wname.c_str(), wvalue.c_str());
|
||||
return (result != 0);
|
||||
}
|
||||
|
||||
#elif defined(XR_OS_ANDROID)
|
||||
|
||||
#include <sys/system_properties.h>
|
||||
|
||||
static inline bool PlatformUtilsGetEnvSet(const char* /* name */) {
|
||||
// Stub func
|
||||
return false;
|
||||
|
|
@ -365,11 +343,6 @@ static inline std::string PlatformUtilsGetSecureEnv(const char* /* name */) {
|
|||
return {};
|
||||
}
|
||||
|
||||
static inline bool PlatformUtilsSetEnv(const char* /* name */, const char* /* value */) {
|
||||
// Stub func
|
||||
return false;
|
||||
}
|
||||
|
||||
// Intended to be only used as a fallback on Android, with a more open, "native" technique used in most cases
|
||||
static inline bool PlatformGetGlobalRuntimeFileName(uint16_t major_version, std::string& file_name) {
|
||||
// Prefix for the runtime JSON file name
|
||||
|
|
@ -385,6 +358,37 @@ static inline bool PlatformGetGlobalRuntimeFileName(uint16_t major_version, std:
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Android system properties are sufficiently different from environment variables that we are not re-using
|
||||
// PlatformUtilsGetEnv for this purpose
|
||||
static inline std::string PlatformUtilsGetAndroidSystemProperty(const char* name) {
|
||||
std::string result;
|
||||
const prop_info* pi = __system_property_find(name);
|
||||
if (pi == nullptr) {
|
||||
return {};
|
||||
}
|
||||
|
||||
#if __ANDROID_API__ >= 26
|
||||
// use callback to retrieve > 92 character sys prop values, if available
|
||||
__system_property_read_callback(
|
||||
pi,
|
||||
[](void* cookie, const char*, const char* value, uint32_t) {
|
||||
auto property_value = reinterpret_cast<std::string*>(cookie);
|
||||
*property_value = value;
|
||||
},
|
||||
reinterpret_cast<void*>(&result));
|
||||
#endif // __ANDROID_API__ >= 26
|
||||
// fallback to __system_property_get if no value retrieved via callback
|
||||
if (result.empty()) {
|
||||
char value[PROP_VALUE_MAX] = {};
|
||||
if (__system_property_get(name, value) != 0) {
|
||||
result = value;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#else // Not Linux, Apple, nor Windows
|
||||
|
||||
static inline bool PlatformUtilsGetEnvSet(const char* /* name */) {
|
||||
|
|
@ -402,11 +406,6 @@ static inline std::string PlatformUtilsGetSecureEnv(const char* /* name */) {
|
|||
return {};
|
||||
}
|
||||
|
||||
static inline bool PlatformUtilsSetEnv(const char* /* name */, const char* /* value */) {
|
||||
// Stub func
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool PlatformGetGlobalRuntimeFileName(uint16_t /* major_version */, std::string const& /* file_name */) {
|
||||
// Stub func
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -65,7 +65,11 @@
|
|||
#endif // XR_USE_GRAPHICS_API_OPENGL
|
||||
|
||||
#ifdef XR_USE_GRAPHICS_API_OPENGL_ES
|
||||
#ifdef GLAD_ENABLED
|
||||
#include "thirdparty/glad/glad/egl.h"
|
||||
#else
|
||||
#include <EGL/egl.h>
|
||||
#endif
|
||||
#endif // XR_USE_GRAPHICS_API_OPENGL_ES
|
||||
|
||||
#ifdef XR_USE_GRAPHICS_API_VULKAN
|
||||
|
|
@ -77,7 +81,11 @@
|
|||
#endif // XR_USE_PLATFORM_WAYLAND
|
||||
|
||||
#ifdef XR_USE_PLATFORM_EGL
|
||||
#ifdef GLAD_ENABLED
|
||||
#include "thirdparty/glad/glad/egl.h"
|
||||
#else
|
||||
#include <EGL/egl.h>
|
||||
#endif
|
||||
#endif // XR_USE_PLATFORM_EGL
|
||||
|
||||
#if defined(XR_USE_PLATFORM_XLIB) || defined(XR_USE_PLATFORM_XCB)
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ static const XrColor4f XrColorCyan = {0.0f, 1.0f, 1.0f, 1.0f};
|
|||
static const XrColor4f XrColorLightGrey = {0.7f, 0.7f, 0.7f, 1.0f};
|
||||
static const XrColor4f XrColorDarkGrey = {0.3f, 0.3f, 0.3f, 1.0f};
|
||||
|
||||
typedef enum GraphicsAPI { GRAPHICS_VULKAN, GRAPHICS_OPENGL, GRAPHICS_OPENGL_ES, GRAPHICS_D3D } GraphicsAPI;
|
||||
typedef enum GraphicsAPI { GRAPHICS_VULKAN, GRAPHICS_OPENGL, GRAPHICS_OPENGL_ES, GRAPHICS_D3D, GRAPHICS_METAL } GraphicsAPI;
|
||||
|
||||
// Column-major, pre-multiplied. This type does not exist in the OpenXR API and is provided for convenience.
|
||||
typedef struct XrMatrix4x4f {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <android/log.h>
|
||||
|
|
@ -82,7 +83,6 @@ static Uri makeContentUri(bool systemBroker, int majorVersion, const char *abi)
|
|||
.appendPath(abi)
|
||||
.appendPath(RUNTIMES_PATH)
|
||||
.appendPath(TABLE_PATH);
|
||||
ContentUris::appendId(builder, 0);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
|
@ -175,7 +175,6 @@ static inline jni::Array<std::string> makeArray(std::initializer_list<const char
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
static constexpr auto TAG = "OpenXR-Loader";
|
||||
|
||||
#if defined(__arm__)
|
||||
static constexpr auto ABI = "armeabi-v7l";
|
||||
|
|
@ -313,26 +312,41 @@ int getActiveRuntimeVirtualManifest(wrap::android::content::Context const &conte
|
|||
|
||||
cursor.moveToFirst();
|
||||
|
||||
auto filename = cursor.getString(cursor.getColumnIndex(active_runtime::Columns::SO_FILENAME));
|
||||
auto libDir = cursor.getString(cursor.getColumnIndex(active_runtime::Columns::NATIVE_LIB_DIR));
|
||||
auto packageName = cursor.getString(cursor.getColumnIndex(active_runtime::Columns::PACKAGE_NAME));
|
||||
do {
|
||||
auto filename = cursor.getString(cursor.getColumnIndex(active_runtime::Columns::SO_FILENAME));
|
||||
auto libDir = cursor.getString(cursor.getColumnIndex(active_runtime::Columns::NATIVE_LIB_DIR));
|
||||
auto packageName = cursor.getString(cursor.getColumnIndex(active_runtime::Columns::PACKAGE_NAME));
|
||||
|
||||
auto hasFunctions = cursor.getInt(cursor.getColumnIndex(active_runtime::Columns::HAS_FUNCTIONS)) == 1;
|
||||
__android_log_print(ANDROID_LOG_INFO, TAG, "Got runtime: package: %s, so filename: %s, native lib dir: %s, has functions: %s",
|
||||
packageName.c_str(), filename.c_str(), libDir.c_str(), (hasFunctions ? "yes" : "no"));
|
||||
auto hasFunctions = cursor.getInt(cursor.getColumnIndex(active_runtime::Columns::HAS_FUNCTIONS)) == 1;
|
||||
ALOGI("Got runtime: package: %s, so filename: %s, native lib dir: %s, has functions: %s", packageName.c_str(),
|
||||
filename.c_str(), libDir.c_str(), (hasFunctions ? "yes" : "no"));
|
||||
|
||||
auto lib_path = libDir + "/" + filename;
|
||||
cursor.close();
|
||||
auto lib_path = libDir + "/" + filename;
|
||||
auto *lib = dlopen(lib_path.c_str(), RTLD_LAZY | RTLD_LOCAL);
|
||||
if (lib) {
|
||||
// we found a runtime that we can dlopen, use it.
|
||||
dlclose(lib);
|
||||
|
||||
JsonManifestBuilder builder{"runtime", lib_path};
|
||||
if (hasFunctions) {
|
||||
int result = populateFunctions(context, systemBroker, packageName, builder);
|
||||
if (result != 0) {
|
||||
return result;
|
||||
JsonManifestBuilder builder{"runtime", lib_path};
|
||||
if (hasFunctions) {
|
||||
int result = populateFunctions(context, systemBroker, packageName, builder);
|
||||
if (result != 0) {
|
||||
ALOGW("Unable to populate functions from runtime: %s, checking for more records...", lib_path.c_str());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
virtualManifest = builder.build();
|
||||
cursor.close();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
virtualManifest = builder.build();
|
||||
return 0;
|
||||
// this runtime was not accessible, see if the broker has more runtimes on
|
||||
// offer.
|
||||
ALOGV("Unable to open broker provided runtime at %s, checking for more records...", lib_path.c_str());
|
||||
} while (cursor.moveToNext());
|
||||
|
||||
ALOGE("Unable to open any of the broker provided runtimes.");
|
||||
cursor.close();
|
||||
return -1;
|
||||
}
|
||||
} // namespace openxr_android
|
||||
|
||||
|
|
|
|||
|
|
@ -334,7 +334,7 @@ static XRAPI_ATTR XrResult XRAPI_CALL LoaderXrDestroyInstance(XrInstance instanc
|
|||
return result;
|
||||
}
|
||||
|
||||
const std::unique_ptr<XrGeneratedDispatchTable> &dispatch_table = loader_instance->DispatchTable();
|
||||
const std::unique_ptr<XrGeneratedDispatchTableCore> &dispatch_table = loader_instance->DispatchTable();
|
||||
|
||||
// If we allocated a default debug utils messenger, free it
|
||||
XrDebugUtilsMessengerEXT messenger = loader_instance->DefaultDebugUtilsMessenger();
|
||||
|
|
@ -546,7 +546,7 @@ LoaderTrampolineSessionBeginDebugUtilsLabelRegionEXT(XrSession session, const Xr
|
|||
return result;
|
||||
}
|
||||
LoaderLogger::GetInstance().BeginLabelRegion(session, labelInfo);
|
||||
const std::unique_ptr<XrGeneratedDispatchTable> &dispatch_table = loader_instance->DispatchTable();
|
||||
const std::unique_ptr<XrGeneratedDispatchTableCore> &dispatch_table = loader_instance->DispatchTable();
|
||||
if (nullptr != dispatch_table->SessionBeginDebugUtilsLabelRegionEXT) {
|
||||
return dispatch_table->SessionBeginDebugUtilsLabelRegionEXT(session, labelInfo);
|
||||
}
|
||||
|
|
@ -567,7 +567,7 @@ static XRAPI_ATTR XrResult XRAPI_CALL LoaderTrampolineSessionEndDebugUtilsLabelR
|
|||
}
|
||||
|
||||
LoaderLogger::GetInstance().EndLabelRegion(session);
|
||||
const std::unique_ptr<XrGeneratedDispatchTable> &dispatch_table = loader_instance->DispatchTable();
|
||||
const std::unique_ptr<XrGeneratedDispatchTableCore> &dispatch_table = loader_instance->DispatchTable();
|
||||
if (nullptr != dispatch_table->SessionEndDebugUtilsLabelRegionEXT) {
|
||||
return dispatch_table->SessionEndDebugUtilsLabelRegionEXT(session);
|
||||
}
|
||||
|
|
@ -597,7 +597,7 @@ LoaderTrampolineSessionInsertDebugUtilsLabelEXT(XrSession session, const XrDebug
|
|||
|
||||
LoaderLogger::GetInstance().InsertLabel(session, labelInfo);
|
||||
|
||||
const std::unique_ptr<XrGeneratedDispatchTable> &dispatch_table = loader_instance->DispatchTable();
|
||||
const std::unique_ptr<XrGeneratedDispatchTableCore> &dispatch_table = loader_instance->DispatchTable();
|
||||
if (nullptr != dispatch_table->SessionInsertDebugUtilsLabelEXT) {
|
||||
return dispatch_table->SessionInsertDebugUtilsLabelEXT(session, labelInfo);
|
||||
}
|
||||
|
|
@ -643,7 +643,7 @@ XRAPI_ATTR XrResult XRAPI_CALL LoaderXrTermCreateDebugUtilsMessengerEXT(XrInstan
|
|||
"xrCreateDebugUtilsMessengerEXT", "invalid messenger pointer");
|
||||
return XR_ERROR_VALIDATION_FAILURE;
|
||||
}
|
||||
const XrGeneratedDispatchTable *dispatch_table = RuntimeInterface::GetDispatchTable(instance);
|
||||
const XrGeneratedDispatchTableCore *dispatch_table = RuntimeInterface::GetDispatchTable(instance);
|
||||
XrResult result = XR_SUCCESS;
|
||||
// This extension is supported entirely by the loader which means the runtime may or may not support it.
|
||||
if (nullptr != dispatch_table->CreateDebugUtilsMessengerEXT) {
|
||||
|
|
@ -664,7 +664,7 @@ XRLOADER_ABI_CATCH_FALLBACK
|
|||
|
||||
XRAPI_ATTR XrResult XRAPI_CALL LoaderXrTermDestroyDebugUtilsMessengerEXT(XrDebugUtilsMessengerEXT messenger) XRLOADER_ABI_TRY {
|
||||
LoaderLogger::LogVerboseMessage("xrDestroyDebugUtilsMessengerEXT", "Entering loader terminator");
|
||||
const XrGeneratedDispatchTable *dispatch_table = RuntimeInterface::GetDebugUtilsMessengerDispatchTable(messenger);
|
||||
const XrGeneratedDispatchTableCore *dispatch_table = RuntimeInterface::GetDebugUtilsMessengerDispatchTable(messenger);
|
||||
XrResult result = XR_SUCCESS;
|
||||
LoaderLogger::GetInstance().RemoveLogRecorder(MakeHandleGeneric(messenger));
|
||||
RuntimeInterface::GetRuntime().ForgetDebugMessenger(messenger);
|
||||
|
|
@ -684,7 +684,7 @@ XRAPI_ATTR XrResult XRAPI_CALL LoaderXrTermSubmitDebugUtilsMessageEXT(
|
|||
XrInstance instance, XrDebugUtilsMessageSeverityFlagsEXT messageSeverity, XrDebugUtilsMessageTypeFlagsEXT messageTypes,
|
||||
const XrDebugUtilsMessengerCallbackDataEXT *callbackData) XRLOADER_ABI_TRY {
|
||||
LoaderLogger::LogVerboseMessage("xrSubmitDebugUtilsMessageEXT", "Entering loader terminator");
|
||||
const XrGeneratedDispatchTable *dispatch_table = RuntimeInterface::GetDispatchTable(instance);
|
||||
const XrGeneratedDispatchTableCore *dispatch_table = RuntimeInterface::GetDispatchTable(instance);
|
||||
XrResult result = XR_SUCCESS;
|
||||
if (nullptr != dispatch_table->SubmitDebugUtilsMessageEXT) {
|
||||
result = dispatch_table->SubmitDebugUtilsMessageEXT(instance, messageSeverity, messageTypes, callbackData);
|
||||
|
|
@ -701,7 +701,7 @@ XRLOADER_ABI_CATCH_FALLBACK
|
|||
XRAPI_ATTR XrResult XRAPI_CALL
|
||||
LoaderXrTermSetDebugUtilsObjectNameEXT(XrInstance instance, const XrDebugUtilsObjectNameInfoEXT *nameInfo) XRLOADER_ABI_TRY {
|
||||
LoaderLogger::LogVerboseMessage("xrSetDebugUtilsObjectNameEXT", "Entering loader terminator");
|
||||
const XrGeneratedDispatchTable *dispatch_table = RuntimeInterface::GetDispatchTable(instance);
|
||||
const XrGeneratedDispatchTableCore *dispatch_table = RuntimeInterface::GetDispatchTable(instance);
|
||||
XrResult result = XR_SUCCESS;
|
||||
if (nullptr != dispatch_table->SetDebugUtilsObjectNameEXT) {
|
||||
result = dispatch_table->SetDebugUtilsObjectNameEXT(instance, nameInfo);
|
||||
|
|
|
|||
|
|
@ -278,12 +278,12 @@ LoaderInstance::LoaderInstance(XrInstance instance, const XrInstanceCreateInfo*
|
|||
: _runtime_instance(instance),
|
||||
_topmost_gipa(topmost_gipa),
|
||||
_api_layer_interfaces(std::move(api_layer_interfaces)),
|
||||
_dispatch_table(new XrGeneratedDispatchTable{}) {
|
||||
_dispatch_table(new XrGeneratedDispatchTableCore{}) {
|
||||
for (uint32_t ext = 0; ext < create_info->enabledExtensionCount; ++ext) {
|
||||
_enabled_extensions.push_back(create_info->enabledExtensionNames[ext]);
|
||||
}
|
||||
|
||||
GeneratedXrPopulateDispatchTable(_dispatch_table.get(), instance, topmost_gipa);
|
||||
GeneratedXrPopulateDispatchTableCore(_dispatch_table.get(), instance, topmost_gipa);
|
||||
}
|
||||
|
||||
LoaderInstance::~LoaderInstance() {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include <vector>
|
||||
|
||||
class ApiLayerInterface;
|
||||
struct XrGeneratedDispatchTable;
|
||||
struct XrGeneratedDispatchTableCore;
|
||||
class LoaderInstance;
|
||||
|
||||
// Manage the single loader instance that is available.
|
||||
|
|
@ -54,7 +54,7 @@ class LoaderInstance {
|
|||
virtual ~LoaderInstance();
|
||||
|
||||
XrInstance GetInstanceHandle() { return _runtime_instance; }
|
||||
const std::unique_ptr<XrGeneratedDispatchTable>& DispatchTable() { return _dispatch_table; }
|
||||
const std::unique_ptr<XrGeneratedDispatchTableCore>& DispatchTable() { return _dispatch_table; }
|
||||
std::vector<std::unique_ptr<ApiLayerInterface>>& LayerInterfaces() { return _api_layer_interfaces; }
|
||||
bool ExtensionIsEnabled(const std::string& extension);
|
||||
XrDebugUtilsMessengerEXT DefaultDebugUtilsMessenger() { return _messenger; }
|
||||
|
|
@ -71,7 +71,7 @@ class LoaderInstance {
|
|||
std::vector<std::string> _enabled_extensions;
|
||||
std::vector<std::unique_ptr<ApiLayerInterface>> _api_layer_interfaces;
|
||||
|
||||
std::unique_ptr<XrGeneratedDispatchTable> _dispatch_table;
|
||||
std::unique_ptr<XrGeneratedDispatchTableCore> _dispatch_table;
|
||||
// Internal debug messenger created during xrCreateInstance
|
||||
XrDebugUtilsMessengerEXT _messenger{XR_NULL_HANDLE};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -75,11 +75,12 @@ static inline bool StringEndsWith(const std::string &value, const std::string &e
|
|||
}
|
||||
|
||||
// If the file found is a manifest file name, add it to the out_files manifest list.
|
||||
static void AddIfJson(const std::string &full_file, std::vector<std::string> &manifest_files) {
|
||||
static bool AddIfJson(const std::string &full_file, std::vector<std::string> &manifest_files) {
|
||||
if (full_file.empty() || !StringEndsWith(full_file, ".json")) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
manifest_files.push_back(full_file);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check the current path for any manifest files. If the provided search_path is a directory, look for
|
||||
|
|
@ -381,7 +382,6 @@ static void ReadRuntimeDataFilesInRegistry(const std::string &runtime_registry_l
|
|||
if (ERROR_SUCCESS != open_value) {
|
||||
LoaderLogger::LogWarningMessage("",
|
||||
"ReadRuntimeDataFilesInRegistry - failed to open registry key " + full_registry_location);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -391,7 +391,23 @@ static void ReadRuntimeDataFilesInRegistry(const std::string &runtime_registry_l
|
|||
LoaderLogger::LogWarningMessage(
|
||||
"", "ReadRuntimeDataFilesInRegistry - failed to read registry value " + default_runtime_value_name);
|
||||
} else {
|
||||
AddFilesInPath(wide_to_utf8(value_w), false, manifest_files);
|
||||
// Not using AddFilesInPath here (as only api_layer manifest paths allow multiple
|
||||
// separated paths)
|
||||
// Small time-of-check vs time-of-use issue here but it mainly only affects the error message.
|
||||
// It does not introduce a security defect.
|
||||
std::string activeRuntimePath = wide_to_utf8(value_w);
|
||||
if (FileSysUtilsIsRegularFile(activeRuntimePath)) {
|
||||
// If the file exists, try to add it
|
||||
std::string absolute_path;
|
||||
FileSysUtilsGetAbsolutePath(activeRuntimePath, absolute_path);
|
||||
if (!AddIfJson(absolute_path, manifest_files)) {
|
||||
LoaderLogger::LogErrorMessage(
|
||||
"", "ReadRuntimeDataFilesInRegistry - registry runtime path is not json " + activeRuntimePath);
|
||||
}
|
||||
} else {
|
||||
LoaderLogger::LogErrorMessage(
|
||||
"", "ReadRuntimeDataFilesInRegistry - registry runtime path does not exist " + activeRuntimePath);
|
||||
}
|
||||
}
|
||||
|
||||
RegCloseKey(hkey);
|
||||
|
|
@ -757,8 +773,7 @@ void ApiLayerManifestFile::AddManifestFilesAndroid(const std::string &openxr_com
|
|||
}
|
||||
std::istringstream json_stream(std::string{buf, length});
|
||||
|
||||
CreateIfValid(ManifestFileType::MANIFEST_TYPE_EXPLICIT_API_LAYER, filename, json_stream,
|
||||
&ApiLayerManifestFile::LocateLibraryInAssets, manifest_files);
|
||||
CreateIfValid(type, filename, json_stream, &ApiLayerManifestFile::LocateLibraryInAssets, manifest_files);
|
||||
}
|
||||
}
|
||||
#endif // defined(XR_USE_PLATFORM_ANDROID) && defined(XR_KHR_LOADER_INIT_SUPPORT)
|
||||
|
|
|
|||
|
|
@ -126,6 +126,10 @@ XrResult RuntimeInterface::TryLoadingSingleRuntime(const std::string& openxr_com
|
|||
XrResult res = XR_ERROR_RUNTIME_FAILURE;
|
||||
if (nullptr != negotiate) {
|
||||
res = negotiate(&loader_info, &runtime_info);
|
||||
} else {
|
||||
std::string error_message = "RuntimeInterface::LoadRuntime failed to find negotiate function ";
|
||||
error_message += function_name;
|
||||
LoaderLogger::LogErrorMessage(openxr_command, error_message);
|
||||
}
|
||||
// If we supposedly succeeded, but got a nullptr for GetInstanceProcAddr
|
||||
// then something still went wrong, so return with an error.
|
||||
|
|
@ -270,8 +274,8 @@ XrResult RuntimeInterface::GetInstanceProcAddr(XrInstance instance, const char*
|
|||
return GetInstance()->_get_instance_proc_addr(instance, name, function);
|
||||
}
|
||||
|
||||
const XrGeneratedDispatchTable* RuntimeInterface::GetDispatchTable(XrInstance instance) {
|
||||
XrGeneratedDispatchTable* table = nullptr;
|
||||
const XrGeneratedDispatchTableCore* RuntimeInterface::GetDispatchTable(XrInstance instance) {
|
||||
XrGeneratedDispatchTableCore* table = nullptr;
|
||||
std::lock_guard<std::mutex> mlock(GetInstance()->_dispatch_table_mutex);
|
||||
auto it = GetInstance()->_dispatch_table_map.find(instance);
|
||||
if (it != GetInstance()->_dispatch_table_map.end()) {
|
||||
|
|
@ -280,7 +284,7 @@ const XrGeneratedDispatchTable* RuntimeInterface::GetDispatchTable(XrInstance in
|
|||
return table;
|
||||
}
|
||||
|
||||
const XrGeneratedDispatchTable* RuntimeInterface::GetDebugUtilsMessengerDispatchTable(XrDebugUtilsMessengerEXT messenger) {
|
||||
const XrGeneratedDispatchTableCore* RuntimeInterface::GetDebugUtilsMessengerDispatchTable(XrDebugUtilsMessengerEXT messenger) {
|
||||
XrInstance runtime_instance = XR_NULL_HANDLE;
|
||||
{
|
||||
std::lock_guard<std::mutex> mlock(GetInstance()->_messenger_to_instance_mutex);
|
||||
|
|
@ -349,8 +353,8 @@ XrResult RuntimeInterface::CreateInstance(const XrInstanceCreateInfo* info, XrIn
|
|||
res = rt_xrCreateInstance(info, instance);
|
||||
if (XR_SUCCEEDED(res)) {
|
||||
create_succeeded = true;
|
||||
std::unique_ptr<XrGeneratedDispatchTable> dispatch_table(new XrGeneratedDispatchTable());
|
||||
GeneratedXrPopulateDispatchTable(dispatch_table.get(), *instance, _get_instance_proc_addr);
|
||||
std::unique_ptr<XrGeneratedDispatchTableCore> dispatch_table(new XrGeneratedDispatchTableCore());
|
||||
GeneratedXrPopulateDispatchTableCore(dispatch_table.get(), *instance, _get_instance_proc_addr);
|
||||
std::lock_guard<std::mutex> mlock(_dispatch_table_mutex);
|
||||
_dispatch_table_map[*instance] = std::move(dispatch_table);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class Value;
|
|||
}
|
||||
|
||||
class RuntimeManifestFile;
|
||||
struct XrGeneratedDispatchTable;
|
||||
struct XrGeneratedDispatchTableCore;
|
||||
|
||||
class RuntimeInterface {
|
||||
public:
|
||||
|
|
@ -37,8 +37,8 @@ class RuntimeInterface {
|
|||
static XrResult GetInstanceProcAddr(XrInstance instance, const char* name, PFN_xrVoidFunction* function);
|
||||
|
||||
// Get the direct dispatch table to this runtime, without API layers or loader terminators.
|
||||
static const XrGeneratedDispatchTable* GetDispatchTable(XrInstance instance);
|
||||
static const XrGeneratedDispatchTable* GetDebugUtilsMessengerDispatchTable(XrDebugUtilsMessengerEXT messenger);
|
||||
static const XrGeneratedDispatchTableCore* GetDispatchTable(XrInstance instance);
|
||||
static const XrGeneratedDispatchTableCore* GetDebugUtilsMessengerDispatchTable(XrDebugUtilsMessengerEXT messenger);
|
||||
|
||||
void GetInstanceExtensionProperties(std::vector<XrExtensionProperties>& extension_properties);
|
||||
bool SupportsExtension(const std::string& extension_name);
|
||||
|
|
@ -66,7 +66,7 @@ class RuntimeInterface {
|
|||
|
||||
LoaderPlatformLibraryHandle _runtime_library;
|
||||
PFN_xrGetInstanceProcAddr _get_instance_proc_addr;
|
||||
std::unordered_map<XrInstance, std::unique_ptr<XrGeneratedDispatchTable>> _dispatch_table_map;
|
||||
std::unordered_map<XrInstance, std::unique_ptr<XrGeneratedDispatchTableCore>> _dispatch_table_map;
|
||||
std::mutex _dispatch_table_mutex;
|
||||
std::unordered_map<XrDebugUtilsMessengerEXT, XrInstance> _messenger_to_instance_map;
|
||||
std::mutex _messenger_to_instance_mutex;
|
||||
|
|
|
|||
|
|
@ -697,4 +697,17 @@ extern "C" LOADER_EXPORT XRAPI_ATTR XrResult XRAPI_CALL xrStopHapticFeedback(
|
|||
}
|
||||
XRLOADER_ABI_CATCH_FALLBACK
|
||||
|
||||
extern "C" LOADER_EXPORT XRAPI_ATTR XrResult XRAPI_CALL xrLocateSpaces(
|
||||
XrSession session,
|
||||
const XrSpacesLocateInfo* locateInfo,
|
||||
XrSpaceLocations* spaceLocations) XRLOADER_ABI_TRY {
|
||||
LoaderInstance* loader_instance;
|
||||
XrResult result = ActiveLoaderInstance::Get(&loader_instance, "xrLocateSpaces");
|
||||
if (XR_SUCCEEDED(result)) {
|
||||
result = loader_instance->DispatchTable()->LocateSpaces(session, locateInfo, spaceLocations);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
XRLOADER_ABI_CATCH_FALLBACK
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -245,6 +245,10 @@ extern "C" LOADER_EXPORT XRAPI_ATTR XrResult XRAPI_CALL xrApplyHapticFeedback(
|
|||
extern "C" LOADER_EXPORT XRAPI_ATTR XrResult XRAPI_CALL xrStopHapticFeedback(
|
||||
XrSession session,
|
||||
const XrHapticActionInfo* hapticActionInfo);
|
||||
extern "C" LOADER_EXPORT XRAPI_ATTR XrResult XRAPI_CALL xrLocateSpaces(
|
||||
XrSession session,
|
||||
const XrSpacesLocateInfo* locateInfo,
|
||||
XrSpaceLocations* spaceLocations);
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
// Helper function to populate an instance dispatch table
|
||||
void GeneratedXrPopulateDispatchTable(struct XrGeneratedDispatchTable *table,
|
||||
void GeneratedXrPopulateDispatchTableCore(struct XrGeneratedDispatchTableCore *table,
|
||||
XrInstance instance,
|
||||
PFN_xrGetInstanceProcAddr get_inst_proc_addr) {
|
||||
|
||||
|
|
@ -96,6 +96,9 @@ void GeneratedXrPopulateDispatchTable(struct XrGeneratedDispatchTable *table,
|
|||
(get_inst_proc_addr(instance, "xrApplyHapticFeedback", (PFN_xrVoidFunction*)&table->ApplyHapticFeedback));
|
||||
(get_inst_proc_addr(instance, "xrStopHapticFeedback", (PFN_xrVoidFunction*)&table->StopHapticFeedback));
|
||||
|
||||
// ---- Core 1.1 commands
|
||||
(get_inst_proc_addr(instance, "xrLocateSpaces", (PFN_xrVoidFunction*)&table->LocateSpaces));
|
||||
|
||||
// ---- XR_EXT_debug_utils extension commands
|
||||
(get_inst_proc_addr(instance, "xrSetDebugUtilsObjectNameEXT", (PFN_xrVoidFunction*)&table->SetDebugUtilsObjectNameEXT));
|
||||
(get_inst_proc_addr(instance, "xrCreateDebugUtilsMessengerEXT", (PFN_xrVoidFunction*)&table->CreateDebugUtilsMessengerEXT));
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
// Generated dispatch table
|
||||
struct XrGeneratedDispatchTable {
|
||||
struct XrGeneratedDispatchTableCore {
|
||||
|
||||
// ---- Core 1.0 commands
|
||||
PFN_xrGetInstanceProcAddr GetInstanceProcAddr;
|
||||
|
|
@ -97,6 +97,9 @@ struct XrGeneratedDispatchTable {
|
|||
PFN_xrApplyHapticFeedback ApplyHapticFeedback;
|
||||
PFN_xrStopHapticFeedback StopHapticFeedback;
|
||||
|
||||
// ---- Core 1.1 commands
|
||||
PFN_xrLocateSpaces LocateSpaces;
|
||||
|
||||
// ---- XR_EXT_debug_utils extension commands
|
||||
PFN_xrSetDebugUtilsObjectNameEXT SetDebugUtilsObjectNameEXT;
|
||||
PFN_xrCreateDebugUtilsMessengerEXT CreateDebugUtilsMessengerEXT;
|
||||
|
|
@ -109,7 +112,7 @@ struct XrGeneratedDispatchTable {
|
|||
|
||||
|
||||
// Prototype for dispatch table helper function
|
||||
void GeneratedXrPopulateDispatchTable(struct XrGeneratedDispatchTable *table,
|
||||
void GeneratedXrPopulateDispatchTableCore(struct XrGeneratedDispatchTableCore *table,
|
||||
XrInstance instance,
|
||||
PFN_xrGetInstanceProcAddr get_inst_proc_addr);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue