xrt: rename OXR_VERIFY_ARG_TYPE_AND_NULL to …_NOT_NULL

This commit is contained in:
Simon Ser 2019-11-05 10:15:33 +01:00
parent 072e9afb54
commit 1b51db68f9
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
8 changed files with 73 additions and 65 deletions

View file

@ -31,7 +31,8 @@ oxr_xrSyncActions(XrSession session, const XrActionsSyncInfo *syncInfo)
struct oxr_session *sess;
struct oxr_logger log;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess, "xrSyncActions");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, syncInfo, XR_TYPE_ACTIONS_SYNC_INFO);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, syncInfo,
XR_TYPE_ACTIONS_SYNC_INFO);
if (syncInfo->countActiveActionSets == 0) {
return oxr_error(&log, XR_ERROR_VALIDATION_FAILURE,
@ -60,8 +61,8 @@ oxr_xrAttachSessionActionSets(XrSession session,
struct oxr_logger log;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrAttachSessionActionSets");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, bindInfo,
XR_TYPE_SESSION_ACTION_SETS_ATTACH_INFO);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(
&log, bindInfo, XR_TYPE_SESSION_ACTION_SETS_ATTACH_INFO);
for (uint32_t i = 0; i < bindInfo->countActionSets; i++) {
struct oxr_action_set *act_set = NULL;
@ -81,7 +82,7 @@ oxr_xrSuggestInteractionProfileBindings(
struct oxr_logger log;
OXR_VERIFY_INSTANCE_AND_INIT_LOG(&log, instance, inst,
"xrSuggestInteractionProfileBindings");
OXR_VERIFY_ARG_TYPE_AND_NULL(
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(
&log, suggestedBindings,
XR_TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING);
@ -109,8 +110,8 @@ oxr_xrGetCurrentInteractionProfile(
struct oxr_logger log;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrGetCurrentInteractionProfile");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, interactionProfile,
XR_TYPE_INTERACTION_PROFILE_STATE);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, interactionProfile,
XR_TYPE_INTERACTION_PROFILE_STATE);
/* XXX: How do we return XR_SESSION_LOSS_PENDING here? */
return oxr_action_get_current_interaction_profile(
@ -154,8 +155,8 @@ oxr_xrCreateActionSet(XrInstance instance,
XrResult ret;
OXR_VERIFY_INSTANCE_AND_INIT_LOG(&log, instance, inst,
"xrCreateActionSet");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, createInfo,
XR_TYPE_ACTION_SET_CREATE_INFO);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, createInfo,
XR_TYPE_ACTION_SET_CREATE_INFO);
OXR_VERIFY_ARG_NOT_NULL(&log, actionSet);
OXR_VERIFY_ARG_SINGLE_LEVEL_FIXED_LENGTH_PATH(
&log, createInfo->actionSetName);
@ -201,8 +202,8 @@ oxr_xrCreateAction(XrActionSet actionSet,
OXR_VERIFY_ACTIONSET_AND_INIT_LOG(&log, actionSet, act_set,
"xrCreateAction");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, createInfo,
XR_TYPE_ACTION_CREATE_INFO);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, createInfo,
XR_TYPE_ACTION_CREATE_INFO);
OXR_VERIFY_ARG_SINGLE_LEVEL_FIXED_LENGTH_PATH(&log,
createInfo->actionName);
OXR_VERIFY_ARG_LOCALIZED_NAME(&log, createInfo->localizedActionName);
@ -249,9 +250,10 @@ oxr_xrGetActionStateBoolean(XrSession session,
XrResult ret;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrGetActionStateBoolean");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, data, XR_TYPE_ACTION_STATE_BOOLEAN);
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, getInfo,
XR_TYPE_ACTION_STATE_GET_INFO);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, data,
XR_TYPE_ACTION_STATE_BOOLEAN);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, getInfo,
XR_TYPE_ACTION_STATE_GET_INFO);
OXR_VERIFY_ACTION_NOT_NULL(&log, getInfo->action, act);
if (act->action_type != XR_ACTION_TYPE_BOOLEAN_INPUT) {
@ -281,9 +283,10 @@ oxr_xrGetActionStateFloat(XrSession session,
XrResult ret;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrGetActionStateFloat");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, data, XR_TYPE_ACTION_STATE_FLOAT);
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, getInfo,
XR_TYPE_ACTION_STATE_GET_INFO);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, data,
XR_TYPE_ACTION_STATE_FLOAT);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, getInfo,
XR_TYPE_ACTION_STATE_GET_INFO);
OXR_VERIFY_ACTION_NOT_NULL(&log, getInfo->action, act);
if (act->action_type != XR_ACTION_TYPE_FLOAT_INPUT) {
@ -313,9 +316,10 @@ oxr_xrGetActionStateVector2f(XrSession session,
XrResult ret;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrGetActionStateVector2f");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, data, XR_TYPE_ACTION_STATE_VECTOR2F);
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, getInfo,
XR_TYPE_ACTION_STATE_GET_INFO);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, data,
XR_TYPE_ACTION_STATE_VECTOR2F);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, getInfo,
XR_TYPE_ACTION_STATE_GET_INFO);
OXR_VERIFY_ACTION_NOT_NULL(&log, getInfo->action, act);
if (act->action_type != XR_ACTION_TYPE_VECTOR2F_INPUT) {
@ -345,9 +349,9 @@ oxr_xrGetActionStatePose(XrSession session,
XrResult ret;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrGetActionStatePose");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, data, XR_TYPE_ACTION_STATE_POSE);
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, getInfo,
XR_TYPE_ACTION_STATE_GET_INFO);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, data, XR_TYPE_ACTION_STATE_POSE);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, getInfo,
XR_TYPE_ACTION_STATE_GET_INFO);
OXR_VERIFY_ACTION_NOT_NULL(&log, getInfo->action, act);
if (act->action_type != XR_ACTION_TYPE_POSE_INPUT) {
@ -378,7 +382,7 @@ oxr_xrEnumerateBoundSourcesForAction(
struct oxr_logger log;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrEnumerateBoundSourcesForAction");
OXR_VERIFY_ARG_TYPE_AND_NULL(
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(
&log, enumerateInfo,
XR_TYPE_BOUND_SOURCES_FOR_ACTION_ENUMERATE_INFO);
OXR_VERIFY_ACTION_NOT_NULL(&log, enumerateInfo->action, act);
@ -407,10 +411,10 @@ oxr_xrApplyHapticFeedback(XrSession session,
XrResult ret;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrApplyHapticFeedback");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, hapticActionInfo,
XR_TYPE_HAPTIC_ACTION_INFO);
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, hapticEvent,
XR_TYPE_HAPTIC_VIBRATION);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, hapticActionInfo,
XR_TYPE_HAPTIC_ACTION_INFO);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, hapticEvent,
XR_TYPE_HAPTIC_VIBRATION);
OXR_VERIFY_ACTION_NOT_NULL(&log, hapticActionInfo->action, act);
ret = oxr_verify_subaction_path_get(
@ -440,8 +444,8 @@ oxr_xrStopHapticFeedback(XrSession session,
XrResult ret;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrStopHapticFeedback");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, hapticActionInfo,
XR_TYPE_HAPTIC_ACTION_INFO);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, hapticActionInfo,
XR_TYPE_HAPTIC_ACTION_INFO);
OXR_VERIFY_ACTION_NOT_NULL(&log, hapticActionInfo->action, act);
ret = oxr_verify_subaction_path_get(

View file

@ -40,7 +40,7 @@ oxr_xrCreateDebugUtilsMessengerEXT(
"xrCreateDebugUtilsMessengerEXT");
OXR_VERIFY_EXTENSION(&log, inst, EXT_debug_utils);
OXR_VERIFY_ARG_TYPE_AND_NULL(
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(
&log, createInfo, XR_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT);
OXR_VERIFY_ARG_NOT_NULL(&log, messenger);

View file

@ -55,8 +55,8 @@ oxr_xrCreateInstance(const XrInstanceCreateInfo *createInfo,
XrResult ret;
struct oxr_logger log;
oxr_log_init(&log, "xrCreateInstance");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, createInfo,
XR_TYPE_INSTANCE_CREATE_INFO);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, createInfo,
XR_TYPE_INSTANCE_CREATE_INFO);
const uint32_t major = XR_VERSION_MAJOR(XR_CURRENT_API_VERSION);
const uint32_t minor = XR_VERSION_MINOR(XR_CURRENT_API_VERSION);
#if 0

View file

@ -84,8 +84,8 @@ oxr_xrBeginSession(XrSession session, const XrSessionBeginInfo *beginInfo)
struct oxr_session *sess;
struct oxr_logger log;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess, "xrBeginSession");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, beginInfo,
XR_TYPE_SESSION_BEGIN_INFO);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, beginInfo,
XR_TYPE_SESSION_BEGIN_INFO);
return oxr_session_begin(&log, sess, beginInfo);
}
@ -108,7 +108,7 @@ oxr_xrWaitFrame(XrSession session,
struct oxr_session *sess;
struct oxr_logger log;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess, "xrWaitFrame");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, frameState, XR_TYPE_FRAME_STATE);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, frameState, XR_TYPE_FRAME_STATE);
OXR_VERIFY_ARG_NOT_NULL(&log, frameState);
return oxr_session_frame_wait(&log, sess, frameState);
@ -122,8 +122,8 @@ oxr_xrBeginFrame(XrSession session, const XrFrameBeginInfo *frameBeginInfo)
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess, "xrBeginFrame");
// NULL explicitly allowed here because it's a basically empty struct.
if (frameBeginInfo != NULL) {
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, frameBeginInfo,
XR_TYPE_FRAME_BEGIN_INFO);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, frameBeginInfo,
XR_TYPE_FRAME_BEGIN_INFO);
}
return oxr_session_frame_begin(&log, sess);
@ -135,8 +135,8 @@ oxr_xrEndFrame(XrSession session, const XrFrameEndInfo *frameEndInfo)
struct oxr_session *sess;
struct oxr_logger log;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess, "xrEndFrame");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, frameEndInfo,
XR_TYPE_FRAME_END_INFO);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, frameEndInfo,
XR_TYPE_FRAME_END_INFO);
return oxr_session_frame_end(&log, sess, frameEndInfo);
}
@ -164,10 +164,10 @@ oxr_xrLocateViews(XrSession session,
struct oxr_space *spc;
struct oxr_logger log;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess, "xrLocateViews");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, viewLocateInfo,
XR_TYPE_VIEW_LOCATE_INFO);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, viewLocateInfo,
XR_TYPE_VIEW_LOCATE_INFO);
OXR_VERIFY_SPACE_NOT_NULL(&log, viewLocateInfo->space, spc);
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, viewState, XR_TYPE_VIEW_STATE);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, viewState, XR_TYPE_VIEW_STATE);
if (viewCapacityInput == 0) {
OXR_VERIFY_ARG_NOT_NULL(&log, viewCountOutput);

View file

@ -34,8 +34,8 @@ oxr_xrCreateActionSpace(XrSession session,
struct oxr_logger log;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrCreateActionSpace");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, createInfo,
XR_TYPE_ACTION_SPACE_CREATE_INFO);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, createInfo,
XR_TYPE_ACTION_SPACE_CREATE_INFO);
OXR_VERIFY_POSE(&log, createInfo->poseInActionSpace);
OXR_VERIFY_ACTION_NOT_NULL(&log, createInfo->action, act);
@ -99,8 +99,8 @@ oxr_xrCreateReferenceSpace(XrSession session,
struct oxr_logger log;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrCreateReferenceSpace");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, createInfo,
XR_TYPE_REFERENCE_SPACE_CREATE_INFO);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, createInfo,
XR_TYPE_REFERENCE_SPACE_CREATE_INFO);
OXR_VERIFY_POSE(&log, createInfo->poseInReferenceSpace);
ret = oxr_space_reference_create(&log, sess, createInfo, &spc);
@ -124,7 +124,8 @@ oxr_xrLocateSpace(XrSpace space,
struct oxr_logger log;
OXR_VERIFY_SPACE_AND_INIT_LOG(&log, space, spc, "xrLocateSpace");
OXR_VERIFY_SPACE_NOT_NULL(&log, baseSpace, baseSpc);
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, location, XR_TYPE_SPACE_LOCATION);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, location,
XR_TYPE_SPACE_LOCATION);
return oxr_space_locate(&log, spc, baseSpc, time, location);
}

View file

@ -54,8 +54,8 @@ oxr_xrCreateSwapchain(XrSession session,
&log, XR_ERROR_VALIDATION_FAILURE,
"xrCreateSwapchain is illegal in headless sessions");
}
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, createInfo,
XR_TYPE_SWAPCHAIN_CREATE_INFO);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, createInfo,
XR_TYPE_SWAPCHAIN_CREATE_INFO);
OXR_VERIFY_ARG_NOT_NULL(&log, out_swapchain);
// Save people from shooting themselves in the foot.
@ -120,8 +120,8 @@ oxr_xrAcquireSwapchainImage(XrSwapchain swapchain,
struct oxr_logger log;
OXR_VERIFY_SWAPCHAIN_AND_INIT_LOG(&log, swapchain, sc,
"xrAcquireSwapchainImage");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, acquireInfo,
XR_TYPE_SWAPCHAIN_IMAGE_ACQUIRE_INFO);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, acquireInfo,
XR_TYPE_SWAPCHAIN_IMAGE_ACQUIRE_INFO);
OXR_VERIFY_ARG_NOT_NULL(&log, index);
return sc->acquire_image(&log, sc, acquireInfo, index);
@ -135,8 +135,8 @@ oxr_xrWaitSwapchainImage(XrSwapchain swapchain,
struct oxr_logger log;
OXR_VERIFY_SWAPCHAIN_AND_INIT_LOG(&log, swapchain, sc,
"xrWaitSwapchainImage");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, waitInfo,
XR_TYPE_SWAPCHAIN_IMAGE_WAIT_INFO);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, waitInfo,
XR_TYPE_SWAPCHAIN_IMAGE_WAIT_INFO);
return sc->wait_image(&log, sc, waitInfo);
}
@ -149,8 +149,8 @@ oxr_xrReleaseSwapchainImage(XrSwapchain swapchain,
struct oxr_logger log;
OXR_VERIFY_SWAPCHAIN_AND_INIT_LOG(&log, swapchain, sc,
"xrReleaseSwapchainImage");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, releaseInfo,
XR_TYPE_SWAPCHAIN_IMAGE_RELEASE_INFO);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, releaseInfo,
XR_TYPE_SWAPCHAIN_IMAGE_RELEASE_INFO);
return sc->release_image(&log, sc, releaseInfo);
}

View file

@ -46,7 +46,8 @@ oxr_xrGetSystem(XrInstance instance,
struct oxr_instance *inst;
struct oxr_logger log;
OXR_VERIFY_INSTANCE_AND_INIT_LOG(&log, instance, inst, "xrGetSystem");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, getInfo, XR_TYPE_SYSTEM_GET_INFO);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, getInfo,
XR_TYPE_SYSTEM_GET_INFO);
OXR_VERIFY_ARG_NOT_NULL(&log, systemId);
struct oxr_system *selected = NULL;
@ -73,8 +74,8 @@ oxr_xrGetSystemProperties(XrInstance instance,
struct oxr_logger log;
OXR_VERIFY_INSTANCE_AND_INIT_LOG(&log, instance, inst,
"xrGetSystemProperties");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, properties,
XR_TYPE_SYSTEM_PROPERTIES);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, properties,
XR_TYPE_SYSTEM_PROPERTIES);
OXR_VERIFY_SYSTEM_AND_GET(&log, inst, systemId, sys);
return oxr_system_get_properties(&log, sys, properties);
@ -130,8 +131,8 @@ oxr_xrGetViewConfigurationProperties(
struct oxr_logger log;
OXR_VERIFY_INSTANCE_AND_INIT_LOG(&log, instance, inst,
"xrGetViewConfigurationProperties");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, configurationProperties,
XR_TYPE_VIEW_CONFIGURATION_PROPERTIES);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, configurationProperties,
XR_TYPE_VIEW_CONFIGURATION_PROPERTIES);
OXR_VERIFY_SYSTEM_AND_GET(&log, inst, systemId, sys);
return oxr_system_get_view_conf_properties(
@ -177,8 +178,9 @@ oxr_xrGetOpenGLGraphicsRequirementsKHR(
struct oxr_logger log;
OXR_VERIFY_INSTANCE_AND_INIT_LOG(&log, instance, inst,
"xrGetOpenGLGraphicsRequirementsKHR");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, graphicsRequirements,
XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_KHR);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(
&log, graphicsRequirements,
XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_KHR);
OXR_VERIFY_SYSTEM_AND_GET(&log, inst, systemId, sys);
struct xrt_api_requirements ver;
@ -270,8 +272,9 @@ oxr_xrGetVulkanGraphicsRequirementsKHR(
OXR_VERIFY_INSTANCE_AND_INIT_LOG(&log, instance, inst,
"xrGetVulkanGraphicsRequirementsKHR");
OXR_VERIFY_SYSTEM_AND_GET(&log, inst, systemId, sys);
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, graphicsRequirements,
XR_TYPE_GRAPHICS_REQUIREMENTS_VULKAN_KHR);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(
&log, graphicsRequirements,
XR_TYPE_GRAPHICS_REQUIREMENTS_VULKAN_KHR);
return oxr_vk_get_requirements(&log, sys, graphicsRequirements);
}

View file

@ -112,7 +112,7 @@ extern "C" {
} \
} while (false)
#define OXR_VERIFY_ARG_TYPE_AND_NULL(log, arg, type_enum) \
#define OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(log, arg, type_enum) \
do { \
if (arg == NULL) { \
return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \