diff --git a/src/xrt/state_trackers/oxr/oxr_api_space.c b/src/xrt/state_trackers/oxr/oxr_api_space.c index 66b8fb293..fe0bf90b1 100644 --- a/src/xrt/state_trackers/oxr/oxr_api_space.c +++ b/src/xrt/state_trackers/oxr/oxr_api_space.c @@ -13,6 +13,7 @@ #include "xrt/xrt_compiler.h" +#include "math/m_api.h" #include "util/u_debug.h" #include "oxr_objects.h" @@ -34,7 +35,7 @@ oxr_xrCreateActionSpace(XrAction action, "xrCreateActionSpace"); OXR_VERIFY_ARG_TYPE_AND_NULL(&log, createInfo, XR_TYPE_ACTION_SPACE_CREATE_INFO); - + OXR_VERIFY_POSE(&log, createInfo->poseInActionSpace); struct oxr_space* spc; XrResult ret = oxr_space_action_create(&log, act, createInfo, &spc); @@ -96,6 +97,7 @@ oxr_xrCreateReferenceSpace(XrSession session, "xrCreateReferenceSpace"); OXR_VERIFY_ARG_TYPE_AND_NULL(&log, createInfo, XR_TYPE_REFERENCE_SPACE_CREATE_INFO); + OXR_VERIFY_POSE(&log, createInfo->poseInReferenceSpace); ret = oxr_space_reference_create(&log, sess, createInfo, &spc); if (ret != XR_SUCCESS) { diff --git a/src/xrt/state_trackers/oxr/oxr_api_verify.h b/src/xrt/state_trackers/oxr/oxr_api_verify.h index 46cbadfc7..88897b648 100644 --- a/src/xrt/state_trackers/oxr/oxr_api_verify.h +++ b/src/xrt/state_trackers/oxr/oxr_api_verify.h @@ -130,6 +130,20 @@ extern "C" { } \ } while (false) +#define OXR_VERIFY_POSE(log, p) \ + do { \ + if (!math_quat_validate((struct xrt_quat*)&p.orientation)) { \ + return oxr_error(log, XR_ERROR_POSE_INVALID, \ + "(" #p \ + ".orientation) is not a valid quat"); \ + } \ + \ + if (!math_vec3_validate((struct xrt_vec3*)&p.position)) { \ + return oxr_error(log, XR_ERROR_POSE_INVALID, \ + "(" #p ".position) is not valid"); \ + } \ + } while (false) + /* * * Implementation in oxr_verify.cpp