The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

u/device: Add default, no-op and not implemented function helpers

+176 -2
+83 -1
src/xrt/auxiliary/util/u_device.c
··· 1 - // Copyright 2019-2021, Collabora, Ltd. 1 + // Copyright 2019-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 397 397 *out_pose = pose; 398 398 } 399 399 400 + 401 + /* 402 + * 403 + * Default implementation of functions. 404 + * 405 + */ 406 + 400 407 void 401 408 u_device_get_view_poses(struct xrt_device *xdev, 402 409 const struct xrt_vec3 *default_eye_relation, ··· 416 423 u_device_get_view_pose(default_eye_relation, i, &out_poses[i]); 417 424 } 418 425 } 426 + 427 + 428 + /* 429 + * 430 + * No-op implementation of functions. 431 + * 432 + */ 433 + 434 + void 435 + u_device_noop_update_inputs(struct xrt_device *xdev) 436 + { 437 + // Empty, should only be used from a device without any inputs. 438 + } 439 + 440 + 441 + /* 442 + * 443 + * Not implemented function helpers. 444 + * 445 + */ 446 + 447 + #define E(FN) U_LOG_E("Function " #FN " is not implemented for '%s'", xdev->str) 448 + 449 + void 450 + u_device_ni_get_hand_tracking(struct xrt_device *xdev, 451 + enum xrt_input_name name, 452 + uint64_t desired_timestamp_ns, 453 + struct xrt_hand_joint_set *out_value, 454 + uint64_t *out_timestamp_ns) 455 + { 456 + E(get_hand_tracking); 457 + } 458 + 459 + void 460 + u_device_ni_set_output(struct xrt_device *xdev, enum xrt_output_name name, const union xrt_output_value *value) 461 + { 462 + E(get_hand_tracking); 463 + } 464 + 465 + void 466 + u_device_ni_get_view_poses(struct xrt_device *xdev, 467 + const struct xrt_vec3 *default_eye_relation, 468 + uint64_t at_timestamp_ns, 469 + uint32_t view_count, 470 + struct xrt_space_relation *out_head_relation, 471 + struct xrt_fov *out_fovs, 472 + struct xrt_pose *out_poses) 473 + { 474 + E(get_hand_tracking); 475 + } 476 + 477 + bool 478 + u_device_ni_compute_distortion( 479 + struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result) 480 + { 481 + E(compute_distortion); 482 + return false; 483 + } 484 + 485 + xrt_result_t 486 + u_device_ni_get_visibility_mask(struct xrt_device *xdev, 487 + enum xrt_visibility_mask_type type, 488 + uint32_t view_index, 489 + struct xrt_visibility_mask **out_mask) 490 + { 491 + E(get_visibility_mask); 492 + return XRT_ERROR_DEVICE_FUNCTION_NOT_IMPLEMENTED; 493 + } 494 + 495 + bool 496 + u_device_ni_is_form_factor_available(struct xrt_device *xdev, enum xrt_form_factor form_factor) 497 + { 498 + E(is_form_factor_available); 499 + return false; 500 + }
+93 -1
src/xrt/auxiliary/util/u_device.h
··· 1 - // Copyright 2019-2021, Collabora, Ltd. 1 + // Copyright 2019-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 144 144 void 145 145 u_device_get_view_pose(const struct xrt_vec3 *eye_relation, uint32_t view_index, struct xrt_pose *out_pose); 146 146 147 + 148 + /* 149 + * 150 + * Default implementation of functions. 151 + * 152 + */ 153 + 147 154 /*! 148 155 * Helper function for `get_view_poses` in a HMD driver. 149 156 */ ··· 155 162 struct xrt_space_relation *out_head_relation, 156 163 struct xrt_fov *out_fovs, 157 164 struct xrt_pose *out_poses); 165 + 166 + 167 + /* 168 + * 169 + * No-op implementation of functions. 170 + * 171 + */ 172 + 173 + /*! 174 + * Noop function for @ref xrt_device::update_inputs, 175 + * should only be used from a device with any inputs. 176 + * 177 + * @ingroup aux_util 178 + */ 179 + void 180 + u_device_noop_update_inputs(struct xrt_device *xdev); 181 + 182 + 183 + /* 184 + * 185 + * Not implemented function helpers. 186 + * 187 + */ 188 + 189 + /*! 190 + * Not implemented function for @ref xrt_device::get_hand_tracking. 191 + * 192 + * @ingroup aux_util 193 + */ 194 + void 195 + u_device_ni_get_hand_tracking(struct xrt_device *xdev, 196 + enum xrt_input_name name, 197 + uint64_t desired_timestamp_ns, 198 + struct xrt_hand_joint_set *out_value, 199 + uint64_t *out_timestamp_ns); 200 + 201 + /*! 202 + * Not implemented function for @ref xrt_device::set_output. 203 + * 204 + * @ingroup aux_util 205 + */ 206 + void 207 + u_device_ni_set_output(struct xrt_device *xdev, enum xrt_output_name name, const union xrt_output_value *value); 208 + 209 + /*! 210 + * Not implemented function for @ref xrt_device::get_view_poses. 211 + * 212 + * @ingroup aux_util 213 + */ 214 + void 215 + u_device_ni_get_view_poses(struct xrt_device *xdev, 216 + const struct xrt_vec3 *default_eye_relation, 217 + uint64_t at_timestamp_ns, 218 + uint32_t view_count, 219 + struct xrt_space_relation *out_head_relation, 220 + struct xrt_fov *out_fovs, 221 + struct xrt_pose *out_poses); 222 + 223 + /*! 224 + * Not implemented function for @ref xrt_device::compute_distortion. 225 + * 226 + * @ingroup aux_util 227 + */ 228 + bool 229 + u_device_ni_compute_distortion( 230 + struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result); 231 + 232 + /*! 233 + * Not implemented function for @ref xrt_device::get_visibility_mask. 234 + * 235 + * @ingroup aux_util 236 + */ 237 + xrt_result_t 238 + u_device_ni_get_visibility_mask(struct xrt_device *xdev, 239 + enum xrt_visibility_mask_type type, 240 + uint32_t view_index, 241 + struct xrt_visibility_mask **out_mask); 242 + 243 + /*! 244 + * Not implemented function for @ref xrt_device::is_form_factor_available. 245 + * 246 + * @ingroup aux_util 247 + */ 248 + bool 249 + u_device_ni_is_form_factor_available(struct xrt_device *xdev, enum xrt_form_factor form_factor); 158 250 159 251 160 252 #ifdef __cplusplus