st/oxr: Update to OpenXR 1.0

This commit is contained in:
Jakob Bornecrantz 2019-07-13 17:17:57 +01:00
parent 08a4b40f77
commit 57c6078a69
15 changed files with 388 additions and 347 deletions

View file

@ -26,43 +26,61 @@
*/ */
XrResult XrResult
oxr_xrSyncActionData(XrSession session, oxr_xrSyncActions(XrSession session, const XrActionsSyncInfo* syncInfo)
uint32_t countActionSets, {
const XrActiveActionSet* actionSets) struct oxr_session* sess;
struct oxr_logger log;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess, "xrSyncActions");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, syncInfo, XR_TYPE_ACTIONS_SYNC_INFO);
if (syncInfo->countActiveActionSets == 0) {
return oxr_error(&log, XR_ERROR_VALIDATION_FAILURE,
"(syncInfo->countActiveActionSets == 0)");
}
for (uint32_t i = 0; i < syncInfo->countActiveActionSets; i++) {
struct oxr_action_set* act_set = NULL;
OXR_VERIFY_ACTIONSET_NOT_NULL(
&log, syncInfo->activeActionSets[i].actionSet, act_set);
oxr_verify_subaction_path_sync(
&log, sess->sys->inst,
syncInfo->activeActionSets[i].subactionPath, i);
}
return oxr_action_sync_data(&log, sess, syncInfo->countActiveActionSets,
syncInfo->activeActionSets);
}
XrResult
oxr_xrAttachSessionActionSets(XrSession session,
const XrSessionActionSetsAttachInfo* bindInfo)
{ {
struct oxr_session* sess; struct oxr_session* sess;
struct oxr_logger log; struct oxr_logger log;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess, OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrSyncActionData"); "xrAttachSessionActionSets");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, bindInfo,
XR_TYPE_SESSION_ACTION_SETS_ATTACH_INFO);
if (countActionSets == 0) { for (uint32_t i = 0; i < bindInfo->countActionSets; i++) {
return oxr_error(&log, XR_ERROR_VALIDATION_FAILURE,
"(countActionSets == 0)");
}
for (uint32_t i = 0; i < countActionSets; i++) {
struct oxr_action_set* act_set = NULL; struct oxr_action_set* act_set = NULL;
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, (&actionSets[i]), OXR_VERIFY_ACTIONSET_NOT_NULL(&log, bindInfo->actionSets[i],
XR_TYPE_ACTIVE_ACTION_SET);
OXR_VERIFY_ACTIONSET_NOT_NULL(&log, actionSets[i].actionSet,
act_set); act_set);
oxr_verify_subaction_path_sync(&log, sess->sys->inst,
actionSets[i].subactionPath, i);
} }
return oxr_action_sync_data(&log, sess, countActionSets, actionSets); return oxr_session_attach_action_sets(&log, sess, bindInfo);
} }
XrResult XrResult
oxr_xrSetInteractionProfileSuggestedBindings( oxr_xrSuggestInteractionProfileBindings(
XrSession session, XrInstance instance,
const XrInteractionProfileSuggestedBinding* suggestedBindings) const XrInteractionProfileSuggestedBinding* suggestedBindings)
{ {
struct oxr_session* sess; struct oxr_instance* inst;
struct oxr_logger log; struct oxr_logger log;
OXR_VERIFY_SESSION_AND_INIT_LOG( OXR_VERIFY_INSTANCE_AND_INIT_LOG(&log, instance, inst,
&log, session, sess, "xrSetInteractionProfileSuggestedBindings"); "xrSuggestInteractionProfileBindings");
OXR_VERIFY_ARG_TYPE_AND_NULL( OXR_VERIFY_ARG_TYPE_AND_NULL(
&log, suggestedBindings, &log, suggestedBindings,
XR_TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING); XR_TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING);
@ -77,21 +95,22 @@ oxr_xrSetInteractionProfileSuggestedBindings(
//! @todo verify path (s->binding). //! @todo verify path (s->binding).
} }
return oxr_action_set_interaction_profile_suggested_bindings( return oxr_action_suggest_interaction_profile_bindings(
&log, sess, suggestedBindings); &log, inst, suggestedBindings);
} }
XrResult XrResult
oxr_xrGetCurrentInteractionProfile(XrSession session, oxr_xrGetCurrentInteractionProfile(
XrPath topLevelUserPath, XrSession session,
XrInteractionProfileInfo* interactionProfile) XrPath topLevelUserPath,
XrInteractionProfileState* interactionProfile)
{ {
struct oxr_session* sess; struct oxr_session* sess;
struct oxr_logger log; struct oxr_logger log;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess, OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrGetCurrentInteractionProfile"); "xrGetCurrentInteractionProfile");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, interactionProfile, OXR_VERIFY_ARG_TYPE_AND_NULL(&log, interactionProfile,
XR_TYPE_INTERACTION_PROFILE_INFO); XR_TYPE_INTERACTION_PROFILE_STATE);
return oxr_action_get_current_interaction_profile( return oxr_action_get_current_interaction_profile(
&log, sess, topLevelUserPath, interactionProfile); &log, sess, topLevelUserPath, interactionProfile);
@ -100,8 +119,7 @@ oxr_xrGetCurrentInteractionProfile(XrSession session,
XrResult XrResult
oxr_xrGetInputSourceLocalizedName( oxr_xrGetInputSourceLocalizedName(
XrSession session, XrSession session,
XrPath source, const XrInputSourceLocalizedNameGetInfo* getInfo,
XrInputSourceLocalizedNameFlags whichComponents,
uint32_t bufferCapacityInput, uint32_t bufferCapacityInput,
uint32_t* bufferCountOutput, uint32_t* bufferCountOutput,
char* buffer) char* buffer)
@ -110,11 +128,11 @@ oxr_xrGetInputSourceLocalizedName(
struct oxr_logger log; struct oxr_logger log;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess, OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrGetInputSourceLocalizedName"); "xrGetInputSourceLocalizedName");
//! @todo verify path //! @todo verify getInfo
return oxr_action_get_input_source_localized_name( return oxr_action_get_input_source_localized_name(
&log, sess, source, whichComponents, bufferCapacityInput, &log, sess, getInfo, bufferCapacityInput, bufferCountOutput,
bufferCountOutput, buffer); buffer);
} }
@ -125,16 +143,16 @@ oxr_xrGetInputSourceLocalizedName(
*/ */
XrResult XrResult
oxr_xrCreateActionSet(XrSession session, oxr_xrCreateActionSet(XrInstance instance,
const XrActionSetCreateInfo* createInfo, const XrActionSetCreateInfo* createInfo,
XrActionSet* actionSet) XrActionSet* actionSet)
{ {
struct oxr_action_set* act_set = NULL; struct oxr_action_set* act_set = NULL;
struct oxr_session* sess = NULL; struct oxr_instance* inst = NULL;
struct oxr_logger log; struct oxr_logger log;
XrResult ret; XrResult ret;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess, OXR_VERIFY_INSTANCE_AND_INIT_LOG(&log, instance, inst,
"xrCreateActionSet"); "xrCreateActionSet");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, createInfo, OXR_VERIFY_ARG_TYPE_AND_NULL(&log, createInfo,
XR_TYPE_ACTION_SET_CREATE_INFO); XR_TYPE_ACTION_SET_CREATE_INFO);
OXR_VERIFY_ARG_NOT_NULL(&log, actionSet); OXR_VERIFY_ARG_NOT_NULL(&log, actionSet);
@ -142,7 +160,7 @@ oxr_xrCreateActionSet(XrSession session,
&log, createInfo->actionSetName); &log, createInfo->actionSetName);
OXR_VERIFY_ARG_LOCALIZED_NAME(&log, createInfo->localizedActionSetName); OXR_VERIFY_ARG_LOCALIZED_NAME(&log, createInfo->localizedActionSetName);
ret = oxr_action_set_create(&log, sess, createInfo, &act_set); ret = oxr_action_set_create(&log, inst, createInfo, &act_set);
if (ret != XR_SUCCESS) { if (ret != XR_SUCCESS) {
return ret; return ret;
} }
@ -189,7 +207,7 @@ oxr_xrCreateAction(XrActionSet actionSet,
OXR_VERIFY_ARG_LOCALIZED_NAME(&log, createInfo->localizedActionName); OXR_VERIFY_ARG_LOCALIZED_NAME(&log, createInfo->localizedActionName);
OXR_VERIFY_ARG_NOT_NULL(&log, action); OXR_VERIFY_ARG_NOT_NULL(&log, action);
struct oxr_instance* inst = act_set->sess->sys->inst; struct oxr_instance* inst = act_set->inst;
ret = oxr_verify_subaction_paths_create( ret = oxr_verify_subaction_paths_create(
&log, inst, createInfo->countSubactionPaths, &log, inst, createInfo->countSubactionPaths,
@ -219,168 +237,153 @@ oxr_xrDestroyAction(XrAction action)
} }
XrResult XrResult
oxr_xrGetActionStateBoolean(XrAction action, oxr_xrGetActionStateBoolean(XrSession session,
uint32_t countSubactionPaths, const XrActionStateGetInfo* getInfo,
const XrPath* subactionPaths,
XrActionStateBoolean* data) XrActionStateBoolean* data)
{ {
XrPath subactionPath = XR_NULL_PATH; struct oxr_session* sess = NULL;
struct oxr_action* act = NULL;
struct oxr_sub_paths sub_paths = {0}; struct oxr_sub_paths sub_paths = {0};
struct oxr_action* act;
struct oxr_logger log; struct oxr_logger log;
XrResult ret; XrResult ret;
OXR_VERIFY_ACTION_AND_INIT_LOG(&log, action, act, OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrGetActionStateBoolean"); "xrGetActionStateBoolean");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, data, XR_TYPE_ACTION_STATE_BOOLEAN); OXR_VERIFY_ARG_TYPE_AND_NULL(&log, data, XR_TYPE_ACTION_STATE_BOOLEAN);
OXR_VERIFY_SUBACTION_PATHS(&log, countSubactionPaths, subactionPaths); OXR_VERIFY_ARG_TYPE_AND_NULL(&log, getInfo,
XR_TYPE_ACTION_STATE_GET_INFO);
OXR_VERIFY_ACTION_NOT_NULL(&log, getInfo->action, act);
if (act->action_type != XR_INPUT_ACTION_TYPE_BOOLEAN) { if (act->action_type != XR_ACTION_TYPE_BOOLEAN_INPUT) {
return oxr_error(&log, XR_ERROR_ACTION_TYPE_MISMATCH, return oxr_error(&log, XR_ERROR_ACTION_TYPE_MISMATCH,
" not created with pose type"); " not created with boolean type");
} }
// Trust me. ret = oxr_verify_subaction_path_get(
if (countSubactionPaths > 1) { &log, act->act_set->inst, getInfo->subactionPath, &act->sub_paths,
return oxr_error(&log, XR_ERROR_PATH_INVALID, &sub_paths, "getInfo->subactionPath");
" can not handle more then one subactionPath");
}
if (countSubactionPaths == 1) {
subactionPath = subactionPaths[0];
}
ret = oxr_verify_subaction_path_get(&log, act->act_set->sess->sys->inst,
subactionPath, &act->sub_paths,
&sub_paths, "subactionPaths[0]");
if (ret != XR_SUCCESS) { if (ret != XR_SUCCESS) {
return ret; return ret;
} }
return oxr_action_get_boolean(&log, act, sub_paths, data); return oxr_action_get_boolean(&log, sess, act->key, sub_paths, data);
} }
XrResult XrResult
oxr_xrGetActionStateVector1f(XrAction action, oxr_xrGetActionStateFloat(XrSession session,
uint32_t countSubactionPaths, const XrActionStateGetInfo* getInfo,
const XrPath* subactionPaths, XrActionStateFloat* data)
XrActionStateVector1f* data)
{ {
XrPath subactionPath = XR_NULL_PATH; struct oxr_session* sess = NULL;
struct oxr_action* act = NULL;
struct oxr_sub_paths sub_paths = {0}; struct oxr_sub_paths sub_paths = {0};
struct oxr_action* act;
struct oxr_logger log; struct oxr_logger log;
XrResult ret; XrResult ret;
OXR_VERIFY_ACTION_AND_INIT_LOG(&log, action, act, OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrGetActionStateVector1f"); "xrGetActionStateFloat");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, data, XR_TYPE_ACTION_STATE_VECTOR1F); OXR_VERIFY_ARG_TYPE_AND_NULL(&log, data, XR_TYPE_ACTION_STATE_FLOAT);
OXR_VERIFY_SUBACTION_PATHS(&log, countSubactionPaths, subactionPaths); OXR_VERIFY_ARG_TYPE_AND_NULL(&log, getInfo,
XR_TYPE_ACTION_STATE_GET_INFO);
OXR_VERIFY_ACTION_NOT_NULL(&log, getInfo->action, act);
if (act->action_type != XR_INPUT_ACTION_TYPE_VECTOR1F) { if (act->action_type != XR_ACTION_TYPE_FLOAT_INPUT) {
return oxr_error(&log, XR_ERROR_ACTION_TYPE_MISMATCH, return oxr_error(&log, XR_ERROR_ACTION_TYPE_MISMATCH,
" not created with float type"); " not created with float type");
} }
// Trust me. ret = oxr_verify_subaction_path_get(
if (countSubactionPaths > 1) { &log, act->act_set->inst, getInfo->subactionPath, &act->sub_paths,
return oxr_error(&log, XR_ERROR_PATH_INVALID, &sub_paths, "getInfo->subactionPath");
" can not handle more then one subactionPath");
}
if (countSubactionPaths == 1) {
subactionPath = subactionPaths[0];
}
ret = oxr_verify_subaction_path_get(&log, act->act_set->sess->sys->inst,
subactionPath, &act->sub_paths,
&sub_paths, "subactionPaths[0]");
if (ret != XR_SUCCESS) { if (ret != XR_SUCCESS) {
return ret; return ret;
} }
return oxr_action_get_vector1f(&log, act, sub_paths, data); return oxr_action_get_vector1f(&log, sess, act->key, sub_paths, data);
} }
XrResult XrResult
oxr_xrGetActionStateVector2f(XrAction action, oxr_xrGetActionStateVector2f(XrSession session,
uint32_t countSubactionPaths, const XrActionStateGetInfo* getInfo,
const XrPath* subactionPaths,
XrActionStateVector2f* data) XrActionStateVector2f* data)
{ {
XrPath subactionPath = XR_NULL_PATH; struct oxr_session* sess = NULL;
struct oxr_action* act = NULL;
struct oxr_sub_paths sub_paths = {0}; struct oxr_sub_paths sub_paths = {0};
struct oxr_action* act;
struct oxr_logger log; struct oxr_logger log;
XrResult ret; XrResult ret;
OXR_VERIFY_ACTION_AND_INIT_LOG(&log, action, act, OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrGetActionStateVector2f"); "xrGetActionStateVector2f");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, data, XR_TYPE_ACTION_STATE_VECTOR2F); OXR_VERIFY_ARG_TYPE_AND_NULL(&log, data, XR_TYPE_ACTION_STATE_VECTOR2F);
OXR_VERIFY_SUBACTION_PATHS(&log, countSubactionPaths, subactionPaths); OXR_VERIFY_ARG_TYPE_AND_NULL(&log, getInfo,
XR_TYPE_ACTION_STATE_GET_INFO);
OXR_VERIFY_ACTION_NOT_NULL(&log, getInfo->action, act);
if (act->action_type != XR_INPUT_ACTION_TYPE_VECTOR2F) { if (act->action_type != XR_ACTION_TYPE_VECTOR2F_INPUT) {
return oxr_error(&log, XR_ERROR_ACTION_TYPE_MISMATCH, return oxr_error(&log, XR_ERROR_ACTION_TYPE_MISMATCH,
" not created with float[2] type"); " not created with float[2] type");
} }
// Trust me. ret = oxr_verify_subaction_path_get(
if (countSubactionPaths > 1) { &log, act->act_set->inst, getInfo->subactionPath, &act->sub_paths,
return oxr_error(&log, XR_ERROR_PATH_INVALID, &sub_paths, "getInfo->subactionPath");
" can not handle more then one subactionPath");
}
if (countSubactionPaths == 1) {
subactionPath = subactionPaths[0];
}
ret = oxr_verify_subaction_path_get(&log, act->act_set->sess->sys->inst,
subactionPath, &act->sub_paths,
&sub_paths, "subactionPaths[0]");
if (ret != XR_SUCCESS) { if (ret != XR_SUCCESS) {
return ret; return ret;
} }
return oxr_action_get_vector2f(&log, act, sub_paths, data); return oxr_action_get_vector2f(&log, sess, act->key, sub_paths, data);
} }
XrResult XrResult
oxr_xrGetActionStatePose(XrAction action, oxr_xrGetActionStatePose(XrSession session,
XrPath subactionPath, const XrActionStateGetInfo* getInfo,
XrActionStatePose* data) XrActionStatePose* data)
{ {
struct oxr_session* sess = NULL;
struct oxr_action* act = NULL;
struct oxr_sub_paths sub_paths = {0}; struct oxr_sub_paths sub_paths = {0};
struct oxr_action* act;
struct oxr_logger log; struct oxr_logger log;
XrResult ret; XrResult ret;
OXR_VERIFY_ACTION_AND_INIT_LOG(&log, action, act, OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrGetActionStatePose"); "xrGetActionStatePose");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, data, XR_TYPE_ACTION_STATE_POSE); OXR_VERIFY_ARG_TYPE_AND_NULL(&log, data, XR_TYPE_ACTION_STATE_POSE);
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, getInfo,
XR_TYPE_ACTION_STATE_GET_INFO);
OXR_VERIFY_ACTION_NOT_NULL(&log, getInfo->action, act);
if (act->action_type != XR_INPUT_ACTION_TYPE_POSE) { if (act->action_type != XR_ACTION_TYPE_POSE_INPUT) {
return oxr_error(&log, XR_ERROR_ACTION_TYPE_MISMATCH, return oxr_error(&log, XR_ERROR_ACTION_TYPE_MISMATCH,
" not created with pose type"); " not created with pose type");
} }
ret = oxr_verify_subaction_path_get(&log, act->act_set->sess->sys->inst, ret = oxr_verify_subaction_path_get(
subactionPath, &act->sub_paths, &log, act->act_set->inst, getInfo->subactionPath, &act->sub_paths,
&sub_paths, "subactionPath"); &sub_paths, "getInfo->subactionPath");
if (ret != XR_SUCCESS) { if (ret != XR_SUCCESS) {
return ret; return ret;
} }
return oxr_action_get_pose(&log, act, sub_paths, data); return oxr_action_get_pose(&log, sess, act->key, sub_paths, data);
} }
XrResult XrResult
oxr_xrGetBoundSourcesForAction(XrAction action, oxr_xrEnumerateBoundSourcesForAction(
uint32_t sourceCapacityInput, XrSession session,
uint32_t* sourceCountOutput, const XrBoundSourcesForActionEnumerateInfo* enumerateInfo,
XrPath* sources) uint32_t sourceCapacityInput,
uint32_t* sourceCountOutput,
XrPath* sources)
{ {
struct oxr_action* act; struct oxr_session* sess = NULL;
struct oxr_action* act = NULL;
struct oxr_logger log; struct oxr_logger log;
OXR_VERIFY_ACTION_AND_INIT_LOG(&log, action, act, OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrGetBoundSourcesForAction"); "xrEnumerateBoundSourcesForAction");
OXR_VERIFY_ARG_TYPE_AND_NULL(
&log, enumerateInfo,
XR_TYPE_BOUND_SOURCES_FOR_ACTION_ENUMERATE_INFO);
OXR_VERIFY_ACTION_NOT_NULL(&log, enumerateInfo->action, act);
return oxr_action_get_bound_sources(&log, act, sourceCapacityInput, return oxr_action_get_bound_sources(&log, sess, act->key,
sourceCapacityInput,
sourceCountOutput, sources); sourceCountOutput, sources);
} }
@ -392,44 +395,65 @@ oxr_xrGetBoundSourcesForAction(XrAction action,
*/ */
XrResult XrResult
oxr_xrApplyHapticFeedback(XrAction hapticAction, oxr_xrApplyHapticFeedback(XrSession session,
uint32_t countSubactionPaths, const XrHapticActionInfo* hapticActionInfo,
const XrPath* subactionPaths,
const XrHapticBaseHeader* hapticEvent) const XrHapticBaseHeader* hapticEvent)
{ {
struct oxr_action* act; struct oxr_session* sess = NULL;
struct oxr_action* act = NULL;
struct oxr_sub_paths sub_paths = {0};
struct oxr_logger log; struct oxr_logger log;
OXR_VERIFY_ACTION_AND_INIT_LOG(&log, hapticAction, act, XrResult ret;
"xrApplyHapticFeedback"); OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
OXR_VERIFY_SUBACTION_PATHS(&log, countSubactionPaths, subactionPaths); "xrApplyHapticFeedback");
//! @todo verify paths OXR_VERIFY_ARG_TYPE_AND_NULL(&log, hapticActionInfo,
XR_TYPE_HAPTIC_ACTION_INFO);
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, hapticEvent,
XR_TYPE_HAPTIC_VIBRATION);
OXR_VERIFY_ACTION_NOT_NULL(&log, hapticActionInfo->action, act);
if (act->action_type != XR_OUTPUT_ACTION_TYPE_VIBRATION) { ret = oxr_verify_subaction_path_get(
&log, act->act_set->inst, hapticActionInfo->subactionPath,
&act->sub_paths, &sub_paths, "getInfo->subactionPath");
if (ret != XR_SUCCESS) {
return ret;
}
if (act->action_type != XR_ACTION_TYPE_VIBRATION_OUTPUT) {
return oxr_error(&log, XR_ERROR_ACTION_TYPE_MISMATCH, return oxr_error(&log, XR_ERROR_ACTION_TYPE_MISMATCH,
" not created with output vibration type"); " not created with output vibration type");
} }
return oxr_action_apply_haptic_feedback(&log, act, countSubactionPaths, return oxr_action_apply_haptic_feedback(&log, sess, act->key, sub_paths,
subactionPaths, hapticEvent); hapticEvent);
} }
XrResult XrResult
oxr_xrStopHapticFeedback(XrAction hapticAction, oxr_xrStopHapticFeedback(XrSession session,
uint32_t countSubactionPaths, const XrHapticActionInfo* hapticActionInfo)
const XrPath* subactionPaths)
{ {
struct oxr_action* act; struct oxr_session* sess = NULL;
struct oxr_action* act = NULL;
struct oxr_sub_paths sub_paths = {0};
struct oxr_logger log; struct oxr_logger log;
OXR_VERIFY_ACTION_AND_INIT_LOG(&log, hapticAction, act, XrResult ret;
"xrStopHapticFeedback"); OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
OXR_VERIFY_SUBACTION_PATHS(&log, countSubactionPaths, subactionPaths); "xrStopHapticFeedback");
//! @todo verify paths OXR_VERIFY_ARG_TYPE_AND_NULL(&log, hapticActionInfo,
XR_TYPE_HAPTIC_ACTION_INFO);
OXR_VERIFY_ACTION_NOT_NULL(&log, hapticActionInfo->action, act);
if (act->action_type != XR_OUTPUT_ACTION_TYPE_VIBRATION) { ret = oxr_verify_subaction_path_get(
&log, act->act_set->inst, hapticActionInfo->subactionPath,
&act->sub_paths, &sub_paths, "getInfo->subactionPath");
if (ret != XR_SUCCESS) {
return ret;
}
if (act->action_type != XR_ACTION_TYPE_VIBRATION_OUTPUT) {
return oxr_error(&log, XR_ERROR_ACTION_TYPE_MISMATCH, return oxr_error(&log, XR_ERROR_ACTION_TYPE_MISMATCH,
" not created with output vibration type"); " not created with output vibration type");
} }
return oxr_action_stop_haptic_feedback(&log, act, countSubactionPaths, return oxr_action_stop_haptic_feedback(&log, sess, act->key, sub_paths);
subactionPaths);
} }

View file

@ -161,6 +161,7 @@ XrResult
oxr_xrEnumerateEnvironmentBlendModes( oxr_xrEnumerateEnvironmentBlendModes(
XrInstance instance, XrInstance instance,
XrSystemId systemId, XrSystemId systemId,
XrViewConfigurationType viewConfigurationType,
uint32_t environmentBlendModeCapacityInput, uint32_t environmentBlendModeCapacityInput,
uint32_t* environmentBlendModeCountOutput, uint32_t* environmentBlendModeCountOutput,
XrEnvironmentBlendMode* environmentBlendModes); XrEnvironmentBlendMode* environmentBlendModes);
@ -245,6 +246,10 @@ oxr_xrBeginFrame(XrSession session, const XrFrameBeginInfo* frameBeginInfo);
XrResult XrResult
oxr_xrEndFrame(XrSession session, const XrFrameEndInfo* frameEndInfo); oxr_xrEndFrame(XrSession session, const XrFrameEndInfo* frameEndInfo);
//! OpenXR API function @ep{xrRequestExitSession}
XrResult
oxr_xrRequestExitSession(XrSession session);
//! OpenXR API function @ep{xrLocateViews} //! OpenXR API function @ep{xrLocateViews}
XrResult XrResult
oxr_xrLocateViews(XrSession session, oxr_xrLocateViews(XrSession session,
@ -314,7 +319,7 @@ XrResult
oxr_xrLocateSpace(XrSpace space, oxr_xrLocateSpace(XrSpace space,
XrSpace baseSpace, XrSpace baseSpace,
XrTime time, XrTime time,
XrSpaceRelation* relation); XrSpaceLocation* relation);
//! OpenXR API function @ep{xrDestroySpace} //! OpenXR API function @ep{xrDestroySpace}
XrResult XrResult
@ -424,13 +429,13 @@ oxr_xrSessionInsertDebugUtilsLabelEXT(XrSession session,
//! OpenXR API function @ep{xrCreateActionSpace} //! OpenXR API function @ep{xrCreateActionSpace}
XrResult XrResult
oxr_xrCreateActionSpace(XrAction action, oxr_xrCreateActionSpace(XrSession session,
const XrActionSpaceCreateInfo* createInfo, const XrActionSpaceCreateInfo* createInfo,
XrSpace* space); XrSpace* space);
//! OpenXR API function @ep{xrCreateActionSet} //! OpenXR API function @ep{xrCreateActionSet}
XrResult XrResult
oxr_xrCreateActionSet(XrSession session, oxr_xrCreateActionSet(XrInstance instance,
const XrActionSetCreateInfo* createInfo, const XrActionSetCreateInfo* createInfo,
XrActionSet* actionSet); XrActionSet* actionSet);
@ -448,81 +453,81 @@ oxr_xrCreateAction(XrActionSet actionSet,
XrResult XrResult
oxr_xrDestroyAction(XrAction action); oxr_xrDestroyAction(XrAction action);
//! OpenXR API function @ep{xrSetInteractionProfileSuggestedBindings} //! OpenXR API function @ep{xrSuggestInteractionProfileBindings}
XrResult XrResult
oxr_xrSetInteractionProfileSuggestedBindings( oxr_xrSuggestInteractionProfileBindings(
XrSession session, XrInstance instance,
const XrInteractionProfileSuggestedBinding* suggestedBindings); const XrInteractionProfileSuggestedBinding* suggestedBindings);
//! OpenXR API function @ep{xrAttachSessionActionSets}
XrResult
oxr_xrAttachSessionActionSets(XrSession session,
const XrSessionActionSetsAttachInfo* bindInfo);
//! OpenXR API function @ep{xrGetCurrentInteractionProfile} //! OpenXR API function @ep{xrGetCurrentInteractionProfile}
XrResult XrResult
oxr_xrGetCurrentInteractionProfile( oxr_xrGetCurrentInteractionProfile(
XrSession session, XrSession session,
XrPath topLevelUserPath, XrPath topLevelUserPath,
XrInteractionProfileInfo* interactionProfile); XrInteractionProfileState* interactionProfile);
//! OpenXR API function @ep{xrGetActionStateBoolean} //! OpenXR API function @ep{xrGetActionStateBoolean}
XrResult XrResult
oxr_xrGetActionStateBoolean(XrAction action, oxr_xrGetActionStateBoolean(XrSession session,
uint32_t countSubactionPaths, const XrActionStateGetInfo* getInfo,
const XrPath* subactionPaths,
XrActionStateBoolean* data); XrActionStateBoolean* data);
//! OpenXR API function @ep{xrGetActionStateVector1f} //! OpenXR API function @ep{xrGetActionStateFloat}
XrResult XrResult
oxr_xrGetActionStateVector1f(XrAction action, oxr_xrGetActionStateFloat(XrSession session,
uint32_t countSubactionPaths, const XrActionStateGetInfo* getInfo,
const XrPath* subactionPaths, XrActionStateFloat* data);
XrActionStateVector1f* data);
//! OpenXR API function @ep{xrGetActionStateVector2f} //! OpenXR API function @ep{xrGetActionStateVector2f}
XrResult XrResult
oxr_xrGetActionStateVector2f(XrAction action, oxr_xrGetActionStateVector2f(XrSession session,
uint32_t countSubactionPaths, const XrActionStateGetInfo* getInfo,
const XrPath* subactionPaths,
XrActionStateVector2f* data); XrActionStateVector2f* data);
//! OpenXR API function @ep{xrGetActionStatePose} //! OpenXR API function @ep{xrGetActionStatePose}
XrResult XrResult
oxr_xrGetActionStatePose(XrAction action, oxr_xrGetActionStatePose(XrSession session,
XrPath subactionPath, const XrActionStateGetInfo* getInfo,
XrActionStatePose* data); XrActionStatePose* data);
//! OpenXR API function @ep{xrSyncActionData} //! OpenXR API function @ep{xrSyncActions}
XrResult XrResult
oxr_xrSyncActionData(XrSession session, oxr_xrSyncActions(XrSession session, const XrActionsSyncInfo* syncInfo);
uint32_t countActionSets,
const XrActiveActionSet* actionSets);
//! OpenXR API function @ep{xrGetBoundSourcesForAction} //! OpenXR API function @ep{xrEnumerateBoundSourcesForAction}
XrResult XrResult
oxr_xrGetBoundSourcesForAction(XrAction action, oxr_xrEnumerateBoundSourcesForAction(
uint32_t sourceCapacityInput, XrSession session,
uint32_t* sourceCountOutput, const XrBoundSourcesForActionEnumerateInfo* enumerateInfo,
XrPath* sources); uint32_t sourceCapacityInput,
uint32_t* sourceCountOutput,
XrPath* sources);
//! OpenXR API function @ep{xrGetInputSourceLocalizedName} //! OpenXR API function @ep{xrGetInputSourceLocalizedName}
XrResult XrResult
oxr_xrGetInputSourceLocalizedName( oxr_xrGetInputSourceLocalizedName(
XrSession session, XrSession session,
XrPath source, const XrInputSourceLocalizedNameGetInfo* getInfo,
XrInputSourceLocalizedNameFlags whichComponents,
uint32_t bufferCapacityInput, uint32_t bufferCapacityInput,
uint32_t* bufferCountOutput, uint32_t* bufferCountOutput,
char* buffer); char* buffer);
//! OpenXR API function @ep{xrApplyHapticFeedback} //! OpenXR API function @ep{xrApplyHapticFeedback}
XrResult XrResult
oxr_xrApplyHapticFeedback(XrAction hapticAction, oxr_xrApplyHapticFeedback(XrSession session,
uint32_t countSubactionPaths, const XrHapticActionInfo* hapticActionInfo,
const XrPath* subactionPaths, const XrHapticBaseHeader* hapticFeedback);
const XrHapticBaseHeader* hapticEvent);
//! OpenXR API function @ep{xrStopHapticFeedback} //! OpenXR API function @ep{xrStopHapticFeedback}
XrResult XrResult
oxr_xrStopHapticFeedback(XrAction hapticAction, oxr_xrStopHapticFeedback(XrSession session,
uint32_t countSubactionPaths, const XrHapticActionInfo* hapticActionInfo);
const XrPath* subactionPaths);
/*! /*!
* @} * @}

View file

@ -34,8 +34,10 @@ static const XrExtensionProperties extension_properties[] = {
{XR_TYPE_EXTENSION_PROPERTIES, NULL, XR_KHR_VULKAN_ENABLE_EXTENSION_NAME, {XR_TYPE_EXTENSION_PROPERTIES, NULL, XR_KHR_VULKAN_ENABLE_EXTENSION_NAME,
XR_KHR_vulkan_enable_SPEC_VERSION}, XR_KHR_vulkan_enable_SPEC_VERSION},
#endif #endif
{XR_TYPE_EXTENSION_PROPERTIES, NULL, XR_KHR_HEADLESS_EXTENSION_NAME, #if XR_MND_headless
XR_KHR_headless_SPEC_VERSION}, {XR_TYPE_EXTENSION_PROPERTIES, NULL, XR_MND_HEADLESS_EXTENSION_NAME,
XR_MND_headless_SPEC_VERSION},
#endif
#ifdef XR_USE_TIMESPEC #ifdef XR_USE_TIMESPEC
{XR_TYPE_EXTENSION_PROPERTIES, NULL, {XR_TYPE_EXTENSION_PROPERTIES, NULL,
XR_KHR_CONVERT_TIMESPEC_TIME_EXTENSION_NAME, XR_KHR_CONVERT_TIMESPEC_TIME_EXTENSION_NAME,

View file

@ -162,6 +162,7 @@ handle_none_null(struct oxr_logger* log,
ENTRY_ELSE_IF(xrWaitFrame) ENTRY_ELSE_IF(xrWaitFrame)
ENTRY_ELSE_IF(xrBeginFrame) ENTRY_ELSE_IF(xrBeginFrame)
ENTRY_ELSE_IF(xrEndFrame) ENTRY_ELSE_IF(xrEndFrame)
ENTRY_ELSE_IF(xrRequestExitSession)
ENTRY_ELSE_IF(xrLocateViews) ENTRY_ELSE_IF(xrLocateViews)
ENTRY_ELSE_IF(xrStringToPath) ENTRY_ELSE_IF(xrStringToPath)
ENTRY_ELSE_IF(xrPathToString) ENTRY_ELSE_IF(xrPathToString)
@ -169,14 +170,15 @@ handle_none_null(struct oxr_logger* log,
ENTRY_ELSE_IF(xrDestroyActionSet) ENTRY_ELSE_IF(xrDestroyActionSet)
ENTRY_ELSE_IF(xrCreateAction) ENTRY_ELSE_IF(xrCreateAction)
ENTRY_ELSE_IF(xrDestroyAction) ENTRY_ELSE_IF(xrDestroyAction)
ENTRY_ELSE_IF(xrSetInteractionProfileSuggestedBindings) ENTRY_ELSE_IF(xrSuggestInteractionProfileBindings)
ENTRY_ELSE_IF(xrAttachSessionActionSets)
ENTRY_ELSE_IF(xrGetCurrentInteractionProfile) ENTRY_ELSE_IF(xrGetCurrentInteractionProfile)
ENTRY_ELSE_IF(xrGetActionStateBoolean) ENTRY_ELSE_IF(xrGetActionStateBoolean)
ENTRY_ELSE_IF(xrGetActionStateVector1f) ENTRY_ELSE_IF(xrGetActionStateFloat)
ENTRY_ELSE_IF(xrGetActionStateVector2f) ENTRY_ELSE_IF(xrGetActionStateVector2f)
ENTRY_ELSE_IF(xrGetActionStatePose) ENTRY_ELSE_IF(xrGetActionStatePose)
ENTRY_ELSE_IF(xrSyncActionData) ENTRY_ELSE_IF(xrSyncActions)
ENTRY_ELSE_IF(xrGetBoundSourcesForAction) ENTRY_ELSE_IF(xrEnumerateBoundSourcesForAction)
ENTRY_ELSE_IF(xrGetInputSourceLocalizedName) ENTRY_ELSE_IF(xrGetInputSourceLocalizedName)
ENTRY_ELSE_IF(xrApplyHapticFeedback) ENTRY_ELSE_IF(xrApplyHapticFeedback)
ENTRY_ELSE_IF(xrStopHapticFeedback) ENTRY_ELSE_IF(xrStopHapticFeedback)

View file

@ -129,6 +129,17 @@ oxr_xrEndFrame(XrSession session, const XrFrameEndInfo* frameEndInfo)
return oxr_session_frame_end(&log, sess, frameEndInfo); return oxr_session_frame_end(&log, sess, frameEndInfo);
} }
XrResult
oxr_xrRequestExitSession(XrSession session)
{
struct oxr_session* sess;
struct oxr_logger log;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrRequestExitSession");
return oxr_error(&log, XR_ERROR_HANDLE_INVALID, " not implemented");
}
XrResult XrResult
oxr_xrLocateViews(XrSession session, oxr_xrLocateViews(XrSession session,
const XrViewLocateInfo* viewLocateInfo, const XrViewLocateInfo* viewLocateInfo,

View file

@ -25,20 +25,23 @@
XrResult XrResult
oxr_xrCreateActionSpace(XrAction action, oxr_xrCreateActionSpace(XrSession session,
const XrActionSpaceCreateInfo* createInfo, const XrActionSpaceCreateInfo* createInfo,
XrSpace* space) XrSpace* space)
{ {
struct oxr_session* sess;
struct oxr_action* act; struct oxr_action* act;
struct oxr_logger log; struct oxr_logger log;
OXR_VERIFY_ACTION_AND_INIT_LOG(&log, action, act, OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrCreateActionSpace"); "xrCreateActionSpace");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, createInfo, OXR_VERIFY_ARG_TYPE_AND_NULL(&log, createInfo,
XR_TYPE_ACTION_SPACE_CREATE_INFO); XR_TYPE_ACTION_SPACE_CREATE_INFO);
OXR_VERIFY_POSE(&log, createInfo->poseInActionSpace); OXR_VERIFY_POSE(&log, createInfo->poseInActionSpace);
OXR_VERIFY_ACTION_NOT_NULL(&log, createInfo->action, act);
struct oxr_space* spc; struct oxr_space* spc;
XrResult ret = oxr_space_action_create(&log, act, createInfo, &spc); XrResult ret =
oxr_space_action_create(&log, sess, act->key, createInfo, &spc);
if (ret != XR_SUCCESS) { if (ret != XR_SUCCESS) {
return ret; return ret;
} }
@ -113,16 +116,16 @@ XrResult
oxr_xrLocateSpace(XrSpace space, oxr_xrLocateSpace(XrSpace space,
XrSpace baseSpace, XrSpace baseSpace,
XrTime time, XrTime time,
XrSpaceRelation* relation) XrSpaceLocation* location)
{ {
struct oxr_space* spc; struct oxr_space* spc;
struct oxr_space* baseSpc; struct oxr_space* baseSpc;
struct oxr_logger log; struct oxr_logger log;
OXR_VERIFY_SPACE_AND_INIT_LOG(&log, space, spc, "xrLocateSpace"); OXR_VERIFY_SPACE_AND_INIT_LOG(&log, space, spc, "xrLocateSpace");
OXR_VERIFY_SPACE_NOT_NULL(&log, baseSpace, baseSpc); OXR_VERIFY_SPACE_NOT_NULL(&log, baseSpace, baseSpc);
OXR_VERIFY_ARG_NOT_NULL(&log, relation); OXR_VERIFY_ARG_TYPE_AND_NULL(&log, location, XR_TYPE_SPACE_LOCATION);
return oxr_space_locate(&log, spc, baseSpc, time, relation); return oxr_space_locate(&log, spc, baseSpc, time, location);
} }
XrResult XrResult

View file

@ -103,6 +103,7 @@ XrResult
oxr_xrEnumerateEnvironmentBlendModes( oxr_xrEnumerateEnvironmentBlendModes(
XrInstance instance, XrInstance instance,
XrSystemId systemId, XrSystemId systemId,
XrViewConfigurationType viewConfigurationType,
uint32_t environmentBlendModeCapacityInput, uint32_t environmentBlendModeCapacityInput,
uint32_t* environmentBlendModeCountOutput, uint32_t* environmentBlendModeCountOutput,
XrEnvironmentBlendMode* environmentBlendModes) XrEnvironmentBlendMode* environmentBlendModes)
@ -114,7 +115,7 @@ oxr_xrEnumerateEnvironmentBlendModes(
OXR_VERIFY_SYSTEM_AND_GET(&log, inst, systemId, sys); OXR_VERIFY_SYSTEM_AND_GET(&log, inst, systemId, sys);
return oxr_system_enumerate_blend_modes( return oxr_system_enumerate_blend_modes(
&log, sys, environmentBlendModeCapacityInput, &log, sys, viewConfigurationType, environmentBlendModeCapacityInput,
environmentBlendModeCountOutput, environmentBlendModes); environmentBlendModeCountOutput, environmentBlendModes);
} }

View file

@ -67,11 +67,11 @@ extern "C" {
#define OXR_VERIFY_SPACE_AND_INIT_LOG(log, thing, new_thing, name) \ #define OXR_VERIFY_SPACE_AND_INIT_LOG(log, thing, new_thing, name) \
_OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, SPACE, name, new_thing->sess->sys->inst) _OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, SPACE, name, new_thing->sess->sys->inst)
#define OXR_VERIFY_ACTION_AND_INIT_LOG(log, thing, new_thing, name) \ #define OXR_VERIFY_ACTION_AND_INIT_LOG(log, thing, new_thing, name) \
_OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, ACTION, name, new_thing->act_set->sess->sys->inst) _OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, ACTION, name, new_thing->act_set->inst)
#define OXR_VERIFY_SWAPCHAIN_AND_INIT_LOG(log, thing, new_thing, name) \ #define OXR_VERIFY_SWAPCHAIN_AND_INIT_LOG(log, thing, new_thing, name) \
_OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, SWAPCHAIN, name, new_thing->sess->sys->inst) _OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, SWAPCHAIN, name, new_thing->sess->sys->inst)
#define OXR_VERIFY_ACTIONSET_AND_INIT_LOG(log, thing, new_thing, name) \ #define OXR_VERIFY_ACTIONSET_AND_INIT_LOG(log, thing, new_thing, name) \
_OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, ACTIONSET, name, new_thing->sess->sys->inst) _OXR_VERIFY_AND_SET_AND_INIT(log, thing, new_thing, ACTIONSET, name, new_thing->inst)
#define OXR_VERIFY_INSTANCE_NOT_NULL(log, arg, new_arg) _OXR_VERIFY_SET(log, arg, new_arg, INSTANCE); #define OXR_VERIFY_INSTANCE_NOT_NULL(log, arg, new_arg) _OXR_VERIFY_SET(log, arg, new_arg, INSTANCE);
#define OXR_VERIFY_MESSENGER_NOT_NULL(log, arg, new_arg) _OXR_VERIFY_SET(log, arg, new_arg, MESSENGER); #define OXR_VERIFY_MESSENGER_NOT_NULL(log, arg, new_arg) _OXR_VERIFY_SET(log, arg, new_arg, MESSENGER);

View file

@ -109,7 +109,7 @@ oxr_action_set_destroy_cb(struct oxr_logger* log, struct oxr_handle_base* hb)
XrResult XrResult
oxr_action_set_create(struct oxr_logger* log, oxr_action_set_create(struct oxr_logger* log,
struct oxr_session* sess, struct oxr_instance* inst,
const XrActionSetCreateInfo* createInfo, const XrActionSetCreateInfo* createInfo,
struct oxr_action_set** out_act_set) struct oxr_action_set** out_act_set)
{ {
@ -119,11 +119,11 @@ oxr_action_set_create(struct oxr_logger* log,
//! @todo Implement more fully. //! @todo Implement more fully.
struct oxr_action_set* act_set = NULL; struct oxr_action_set* act_set = NULL;
OXR_ALLOCATE_HANDLE_OR_RETURN(log, act_set, OXR_XR_DEBUG_ACTIONSET, OXR_ALLOCATE_HANDLE_OR_RETURN(log, act_set, OXR_XR_DEBUG_ACTIONSET,
oxr_action_set_destroy_cb, &sess->handle); oxr_action_set_destroy_cb, &inst->handle);
act_set->key = key_gen++; act_set->key = key_gen++;
act_set->generation = 1; act_set->generation = 1;
act_set->sess = sess; act_set->inst = inst;
*out_act_set = act_set; *out_act_set = act_set;
@ -158,7 +158,7 @@ oxr_action_create(struct oxr_logger* log,
const XrActionCreateInfo* createInfo, const XrActionCreateInfo* createInfo,
struct oxr_action** out_act) struct oxr_action** out_act)
{ {
struct oxr_instance* inst = act_set->sess->sys->inst; struct oxr_instance* inst = act_set->inst;
struct oxr_sub_paths sub_paths = {0}; struct oxr_sub_paths sub_paths = {0};
// Mod music for all! // Mod music for all!
@ -307,7 +307,7 @@ MEGA_HACK_get_binding(struct oxr_logger* log,
default: break; default: break;
} }
if (strcmp(act->name, "grip_object") == 0) { if (strcmp(act->name, "grab_object") == 0) {
oxr_xdev_find_input(xdev, XRT_INPUT_PSMV_TRIGGER_VALUE, oxr_xdev_find_input(xdev, XRT_INPUT_PSMV_TRIGGER_VALUE,
&input) || &input) ||
oxr_xdev_find_input(xdev, XRT_INPUT_HYDRA_TRIGGER_VALUE, oxr_xdev_find_input(xdev, XRT_INPUT_HYDRA_TRIGGER_VALUE,
@ -316,6 +316,8 @@ MEGA_HACK_get_binding(struct oxr_logger* log,
oxr_xdev_find_input(xdev, XRT_INPUT_PSMV_BODY_CENTER_POSE, oxr_xdev_find_input(xdev, XRT_INPUT_PSMV_BODY_CENTER_POSE,
&input) || &input) ||
oxr_xdev_find_input(xdev, XRT_INPUT_HYDRA_POSE, &input); oxr_xdev_find_input(xdev, XRT_INPUT_HYDRA_POSE, &input);
} else if (strcmp(act->name, "quit_session") == 0) {
oxr_xdev_find_input(xdev, XRT_INPUT_PSMV_PS_CLICK, &input);
} else if (strcmp(act->name, "vibrate_hand") == 0) { } else if (strcmp(act->name, "vibrate_hand") == 0) {
oxr_xdev_find_output( oxr_xdev_find_output(
xdev, XRT_OUTPUT_NAME_PSMV_RUMBLE_VIBRATION, &output); xdev, XRT_OUTPUT_NAME_PSMV_RUMBLE_VIBRATION, &output);
@ -354,10 +356,10 @@ oxr_source_set_destroy_cb(struct oxr_logger* log, struct oxr_handle_base* hb)
static XrResult static XrResult
oxr_source_set_create(struct oxr_logger* log, oxr_source_set_create(struct oxr_logger* log,
struct oxr_session* sess,
struct oxr_action_set* act_set, struct oxr_action_set* act_set,
struct oxr_source_set** out_src_set) struct oxr_source_set** out_src_set)
{ {
struct oxr_session* sess = act_set->sess;
struct oxr_source_set* src_set = NULL; struct oxr_source_set* src_set = NULL;
OXR_ALLOCATE_HANDLE_OR_RETURN(log, src_set, OXR_XR_DEBUG_SOURCESET, OXR_ALLOCATE_HANDLE_OR_RETURN(log, src_set, OXR_XR_DEBUG_SOURCESET,
oxr_source_set_destroy_cb, &sess->handle); oxr_source_set_destroy_cb, &sess->handle);
@ -636,6 +638,15 @@ oxr_session_destroy_all_sources(struct oxr_logger* log,
} }
} }
XrResult
oxr_session_attach_action_sets(struct oxr_logger* log,
struct oxr_session* sess,
const XrSessionActionSetsAttachInfo* bindInfo)
{
//! @todo not implementeds
return XR_SUCCESS;
}
XrResult 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,
@ -663,7 +674,7 @@ oxr_action_sync_data(struct oxr_logger* log,
// current action set generation, that's okay since we will // current action set generation, that's okay since we will
// be creating the sources for the actions below. // be creating the sources for the actions below.
if (src_set == NULL) { if (src_set == NULL) {
oxr_source_set_create(log, act_set, &src_set); oxr_source_set_create(log, sess, act_set, &src_set);
continue; continue;
} }
@ -707,13 +718,12 @@ oxr_action_sync_data(struct oxr_logger* log,
} }
XrResult XrResult
oxr_action_set_interaction_profile_suggested_bindings( oxr_action_suggest_interaction_profile_bindings(
struct oxr_logger* log, struct oxr_logger* log,
struct oxr_session* sess, struct oxr_instance* inst,
const XrInteractionProfileSuggestedBinding* suggestedBindings) const XrInteractionProfileSuggestedBinding* suggestedBindings)
{ {
//! @todo Implement //! @todo Implement
struct oxr_instance* inst = sess->sys->inst;
const char* str; const char* str;
size_t length; size_t length;
@ -748,7 +758,7 @@ oxr_action_get_current_interaction_profile(
struct oxr_logger* log, struct oxr_logger* log,
struct oxr_session* sess, struct oxr_session* sess,
XrPath topLevelUserPath, XrPath topLevelUserPath,
XrInteractionProfileInfo* interactionProfile) XrInteractionProfileState* interactionProfile)
{ {
//! @todo Implement //! @todo Implement
return oxr_error(log, XR_ERROR_HANDLE_INVALID, " not implemented"); return oxr_error(log, XR_ERROR_HANDLE_INVALID, " not implemented");
@ -758,8 +768,7 @@ XrResult
oxr_action_get_input_source_localized_name( oxr_action_get_input_source_localized_name(
struct oxr_logger* log, struct oxr_logger* log,
struct oxr_session* sess, struct oxr_session* sess,
XrPath source, const XrInputSourceLocalizedNameGetInfo* getInfo,
XrInputSourceLocalizedNameFlags whichComponents,
uint32_t bufferCapacityInput, uint32_t bufferCapacityInput,
uint32_t* bufferCountOutput, uint32_t* bufferCountOutput,
char* buffer) char* buffer)
@ -796,7 +805,7 @@ get_state_from_state_bool(struct oxr_source_state* state,
static void static void
get_state_from_state_vec1(struct oxr_source_state* state, get_state_from_state_vec1(struct oxr_source_state* state,
XrActionStateVector1f* data) XrActionStateFloat* data)
{ {
data->currentState = state->vec1.x; data->currentState = state->vec1.x;
data->lastChangeTime = state->timestamp; data->lastChangeTime = state->timestamp;
@ -859,14 +868,14 @@ get_state_from_state_vec2(struct oxr_source_state* state,
XrResult XrResult
oxr_action_get_boolean(struct oxr_logger* log, oxr_action_get_boolean(struct oxr_logger* log,
struct oxr_action* act, struct oxr_session* sess,
uint64_t key,
struct oxr_sub_paths sub_paths, struct oxr_sub_paths sub_paths,
XrActionStateBoolean* data) XrActionStateBoolean* data)
{ {
struct oxr_session* sess = act->act_set->sess;
struct oxr_source* src = NULL; struct oxr_source* src = NULL;
oxr_session_get_source(sess, act->key, &src); oxr_session_get_source(sess, key, &src);
data->isActive = XR_FALSE; data->isActive = XR_FALSE;
U_ZERO(&data->currentState); U_ZERO(&data->currentState);
@ -888,14 +897,14 @@ oxr_action_get_boolean(struct oxr_logger* log,
XrResult XrResult
oxr_action_get_vector1f(struct oxr_logger* log, oxr_action_get_vector1f(struct oxr_logger* log,
struct oxr_action* act, struct oxr_session* sess,
uint64_t key,
struct oxr_sub_paths sub_paths, struct oxr_sub_paths sub_paths,
XrActionStateVector1f* data) XrActionStateFloat* data)
{ {
struct oxr_session* sess = act->act_set->sess;
struct oxr_source* src = NULL; struct oxr_source* src = NULL;
oxr_session_get_source(sess, act->key, &src); oxr_session_get_source(sess, key, &src);
data->isActive = XR_FALSE; data->isActive = XR_FALSE;
U_ZERO(&data->currentState); U_ZERO(&data->currentState);
@ -917,14 +926,14 @@ oxr_action_get_vector1f(struct oxr_logger* log,
XrResult XrResult
oxr_action_get_vector2f(struct oxr_logger* log, oxr_action_get_vector2f(struct oxr_logger* log,
struct oxr_action* act, struct oxr_session* sess,
uint64_t key,
struct oxr_sub_paths sub_paths, struct oxr_sub_paths sub_paths,
XrActionStateVector2f* data) XrActionStateVector2f* data)
{ {
struct oxr_session* sess = act->act_set->sess;
struct oxr_source* src = NULL; struct oxr_source* src = NULL;
oxr_session_get_source(sess, act->key, &src); oxr_session_get_source(sess, key, &src);
data->isActive = XR_FALSE; data->isActive = XR_FALSE;
U_ZERO(&data->currentState); U_ZERO(&data->currentState);
@ -946,14 +955,14 @@ oxr_action_get_vector2f(struct oxr_logger* log,
XrResult XrResult
oxr_action_get_pose(struct oxr_logger* log, oxr_action_get_pose(struct oxr_logger* log,
struct oxr_action* act, struct oxr_session* sess,
uint64_t key,
struct oxr_sub_paths sub_paths, struct oxr_sub_paths sub_paths,
XrActionStatePose* data) XrActionStatePose* data)
{ {
struct oxr_session* sess = act->act_set->sess;
struct oxr_source* src = NULL; struct oxr_source* src = NULL;
oxr_session_get_source(sess, act->key, &src); oxr_session_get_source(sess, key, &src);
data->isActive = XR_FALSE; data->isActive = XR_FALSE;
@ -982,7 +991,8 @@ oxr_action_get_pose(struct oxr_logger* log,
XrResult XrResult
oxr_action_get_bound_sources(struct oxr_logger* log, oxr_action_get_bound_sources(struct oxr_logger* log,
struct oxr_action* act, struct oxr_session* sess,
uint64_t key,
uint32_t sourceCapacityInput, uint32_t sourceCapacityInput,
uint32_t* sourceCountOutput, uint32_t* sourceCountOutput,
XrPath* sources) XrPath* sources)
@ -1019,21 +1029,18 @@ set_source_output_vibration(struct oxr_session* sess,
} }
} }
XrResult XrResult
oxr_action_apply_haptic_feedback(struct oxr_logger* log, oxr_action_apply_haptic_feedback(struct oxr_logger* log,
struct oxr_action* act, struct oxr_session* sess,
uint32_t countSubactionPaths, uint64_t key,
const XrPath* subactionPaths, struct oxr_sub_paths sub_paths,
const XrHapticBaseHeader* hapticEvent) const XrHapticBaseHeader* hapticEvent)
{ {
struct oxr_session* sess = act->act_set->sess;
struct oxr_source* src = NULL; struct oxr_source* src = NULL;
struct oxr_sub_paths sub_paths = {0};
oxr_classify_sub_action_paths(log, sess->sys->inst, countSubactionPaths, oxr_session_get_source(sess, key, &src);
subactionPaths, &sub_paths);
oxr_session_get_source(sess, act->key, &src);
if (src == NULL) { if (src == NULL) {
return XR_SUCCESS; return XR_SUCCESS;
@ -1067,18 +1074,13 @@ oxr_action_apply_haptic_feedback(struct oxr_logger* log,
XrResult XrResult
oxr_action_stop_haptic_feedback(struct oxr_logger* log, oxr_action_stop_haptic_feedback(struct oxr_logger* log,
struct oxr_action* act, struct oxr_session* sess,
uint32_t countSubactionPaths, uint64_t key,
const XrPath* subactionPaths) struct oxr_sub_paths sub_paths)
{ {
struct oxr_session* sess = act->act_set->sess;
struct oxr_source* src = NULL; struct oxr_source* src = NULL;
struct oxr_sub_paths sub_paths = {0};
oxr_classify_sub_action_paths(log, sess->sys->inst, countSubactionPaths, oxr_session_get_source(sess, key, &src);
subactionPaths, &sub_paths);
oxr_session_get_source(sess, act->key, &src);
if (src == NULL) { if (src == NULL) {
return XR_SUCCESS; return XR_SUCCESS;

View file

@ -178,16 +178,24 @@ oxr_instance_create(struct oxr_logger *log,
inst->opengl_enable = false; inst->opengl_enable = false;
inst->vulkan_enable = false; inst->vulkan_enable = false;
for (uint32_t i = 0; i < createInfo->enabledExtensionCount; ++i) { for (uint32_t i = 0; i < createInfo->enabledExtensionCount; ++i) {
#if XR_MND_headless
if (strcmp(createInfo->enabledExtensionNames[i], if (strcmp(createInfo->enabledExtensionNames[i],
XR_KHR_HEADLESS_EXTENSION_NAME) == 0) { XR_MND_HEADLESS_EXTENSION_NAME) == 0) {
inst->headless = true; inst->headless = true;
} else if (strcmp(createInfo->enabledExtensionNames[i], }
XR_KHR_OPENGL_ENABLE_EXTENSION_NAME) == 0) { #endif
#if XR_KHR_opengl_enable
if (strcmp(createInfo->enabledExtensionNames[i],
XR_KHR_OPENGL_ENABLE_EXTENSION_NAME) == 0) {
inst->opengl_enable = true; inst->opengl_enable = true;
} else if (strcmp(createInfo->enabledExtensionNames[i], }
XR_KHR_VULKAN_ENABLE_EXTENSION_NAME) == 0) { #endif
#if XR_KHR_vulkan_enable
if (strcmp(createInfo->enabledExtensionNames[i],
XR_KHR_VULKAN_ENABLE_EXTENSION_NAME) == 0) {
inst->vulkan_enable = true; inst->vulkan_enable = true;
} }
#endif
} }
//! @todo check if this (and other creates) failed? //! @todo check if this (and other creates) failed?

View file

@ -16,6 +16,8 @@
#include "oxr_objects.h" #include "oxr_objects.h"
#include "oxr_logger.h" #include "oxr_logger.h"
#include "openxr_includes/openxr_reflection.h"
DEBUG_GET_ONCE_BOOL_OPTION(entrypoints, "OXR_DEBUG_ENTRYPOINTS", false) DEBUG_GET_ONCE_BOOL_OPTION(entrypoints, "OXR_DEBUG_ENTRYPOINTS", false)
DEBUG_GET_ONCE_BOOL_OPTION(break_on_error, "OXR_BREAK_ON_ERROR", false) DEBUG_GET_ONCE_BOOL_OPTION(break_on_error, "OXR_BREAK_ON_ERROR", false)
@ -107,59 +109,12 @@ oxr_result_to_string(XrResult result)
{ {
// clang-format off // clang-format off
switch (result) { switch (result) {
case XR_SUCCESS: return "XR_SUCCESS";
case XR_TIMEOUT_EXPIRED: return "XR_TIMEOUT_EXPIRED"; #define ENTRY(NAME, VALUE) \
case XR_SESSION_VISIBILITY_UNAVAILABLE: return "XR_SESSION_VISIBILITY_UNAVAILABLE"; case VALUE: return #NAME;
case XR_SESSION_LOSS_PENDING: return "XR_SESSION_LOSS_PENDING"; XR_LIST_ENUM_XrResult(ENTRY)
case XR_EVENT_UNAVAILABLE: return "XR_EVENT_UNAVAILABLE"; #undef ENTRY
case XR_STATE_UNAVAILABLE: return "XR_STATE_UNAVAILABLE";
case XR_STATE_TYPE_UNAVAILABLE: return "XR_STATE_TYPE_UNAVAILABLE";
case XR_SPACE_BOUNDS_UNAVAILABLE: return "XR_SPACE_BOUNDS_UNAVAILABLE";
case XR_SESSION_NOT_FOCUSED: return "XR_SESSION_NOT_FOCUSED";
case XR_FRAME_DISCARDED: return "XR_FRAME_DISCARDED";
case XR_ERROR_VALIDATION_FAILURE: return "XR_ERROR_VALIDATION_FAILURE";
case XR_ERROR_RUNTIME_FAILURE: return "XR_ERROR_RUNTIME_FAILURE";
case XR_ERROR_OUT_OF_MEMORY: return "XR_ERROR_OUT_OF_MEMORY";
case XR_ERROR_RUNTIME_VERSION_INCOMPATIBLE: return "XR_ERROR_RUNTIME_VERSION_INCOMPATIBLE";
case XR_ERROR_DRIVER_INCOMPATIBLE: return "XR_ERROR_DRIVER_INCOMPATIBLE";
case XR_ERROR_INITIALIZATION_FAILED: return "XR_ERROR_INITIALIZATION_FAILED";
case XR_ERROR_FUNCTION_UNSUPPORTED: return "XR_ERROR_FUNCTION_UNSUPPORTED";
case XR_ERROR_FEATURE_UNSUPPORTED: return "XR_ERROR_FEATURE_UNSUPPORTED";
case XR_ERROR_EXTENSION_NOT_PRESENT: return "XR_ERROR_EXTENSION_NOT_PRESENT";
case XR_ERROR_LIMIT_REACHED: return "XR_ERROR_LIMIT_REACHED";
case XR_ERROR_SIZE_INSUFFICIENT: return "XR_ERROR_SIZE_INSUFFICIENT";
case XR_ERROR_HANDLE_INVALID: return "XR_ERROR_HANDLE_INVALID";
case XR_ERROR_INSTANCE_LOST: return "XR_ERROR_INSTANCE_LOST";
case XR_ERROR_SESSION_RUNNING: return "XR_ERROR_SESSION_RUNNING";
case XR_ERROR_SESSION_NOT_RUNNING: return "XR_ERROR_SESSION_NOT_RUNNING";
case XR_ERROR_SESSION_LOST: return "XR_ERROR_SESSION_LOST";
case XR_ERROR_SYSTEM_INVALID: return "XR_ERROR_SYSTEM_INVALID";
case XR_ERROR_PATH_INVALID: return "XR_ERROR_PATH_INVALID";
case XR_ERROR_PATH_COUNT_EXCEEDED: return "XR_ERROR_PATH_COUNT_EXCEEDED";
case XR_ERROR_PATH_FORMAT_INVALID: return "XR_ERROR_PATH_FORMAT_INVALID";
case XR_ERROR_LAYER_INVALID: return "XR_ERROR_LAYER_INVALID";
case XR_ERROR_LAYER_LIMIT_EXCEEDED: return "XR_ERROR_LAYER_LIMIT_EXCEEDED";
case XR_ERROR_SWAPCHAIN_RECT_INVALID: return "XR_ERROR_SWAPCHAIN_RECT_INVALID";
case XR_ERROR_SWAPCHAIN_FORMAT_UNSUPPORTED: return "XR_ERROR_SWAPCHAIN_FORMAT_UNSUPPORTED";
case XR_ERROR_ACTION_TYPE_MISMATCH: return "XR_ERROR_ACTION_TYPE_MISMATCH";
case XR_ERROR_REFERENCE_SPACE_UNSUPPORTED: return "XR_ERROR_REFERENCE_SPACE_UNSUPPORTED";
case XR_ERROR_FILE_ACCESS_ERROR: return "XR_ERROR_FILE_ACCESS_ERROR";
case XR_ERROR_FILE_CONTENTS_INVALID: return "XR_ERROR_FILE_CONTENTS_INVALID";
case XR_ERROR_FORM_FACTOR_UNSUPPORTED: return "XR_ERROR_FORM_FACTOR_UNSUPPORTED";
case XR_ERROR_FORM_FACTOR_UNAVAILABLE: return "XR_ERROR_FORM_FACTOR_UNAVAILABLE";
case XR_ERROR_API_LAYER_NOT_PRESENT: return "XR_ERROR_API_LAYER_NOT_PRESENT";
case XR_ERROR_CALL_ORDER_INVALID: return "XR_ERROR_CALL_ORDER_INVALID";
case XR_ERROR_GRAPHICS_DEVICE_INVALID: return "XR_ERROR_GRAPHICS_DEVICE_INVALID";
case XR_ERROR_POSE_INVALID: return "XR_ERROR_POSE_INVALID";
case XR_ERROR_INDEX_OUT_OF_RANGE: return "XR_ERROR_INDEX_OUT_OF_RANGE";
case XR_ERROR_VIEW_CONFIGURATION_TYPE_UNSUPPORTED: return "XR_ERROR_VIEW_CONFIGURATION_TYPE_UNSUPPORTED";
case XR_ERROR_ENVIRONMENT_BLEND_MODE_UNSUPPORTED: return "XR_ERROR_ENVIRONMENT_BLEND_MODE_UNSUPPORTED";
case XR_ERROR_BINDINGS_DUPLICATED: return "XR_ERROR_BINDINGS_DUPLICATED";
case XR_ERROR_NAME_DUPLICATED: return "XR_ERROR_NAME_DUPLICATED";
case XR_ERROR_NAME_INVALID: return "XR_ERROR_NAME_INVALID";
case XR_ERROR_ANDROID_THREAD_SETTINGS_ID_INVALID_KHR: return "XR_ERROR_ANDROID_THREAD_SETTINGS_ID_INVALID_KHR";
case XR_ERROR_ANDROID_THREAD_SETTINGS_FAILURE_KHR: return "XR_ERROR_ANDROID_THREAD_SETTINGS_FAILURE_KHR";
case XR_ERROR_DEBUG_UTILS_MESSENGER_INVALID_EXT: return "XR_ERROR_DEBUG_UTILS_MESSENGER_INVALID_EXT";
default: return "<UNKNOWN>"; default: return "<UNKNOWN>";
} }
// clang-format on // clang-format on

View file

@ -252,7 +252,7 @@ oxr_action_set_to_openxr(struct oxr_action_set *act_set)
XrResult XrResult
oxr_action_set_create(struct oxr_logger *log, oxr_action_set_create(struct oxr_logger *log,
struct oxr_session *sess, struct oxr_instance *inst,
const XrActionSetCreateInfo *createInfo, const XrActionSetCreateInfo *createInfo,
struct oxr_action_set **out_act_set); struct oxr_action_set **out_act_set);
@ -271,6 +271,11 @@ oxr_action_create(struct oxr_logger *log,
const XrActionCreateInfo *createInfo, const XrActionCreateInfo *createInfo,
struct oxr_action **out_act); struct oxr_action **out_act);
XrResult
oxr_session_attach_action_sets(struct oxr_logger *log,
struct oxr_session *sess,
const XrSessionActionSetsAttachInfo *bindInfo);
XrResult 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,
@ -278,9 +283,9 @@ oxr_action_sync_data(struct oxr_logger *log,
const XrActiveActionSet *actionSets); const XrActiveActionSet *actionSets);
XrResult XrResult
oxr_action_set_interaction_profile_suggested_bindings( oxr_action_suggest_interaction_profile_bindings(
struct oxr_logger *log, struct oxr_logger *log,
struct oxr_session *sess, struct oxr_instance *inst,
const XrInteractionProfileSuggestedBinding *suggestedBindings); const XrInteractionProfileSuggestedBinding *suggestedBindings);
XrResult XrResult
@ -288,61 +293,66 @@ oxr_action_get_current_interaction_profile(
struct oxr_logger *log, struct oxr_logger *log,
struct oxr_session *sess, struct oxr_session *sess,
XrPath topLevelUserPath, XrPath topLevelUserPath,
XrInteractionProfileInfo *interactionProfile); XrInteractionProfileState *interactionProfile);
XrResult XrResult
oxr_action_get_input_source_localized_name( oxr_action_get_input_source_localized_name(
struct oxr_logger *log, struct oxr_logger *log,
struct oxr_session *sess, struct oxr_session *sess,
XrPath source, const XrInputSourceLocalizedNameGetInfo *getInfo,
XrInputSourceLocalizedNameFlags whichComponents,
uint32_t bufferCapacityInput, uint32_t bufferCapacityInput,
uint32_t *bufferCountOutput, uint32_t *bufferCountOutput,
char *buffer); char *buffer);
XrResult XrResult
oxr_action_get_boolean(struct oxr_logger *log, oxr_action_get_boolean(struct oxr_logger *log,
struct oxr_action *act, struct oxr_session *sess,
uint64_t key,
struct oxr_sub_paths sub_paths, struct oxr_sub_paths sub_paths,
XrActionStateBoolean *data); XrActionStateBoolean *data);
XrResult XrResult
oxr_action_get_vector1f(struct oxr_logger *log, oxr_action_get_vector1f(struct oxr_logger *log,
struct oxr_action *act, struct oxr_session *sess,
uint64_t key,
struct oxr_sub_paths sub_paths, struct oxr_sub_paths sub_paths,
XrActionStateVector1f *data); XrActionStateFloat *data);
XrResult XrResult
oxr_action_get_vector2f(struct oxr_logger *log, oxr_action_get_vector2f(struct oxr_logger *log,
struct oxr_action *act, struct oxr_session *sess,
uint64_t key,
struct oxr_sub_paths sub_paths, struct oxr_sub_paths sub_paths,
XrActionStateVector2f *data); XrActionStateVector2f *data);
XrResult XrResult
oxr_action_get_pose(struct oxr_logger *log, oxr_action_get_pose(struct oxr_logger *log,
struct oxr_action *act, struct oxr_session *sess,
uint64_t key,
struct oxr_sub_paths sub_paths, struct oxr_sub_paths sub_paths,
XrActionStatePose *data); XrActionStatePose *data);
XrResult XrResult
oxr_action_get_bound_sources(struct oxr_logger *log, oxr_action_get_bound_sources(struct oxr_logger *log,
struct oxr_action *act, struct oxr_session *sess,
uint64_t key,
uint32_t sourceCapacityInput, uint32_t sourceCapacityInput,
uint32_t *sourceCountOutput, uint32_t *sourceCountOutput,
XrPath *sources); XrPath *sources);
XrResult XrResult
oxr_action_apply_haptic_feedback(struct oxr_logger *log, oxr_action_apply_haptic_feedback(struct oxr_logger *log,
struct oxr_action *act, struct oxr_session *sess,
uint32_t countSubactionPaths, uint64_t key,
const XrPath *subactionPaths, struct oxr_sub_paths sub_paths,
const XrHapticBaseHeader *hapticEvent); const XrHapticBaseHeader *hapticEvent);
XrResult XrResult
oxr_action_stop_haptic_feedback(struct oxr_logger *log, oxr_action_stop_haptic_feedback(struct oxr_logger *log,
struct oxr_action *act, struct oxr_session *sess,
uint32_t countSubactionPaths, uint64_t key,
const XrPath *subactionPaths); struct oxr_sub_paths sub_paths);
/* /*
@ -431,9 +441,11 @@ oxr_space_to_openxr(struct oxr_space *spc)
XrResult XrResult
oxr_space_action_create(struct oxr_logger *log, oxr_space_action_create(struct oxr_logger *log,
struct oxr_action *act, struct oxr_session *sess,
uint64_t key,
const XrActionSpaceCreateInfo *createInfo, const XrActionSpaceCreateInfo *createInfo,
struct oxr_space **out_space); struct oxr_space **out_space);
XrResult XrResult
oxr_space_reference_create(struct oxr_logger *log, oxr_space_reference_create(struct oxr_logger *log,
struct oxr_session *sess, struct oxr_session *sess,
@ -445,7 +457,7 @@ oxr_space_locate(struct oxr_logger *log,
struct oxr_space *spc, struct oxr_space *spc,
struct oxr_space *baseSpc, struct oxr_space *baseSpc,
XrTime time, XrTime time,
XrSpaceRelation *relation); XrSpaceLocation *relation);
XrResult XrResult
oxr_space_ref_relation(struct oxr_logger *log, oxr_space_ref_relation(struct oxr_logger *log,
@ -552,6 +564,7 @@ oxr_system_enumerate_view_confs(
XrResult XrResult
oxr_system_enumerate_blend_modes(struct oxr_logger *log, oxr_system_enumerate_blend_modes(struct oxr_logger *log,
struct oxr_system *sys, struct oxr_system *sys,
XrViewConfigurationType viewConfigurationType,
uint32_t environmentBlendModeCapacityInput, uint32_t environmentBlendModeCapacityInput,
uint32_t *environmentBlendModeCountOutput, uint32_t *environmentBlendModeCountOutput,
XrEnvironmentBlendMode *environmentBlendModes); XrEnvironmentBlendMode *environmentBlendModes);
@ -1036,7 +1049,7 @@ struct oxr_action_set
struct oxr_handle_base handle; struct oxr_handle_base handle;
//! Onwer of this messenger. //! Onwer of this messenger.
struct oxr_session *sess; struct oxr_instance *inst;
/*! /*!
* Every change that is done to a action set will increment this * Every change that is done to a action set will increment this

View file

@ -37,7 +37,17 @@ static bool
is_running(XrSessionState state) is_running(XrSessionState state)
{ {
switch (state) { switch (state) {
case XR_SESSION_STATE_RUNNING: return true; case XR_SESSION_STATE_SYNCHRONIZED: return true;
case XR_SESSION_STATE_VISIBLE: return true;
case XR_SESSION_STATE_FOCUSED: return true;
default: return false;
}
}
static bool
should_render(XrSessionState state)
{
switch (state) {
case XR_SESSION_STATE_VISIBLE: return true; case XR_SESSION_STATE_VISIBLE: return true;
case XR_SESSION_STATE_FOCUSED: return true; case XR_SESSION_STATE_FOCUSED: return true;
default: return false; default: return false;
@ -89,7 +99,7 @@ oxr_session_begin(struct oxr_logger *log,
} }
oxr_event_push_XrEventDataSessionStateChanged( oxr_event_push_XrEventDataSessionStateChanged(
log, sess, XR_SESSION_STATE_RUNNING, 0); log, sess, XR_SESSION_STATE_SYNCHRONIZED, 0);
oxr_event_push_XrEventDataSessionStateChanged( oxr_event_push_XrEventDataSessionStateChanged(
log, sess, XR_SESSION_STATE_VISIBLE, 0); log, sess, XR_SESSION_STATE_VISIBLE, 0);
oxr_event_push_XrEventDataSessionStateChanged( oxr_event_push_XrEventDataSessionStateChanged(
@ -336,11 +346,12 @@ oxr_session_frame_wait(struct oxr_logger *log,
XRT_MAYBE_UNUSED timepoint_ns now = XRT_MAYBE_UNUSED timepoint_ns now =
time_state_get_now_and_update(sess->sys->inst->timekeeping); time_state_get_now_and_update(sess->sys->inst->timekeeping);
struct xrt_compositor *xc = sess->compositor; struct xrt_compositor *xc = sess->compositor;
xc->wait_frame(xc, &frameState->predictedDisplayTime, xc->wait_frame(xc, &frameState->predictedDisplayTime,
&frameState->predictedDisplayPeriod); &frameState->predictedDisplayPeriod);
frameState->shouldRender = should_render(sess->state);
return XR_SUCCESS; return XR_SUCCESS;
} }

View file

@ -54,17 +54,17 @@ oxr_space_destroy(struct oxr_logger *log, struct oxr_handle_base *hb)
XrResult XrResult
oxr_space_action_create(struct oxr_logger *log, oxr_space_action_create(struct oxr_logger *log,
struct oxr_action *act, struct oxr_session *sess,
uint64_t key,
const XrActionSpaceCreateInfo *createInfo, const XrActionSpaceCreateInfo *createInfo,
struct oxr_space **out_space) struct oxr_space **out_space)
{ {
struct oxr_session *sess = act->act_set->sess;
struct oxr_instance *inst = sess->sys->inst; struct oxr_instance *inst = sess->sys->inst;
struct oxr_sub_paths sub_paths = {0}; struct oxr_sub_paths sub_paths = {0};
struct oxr_space *spc = NULL; struct oxr_space *spc = NULL;
OXR_ALLOCATE_HANDLE_OR_RETURN(log, spc, OXR_XR_DEBUG_SPACE, OXR_ALLOCATE_HANDLE_OR_RETURN(log, spc, OXR_XR_DEBUG_SPACE,
oxr_space_destroy, &act->handle); oxr_space_destroy, &sess->handle);
//! @todo implement more fully //! @todo implement more fully
oxr_warn(log, " not fully implemented"); oxr_warn(log, " not fully implemented");
@ -72,9 +72,10 @@ oxr_space_action_create(struct oxr_logger *log,
oxr_classify_sub_action_paths(log, inst, 1, &createInfo->subactionPath, oxr_classify_sub_action_paths(log, inst, 1, &createInfo->subactionPath,
&sub_paths); &sub_paths);
spc->sess = act->act_set->sess; spc->sess = sess;
spc->is_reference = false; spc->is_reference = false;
spc->sub_paths = sub_paths; spc->sub_paths = sub_paths;
spc->act_key = key;
memcpy(&spc->pose, &createInfo->poseInActionSpace, sizeof(spc->pose)); memcpy(&spc->pose, &createInfo->poseInActionSpace, sizeof(spc->pose));
*out_space = spc; *out_space = spc;
@ -332,7 +333,7 @@ oxr_space_locate(struct oxr_logger *log,
struct oxr_space *spc, struct oxr_space *spc,
struct oxr_space *baseSpc, struct oxr_space *baseSpc,
XrTime time, XrTime time,
XrSpaceRelation *relation) XrSpaceLocation *location)
{ {
if (debug_get_bool_option_space()) { if (debug_get_bool_option_space()) {
fprintf(stderr, "%s\n", __func__); fprintf(stderr, "%s\n", __func__);
@ -346,7 +347,7 @@ oxr_space_locate(struct oxr_logger *log,
struct xrt_space_relation pure; struct xrt_space_relation pure;
XrResult ret = get_pure_space_relation(log, spc, baseSpc, time, &pure); XrResult ret = get_pure_space_relation(log, spc, baseSpc, time, &pure);
if (ret != XR_SUCCESS) { if (ret != XR_SUCCESS) {
relation->relationFlags = 0; location->locationFlags = 0;
return ret; return ret;
} }
@ -355,16 +356,18 @@ oxr_space_locate(struct oxr_logger *log,
math_relation_openxr_locate(&spc->pose, &pure, &baseSpc->pose, &result); math_relation_openxr_locate(&spc->pose, &pure, &baseSpc->pose, &result);
// Copy // Copy
relation->pose = *(XrPosef *)&result.pose; location->pose = *(XrPosef *)&result.pose;
relation->linearVelocity = *(XrVector3f *)&result.linear_velocity; location->locationFlags = result.relation_flags;
relation->angularVelocity = *(XrVector3f *)&result.angular_velocity; #if 0
relation->linearAcceleration = location->linearVelocity = *(XrVector3f *)&result.linear_velocity;
location->angularVelocity = *(XrVector3f *)&result.angular_velocity;
location->linearAcceleration =
*(XrVector3f *)&result.linear_acceleration; *(XrVector3f *)&result.linear_acceleration;
relation->angularAcceleration = location->angularAcceleration =
*(XrVector3f *)&result.angular_acceleration; *(XrVector3f *)&result.angular_acceleration;
relation->relationFlags = result.relation_flags; #endif
print_pose("\trelation->pose", (struct xrt_pose *)&relation->pose); print_pose("\trelation->pose", (struct xrt_pose *)&location->pose);
return XR_SUCCESS; return XR_SUCCESS;
} }

View file

@ -178,7 +178,6 @@ oxr_system_get_properties(struct oxr_logger *log,
{ {
properties->vendorId = 42; properties->vendorId = 42;
properties->systemId = sys->systemId; properties->systemId = sys->systemId;
properties->graphicsProperties.maxViewCount = 2;
// Needed to silence the warnings. // Needed to silence the warnings.
const char *name = sys->head->name; const char *name = sys->head->name;
@ -214,10 +213,12 @@ oxr_system_enumerate_view_confs(struct oxr_logger *log,
XrResult XrResult
oxr_system_enumerate_blend_modes(struct oxr_logger *log, oxr_system_enumerate_blend_modes(struct oxr_logger *log,
struct oxr_system *sys, struct oxr_system *sys,
XrViewConfigurationType viewConfigurationType,
uint32_t environmentBlendModeCapacityInput, uint32_t environmentBlendModeCapacityInput,
uint32_t *environmentBlendModeCountOutput, uint32_t *environmentBlendModeCountOutput,
XrEnvironmentBlendMode *environmentBlendModes) XrEnvironmentBlendMode *environmentBlendModes)
{ {
//! @todo Take into account viewConfigurationType
OXR_TWO_CALL_HELPER(log, environmentBlendModeCapacityInput, OXR_TWO_CALL_HELPER(log, environmentBlendModeCapacityInput,
environmentBlendModeCountOutput, environmentBlendModeCountOutput,
environmentBlendModes, sys->num_blend_modes, environmentBlendModes, sys->num_blend_modes,