Commit e7a933a1 authored by Jakob Bornecrantz's avatar Jakob Bornecrantz Committed by Jakob Bornecrantz

st/oxr: Verify poses in space create functions

parent 505d5cf5
Pipeline #50145 passed with stages
in 1 minute and 19 seconds
......@@ -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) {
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment