The open source OpenXR runtime

st/oxr: Implement loader init extension.

+51
+6
src/xrt/state_trackers/oxr/oxr_api_funcs.h
··· 50 50 * 51 51 */ 52 52 53 + #ifdef OXR_HAVE_KHR_loader_init 54 + //! OpenXR API function @ep{xrInitializeLoaderKHR} 55 + XRAPI_ATTR XrResult XRAPI_CALL 56 + oxr_xrInitializeLoaderKHR(const XrLoaderInitInfoBaseHeaderKHR *loaderInitInfo); 57 + #endif // OXR_HAVE_KHR_loader_init 58 + 53 59 //! OpenXR API function @ep{xrEnumerateInstanceExtensionProperties} 54 60 XRAPI_ATTR XrResult XRAPI_CALL 55 61 oxr_xrEnumerateInstanceExtensionProperties(const char *layerName,
+41
src/xrt/state_trackers/oxr/oxr_api_instance.c
··· 21 21 #include "oxr_api_funcs.h" 22 22 #include "oxr_api_verify.h" 23 23 24 + 25 + #ifdef XRT_OS_ANDROID 26 + #include "android/android_globals.h" 27 + #endif 28 + 24 29 #include "openxr/openxr.h" 25 30 #include "openxr/openxr_reflection.h" 26 31 ··· 48 53 OXR_TWO_CALL_HELPER(&log, propertyCapacityInput, propertyCountOutput, properties, 49 54 ARRAY_SIZE(extension_properties), extension_properties, XR_SUCCESS); 50 55 } 56 + 57 + #ifdef OXR_HAVE_KHR_loader_init 58 + XrResult 59 + oxr_xrInitializeLoaderKHR(const XrLoaderInitInfoBaseHeaderKHR *loaderInitInfo) 60 + { 61 + struct oxr_logger log; 62 + oxr_log_init(&log, "oxr_xrInitializeLoaderKHR"); 63 + 64 + 65 + oxr_log(&log, "Loader forwarded call to xrInitializeLoaderKHR."); 66 + #ifdef XRT_OS_ANDROID 67 + const XrLoaderInitInfoAndroidKHR *initInfoAndroid = 68 + OXR_GET_INPUT_FROM_CHAIN(loaderInitInfo, XR_TYPE_LOADER_INIT_INFO_ANDROID_KHR, XrLoaderInitInfoAndroidKHR); 69 + if (initInfoAndroid == NULL) { 70 + return oxr_error(&log, XR_ERROR_VALIDATION_FAILURE, 71 + "(loaderInitInfo) " 72 + "Did not find XrLoaderInitInfoAndroidKHR"); 73 + } 74 + if (initInfoAndroid->applicationVM == NULL) { 75 + return oxr_error(&log, XR_ERROR_VALIDATION_FAILURE, 76 + "(initInfoAndroid->applicationVM) " 77 + "applicationVM must be populated"); 78 + } 79 + if (initInfoAndroid->applicationContext == NULL) { 80 + return oxr_error(&log, XR_ERROR_VALIDATION_FAILURE, 81 + "(initInfoAndroid->applicationContext) " 82 + "applicationContext must be populated"); 83 + } 84 + //! @todo check that applicationContext is in fact an Activity. 85 + android_globals_store_vm_and_context(initInfoAndroid->applicationVM, initInfoAndroid->applicationContext); 86 + 87 + #endif // XRT_OS_ANDROID 88 + return XR_SUCCESS; 89 + } 90 + #endif // OXR_HAVE_KHR_loader_init 91 + 51 92 52 93 #ifdef XRT_OS_ANDROID 53 94 static XrResult
+4
src/xrt/state_trackers/oxr/oxr_api_negotiate.c
··· 276 276 ENTRY(xrEnumerateInstanceExtensionProperties); 277 277 ENTRY(xrEnumerateApiLayerProperties); 278 278 279 + #ifdef OXR_HAVE_KHR_loader_init 280 + ENTRY(xrInitializeLoaderKHR); 281 + #endif // OXR_HAVE_KHR_loader_init 282 + 279 283 /* 280 284 * This is fine to log, since there should not be other 281 285 * null-instance calls.