Skip to content

Commit 4dd29bc

Browse files
quic-dengkailrpavlik
authored andcommitted
OpenXR loader: Propagate runtime info source
1 parent ea89384 commit 4dd29bc

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

src/loader/loader_init_data.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <json/value.h>
1717
#include <android/asset_manager_jni.h>
1818
#include "android_utilities.h"
19+
#include "manifest_file.hpp"
1920
#endif // XR_USE_PLATFORM_ANDROID
2021

2122
#ifdef XR_KHR_LOADER_INIT_SUPPORT
@@ -84,7 +85,9 @@ class LoaderInitData {
8485
XrResult InitializeLoaderInitData(const XrLoaderInitInfoBaseHeaderKHR* loaderInitInfo);
8586

8687
#ifdef XR_USE_PLATFORM_ANDROID
87-
XrResult GetPlatformRuntimeVirtualManifest(Json::Value& out_manifest);
88+
89+
//! Modifies @p out_manifest and @p out_runtime_source only if returning successfully
90+
XrResult GetPlatformRuntimeVirtualManifest(Json::Value& out_manifest, ManifestFileSource& out_runtime_source);
8891
std::string GetAndroidNativeLibraryDir();
8992
void* Android_Get_Asset_Manager();
9093
#endif // XR_USE_PLATFORM_ANDROID

src/loader/manifest_file.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,8 @@ XrResult RuntimeManifestFile::FindManifestFiles(const std::string &openxr_comman
682682

683683
#if defined(XR_KHR_LOADER_INIT_SUPPORT) && defined(XR_USE_PLATFORM_ANDROID)
684684
Json::Value virtualManifest;
685-
result = GetPlatformRuntimeVirtualManifest(virtualManifest);
685+
ManifestFileSource runtimeSource = ManifestFileSource::FROM_JSON_MANIFEST;
686+
result = GetPlatformRuntimeVirtualManifest(virtualManifest, runtimeSource);
686687
if (XR_SUCCESS == result) {
687688
RuntimeManifestFile::CreateIfValid(virtualManifest, "", manifest_files);
688689
return result;

src/loader/manifest_file.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ enum ManifestFileType {
2828
MANIFEST_TYPE_EXPLICIT_API_LAYER,
2929
};
3030

31+
//! Where did the data for this manifest file (may be virtual) come from?
32+
enum ManifestFileSource {
33+
//! An actual json file on a file system
34+
FROM_JSON_MANIFEST = 0,
35+
//! The installable runtime broker on Android
36+
FROM_INSTALLABLE_BROKER,
37+
//! The system runtime broker on Android
38+
FROM_SYSTEM_BROKER,
39+
};
40+
3141
struct JsonVersion {
3242
uint32_t major;
3343
uint32_t minor;

src/loader/runtime_interface.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#endif // XR_USE_PLATFORM_ANDROID
3636

3737
#if defined(XR_KHR_LOADER_INIT_SUPPORT) && defined(XR_USE_PLATFORM_ANDROID)
38-
XrResult GetPlatformRuntimeVirtualManifest(Json::Value& out_manifest) {
38+
XrResult GetPlatformRuntimeVirtualManifest(Json::Value& out_manifest, ManifestFileSource& out_runtime_source) {
3939
using wrap::android::content::Context;
4040
auto& initData = LoaderInitData::instance();
4141
if (!initData.initialized()) {
@@ -50,6 +50,11 @@ XrResult GetPlatformRuntimeVirtualManifest(Json::Value& out_manifest) {
5050
if (0 != openxr_android::getActiveRuntimeVirtualManifest(context, virtualManifest, systemBroker)) {
5151
return XR_ERROR_INITIALIZATION_FAILED;
5252
}
53+
if (systemBroker) {
54+
out_runtime_source = ManifestFileSource::FROM_SYSTEM_BROKER;
55+
} else {
56+
out_runtime_source = ManifestFileSource::FROM_INSTALLABLE_BROKER;
57+
}
5358
out_manifest = virtualManifest;
5459
return XR_SUCCESS;
5560
}

0 commit comments

Comments
 (0)