The open source OpenXR runtime
0
fork

Configure Feed

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

st/oxr: Special case the any path for pose actions

authored by

Jakob Bornecrantz and committed by
Jakob Bornecrantz
557dacbb deb5633b

+50 -6
+3
doc/changes/state_trackers/mr.510.md
··· 1 + OpenXR: For pose actions the any path (`XR_NULL_PATH`) needs to be special 2 + cased, essentially turning into a separate action sub path, that is assigned 3 + at binding time.
+40 -6
src/xrt/state_trackers/oxr/oxr_input.c
··· 445 445 oxr_action_get_pose_input(struct oxr_logger *log, 446 446 struct oxr_session *sess, 447 447 uint32_t act_key, 448 - const struct oxr_sub_paths *sub_paths, 448 + const struct oxr_sub_paths *sub_paths_ptr, 449 449 struct oxr_action_input **out_input) 450 450 { 451 451 struct oxr_action_attachment *act_attached = NULL; ··· 456 456 return XR_SUCCESS; 457 457 } 458 458 459 + struct oxr_sub_paths sub_paths = *sub_paths_ptr; 460 + if (sub_paths.any) { 461 + sub_paths = act_attached->any_pose_sub_path; 462 + } 463 + 459 464 // Priority of inputs. 460 465 #define GET_POSE_INPUT(X) \ 461 - if (act_attached->X.current.active && \ 462 - (sub_paths->X || sub_paths->any)) { \ 466 + if (act_attached->X.current.active && sub_paths.X) { \ 463 467 *out_input = act_attached->X.inputs; \ 464 468 return XR_SUCCESS; \ 465 469 } ··· 695 699 } 696 700 OXR_FOR_EACH_VALID_SUBACTION_PATH_DETAILED(BIND_SUBACTION) 697 701 #undef BIND_SUBACTION 702 + 703 + 704 + /*! 705 + * The any sub path is special cased for poses, it binds to one sub path 706 + * and sticks with it. 707 + */ 708 + if (act_ref->action_type == XR_ACTION_TYPE_POSE_INPUT) { 709 + 710 + #define POSE_ANY(X) \ 711 + if (act_ref->sub_paths.X && act_attached->X.num_inputs > 0) { \ 712 + act_attached->any_pose_sub_path.X = true; \ 713 + oxr_slog(&slog, \ 714 + "\tFor: <any>\n\t\tBinding any pose to " #X ".\n"); \ 715 + } else 716 + OXR_FOR_EACH_VALID_SUBACTION_PATH(POSE_ANY) 717 + #undef POSE_ANY 718 + 719 + { 720 + oxr_slog(&slog, 721 + "\tFor: <any>\n\t\tNo active sub paths for " 722 + "the any pose!\n"); 723 + } 724 + } 698 725 699 726 oxr_slog(&slog, "\tDone"); 700 727 ··· 1731 1758 "Action has not been attached to this session"); 1732 1759 } 1733 1760 1761 + // For poses on the any path we select a single path. 1762 + if (sub_paths.any) { 1763 + sub_paths = act_attached->any_pose_sub_path; 1764 + } 1765 + 1734 1766 data->isActive = XR_FALSE; 1735 1767 1768 + /* 1769 + * The sub path any is used as a catch all here to see if any 1770 + */ 1736 1771 #define COMPUTE_ACTIVE(X) \ 1737 - if (sub_paths.X || sub_paths.any) { \ 1772 + if (sub_paths.X) { \ 1738 1773 data->isActive |= act_attached->X.current.active; \ 1739 1774 } 1740 1775 1741 1776 OXR_FOR_EACH_VALID_SUBACTION_PATH(COMPUTE_ACTIVE) 1742 1777 #undef COMPUTE_ACTIVE 1778 + 1743 1779 return oxr_session_success_result(sess); 1744 1780 } 1745 1781 ··· 1770 1806 xrt_device_set_output(xdev, output->name, &value); 1771 1807 } 1772 1808 } 1773 - 1774 - 1775 1809 1776 1810 XrResult 1777 1811 oxr_action_apply_haptic_feedback(struct oxr_logger *log,
+7
src/xrt/state_trackers/oxr/oxr_objects.h
··· 1568 1568 //! Unique key for the session hashmap. 1569 1569 uint32_t act_key; 1570 1570 1571 + 1572 + /*! 1573 + * For pose actions any sub paths are special treated, at bind time we 1574 + * pick one sub path and stick to it as long as the action lives. 1575 + */ 1576 + struct oxr_sub_paths any_pose_sub_path; 1577 + 1571 1578 struct oxr_action_state any_state; 1572 1579 1573 1580 #define OXR_CACHE_MEMBER(X) struct oxr_action_cache X;