st/oxr: Add controller extensions

Extensions enabled:
* XR_EXT_hp_mixed_reality_controller
* XR_EXT_samsung_odyssey_controller
* XR_ML_ml2_controller_interaction
This commit is contained in:
Jakob Bornecrantz 2023-01-23 23:23:42 +00:00
parent 6ce2978648
commit c21a8ef0cc
6 changed files with 84 additions and 0 deletions

View file

@ -54,7 +54,10 @@ EXTENSIONS = (
['XR_EXT_debug_utils', 'XRT_FEATURE_OPENXR_DEBUG_UTILS'],
['XR_EXT_dpad_binding'],
['XR_EXT_hand_tracking'],
['XR_EXT_hp_mixed_reality_controller'],
['XR_EXT_samsung_odyssey_controller'],
['XR_FB_display_refresh_rate'],
['XR_ML_ml2_controller_interaction'],
['XR_MND_headless'],
['XR_MND_swapchain_usage_input_attachment_bit'],
['XR_EXTX_overlay'],

View file

@ -249,6 +249,39 @@ oxr_xrSuggestInteractionProfileBindings(XrInstance instance,
subpath_fn = oxr_verify_valve_index_controller_subpath;
dpad_path_fn = oxr_verify_valve_index_controller_dpad_path;
dpad_emulator_fn = oxr_verify_valve_index_controller_dpad_emulator;
} else if (ip == inst->path_cache.hp_mixed_reality_controller) {
if (!inst->extensions.EXT_hp_mixed_reality_controller) {
return oxr_error(&log, XR_ERROR_PATH_UNSUPPORTED,
"(suggestedBindings->interactionProfile == \"%s\") used but "
"XR_EXT_hp_mixed_reality_controller not enabled",
ip_str);
}
subpath_fn = oxr_verify_hp_mixed_reality_controller_subpath;
dpad_path_fn = oxr_verify_hp_mixed_reality_controller_dpad_path;
dpad_emulator_fn = oxr_verify_hp_mixed_reality_controller_dpad_emulator;
} else if (ip == inst->path_cache.samsung_odyssey_controller) {
if (!inst->extensions.EXT_samsung_odyssey_controller) {
return oxr_error(&log, XR_ERROR_PATH_UNSUPPORTED,
"(suggestedBindings->interactionProfile == \"%s\") used but "
"XR_EXT_samsung_odyssey_controller not enabled",
ip_str);
}
subpath_fn = oxr_verify_samsung_odyssey_controller_subpath;
dpad_path_fn = oxr_verify_samsung_odyssey_controller_dpad_path;
dpad_emulator_fn = oxr_verify_samsung_odyssey_controller_dpad_emulator;
} else if (ip == inst->path_cache.ml_ml2_controller) {
if (!inst->extensions.ML_ml2_controller_interaction) {
return oxr_error(&log, XR_ERROR_PATH_UNSUPPORTED,
"(suggestedBindings->interactionProfile == \"%s\") used but "
"XR_ML_ml2_controller not enabled",
ip_str);
}
subpath_fn = oxr_verify_ml_ml2_controller_subpath;
dpad_path_fn = oxr_verify_ml_ml2_controller_dpad_path;
dpad_emulator_fn = oxr_verify_ml_ml2_controller_dpad_emulator;
} else if (ip == inst->path_cache.mndx_ball_on_a_stick_controller) {
subpath_fn = oxr_verify_mndx_ball_on_a_stick_controller_subpath;
dpad_path_fn = oxr_verify_mndx_ball_on_a_stick_controller_dpad_path;

View file

@ -328,6 +328,9 @@ get_profile_for_device_name(struct oxr_logger *log,
case XRT_DEVICE_GO_CONTROLLER: FIND_PROFILE(oculus_go_controller); return;
case XRT_DEVICE_VIVE_PRO: FIND_PROFILE(htc_vive_pro); return;
case XRT_DEVICE_XBOX_CONTROLLER: FIND_PROFILE(microsoft_xbox_controller); return;
case XRT_DEVICE_HP_REVERB_G2_CONTROLLER: FIND_PROFILE(hp_mixed_reality_controller); return;
case XRT_DEVICE_SAMSUNG_ODYSSEY_CONTROLLER: FIND_PROFILE(samsung_odyssey_controller); return;
case XRT_DEVICE_ML2_CONTROLLER: FIND_PROFILE(ml_ml2_controller); return;
case XRT_DEVICE_HAND_INTERACTION: FIND_PROFILE(msft_hand_interaction); return;
// no interaction

View file

@ -257,6 +257,30 @@
#endif
/*
* XR_EXT_hp_mixed_reality_controller
*/
#if defined(XR_EXT_hp_mixed_reality_controller)
#define OXR_HAVE_EXT_hp_mixed_reality_controller
#define OXR_EXTENSION_SUPPORT_EXT_hp_mixed_reality_controller(_) \
_(EXT_hp_mixed_reality_controller, EXT_HP_MIXED_REALITY_CONTROLLER)
#else
#define OXR_EXTENSION_SUPPORT_EXT_hp_mixed_reality_controller(_)
#endif
/*
* XR_EXT_samsung_odyssey_controller
*/
#if defined(XR_EXT_samsung_odyssey_controller)
#define OXR_HAVE_EXT_samsung_odyssey_controller
#define OXR_EXTENSION_SUPPORT_EXT_samsung_odyssey_controller(_) \
_(EXT_samsung_odyssey_controller, EXT_SAMSUNG_ODYSSEY_CONTROLLER)
#else
#define OXR_EXTENSION_SUPPORT_EXT_samsung_odyssey_controller(_)
#endif
/*
* XR_FB_display_refresh_rate
*/
@ -268,6 +292,18 @@
#endif
/*
* XR_ML_ml2_controller_interaction
*/
#if defined(XR_ML_ml2_controller_interaction)
#define OXR_HAVE_ML_ml2_controller_interaction
#define OXR_EXTENSION_SUPPORT_ML_ml2_controller_interaction(_) \
_(ML_ml2_controller_interaction, ML_ML2_CONTROLLER_INTERACTION)
#else
#define OXR_EXTENSION_SUPPORT_ML_ml2_controller_interaction(_)
#endif
/*
* XR_MND_headless
*/
@ -380,7 +416,10 @@
OXR_EXTENSION_SUPPORT_EXT_debug_utils(_) \
OXR_EXTENSION_SUPPORT_EXT_dpad_binding(_) \
OXR_EXTENSION_SUPPORT_EXT_hand_tracking(_) \
OXR_EXTENSION_SUPPORT_EXT_hp_mixed_reality_controller(_) \
OXR_EXTENSION_SUPPORT_EXT_samsung_odyssey_controller(_) \
OXR_EXTENSION_SUPPORT_FB_display_refresh_rate(_) \
OXR_EXTENSION_SUPPORT_ML_ml2_controller_interaction(_) \
OXR_EXTENSION_SUPPORT_MND_headless(_) \
OXR_EXTENSION_SUPPORT_MND_swapchain_usage_input_attachment_bit(_) \
OXR_EXTENSION_SUPPORT_EXTX_overlay(_) \

View file

@ -244,6 +244,9 @@ oxr_instance_create(struct oxr_logger *log,
cache_path(log, inst, "/interaction_profiles/oculus/go_controller", &inst->path_cache.oculus_go_controller);
cache_path(log, inst, "/interaction_profiles/oculus/touch_controller", &inst->path_cache.oculus_touch_controller);
cache_path(log, inst, "/interaction_profiles/valve/index_controller", &inst->path_cache.valve_index_controller);
cache_path(log, inst, "/interaction_profiles/hp/mixed_reality_controller", &inst->path_cache.hp_mixed_reality_controller);
cache_path(log, inst, "/interaction_profiles/samsung/odyssey_controller", &inst->path_cache.samsung_odyssey_controller);
cache_path(log, inst, "/interaction_profiles/ml/ml2_controller", &inst->path_cache.ml_ml2_controller);
cache_path(log, inst, "/interaction_profiles/mndx/ball_on_a_stick_controller", &inst->path_cache.mndx_ball_on_a_stick_controller);
cache_path(log, inst, "/interaction_profiles/microsoft/hand_interaction", &inst->path_cache.msft_hand_interaction);

View file

@ -1487,6 +1487,9 @@ struct oxr_instance
XrPath oculus_go_controller;
XrPath oculus_touch_controller;
XrPath valve_index_controller;
XrPath hp_mixed_reality_controller;
XrPath samsung_odyssey_controller;
XrPath ml_ml2_controller;
XrPath mndx_ball_on_a_stick_controller;
XrPath msft_hand_interaction;
} path_cache;