diff --git a/src/xrt/state_trackers/oxr/oxr_conversions.h b/src/xrt/state_trackers/oxr/oxr_conversions.h index 8eb47084b..2532bf4c9 100644 --- a/src/xrt/state_trackers/oxr/oxr_conversions.h +++ b/src/xrt/state_trackers/oxr/oxr_conversions.h @@ -50,3 +50,35 @@ xrt_to_xr_space_location_flags(enum xrt_space_relation_flags relation_flags) return location_flags; } + +static inline XrReferenceSpaceType +oxr_ref_space_to_xr(enum oxr_space_type space_type) +{ + switch (space_type) { + case OXR_SPACE_TYPE_REFERENCE_VIEW: return XR_REFERENCE_SPACE_TYPE_VIEW; + case OXR_SPACE_TYPE_REFERENCE_LOCAL: return XR_REFERENCE_SPACE_TYPE_LOCAL; + case OXR_SPACE_TYPE_REFERENCE_STAGE: return XR_REFERENCE_SPACE_TYPE_STAGE; + case OXR_SPACE_TYPE_REFERENCE_UNBOUNDED_MSFT: return XR_REFERENCE_SPACE_TYPE_UNBOUNDED_MSFT; + case OXR_SPACE_TYPE_REFERENCE_COMBINED_EYE_VARJO: return XR_REFERENCE_SPACE_TYPE_COMBINED_EYE_VARJO; + + case OXR_SPACE_TYPE_ACTION: return XR_REFERENCE_SPACE_TYPE_MAX_ENUM; + } + return XR_REFERENCE_SPACE_TYPE_MAX_ENUM; +} + +static inline enum oxr_space_type +xr_ref_space_to_oxr(XrReferenceSpaceType space_type) +{ + switch (space_type) { + case XR_REFERENCE_SPACE_TYPE_VIEW: return OXR_SPACE_TYPE_REFERENCE_VIEW; + case XR_REFERENCE_SPACE_TYPE_LOCAL: return OXR_SPACE_TYPE_REFERENCE_LOCAL; + case XR_REFERENCE_SPACE_TYPE_STAGE: return OXR_SPACE_TYPE_REFERENCE_STAGE; + case XR_REFERENCE_SPACE_TYPE_UNBOUNDED_MSFT: return OXR_SPACE_TYPE_REFERENCE_UNBOUNDED_MSFT; + case XR_REFERENCE_SPACE_TYPE_COMBINED_EYE_VARJO: return OXR_SPACE_TYPE_REFERENCE_COMBINED_EYE_VARJO; + + case XR_REFERENCE_SPACE_TYPE_MAX_ENUM: return (enum oxr_space_type) - 1; + } + + // wrap around or negative depending on enum data type, invalid value either way. + return (enum oxr_space_type) - 1; +} diff --git a/src/xrt/state_trackers/oxr/oxr_objects.h b/src/xrt/state_trackers/oxr/oxr_objects.h index d7000752f..f30d22744 100644 --- a/src/xrt/state_trackers/oxr/oxr_objects.h +++ b/src/xrt/state_trackers/oxr/oxr_objects.h @@ -1964,37 +1964,6 @@ oxr_space_type_is_reference(enum oxr_space_type space_type) return false; } -static inline XrReferenceSpaceType -oxr_ref_space_to_xr(enum oxr_space_type space_type) -{ - switch (space_type) { - case OXR_SPACE_TYPE_REFERENCE_VIEW: return XR_REFERENCE_SPACE_TYPE_VIEW; - case OXR_SPACE_TYPE_REFERENCE_LOCAL: return XR_REFERENCE_SPACE_TYPE_LOCAL; - case OXR_SPACE_TYPE_REFERENCE_STAGE: return XR_REFERENCE_SPACE_TYPE_STAGE; - case OXR_SPACE_TYPE_REFERENCE_UNBOUNDED_MSFT: return XR_REFERENCE_SPACE_TYPE_UNBOUNDED_MSFT; - case OXR_SPACE_TYPE_REFERENCE_COMBINED_EYE_VARJO: return XR_REFERENCE_SPACE_TYPE_COMBINED_EYE_VARJO; - - case OXR_SPACE_TYPE_ACTION: return XR_REFERENCE_SPACE_TYPE_MAX_ENUM; - } - return XR_REFERENCE_SPACE_TYPE_MAX_ENUM; -} - -static inline enum oxr_space_type -xr_ref_space_to_oxr(XrReferenceSpaceType space_type) -{ - switch (space_type) { - case XR_REFERENCE_SPACE_TYPE_VIEW: return OXR_SPACE_TYPE_REFERENCE_VIEW; - case XR_REFERENCE_SPACE_TYPE_LOCAL: return OXR_SPACE_TYPE_REFERENCE_LOCAL; - case XR_REFERENCE_SPACE_TYPE_STAGE: return OXR_SPACE_TYPE_REFERENCE_STAGE; - case XR_REFERENCE_SPACE_TYPE_UNBOUNDED_MSFT: return OXR_SPACE_TYPE_REFERENCE_UNBOUNDED_MSFT; - case XR_REFERENCE_SPACE_TYPE_COMBINED_EYE_VARJO: return OXR_SPACE_TYPE_REFERENCE_COMBINED_EYE_VARJO; - - case XR_REFERENCE_SPACE_TYPE_MAX_ENUM: return (enum oxr_space_type) - 1; - } - - // wrap around or negative depending on enum data type, invalid value either way. - return (enum oxr_space_type) - 1; -} /*! * Can be one of several reference space types, or a space that is bound to an