st/oxr: Implement the EXT_active_action_set_priority extension

This is required for proper action set priority emulation in OpenComposite.

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2370>
This commit is contained in:
Beyley Thomas 2024-11-29 02:29:01 -08:00
parent faf0aafbd4
commit aa2b0f9f1d
10 changed files with 126 additions and 64 deletions

View file

@ -344,6 +344,7 @@ set(XRT_OXR_RUNTIME_SUFFIX monado CACHE STRING "OpenXR client library suffix")
mark_as_advanced(XRT_MODULE_COMPOSITOR_MAIN XRT_MODULE_COMPOSITOR_NULL XRT_FEATURE_OPENXR) mark_as_advanced(XRT_MODULE_COMPOSITOR_MAIN XRT_MODULE_COMPOSITOR_NULL XRT_FEATURE_OPENXR)
# Misc extension support. # Misc extension support.
option(XRT_FEATURE_OPENXR_ACTIVE_ACTION_SET_PRIORITY "Enable XR_EXT_active_action_set_priority" ON)
option(XRT_FEATURE_OPENXR_BODY_TRACKING_FB "Enable XR_FB_body_tracking" OFF) option(XRT_FEATURE_OPENXR_BODY_TRACKING_FB "Enable XR_FB_body_tracking" OFF)
option(XRT_FEATURE_OPENXR_DISPLAY_REFRESH_RATE "Enable XR_FB_display_refresh_rate" ON) option(XRT_FEATURE_OPENXR_DISPLAY_REFRESH_RATE "Enable XR_FB_display_refresh_rate" ON)
option(XRT_FEATURE_OPENXR_FACE_TRACKING2_FB "Enable XR_FB_face_tracking2" OFF) option(XRT_FEATURE_OPENXR_FACE_TRACKING2_FB "Enable XR_FB_face_tracking2" OFF)
@ -574,53 +575,54 @@ message(STATUS "# MODULE_IPC: ${XRT_MODULE_IPC}")
message(STATUS "# MODULE_MONADO_GUI: ${XRT_MODULE_MONADO_GUI}") message(STATUS "# MODULE_MONADO_GUI: ${XRT_MODULE_MONADO_GUI}")
message(STATUS "# MODULE_MONADO_CLI: ${XRT_MODULE_MONADO_CLI}") message(STATUS "# MODULE_MONADO_CLI: ${XRT_MODULE_MONADO_CLI}")
message(STATUS "#") message(STATUS "#")
message(STATUS "# FEATURE_AHARDWARE_BUFFER: ${XRT_FEATURE_AHARDWARE_BUFFER}") message(STATUS "# FEATURE_AHARDWARE_BUFFER: ${XRT_FEATURE_AHARDWARE_BUFFER}")
message(STATUS "# FEATURE_CLIENT_DEBUG_GUI: ${XRT_FEATURE_CLIENT_DEBUG_GUI}") message(STATUS "# FEATURE_CLIENT_DEBUG_GUI: ${XRT_FEATURE_CLIENT_DEBUG_GUI}")
message(STATUS "# FEATURE_COLOR_LOG: ${XRT_FEATURE_COLOR_LOG}") message(STATUS "# FEATURE_COLOR_LOG: ${XRT_FEATURE_COLOR_LOG}")
message(STATUS "# FEATURE_DEBUG_GUI: ${XRT_FEATURE_DEBUG_GUI}") message(STATUS "# FEATURE_DEBUG_GUI: ${XRT_FEATURE_DEBUG_GUI}")
message(STATUS "# FEATURE_OPENXR: ${XRT_FEATURE_OPENXR}") message(STATUS "# FEATURE_OPENXR: ${XRT_FEATURE_OPENXR}")
message(STATUS "# FEATURE_OPENXR_BODY_TRACKING_FB: ${XRT_FEATURE_OPENXR_BODY_TRACKING_FB}") message(STATUS "# FEATURE_OPENXR_ACTIVE_ACTION_SET_PRIORITY: ${XRT_FEATURE_OPENXR_ACTIVE_ACTION_SET_PRIORITY}")
message(STATUS "# FEATURE_OPENXR_FACE_TRACKING2_FB: ${XRT_FEATURE_OPENXR_FACE_TRACKING2_FB}") message(STATUS "# FEATURE_OPENXR_BODY_TRACKING_FB: ${XRT_FEATURE_OPENXR_BODY_TRACKING_FB}")
message(STATUS "# FEATURE_OPENXR_DEBUG_UTILS: ${XRT_FEATURE_OPENXR_DEBUG_UTILS}") message(STATUS "# FEATURE_OPENXR_FACE_TRACKING2_FB: ${XRT_FEATURE_OPENXR_FACE_TRACKING2_FB}")
message(STATUS "# FEATURE_OPENXR_DISPLAY_REFRESH_RATE: ${XRT_FEATURE_OPENXR_DISPLAY_REFRESH_RATE}") message(STATUS "# FEATURE_OPENXR_DEBUG_UTILS: ${XRT_FEATURE_OPENXR_DEBUG_UTILS}")
message(STATUS "# FEATURE_OPENXR_FACIAL_TRACKING_HTC: ${XRT_FEATURE_OPENXR_FACIAL_TRACKING_HTC}") message(STATUS "# FEATURE_OPENXR_DISPLAY_REFRESH_RATE: ${XRT_FEATURE_OPENXR_DISPLAY_REFRESH_RATE}")
message(STATUS "# FEATURE_OPENXR_FORCE_FEEDBACK_CURL: ${XRT_FEATURE_OPENXR_FORCE_FEEDBACK_CURL}") message(STATUS "# FEATURE_OPENXR_FACIAL_TRACKING_HTC: ${XRT_FEATURE_OPENXR_FACIAL_TRACKING_HTC}")
message(STATUS "# FEATURE_OPENXR_HAND_TRACKING_EXT: ${XRT_FEATURE_OPENXR_HAND_TRACKING_EXT}") message(STATUS "# FEATURE_OPENXR_FORCE_FEEDBACK_CURL: ${XRT_FEATURE_OPENXR_FORCE_FEEDBACK_CURL}")
message(STATUS "# FEATURE_OPENXR_HEADLESS: ${XRT_FEATURE_OPENXR_HEADLESS}") message(STATUS "# FEATURE_OPENXR_HAND_TRACKING_EXT: ${XRT_FEATURE_OPENXR_HAND_TRACKING_EXT}")
message(STATUS "# FEATURE_OPENXR_INTERACTION_EXT_EYE_GAZE: ${XRT_FEATURE_OPENXR_INTERACTION_EXT_EYE_GAZE}") message(STATUS "# FEATURE_OPENXR_HEADLESS: ${XRT_FEATURE_OPENXR_HEADLESS}")
message(STATUS "# FEATURE_OPENXR_INTERACTION_EXT_HAND: ${XRT_FEATURE_OPENXR_INTERACTION_EXT_HAND}") message(STATUS "# FEATURE_OPENXR_INTERACTION_EXT_EYE_GAZE: ${XRT_FEATURE_OPENXR_INTERACTION_EXT_EYE_GAZE}")
message(STATUS "# FEATURE_OPENXR_INTERACTION_EXT_PALM_POSE: ${XRT_FEATURE_OPENXR_INTERACTION_EXT_PALM_POSE}") message(STATUS "# FEATURE_OPENXR_INTERACTION_EXT_HAND: ${XRT_FEATURE_OPENXR_INTERACTION_EXT_HAND}")
message(STATUS "# FEATURE_OPENXR_INTERACTION_ML2: ${XRT_FEATURE_OPENXR_INTERACTION_ML2}") message(STATUS "# FEATURE_OPENXR_INTERACTION_EXT_PALM_POSE: ${XRT_FEATURE_OPENXR_INTERACTION_EXT_PALM_POSE}")
message(STATUS "# FEATURE_OPENXR_INTERACTION_MNDX: ${XRT_FEATURE_OPENXR_INTERACTION_MNDX}") message(STATUS "# FEATURE_OPENXR_INTERACTION_ML2: ${XRT_FEATURE_OPENXR_INTERACTION_ML2}")
message(STATUS "# FEATURE_OPENXR_INTERACTION_MSFT_HAND: ${XRT_FEATURE_OPENXR_INTERACTION_MSFT_HAND}") message(STATUS "# FEATURE_OPENXR_INTERACTION_MNDX: ${XRT_FEATURE_OPENXR_INTERACTION_MNDX}")
message(STATUS "# FEATURE_OPENXR_INTERACTION_OPPO: ${XRT_FEATURE_OPENXR_INTERACTION_OPPO}") message(STATUS "# FEATURE_OPENXR_INTERACTION_MSFT_HAND: ${XRT_FEATURE_OPENXR_INTERACTION_MSFT_HAND}")
message(STATUS "# FEATURE_OPENXR_INTERACTION_WINMR: ${XRT_FEATURE_OPENXR_INTERACTION_WINMR}") message(STATUS "# FEATURE_OPENXR_INTERACTION_OPPO: ${XRT_FEATURE_OPENXR_INTERACTION_OPPO}")
message(STATUS "# FEATURE_OPENXR_LAYER_COLOR_SCALE_BIAS: ${XRT_FEATURE_OPENXR_LAYER_COLOR_SCALE_BIAS}") message(STATUS "# FEATURE_OPENXR_INTERACTION_WINMR: ${XRT_FEATURE_OPENXR_INTERACTION_WINMR}")
message(STATUS "# FEATURE_OPENXR_LAYER_CUBE: ${XRT_FEATURE_OPENXR_LAYER_CUBE}") message(STATUS "# FEATURE_OPENXR_LAYER_COLOR_SCALE_BIAS: ${XRT_FEATURE_OPENXR_LAYER_COLOR_SCALE_BIAS}")
message(STATUS "# FEATURE_OPENXR_LAYER_CYLINDER: ${XRT_FEATURE_OPENXR_LAYER_CYLINDER}") message(STATUS "# FEATURE_OPENXR_LAYER_CUBE: ${XRT_FEATURE_OPENXR_LAYER_CUBE}")
message(STATUS "# FEATURE_OPENXR_LAYER_DEPTH: ${XRT_FEATURE_OPENXR_LAYER_DEPTH}") message(STATUS "# FEATURE_OPENXR_LAYER_CYLINDER: ${XRT_FEATURE_OPENXR_LAYER_CYLINDER}")
message(STATUS "# FEATURE_OPENXR_LAYER_EQUIRECT1: ${XRT_FEATURE_OPENXR_LAYER_EQUIRECT1}") message(STATUS "# FEATURE_OPENXR_LAYER_DEPTH: ${XRT_FEATURE_OPENXR_LAYER_DEPTH}")
message(STATUS "# FEATURE_OPENXR_LAYER_EQUIRECT2: ${XRT_FEATURE_OPENXR_LAYER_EQUIRECT2}") message(STATUS "# FEATURE_OPENXR_LAYER_EQUIRECT1: ${XRT_FEATURE_OPENXR_LAYER_EQUIRECT1}")
message(STATUS "# FEATURE_OPENXR_LAYER_FB_ALPHA_BLEND: ${XRT_FEATURE_OPENXR_LAYER_FB_ALPHA_BLEND}") message(STATUS "# FEATURE_OPENXR_LAYER_EQUIRECT2: ${XRT_FEATURE_OPENXR_LAYER_EQUIRECT2}")
message(STATUS "# FEATURE_OPENXR_LAYER_FB_DEPTH_TEST: ${XRT_FEATURE_OPENXR_LAYER_FB_DEPTH_TEST}") message(STATUS "# FEATURE_OPENXR_LAYER_FB_ALPHA_BLEND: ${XRT_FEATURE_OPENXR_LAYER_FB_ALPHA_BLEND}")
message(STATUS "# FEATURE_OPENXR_LAYER_FB_IMAGE_LAYOUT ${XRT_FEATURE_OPENXR_LAYER_FB_IMAGE_LAYOUT}") message(STATUS "# FEATURE_OPENXR_LAYER_FB_DEPTH_TEST: ${XRT_FEATURE_OPENXR_LAYER_FB_DEPTH_TEST}")
message(STATUS "# FEATURE_OPENXR_LAYER_FB_SETTINGS: ${XRT_FEATURE_OPENXR_LAYER_FB_SETTINGS}") message(STATUS "# FEATURE_OPENXR_LAYER_FB_IMAGE_LAYOUT ${XRT_FEATURE_OPENXR_LAYER_FB_IMAGE_LAYOUT}")
message(STATUS "# FEATURE_OPENXR_LAYER_FB_PASSTHROUGH: ${XRT_FEATURE_OPENXR_LAYER_FB_PASSTHROUGH}") message(STATUS "# FEATURE_OPENXR_LAYER_FB_SETTINGS: ${XRT_FEATURE_OPENXR_LAYER_FB_SETTINGS}")
message(STATUS "# FEATURE_OPENXR_OVERLAY: ${XRT_FEATURE_OPENXR_OVERLAY}") message(STATUS "# FEATURE_OPENXR_LAYER_FB_PASSTHROUGH: ${XRT_FEATURE_OPENXR_LAYER_FB_PASSTHROUGH}")
message(STATUS "# FEATURE_OPENXR_PERFORMANCE_SETTINGS: ${XRT_FEATURE_OPENXR_PERFORMANCE_SETTINGS}") message(STATUS "# FEATURE_OPENXR_OVERLAY: ${XRT_FEATURE_OPENXR_OVERLAY}")
message(STATUS "# FEATURE_OPENXR_SPACE_LOCAL_FLOOR: ${XRT_FEATURE_OPENXR_SPACE_LOCAL_FLOOR}") message(STATUS "# FEATURE_OPENXR_PERFORMANCE_SETTINGS: ${XRT_FEATURE_OPENXR_PERFORMANCE_SETTINGS}")
message(STATUS "# FEATURE_OPENXR_SPACE_UNBOUNDED: ${XRT_FEATURE_OPENXR_SPACE_UNBOUNDED}") message(STATUS "# FEATURE_OPENXR_SPACE_LOCAL_FLOOR: ${XRT_FEATURE_OPENXR_SPACE_LOCAL_FLOOR}")
message(STATUS "# FEATURE_OPENXR_VISIBILITY_MASK ${XRT_FEATURE_OPENXR_VISIBILITY_MASK}") message(STATUS "# FEATURE_OPENXR_SPACE_UNBOUNDED: ${XRT_FEATURE_OPENXR_SPACE_UNBOUNDED}")
message(STATUS "# FEATURE_OPENXR_VULKAN_SWAPCHAIN_FORMAT_LIST ${XRT_FEATURE_OPENXR_VULKAN_SWAPCHAIN_FORMAT_LIST}") message(STATUS "# FEATURE_OPENXR_VISIBILITY_MASK: ${XRT_FEATURE_OPENXR_VISIBILITY_MASK}")
message(STATUS "# FEATURE_OPENXR_XDEV_SPACE: ${XRT_FEATURE_OPENXR_XDEV_SPACE}") message(STATUS "# FEATURE_OPENXR_VULKAN_SWAPCHAIN_FORMAT_LIST: ${XRT_FEATURE_OPENXR_VULKAN_SWAPCHAIN_FORMAT_LIST}")
message(STATUS "# FEATURE_RENDERDOC: ${XRT_FEATURE_RENDERDOC}") message(STATUS "# FEATURE_OPENXR_XDEV_SPACE: ${XRT_FEATURE_OPENXR_XDEV_SPACE}")
message(STATUS "# FEATURE_SERVICE: ${XRT_FEATURE_SERVICE}") message(STATUS "# FEATURE_RENDERDOC: ${XRT_FEATURE_RENDERDOC}")
message(STATUS "# FEATURE_SERVICE_SYSTEMD: ${XRT_FEATURE_SERVICE_SYSTEMD}") message(STATUS "# FEATURE_SERVICE: ${XRT_FEATURE_SERVICE}")
message(STATUS "# FEATURE_SLAM: ${XRT_FEATURE_SLAM}") message(STATUS "# FEATURE_SERVICE_SYSTEMD: ${XRT_FEATURE_SERVICE_SYSTEMD}")
message(STATUS "# FEATURE_SSE2: ${XRT_FEATURE_SSE2}") message(STATUS "# FEATURE_SLAM: ${XRT_FEATURE_SLAM}")
message(STATUS "# FEATURE_STEAMVR_PLUGIN: ${XRT_FEATURE_STEAMVR_PLUGIN}") message(STATUS "# FEATURE_SSE2: ${XRT_FEATURE_SSE2}")
message(STATUS "# FEATURE_TRACING: ${XRT_FEATURE_TRACING}") message(STATUS "# FEATURE_STEAMVR_PLUGIN: ${XRT_FEATURE_STEAMVR_PLUGIN}")
message(STATUS "# FEATURE_WINDOW_PEEK: ${XRT_FEATURE_WINDOW_PEEK}") message(STATUS "# FEATURE_TRACING: ${XRT_FEATURE_TRACING}")
message(STATUS "# FEATURE_WINDOW_PEEK: ${XRT_FEATURE_WINDOW_PEEK}")
message(STATUS "#") message(STATUS "#")
message(STATUS "# DRIVER_ANDROID: ${XRT_BUILD_DRIVER_ANDROID}") message(STATUS "# DRIVER_ANDROID: ${XRT_BUILD_DRIVER_ANDROID}")
message(STATUS "# DRIVER_ARDUINO: ${XRT_BUILD_DRIVER_ARDUINO}") message(STATUS "# DRIVER_ARDUINO: ${XRT_BUILD_DRIVER_ARDUINO}")

View file

@ -0,0 +1 @@
- st/oxr: Implement the EXT_active_action_set_priority extension.

View file

@ -57,6 +57,7 @@ EXTENSIONS = (
['XR_KHR_vulkan_enable2', 'XR_USE_GRAPHICS_API_VULKAN'], ['XR_KHR_vulkan_enable2', 'XR_USE_GRAPHICS_API_VULKAN'],
['XR_KHR_vulkan_swapchain_format_list', 'XR_USE_GRAPHICS_API_VULKAN', 'XRT_FEATURE_OPENXR_VULKAN_SWAPCHAIN_FORMAT_LIST'], ['XR_KHR_vulkan_swapchain_format_list', 'XR_USE_GRAPHICS_API_VULKAN', 'XRT_FEATURE_OPENXR_VULKAN_SWAPCHAIN_FORMAT_LIST'],
['XR_KHR_win32_convert_performance_counter_time', 'XR_USE_PLATFORM_WIN32'], ['XR_KHR_win32_convert_performance_counter_time', 'XR_USE_PLATFORM_WIN32'],
['XR_EXT_active_action_set_priority', 'XRT_FEATURE_OPENXR_ACTIVE_ACTION_SET_PRIORITY'],
['XR_EXT_debug_utils', 'XRT_FEATURE_OPENXR_DEBUG_UTILS'], ['XR_EXT_debug_utils', 'XRT_FEATURE_OPENXR_DEBUG_UTILS'],
['XR_EXT_dpad_binding'], ['XR_EXT_dpad_binding'],
['XR_EXT_eye_gaze_interaction', 'XRT_FEATURE_OPENXR_INTERACTION_EXT_EYE_GAZE'], ['XR_EXT_eye_gaze_interaction', 'XRT_FEATURE_OPENXR_INTERACTION_EXT_EYE_GAZE'],

View file

@ -32,6 +32,7 @@
{ symbol: ["XRT_FEATURE_COLOR_LOG", "public", "\"xrt/xrt_config_build.h\"", "public"] }, { symbol: ["XRT_FEATURE_COLOR_LOG", "public", "\"xrt/xrt_config_build.h\"", "public"] },
{ symbol: ["XRT_FEATURE_DEBUG_GUI", "public", "\"xrt/xrt_config_build.h\"", "public"] }, { symbol: ["XRT_FEATURE_DEBUG_GUI", "public", "\"xrt/xrt_config_build.h\"", "public"] },
{ symbol: ["XRT_FEATURE_OPENXR", "public", "\"xrt/xrt_config_build.h\"", "public"] }, { symbol: ["XRT_FEATURE_OPENXR", "public", "\"xrt/xrt_config_build.h\"", "public"] },
{ symbol: ["XRT_FEATURE_OPENXR_ACTIVE_ACTION_SET_PRIORITY", "public", "\"xrt/xrt_config_build.h\"", "public"] },
{ symbol: ["XRT_FEATURE_OPENXR_BODY_TRACKING_FB", "public", "\"xrt/xrt_config_build.h\"", "public"] }, { symbol: ["XRT_FEATURE_OPENXR_BODY_TRACKING_FB", "public", "\"xrt/xrt_config_build.h\"", "public"] },
{ symbol: ["XRT_FEATURE_OPENXR_DEBUG_UTILS", "public", "\"xrt/xrt_config_build.h\"", "public"] }, { symbol: ["XRT_FEATURE_OPENXR_DEBUG_UTILS", "public", "\"xrt/xrt_config_build.h\"", "public"] },
{ symbol: ["XRT_FEATURE_OPENXR_DISPLAY_REFRESH_RATE", "public", "\"xrt/xrt_config_build.h\"", "public"] }, { symbol: ["XRT_FEATURE_OPENXR_DISPLAY_REFRESH_RATE", "public", "\"xrt/xrt_config_build.h\"", "public"] },

View file

@ -29,6 +29,7 @@
#cmakedefine XRT_FEATURE_COLOR_LOG #cmakedefine XRT_FEATURE_COLOR_LOG
#cmakedefine XRT_FEATURE_DEBUG_GUI #cmakedefine XRT_FEATURE_DEBUG_GUI
#cmakedefine XRT_FEATURE_OPENXR #cmakedefine XRT_FEATURE_OPENXR
#cmakedefine XRT_FEATURE_OPENXR_ACTIVE_ACTION_SET_PRIORITY
#cmakedefine XRT_FEATURE_OPENXR_BODY_TRACKING_FB #cmakedefine XRT_FEATURE_OPENXR_BODY_TRACKING_FB
#cmakedefine XRT_FEATURE_OPENXR_DEBUG_UTILS #cmakedefine XRT_FEATURE_OPENXR_DEBUG_UTILS
#cmakedefine XRT_FEATURE_OPENXR_DISPLAY_REFRESH_RATE #cmakedefine XRT_FEATURE_OPENXR_DISPLAY_REFRESH_RATE

View file

@ -132,6 +132,19 @@ oxr_xrSyncActions(XrSession session, const XrActionsSyncInfo *syncInfo)
OXR_VERIFY_SESSION_NOT_LOST(&log, sess); OXR_VERIFY_SESSION_NOT_LOST(&log, sess);
OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, syncInfo, XR_TYPE_ACTIONS_SYNC_INFO); OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, syncInfo, XR_TYPE_ACTIONS_SYNC_INFO);
const XrActiveActionSetPrioritiesEXT *active_priorities = NULL;
#ifdef OXR_HAVE_EXT_active_action_set_priority
active_priorities = OXR_GET_OUTPUT_FROM_CHAIN(syncInfo->next, XR_TYPE_ACTIVE_ACTION_SET_PRIORITIES_EXT,
const XrActiveActionSetPrioritiesEXT);
// ensure that if the active priority override is present,
// the EXT_active_action_set_priority extension is enabled
if (active_priorities) {
OXR_VERIFY_EXTENSION(&log, sess->sys->inst, EXT_active_action_set_priority);
}
#endif
struct xrt_system_roles sys_roles = XRT_STRUCT_INIT; struct xrt_system_roles sys_roles = XRT_STRUCT_INIT;
xrt_system_devices_get_roles(sess->sys->xsysd, &sys_roles); xrt_system_devices_get_roles(sess->sys->xsysd, &sys_roles);
{ {
@ -159,7 +172,8 @@ oxr_xrSyncActions(XrSession session, const XrActionsSyncInfo *syncInfo)
} }
} }
return oxr_action_sync_data(&log, sess, syncInfo->countActiveActionSets, syncInfo->activeActionSets); return oxr_action_sync_data(&log, sess, syncInfo->countActiveActionSets, syncInfo->activeActionSets,
active_priorities);
} }
XRAPI_ATTR XrResult XRAPI_CALL XRAPI_ATTR XrResult XRAPI_CALL

View file

@ -61,7 +61,7 @@ oxr_find_input_in_chain(const void *ptr, XrStructureType desired)
* casting. * casting.
*/ */
static inline XrBaseOutStructure * static inline XrBaseOutStructure *
oxr_find_output_in_chain(void *ptr, XrStructureType desired) oxr_find_output_in_chain(const void *ptr, XrStructureType desired)
{ {
while (ptr != NULL) { while (ptr != NULL) {
XrBaseOutStructure *base = (XrBaseOutStructure *)ptr; XrBaseOutStructure *base = (XrBaseOutStructure *)ptr;

View file

@ -293,6 +293,18 @@
#endif #endif
/*
* XR_EXT_active_action_set_priority
*/
#if defined(XR_EXT_active_action_set_priority) && defined(XRT_FEATURE_OPENXR_ACTIVE_ACTION_SET_PRIORITY)
#define OXR_HAVE_EXT_active_action_set_priority
#define OXR_EXTENSION_SUPPORT_EXT_active_action_set_priority(_) \
_(EXT_active_action_set_priority, EXT_ACTIVE_ACTION_SET_PRIORITY)
#else
#define OXR_EXTENSION_SUPPORT_EXT_active_action_set_priority(_)
#endif
/* /*
* XR_EXT_debug_utils * XR_EXT_debug_utils
*/ */
@ -783,6 +795,7 @@
OXR_EXTENSION_SUPPORT_KHR_vulkan_enable2(_) \ OXR_EXTENSION_SUPPORT_KHR_vulkan_enable2(_) \
OXR_EXTENSION_SUPPORT_KHR_vulkan_swapchain_format_list(_) \ OXR_EXTENSION_SUPPORT_KHR_vulkan_swapchain_format_list(_) \
OXR_EXTENSION_SUPPORT_KHR_win32_convert_performance_counter_time(_) \ OXR_EXTENSION_SUPPORT_KHR_win32_convert_performance_counter_time(_) \
OXR_EXTENSION_SUPPORT_EXT_active_action_set_priority(_) \
OXR_EXTENSION_SUPPORT_EXT_debug_utils(_) \ OXR_EXTENSION_SUPPORT_EXT_debug_utils(_) \
OXR_EXTENSION_SUPPORT_EXT_dpad_binding(_) \ OXR_EXTENSION_SUPPORT_EXT_dpad_binding(_) \
OXR_EXTENSION_SUPPORT_EXT_eye_gaze_interaction(_) \ OXR_EXTENSION_SUPPORT_EXT_eye_gaze_interaction(_) \

View file

@ -58,7 +58,8 @@ oxr_action_cache_update(struct oxr_logger *log,
struct oxr_action_cache *cache, struct oxr_action_cache *cache,
int64_t time, int64_t time,
struct oxr_subaction_paths *subaction_path, struct oxr_subaction_paths *subaction_path,
bool select); bool select,
const XrActiveActionSetPrioritiesEXT *active_priorities);
static void static void
oxr_action_attachment_update(struct oxr_logger *log, oxr_action_attachment_update(struct oxr_logger *log,
@ -67,7 +68,8 @@ oxr_action_attachment_update(struct oxr_logger *log,
const XrActiveActionSet *actionSets, const XrActiveActionSet *actionSets,
struct oxr_action_attachment *act_attached, struct oxr_action_attachment *act_attached,
int64_t time, int64_t time,
struct oxr_subaction_paths subaction_paths); struct oxr_subaction_paths subaction_paths,
const XrActiveActionSetPrioritiesEXT *active_priorities);
static void static void
oxr_action_bind_io(struct oxr_logger *log, oxr_action_bind_io(struct oxr_logger *log,
@ -925,16 +927,37 @@ oxr_input_is_bound_in_act_set(struct oxr_action_input *action_input, struct oxr_
return false; return false;
} }
static uint32_t
oxr_get_action_set_priority(const struct oxr_action_set_ref *act_set_ref,
const XrActiveActionSetPrioritiesEXT *active_priorities)
{
if (active_priorities) {
for (uint32_t i = 0; i < active_priorities->actionSetPriorityCount; i++) {
XrActiveActionSetPriorityEXT act_set_priority = active_priorities->actionSetPriorities[i];
struct oxr_action_set *action_set =
XRT_CAST_OXR_HANDLE_TO_PTR(struct oxr_action_set *, act_set_priority.actionSet);
if (action_set->data == act_set_ref) {
return act_set_priority.priorityOverride;
}
}
}
return act_set_ref->priority;
}
static bool static bool
oxr_input_supressed(struct oxr_session *sess, oxr_input_supressed(struct oxr_session *sess,
uint32_t countActionSets, uint32_t countActionSets,
const XrActiveActionSet *actionSets, const XrActiveActionSet *actionSets,
struct oxr_subaction_paths *subaction_path, struct oxr_subaction_paths *subaction_path,
struct oxr_action_attachment *act_attached, struct oxr_action_attachment *act_attached,
struct oxr_action_input *action_input) struct oxr_action_input *action_input,
const XrActiveActionSetPrioritiesEXT *active_priorities)
{ {
struct oxr_action_set_ref *act_set_ref = act_attached->act_set_attached->act_set_ref; struct oxr_action_set_ref *act_set_ref = act_attached->act_set_attached->act_set_ref;
uint32_t priority = act_set_ref->priority; uint32_t priority = oxr_get_action_set_priority(act_set_ref, active_priorities);
// find sources that are bound to an action in a set with higher prio // find sources that are bound to an action in a set with higher prio
for (uint32_t i = 0; i < countActionSets; i++) { for (uint32_t i = 0; i < countActionSets; i++) {
@ -954,7 +977,7 @@ oxr_input_supressed(struct oxr_session *sess,
} }
/* input may be suppressed by action set with higher prio */ /* input may be suppressed by action set with higher prio */
if (other_act_set_attached->act_set_ref->priority <= priority) { if (oxr_get_action_set_priority(other_act_set_attached->act_set_ref, active_priorities) <= priority) {
continue; continue;
} }
@ -993,7 +1016,8 @@ oxr_input_combine_input(struct oxr_session *sess,
struct oxr_action_cache *cache, struct oxr_action_cache *cache,
struct oxr_input_value_tagged *out_input, struct oxr_input_value_tagged *out_input,
int64_t *out_timestamp, int64_t *out_timestamp,
bool *out_is_active) bool *out_is_active,
const XrActiveActionSetPrioritiesEXT *active_priorities)
{ {
struct oxr_action_input *inputs = cache->inputs; struct oxr_action_input *inputs = cache->inputs;
size_t input_count = cache->input_count; size_t input_count = cache->input_count;
@ -1013,8 +1037,8 @@ oxr_input_combine_input(struct oxr_session *sess,
// suppress input if it is also bound to action in set with // suppress input if it is also bound to action in set with
// higher priority // higher priority
if (oxr_input_supressed(sess, countActionSets, actionSets, subaction_path, act_attached, if (oxr_input_supressed(sess, countActionSets, actionSets, subaction_path, act_attached, action_input,
action_input)) { active_priorities)) {
continue; continue;
} }
@ -1111,7 +1135,8 @@ oxr_action_cache_update(struct oxr_logger *log,
struct oxr_action_cache *cache, struct oxr_action_cache *cache,
int64_t time, int64_t time,
struct oxr_subaction_paths *subaction_path, struct oxr_subaction_paths *subaction_path,
bool selected) bool selected,
const XrActiveActionSetPrioritiesEXT *active_priorities)
{ {
struct oxr_action_state last = cache->current; struct oxr_action_state last = cache->current;
@ -1144,7 +1169,8 @@ oxr_action_cache_update(struct oxr_logger *log,
cache, // cache cache, // cache
&combined, // out_input &combined, // out_input
&timestamp, // out_timestamp &timestamp, // out_timestamp
&is_active); // out_is_active &is_active, // out_is_active
active_priorities); // active_priorities
if (!bret) { if (!bret) {
oxr_log(log, "Failed to get/combine input values '%s'", act_attached->act_ref->name); oxr_log(log, "Failed to get/combine input values '%s'", act_attached->act_ref->name);
return; return;
@ -1291,7 +1317,8 @@ oxr_action_attachment_update(struct oxr_logger *log,
const XrActiveActionSet *actionSets, const XrActiveActionSet *actionSets,
struct oxr_action_attachment *act_attached, struct oxr_action_attachment *act_attached,
int64_t time, int64_t time,
struct oxr_subaction_paths subaction_paths) struct oxr_subaction_paths subaction_paths,
const XrActiveActionSetPrioritiesEXT *active_priorities)
{ {
// This really shouldn't be happening. // This really shouldn't be happening.
if (act_attached == NULL) { if (act_attached == NULL) {
@ -1303,7 +1330,7 @@ oxr_action_attachment_update(struct oxr_logger *log,
subaction_paths_##X.X = true; \ subaction_paths_##X.X = true; \
bool select_##X = subaction_paths.X || subaction_paths.any; \ bool select_##X = subaction_paths.X || subaction_paths.any; \
oxr_action_cache_update(log, sess, countActionSets, actionSets, act_attached, &act_attached->X, time, \ oxr_action_cache_update(log, sess, countActionSets, actionSets, act_attached, &act_attached->X, time, \
&subaction_paths_##X, select_##X); &subaction_paths_##X, select_##X, active_priorities);
OXR_FOR_EACH_VALID_SUBACTION_PATH(UPDATE_SELECT) OXR_FOR_EACH_VALID_SUBACTION_PATH(UPDATE_SELECT)
#undef UPDATE_SELECT #undef UPDATE_SELECT
@ -1792,7 +1819,8 @@ XrResult
oxr_action_sync_data(struct oxr_logger *log, oxr_action_sync_data(struct oxr_logger *log,
struct oxr_session *sess, struct oxr_session *sess,
uint32_t countActionSets, uint32_t countActionSets,
const XrActiveActionSet *actionSets) const XrActiveActionSet *actionSets,
const XrActiveActionSetPrioritiesEXT *activePriorities)
{ {
struct oxr_action_set *act_set = NULL; struct oxr_action_set *act_set = NULL;
struct oxr_action_set_attachment *act_set_attached = NULL; struct oxr_action_set_attachment *act_set_attached = NULL;
@ -1877,7 +1905,7 @@ oxr_action_sync_data(struct oxr_logger *log,
} }
oxr_action_attachment_update(log, sess, countActionSets, actionSets, act_attached, now, oxr_action_attachment_update(log, sess, countActionSets, actionSets, act_attached, now,
subaction_paths); subaction_paths, activePriorities);
} }
} }

View file

@ -506,7 +506,8 @@ XrResult
oxr_action_sync_data(struct oxr_logger *log, oxr_action_sync_data(struct oxr_logger *log,
struct oxr_session *sess, struct oxr_session *sess,
uint32_t countActionSets, uint32_t countActionSets,
const XrActiveActionSet *actionSets); const XrActiveActionSet *actionSets,
const XrActiveActionSetPrioritiesEXT *activePriorities);
/*! /*!
* @public @memberof oxr_session * @public @memberof oxr_session