The open source OpenXR runtime
0
fork

Configure Feed

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

st/oxr: bind to dynamic role's profile

- Fixes a bug where `interaction_profile_find_in_session` would return
unconditionally after finding the first profile. When multiple profiles
share a name (e.g., `touch_plus` in both `XR_META_touch_controller_plus`
and the OpenXR 1.1 core spec), only the first was ever considered.

- In `oxr_session_update_action_bindings`, change the selection priority
for dynamic roles to prioritize the device name

Co-authored-by: Korcan Hussein <korcan.hussein@collabora.com>
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2421>

authored by

Patrick Nicolas
Korcan Hussein
and committed by
Korcan Hussein
6e4b8c09 68612a72

+10 -8
+8 -3
src/xrt/state_trackers/oxr/oxr_binding.c
··· 453 453 return str; 454 454 } 455 455 456 - void 456 + bool 457 457 oxr_get_profile_for_device_name(struct oxr_logger *log, 458 458 struct oxr_session *sess, 459 459 enum xrt_device_name name, 460 460 struct oxr_interaction_profile **out_p) 461 461 { 462 + if (name == XRT_DEVICE_INVALID) { 463 + return false; 464 + } 462 465 /* 463 466 * Map xrt_device_name to an interaction profile XrPath. 464 467 * Set *out_p to an oxr_interaction_profile if bindings for that interaction profile XrPath have been suggested. 465 468 */ 466 469 for (uint32_t i = 0; i < ARRAY_SIZE(profile_templates); i++) { 467 470 if (name == profile_templates[i].name) { 468 - interaction_profile_find_in_session(log, sess, profile_templates[i].path_cache, out_p); 469 - return; 471 + if (interaction_profile_find_in_session(log, sess, profile_templates[i].path_cache, out_p)) { 472 + return true; 473 + } 470 474 } 471 475 } 476 + return false; 472 477 } 473 478 474 479
+1 -4
src/xrt/state_trackers/oxr/oxr_input.c
··· 799 799 struct oxr_profiles_per_subaction *out_profiles) 800 800 { 801 801 #define FIND_PROFILE(X) \ 802 - { \ 802 + if (!oxr_get_profile_for_device_name(log, sess, GET_PROFILE_NAME_BY_ROLE(sess->sys, X), &out_profiles->X)) { \ 803 803 struct xrt_device *xdev = GET_XDEV_BY_ROLE(sess->sys, X); \ 804 804 if (xdev != NULL) { \ 805 805 oxr_find_profile_for_device(log, sess, xdev, &out_profiles->X); \ 806 - } else { \ 807 - oxr_get_profile_for_device_name(log, sess, GET_PROFILE_NAME_BY_ROLE(sess->sys, X), \ 808 - &out_profiles->X); \ 809 806 } \ 810 807 } 811 808 OXR_FOR_EACH_VALID_SUBACTION_PATH(FIND_PROFILE)
+1 -1
src/xrt/state_trackers/oxr/oxr_objects.h
··· 651 651 struct xrt_device *xdev, 652 652 struct oxr_interaction_profile **out_p); 653 653 654 - void 654 + bool 655 655 oxr_get_profile_for_device_name(struct oxr_logger *log, 656 656 struct oxr_session *sess, 657 657 enum xrt_device_name name,