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
oxr_xrSyncActionData(XrSession session,
uint32_t countActionSets,
const XrActiveActionSet* actionSets)
oxr_xrSyncActions(XrSession session, const XrActionsSyncInfo* syncInfo)
{
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_logger log;
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) {
return oxr_error(&log, XR_ERROR_VALIDATION_FAILURE,
"(countActionSets == 0)");
}
for (uint32_t i = 0; i < countActionSets; i++) {
for (uint32_t i = 0; i < bindInfo->countActionSets; i++) {
struct oxr_action_set* act_set = NULL;
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, (&actionSets[i]),
XR_TYPE_ACTIVE_ACTION_SET);
OXR_VERIFY_ACTIONSET_NOT_NULL(&log, actionSets[i].actionSet,
OXR_VERIFY_ACTIONSET_NOT_NULL(&log, bindInfo->actionSets[i],
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
oxr_xrSetInteractionProfileSuggestedBindings(
XrSession session,
oxr_xrSuggestInteractionProfileBindings(
XrInstance instance,
const XrInteractionProfileSuggestedBinding* suggestedBindings)
{
struct oxr_session* sess;
struct oxr_instance* inst;
struct oxr_logger log;
OXR_VERIFY_SESSION_AND_INIT_LOG(
&log, session, sess, "xrSetInteractionProfileSuggestedBindings");
OXR_VERIFY_INSTANCE_AND_INIT_LOG(&log, instance, inst,
"xrSuggestInteractionProfileBindings");
OXR_VERIFY_ARG_TYPE_AND_NULL(
&log, suggestedBindings,
XR_TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING);
@ -77,21 +95,22 @@ oxr_xrSetInteractionProfileSuggestedBindings(
//! @todo verify path (s->binding).
}
return oxr_action_set_interaction_profile_suggested_bindings(
&log, sess, suggestedBindings);
return oxr_action_suggest_interaction_profile_bindings(
&log, inst, suggestedBindings);
}
XrResult
oxr_xrGetCurrentInteractionProfile(XrSession session,
XrPath topLevelUserPath,
XrInteractionProfileInfo* interactionProfile)
oxr_xrGetCurrentInteractionProfile(
XrSession session,
XrPath topLevelUserPath,
XrInteractionProfileState* interactionProfile)
{
struct oxr_session* sess;
struct oxr_logger log;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrGetCurrentInteractionProfile");
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(
&log, sess, topLevelUserPath, interactionProfile);
@ -100,8 +119,7 @@ oxr_xrGetCurrentInteractionProfile(XrSession session,
XrResult
oxr_xrGetInputSourceLocalizedName(
XrSession session,
XrPath source,
XrInputSourceLocalizedNameFlags whichComponents,
const XrInputSourceLocalizedNameGetInfo* getInfo,
uint32_t bufferCapacityInput,
uint32_t* bufferCountOutput,
char* buffer)
@ -110,11 +128,11 @@ oxr_xrGetInputSourceLocalizedName(
struct oxr_logger log;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrGetInputSourceLocalizedName");
//! @todo verify path
//! @todo verify getInfo
return oxr_action_get_input_source_localized_name(
&log, sess, source, whichComponents, bufferCapacityInput,
bufferCountOutput, buffer);
&log, sess, getInfo, bufferCapacityInput, bufferCountOutput,
buffer);
}
@ -125,16 +143,16 @@ oxr_xrGetInputSourceLocalizedName(
*/
XrResult
oxr_xrCreateActionSet(XrSession session,
oxr_xrCreateActionSet(XrInstance instance,
const XrActionSetCreateInfo* createInfo,
XrActionSet* actionSet)
{
struct oxr_action_set* act_set = NULL;
struct oxr_session* sess = NULL;
struct oxr_instance* inst = NULL;
struct oxr_logger log;
XrResult ret;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrCreateActionSet");
OXR_VERIFY_INSTANCE_AND_INIT_LOG(&log, instance, inst,
"xrCreateActionSet");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, createInfo,
XR_TYPE_ACTION_SET_CREATE_INFO);
OXR_VERIFY_ARG_NOT_NULL(&log, actionSet);
@ -142,7 +160,7 @@ oxr_xrCreateActionSet(XrSession session,
&log, createInfo->actionSetName);
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) {
return ret;
}
@ -189,7 +207,7 @@ oxr_xrCreateAction(XrActionSet actionSet,
OXR_VERIFY_ARG_LOCALIZED_NAME(&log, createInfo->localizedActionName);
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(
&log, inst, createInfo->countSubactionPaths,
@ -219,168 +237,153 @@ oxr_xrDestroyAction(XrAction action)
}
XrResult
oxr_xrGetActionStateBoolean(XrAction action,
uint32_t countSubactionPaths,
const XrPath* subactionPaths,
oxr_xrGetActionStateBoolean(XrSession session,
const XrActionStateGetInfo* getInfo,
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_action* act;
struct oxr_logger log;
XrResult ret;
OXR_VERIFY_ACTION_AND_INIT_LOG(&log, action, act,
"xrGetActionStateBoolean");
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrGetActionStateBoolean");
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,
" not created with pose type");
" not created with boolean type");
}
// Trust me.
if (countSubactionPaths > 1) {
return oxr_error(&log, XR_ERROR_PATH_INVALID,
" 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]");
ret = oxr_verify_subaction_path_get(
&log, act->act_set->inst, getInfo->subactionPath, &act->sub_paths,
&sub_paths, "getInfo->subactionPath");
if (ret != XR_SUCCESS) {
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
oxr_xrGetActionStateVector1f(XrAction action,
uint32_t countSubactionPaths,
const XrPath* subactionPaths,
XrActionStateVector1f* data)
oxr_xrGetActionStateFloat(XrSession session,
const XrActionStateGetInfo* getInfo,
XrActionStateFloat* 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_action* act;
struct oxr_logger log;
XrResult ret;
OXR_VERIFY_ACTION_AND_INIT_LOG(&log, action, act,
"xrGetActionStateVector1f");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, data, XR_TYPE_ACTION_STATE_VECTOR1F);
OXR_VERIFY_SUBACTION_PATHS(&log, countSubactionPaths, subactionPaths);
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrGetActionStateFloat");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, data, XR_TYPE_ACTION_STATE_FLOAT);
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,
" not created with float type");
}
// Trust me.
if (countSubactionPaths > 1) {
return oxr_error(&log, XR_ERROR_PATH_INVALID,
" 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]");
ret = oxr_verify_subaction_path_get(
&log, act->act_set->inst, getInfo->subactionPath, &act->sub_paths,
&sub_paths, "getInfo->subactionPath");
if (ret != XR_SUCCESS) {
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
oxr_xrGetActionStateVector2f(XrAction action,
uint32_t countSubactionPaths,
const XrPath* subactionPaths,
oxr_xrGetActionStateVector2f(XrSession session,
const XrActionStateGetInfo* getInfo,
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_action* act;
struct oxr_logger log;
XrResult ret;
OXR_VERIFY_ACTION_AND_INIT_LOG(&log, action, act,
"xrGetActionStateVector2f");
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrGetActionStateVector2f");
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,
" not created with float[2] type");
}
// Trust me.
if (countSubactionPaths > 1) {
return oxr_error(&log, XR_ERROR_PATH_INVALID,
" 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]");
ret = oxr_verify_subaction_path_get(
&log, act->act_set->inst, getInfo->subactionPath, &act->sub_paths,
&sub_paths, "getInfo->subactionPath");
if (ret != XR_SUCCESS) {
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
oxr_xrGetActionStatePose(XrAction action,
XrPath subactionPath,
oxr_xrGetActionStatePose(XrSession session,
const XrActionStateGetInfo* getInfo,
XrActionStatePose* data)
{
struct oxr_session* sess = NULL;
struct oxr_action* act = NULL;
struct oxr_sub_paths sub_paths = {0};
struct oxr_action* act;
struct oxr_logger log;
XrResult ret;
OXR_VERIFY_ACTION_AND_INIT_LOG(&log, action, act,
"xrGetActionStatePose");
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrGetActionStatePose");
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,
" not created with pose type");
}
ret = oxr_verify_subaction_path_get(&log, act->act_set->sess->sys->inst,
subactionPath, &act->sub_paths,
&sub_paths, "subactionPath");
ret = oxr_verify_subaction_path_get(
&log, act->act_set->inst, getInfo->subactionPath, &act->sub_paths,
&sub_paths, "getInfo->subactionPath");
if (ret != XR_SUCCESS) {
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
oxr_xrGetBoundSourcesForAction(XrAction action,
uint32_t sourceCapacityInput,
uint32_t* sourceCountOutput,
XrPath* sources)
oxr_xrEnumerateBoundSourcesForAction(
XrSession session,
const XrBoundSourcesForActionEnumerateInfo* enumerateInfo,
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;
OXR_VERIFY_ACTION_AND_INIT_LOG(&log, action, act,
"xrGetBoundSourcesForAction");
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"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);
}
@ -392,44 +395,65 @@ oxr_xrGetBoundSourcesForAction(XrAction action,
*/
XrResult
oxr_xrApplyHapticFeedback(XrAction hapticAction,
uint32_t countSubactionPaths,
const XrPath* subactionPaths,
oxr_xrApplyHapticFeedback(XrSession session,
const XrHapticActionInfo* hapticActionInfo,
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;
OXR_VERIFY_ACTION_AND_INIT_LOG(&log, hapticAction, act,
"xrApplyHapticFeedback");
OXR_VERIFY_SUBACTION_PATHS(&log, countSubactionPaths, subactionPaths);
//! @todo verify paths
XrResult ret;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrApplyHapticFeedback");
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,
" not created with output vibration type");
}
return oxr_action_apply_haptic_feedback(&log, act, countSubactionPaths,
subactionPaths, hapticEvent);
return oxr_action_apply_haptic_feedback(&log, sess, act->key, sub_paths,
hapticEvent);
}
XrResult
oxr_xrStopHapticFeedback(XrAction hapticAction,
uint32_t countSubactionPaths,
const XrPath* subactionPaths)
oxr_xrStopHapticFeedback(XrSession session,
const XrHapticActionInfo* hapticActionInfo)
{
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;
OXR_VERIFY_ACTION_AND_INIT_LOG(&log, hapticAction, act,
"xrStopHapticFeedback");
OXR_VERIFY_SUBACTION_PATHS(&log, countSubactionPaths, subactionPaths);
//! @todo verify paths
XrResult ret;
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrStopHapticFeedback");
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,
" not created with output vibration type");
}
return oxr_action_stop_haptic_feedback(&log, act, countSubactionPaths,
subactionPaths);
return oxr_action_stop_haptic_feedback(&log, sess, act->key, sub_paths);
}

View file

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

View file

@ -34,8 +34,10 @@ static const XrExtensionProperties extension_properties[] = {
{XR_TYPE_EXTENSION_PROPERTIES, NULL, XR_KHR_VULKAN_ENABLE_EXTENSION_NAME,
XR_KHR_vulkan_enable_SPEC_VERSION},
#endif
{XR_TYPE_EXTENSION_PROPERTIES, NULL, XR_KHR_HEADLESS_EXTENSION_NAME,
XR_KHR_headless_SPEC_VERSION},
#if XR_MND_headless
{XR_TYPE_EXTENSION_PROPERTIES, NULL, XR_MND_HEADLESS_EXTENSION_NAME,
XR_MND_headless_SPEC_VERSION},
#endif
#ifdef XR_USE_TIMESPEC
{XR_TYPE_EXTENSION_PROPERTIES, NULL,
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(xrBeginFrame)
ENTRY_ELSE_IF(xrEndFrame)
ENTRY_ELSE_IF(xrRequestExitSession)
ENTRY_ELSE_IF(xrLocateViews)
ENTRY_ELSE_IF(xrStringToPath)
ENTRY_ELSE_IF(xrPathToString)
@ -169,14 +170,15 @@ handle_none_null(struct oxr_logger* log,
ENTRY_ELSE_IF(xrDestroyActionSet)
ENTRY_ELSE_IF(xrCreateAction)
ENTRY_ELSE_IF(xrDestroyAction)
ENTRY_ELSE_IF(xrSetInteractionProfileSuggestedBindings)
ENTRY_ELSE_IF(xrSuggestInteractionProfileBindings)
ENTRY_ELSE_IF(xrAttachSessionActionSets)
ENTRY_ELSE_IF(xrGetCurrentInteractionProfile)
ENTRY_ELSE_IF(xrGetActionStateBoolean)
ENTRY_ELSE_IF(xrGetActionStateVector1f)
ENTRY_ELSE_IF(xrGetActionStateFloat)
ENTRY_ELSE_IF(xrGetActionStateVector2f)
ENTRY_ELSE_IF(xrGetActionStatePose)
ENTRY_ELSE_IF(xrSyncActionData)
ENTRY_ELSE_IF(xrGetBoundSourcesForAction)
ENTRY_ELSE_IF(xrSyncActions)
ENTRY_ELSE_IF(xrEnumerateBoundSourcesForAction)
ENTRY_ELSE_IF(xrGetInputSourceLocalizedName)
ENTRY_ELSE_IF(xrApplyHapticFeedback)
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);
}
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
oxr_xrLocateViews(XrSession session,
const XrViewLocateInfo* viewLocateInfo,

View file

@ -25,20 +25,23 @@
XrResult
oxr_xrCreateActionSpace(XrAction action,
oxr_xrCreateActionSpace(XrSession session,
const XrActionSpaceCreateInfo* createInfo,
XrSpace* space)
{
struct oxr_session* sess;
struct oxr_action* act;
struct oxr_logger log;
OXR_VERIFY_ACTION_AND_INIT_LOG(&log, action, act,
"xrCreateActionSpace");
OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess,
"xrCreateActionSpace");
OXR_VERIFY_ARG_TYPE_AND_NULL(&log, createInfo,
XR_TYPE_ACTION_SPACE_CREATE_INFO);
OXR_VERIFY_POSE(&log, createInfo->poseInActionSpace);
OXR_VERIFY_ACTION_NOT_NULL(&log, createInfo->action, act);
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) {
return ret;
}
@ -113,16 +116,16 @@ XrResult
oxr_xrLocateSpace(XrSpace space,
XrSpace baseSpace,
XrTime time,
XrSpaceRelation* relation)
XrSpaceLocation* location)
{
struct oxr_space* spc;
struct oxr_space* baseSpc;
struct oxr_logger log;
OXR_VERIFY_SPACE_AND_INIT_LOG(&log, space, spc, "xrLocateSpace");
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

View file

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

View file

@ -67,11 +67,11 @@ extern "C" {
#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)
#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) \
_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) \
_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_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
oxr_action_set_create(struct oxr_logger* log,
struct oxr_session* sess,
struct oxr_instance* inst,
const XrActionSetCreateInfo* createInfo,
struct oxr_action_set** out_act_set)
{
@ -119,11 +119,11 @@ oxr_action_set_create(struct oxr_logger* log,
//! @todo Implement more fully.
struct oxr_action_set* act_set = NULL;
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->generation = 1;
act_set->sess = sess;
act_set->inst = inst;
*out_act_set = act_set;
@ -158,7 +158,7 @@ oxr_action_create(struct oxr_logger* log,
const XrActionCreateInfo* createInfo,
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};
// Mod music for all!
@ -307,7 +307,7 @@ MEGA_HACK_get_binding(struct oxr_logger* log,
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,
&input) ||
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,
&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) {
oxr_xdev_find_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
oxr_source_set_create(struct oxr_logger* log,
struct oxr_session* sess,
struct oxr_action_set* act_set,
struct oxr_source_set** out_src_set)
{
struct oxr_session* sess = act_set->sess;
struct oxr_source_set* src_set = NULL;
OXR_ALLOCATE_HANDLE_OR_RETURN(log, src_set, OXR_XR_DEBUG_SOURCESET,
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
oxr_action_sync_data(struct oxr_logger* log,
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
// be creating the sources for the actions below.
if (src_set == NULL) {
oxr_source_set_create(log, act_set, &src_set);
oxr_source_set_create(log, sess, act_set, &src_set);
continue;
}
@ -707,13 +718,12 @@ oxr_action_sync_data(struct oxr_logger* log,
}
XrResult
oxr_action_set_interaction_profile_suggested_bindings(
oxr_action_suggest_interaction_profile_bindings(
struct oxr_logger* log,
struct oxr_session* sess,
struct oxr_instance* inst,
const XrInteractionProfileSuggestedBinding* suggestedBindings)
{
//! @todo Implement
struct oxr_instance* inst = sess->sys->inst;
const char* str;
size_t length;
@ -748,7 +758,7 @@ oxr_action_get_current_interaction_profile(
struct oxr_logger* log,
struct oxr_session* sess,
XrPath topLevelUserPath,
XrInteractionProfileInfo* interactionProfile)
XrInteractionProfileState* interactionProfile)
{
//! @todo Implement
return oxr_error(log, XR_ERROR_HANDLE_INVALID, " not implemented");
@ -758,8 +768,7 @@ XrResult
oxr_action_get_input_source_localized_name(
struct oxr_logger* log,
struct oxr_session* sess,
XrPath source,
XrInputSourceLocalizedNameFlags whichComponents,
const XrInputSourceLocalizedNameGetInfo* getInfo,
uint32_t bufferCapacityInput,
uint32_t* bufferCountOutput,
char* buffer)
@ -796,7 +805,7 @@ get_state_from_state_bool(struct oxr_source_state* state,
static void
get_state_from_state_vec1(struct oxr_source_state* state,
XrActionStateVector1f* data)
XrActionStateFloat* data)
{
data->currentState = state->vec1.x;
data->lastChangeTime = state->timestamp;
@ -859,14 +868,14 @@ get_state_from_state_vec2(struct oxr_source_state* state,
XrResult
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,
XrActionStateBoolean* data)
{
struct oxr_session* sess = act->act_set->sess;
struct oxr_source* src = NULL;
oxr_session_get_source(sess, act->key, &src);
oxr_session_get_source(sess, key, &src);
data->isActive = XR_FALSE;
U_ZERO(&data->currentState);
@ -888,14 +897,14 @@ oxr_action_get_boolean(struct oxr_logger* log,
XrResult
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,
XrActionStateVector1f* data)
XrActionStateFloat* data)
{
struct oxr_session* sess = act->act_set->sess;
struct oxr_source* src = NULL;
oxr_session_get_source(sess, act->key, &src);
oxr_session_get_source(sess, key, &src);
data->isActive = XR_FALSE;
U_ZERO(&data->currentState);
@ -917,14 +926,14 @@ oxr_action_get_vector1f(struct oxr_logger* log,
XrResult
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,
XrActionStateVector2f* data)
{
struct oxr_session* sess = act->act_set->sess;
struct oxr_source* src = NULL;
oxr_session_get_source(sess, act->key, &src);
oxr_session_get_source(sess, key, &src);
data->isActive = XR_FALSE;
U_ZERO(&data->currentState);
@ -946,14 +955,14 @@ oxr_action_get_vector2f(struct oxr_logger* log,
XrResult
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,
XrActionStatePose* data)
{
struct oxr_session* sess = act->act_set->sess;
struct oxr_source* src = NULL;
oxr_session_get_source(sess, act->key, &src);
oxr_session_get_source(sess, key, &src);
data->isActive = XR_FALSE;
@ -982,7 +991,8 @@ oxr_action_get_pose(struct oxr_logger* log,
XrResult
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* sourceCountOutput,
XrPath* sources)
@ -1019,21 +1029,18 @@ set_source_output_vibration(struct oxr_session* sess,
}
}
XrResult
oxr_action_apply_haptic_feedback(struct oxr_logger* log,
struct oxr_action* act,
uint32_t countSubactionPaths,
const XrPath* subactionPaths,
struct oxr_session* sess,
uint64_t key,
struct oxr_sub_paths sub_paths,
const XrHapticBaseHeader* hapticEvent)
{
struct oxr_session* sess = act->act_set->sess;
struct oxr_source* src = NULL;
struct oxr_sub_paths sub_paths = {0};
oxr_classify_sub_action_paths(log, sess->sys->inst, countSubactionPaths,
subactionPaths, &sub_paths);
oxr_session_get_source(sess, act->key, &src);
oxr_session_get_source(sess, key, &src);
if (src == NULL) {
return XR_SUCCESS;
@ -1067,18 +1074,13 @@ oxr_action_apply_haptic_feedback(struct oxr_logger* log,
XrResult
oxr_action_stop_haptic_feedback(struct oxr_logger* log,
struct oxr_action* act,
uint32_t countSubactionPaths,
const XrPath* subactionPaths)
struct oxr_session* sess,
uint64_t key,
struct oxr_sub_paths sub_paths)
{
struct oxr_session* sess = act->act_set->sess;
struct oxr_source* src = NULL;
struct oxr_sub_paths sub_paths = {0};
oxr_classify_sub_action_paths(log, sess->sys->inst, countSubactionPaths,
subactionPaths, &sub_paths);
oxr_session_get_source(sess, act->key, &src);
oxr_session_get_source(sess, key, &src);
if (src == NULL) {
return XR_SUCCESS;

View file

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

View file

@ -16,6 +16,8 @@
#include "oxr_objects.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(break_on_error, "OXR_BREAK_ON_ERROR", false)
@ -107,59 +109,12 @@ oxr_result_to_string(XrResult result)
{
// clang-format off
switch (result) {
case XR_SUCCESS: return "XR_SUCCESS";
case XR_TIMEOUT_EXPIRED: return "XR_TIMEOUT_EXPIRED";
case XR_SESSION_VISIBILITY_UNAVAILABLE: return "XR_SESSION_VISIBILITY_UNAVAILABLE";
case XR_SESSION_LOSS_PENDING: return "XR_SESSION_LOSS_PENDING";
case XR_EVENT_UNAVAILABLE: return "XR_EVENT_UNAVAILABLE";
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";
#define ENTRY(NAME, VALUE) \
case VALUE: return #NAME;
XR_LIST_ENUM_XrResult(ENTRY)
#undef ENTRY
default: return "<UNKNOWN>";
}
// clang-format on

View file

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

View file

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

View file

@ -54,17 +54,17 @@ oxr_space_destroy(struct oxr_logger *log, struct oxr_handle_base *hb)
XrResult
oxr_space_action_create(struct oxr_logger *log,
struct oxr_action *act,
struct oxr_session *sess,
uint64_t key,
const XrActionSpaceCreateInfo *createInfo,
struct oxr_space **out_space)
{
struct oxr_session *sess = act->act_set->sess;
struct oxr_instance *inst = sess->sys->inst;
struct oxr_sub_paths sub_paths = {0};
struct oxr_space *spc = NULL;
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
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,
&sub_paths);
spc->sess = act->act_set->sess;
spc->sess = sess;
spc->is_reference = false;
spc->sub_paths = sub_paths;
spc->act_key = key;
memcpy(&spc->pose, &createInfo->poseInActionSpace, sizeof(spc->pose));
*out_space = spc;
@ -332,7 +333,7 @@ oxr_space_locate(struct oxr_logger *log,
struct oxr_space *spc,
struct oxr_space *baseSpc,
XrTime time,
XrSpaceRelation *relation)
XrSpaceLocation *location)
{
if (debug_get_bool_option_space()) {
fprintf(stderr, "%s\n", __func__);
@ -346,7 +347,7 @@ oxr_space_locate(struct oxr_logger *log,
struct xrt_space_relation pure;
XrResult ret = get_pure_space_relation(log, spc, baseSpc, time, &pure);
if (ret != XR_SUCCESS) {
relation->relationFlags = 0;
location->locationFlags = 0;
return ret;
}
@ -355,16 +356,18 @@ oxr_space_locate(struct oxr_logger *log,
math_relation_openxr_locate(&spc->pose, &pure, &baseSpc->pose, &result);
// Copy
relation->pose = *(XrPosef *)&result.pose;
relation->linearVelocity = *(XrVector3f *)&result.linear_velocity;
relation->angularVelocity = *(XrVector3f *)&result.angular_velocity;
relation->linearAcceleration =
location->pose = *(XrPosef *)&result.pose;
location->locationFlags = result.relation_flags;
#if 0
location->linearVelocity = *(XrVector3f *)&result.linear_velocity;
location->angularVelocity = *(XrVector3f *)&result.angular_velocity;
location->linearAcceleration =
*(XrVector3f *)&result.linear_acceleration;
relation->angularAcceleration =
location->angularAcceleration =
*(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;
}

View file

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