17 #define _OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, THING, name, \ 20 oxr_log_init(log, name); \ 21 if ((void *)thing == NULL) { \ 22 return oxr_error(log, XR_ERROR_HANDLE_INVALID, \ 23 "(" #thing " == NULL)"); \ 25 new_thing = (__typeof__(new_thing))thing; \ 26 if (new_thing->handle.debug != OXR_XR_DEBUG_##THING) { \ 27 return oxr_error(log, XR_ERROR_HANDLE_INVALID, \ 28 "(" #thing " == %p)", \ 31 if (new_thing->handle.state != OXR_HANDLE_STATE_LIVE) { \ 32 return oxr_error(log, XR_ERROR_HANDLE_INVALID, \ 33 " state == %s (" #thing " == %p)", \ 34 oxr_handle_state_to_string( \ 35 new_thing->handle.state), \ 38 oxr_log_set_instance(log, lookup); \ 41 #define _OXR_VERIFY_SET(log, arg, new_arg, THING) \ 43 if ((void *)arg == NULL) { \ 44 return oxr_error(log, XR_ERROR_HANDLE_INVALID, \ 45 "(" #arg " == NULL)"); \ 47 new_arg = (__typeof__(new_arg))arg; \ 48 if (new_arg->handle.debug != OXR_XR_DEBUG_##THING) { \ 49 return oxr_error(log, XR_ERROR_HANDLE_INVALID, \ 50 "(" #arg " == %p)", (void *)new_arg); \ 61 #define OXR_VERIFY_INSTANCE_AND_INIT_LOG(log, thing, new_thing, name) \ 62 _OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, INSTANCE, name, new_thing) 63 #define OXR_VERIFY_MESSENGER_AND_INIT_LOG(log, thing, new_thing, name) \ 64 _OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, MESSENGER, name, new_thing->inst) 65 #define OXR_VERIFY_SESSION_AND_INIT_LOG(log, thing, new_thing, name) \ 66 _OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, SESSION, name, new_thing->sys->inst) 67 #define OXR_VERIFY_SPACE_AND_INIT_LOG(log, thing, new_thing, name) \ 68 _OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, SPACE, name, new_thing->sess->sys->inst) 69 #define OXR_VERIFY_ACTION_AND_INIT_LOG(log, thing, new_thing, name) \ 70 _OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, ACTION, name, new_thing->act_set->inst) 71 #define OXR_VERIFY_SWAPCHAIN_AND_INIT_LOG(log, thing, new_thing, name) \ 72 _OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, SWAPCHAIN, name, new_thing->sess->sys->inst) 73 #define OXR_VERIFY_ACTIONSET_AND_INIT_LOG(log, thing, new_thing, name) \ 74 _OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, ACTIONSET, name, new_thing->inst) 76 #define OXR_VERIFY_INSTANCE_NOT_NULL(log, arg, new_arg) _OXR_VERIFY_SET(log, arg, new_arg, INSTANCE); 77 #define OXR_VERIFY_MESSENGER_NOT_NULL(log, arg, new_arg) _OXR_VERIFY_SET(log, arg, new_arg, MESSENGER); 78 #define OXR_VERIFY_SESSION_NOT_NULL(log, arg, new_arg) _OXR_VERIFY_SET(log, arg, new_arg, SESSION); 79 #define OXR_VERIFY_SPACE_NOT_NULL(log, arg, new_arg) _OXR_VERIFY_SET(log, arg, new_arg, SPACE); 80 #define OXR_VERIFY_ACTION_NOT_NULL(log, arg, new_arg) _OXR_VERIFY_SET(log, arg, new_arg, ACTION); 81 #define OXR_VERIFY_SWAPCHAIN_NOT_NULL(log, arg, new_arg) _OXR_VERIFY_SET(log, arg, new_arg, SWAPCHAIN); 82 #define OXR_VERIFY_ACTIONSET_NOT_NULL(log, arg, new_arg) _OXR_VERIFY_SET(log, arg, new_arg, ACTIONSET); 90 #define OXR_VERIFY_EXTENSION(log, inst, mixed_case_name) \ 92 if (!(inst)->extensions.mixed_case_name) { \ 93 return oxr_error((log), XR_ERROR_FUNCTION_UNSUPPORTED, \ 94 " Requires XR_" #mixed_case_name \ 95 " extension enabled"); \ 99 #define OXR_VERIFY_ARG_NOT_NULL(log, arg) \ 102 return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \ 103 "(" #arg " == NULL)"); \ 107 #define OXR_VERIFY_ARG_NOT_ZERO(log, arg) \ 110 return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \ 111 "(" #arg " == 0) must be non-zero"); \ 115 #define OXR_VERIFY_ARG_TYPE_CAN_BE_NULL(log, arg, type_enum) \ 117 if (arg != NULL && arg->type != type_enum) { \ 118 return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \ 119 "(" #arg "->type == %u)", arg->type); \ 123 #define OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(log, arg, type_enum) \ 126 return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \ 127 "(" #arg " == NULL)"); \ 129 OXR_VERIFY_ARG_TYPE_CAN_BE_NULL(log, arg, type_enum); \ 132 #define OXR_VERIFY_SUBACTION_PATHS(log, count, paths) \ 134 if (count > 0 && paths == NULL) { \ 135 return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \ 136 " " #count " is not zero but " #paths \ 141 #define OXR_VERIFY_ARG_SINGLE_LEVEL_FIXED_LENGTH_PATH(log, path) \ 143 XrResult verify_ret = oxr_verify_fixed_size_single_level_path( \ 144 log, path, ARRAY_SIZE(path), #path); \ 145 if (verify_ret != XR_SUCCESS) { \ 150 #define OXR_VERIFY_ARG_LOCALIZED_NAME(log, string) \ 152 XrResult verify_ret = oxr_verify_localized_name( \ 153 log, string, ARRAY_SIZE(string), #string); \ 154 if (verify_ret != XR_SUCCESS) { \ 159 #define OXR_VERIFY_POSE(log, p) \ 161 if (!math_quat_validate((struct xrt_quat *)&p.orientation)) { \ 162 return oxr_error(log, XR_ERROR_POSE_INVALID, \ 164 ".orientation) is not a valid quat"); \ 167 if (!math_vec3_validate((struct xrt_vec3 *)&p.position)) { \ 168 return oxr_error(log, XR_ERROR_POSE_INVALID, \ 169 "(" #p ".position) is not valid"); \ 219 uint32_t countSubactionPaths,
220 const XrPath *subactionPaths,
221 const char *variable);
241 const char *variable);
246 const XrSessionCreateInfo *);
248 #if defined(XR_USE_PLATFORM_XLIB) && defined(XR_USE_GRAPHICS_API_OPENGL) 251 struct oxr_logger *,
const XrGraphicsBindingOpenGLXlibKHR *);
252 #endif // defined(XR_USE_PLATFORM_XLIB) && defined(XR_USE_GRAPHICS_API_OPENGL) 254 #if defined(XR_USE_GRAPHICS_API_VULKAN) 257 const XrGraphicsBindingVulkanKHR *);
258 #endif // defined(XR_USE_GRAPHICS_API_VULKAN) 260 #if defined(XR_USE_PLATFORM_EGL) && defined(XR_USE_GRAPHICS_API_OPENGL) 262 oxr_verify_XrGraphicsBindingEGLMND(
struct oxr_logger *log,
263 const XrGraphicsBindingEGLMND *next);
264 #endif // defined(XR_USE_PLATFORM_EGL) && defined(XR_USE_GRAPHICS_API_OPENGL) XrResult oxr_verify_localized_name(struct oxr_logger *, const char *string, uint32_t array_size, const char *name)
Verify an arbitrary UTF-8 string that sits inside of a fixed sized array.
Definition: oxr_verify.c:102
XrResult oxr_verify_subaction_paths_create(struct oxr_logger *log, struct oxr_instance *inst, uint32_t countSubactionPaths, const XrPath *subactionPaths, const char *variable)
Verify a set of subaction paths for action creation.
Definition: oxr_verify.c:353
XrResult oxr_verify_subaction_path_get(struct oxr_logger *log, struct oxr_instance *inst, XrPath path, const struct oxr_sub_paths *act_sub_paths, struct oxr_sub_paths *out_sub_paths, const char *variable)
Verify a set of subaction paths for action state get.
Definition: oxr_verify.c:397
XrResult oxr_verify_fixed_size_single_level_path(struct oxr_logger *, const char *path, uint32_t array_size, const char *name)
Verify a single path level that sits inside of a fixed sized array.
Definition: oxr_verify.c:62
XrResult oxr_verify_XrGraphicsBindingVulkanKHR(struct oxr_logger *, const XrGraphicsBindingVulkanKHR *)
Definition: oxr_verify.c:566
Logger struct that lives on the stack, one for each call client call.
Definition: oxr_logger.h:36
XrResult oxr_verify_full_path(struct oxr_logger *log, const char *path, size_t length, const char *name)
Verify a full path.
Definition: oxr_verify.c:154
XrResult oxr_verify_subaction_path_sync(struct oxr_logger *log, struct oxr_instance *inst, XrPath path, uint32_t index)
Verify a set of subaction paths for action sync.
Definition: oxr_verify.c:375
To carry around a sementic selection of sub action paths.
Definition: oxr_objects.h:1073
XrResult oxr_verify_full_path_c(struct oxr_logger *log, const char *path, const char *name)
Definition: oxr_verify.c:136
XrResult oxr_verify_XrSessionCreateInfo(struct oxr_logger *, const struct oxr_instance *, const XrSessionCreateInfo *)
Definition: oxr_verify.c:458
XrResult oxr_verify_XrGraphicsBindingOpenGLXlibKHR(struct oxr_logger *, const XrGraphicsBindingOpenGLXlibKHR *)
Definition: oxr_verify.c:533
struct oxr_instance * inst
Definition: oxr_logger.h:38
Main object that ties everything together.
Definition: oxr_objects.h:899