47 #define OXR_XR_DEBUG_INSTANCE (*(uint64_t *)"oxrinst\0") 48 #define OXR_XR_DEBUG_SESSION (*(uint64_t *)"oxrsess\0") 49 #define OXR_XR_DEBUG_SPACE (*(uint64_t *)"oxrspac\0") 50 #define OXR_XR_DEBUG_PATH (*(uint64_t *)"oxrpath\0") 51 #define OXR_XR_DEBUG_ACTION (*(uint64_t *)"oxracti\0") 52 #define OXR_XR_DEBUG_SWAPCHAIN (*(uint64_t *)"oxrswap\0") 53 #define OXR_XR_DEBUG_ACTIONSET (*(uint64_t *)"oxraset\0") 54 #define OXR_XR_DEBUG_MESSENGER (*(uint64_t *)"oxrmess\0") 55 #define OXR_XR_DEBUG_SOURCESET (*(uint64_t *)"oxrsrcs\0") 56 #define OXR_XR_DEBUG_SOURCE (*(uint64_t *)"oxrsrc_\0") 85 #define XRT_MAX_HANDLE_CHILDREN 256 89 typedef XrResult (*oxr_handle_destroyer)(
struct oxr_logger *log,
113 OXR_SUB_ACTION_PATH_USER,
114 OXR_SUB_ACTION_PATH_HEAD,
115 OXR_SUB_ACTION_PATH_LEFT,
116 OXR_SUB_ACTION_PATH_RIGHT,
117 OXR_SUB_ACTION_PATH_GAMEPAD,
150 static inline XrInstance
153 return (XrInstance)inst;
158 const XrInstanceCreateInfo *createInfo,
162 oxr_instance_get_properties(
struct oxr_logger *log,
164 XrInstanceProperties *instanceProperties);
169 oxr_instance_convert_time_to_timespec(
struct oxr_logger *log,
172 struct timespec *timespecTime);
174 oxr_instance_convert_timespec_to_time(
struct oxr_logger *log,
176 const struct timespec *timespecTime,
178 #endif // XR_USE_TIMESPEC 224 const char **out_str,
246 uint32_t num_subaction_paths,
247 const XrPath *subaction_paths,
263 static inline XrActionSet
266 return (XrActionSet)act_set;
272 const XrActionSetCreateInfo *createInfo,
278 static inline XrAction
281 return (XrAction)act;
287 const XrActionCreateInfo *createInfo,
291 oxr_session_attach_action_sets(
struct oxr_logger *log,
293 const XrSessionActionSetsAttachInfo *bindInfo);
298 uint32_t countActionSets,
299 const XrActiveActionSet *actionSets);
302 oxr_action_get_boolean(
struct oxr_logger *log,
306 XrActionStateBoolean *data);
309 oxr_action_get_vector1f(
struct oxr_logger *log,
313 XrActionStateFloat *data);
317 oxr_action_get_vector2f(
struct oxr_logger *log,
321 XrActionStateVector2f *data);
328 XrActionStatePose *data);
331 oxr_action_apply_haptic_feedback(
struct oxr_logger *log,
335 const XrHapticBaseHeader *hapticEvent);
338 oxr_action_stop_haptic_feedback(
struct oxr_logger *log,
378 size_t *num_bindings);
384 const XrInteractionProfileSuggestedBinding *suggestedBindings);
387 oxr_action_get_current_interaction_profile(
390 XrPath topLevelUserPath,
391 XrInteractionProfileState *interactionProfile);
397 const XrInputSourceLocalizedNameGetInfo *getInfo,
398 uint32_t bufferCapacityInput,
399 uint32_t *bufferCountOutput,
406 uint32_t sourceCapacityInput,
407 uint32_t *sourceCountOutput,
420 static inline XrSession
423 return (XrSession)sess;
429 const XrSessionCreateInfo *createInfo,
433 oxr_session_enumerate_formats(
struct oxr_logger *log,
435 uint32_t formatCapacityInput,
436 uint32_t *formatCountOutput,
442 const XrSessionBeginInfo *beginInfo);
466 const XrViewLocateInfo *viewLocateInfo,
467 XrViewState *viewState,
468 uint32_t viewCapacityInput,
469 uint32_t *viewCountOutput,
475 XrFrameState *frameState);
483 const XrFrameEndInfo *frameEndInfo);
495 static inline XrSpace
496 oxr_space_to_openxr(
struct oxr_space *spc)
502 oxr_space_action_create(
struct oxr_logger *log,
505 const XrActionSpaceCreateInfo *createInfo,
509 oxr_space_reference_create(
struct oxr_logger *log,
511 const XrReferenceSpaceCreateInfo *createInfo,
519 XrSpaceLocation *location);
524 XrReferenceSpaceType space,
525 XrReferenceSpaceType baseSpc,
539 static inline XrSwapchain
542 return (XrSwapchain)sc;
548 const XrSwapchainCreateInfo *,
561 static inline XrDebugUtilsMessengerEXT
564 return (XrDebugUtilsMessengerEXT)mssngr;
570 const XrDebugUtilsMessengerCreateInfoEXT *,
586 uint32_t num_systems,
587 XrFormFactor form_factor,
601 XrSystemId systemId);
612 XrSystemProperties *properties);
615 oxr_system_enumerate_view_confs(
618 uint32_t viewConfigurationTypeCapacityInput,
619 uint32_t *viewConfigurationTypeCountOutput,
620 XrViewConfigurationType *viewConfigurationTypes);
625 XrViewConfigurationType viewConfigurationType,
626 uint32_t environmentBlendModeCapacityInput,
627 uint32_t *environmentBlendModeCountOutput,
628 XrEnvironmentBlendMode *environmentBlendModes);
631 oxr_system_get_view_conf_properties(
634 XrViewConfigurationType viewConfigurationType,
635 XrViewConfigurationProperties *configurationProperties);
638 oxr_system_enumerate_view_conf_views(
641 XrViewConfigurationType viewConfigurationType,
642 uint32_t viewCapacityInput,
643 uint32_t *viewCountOutput,
644 XrViewConfigurationView *views);
656 XrEventDataBuffer *eventData);
659 oxr_event_push_XrEventDataSessionStateChanged(
struct oxr_logger *log,
661 XrSessionState state,
672 oxr_xdev_destroy(
struct xrt_device **xdev_ptr);
708 #ifdef XR_USE_GRAPHICS_API_OPENGL 709 #ifdef XR_USE_PLATFORM_XLIB 712 oxr_session_populate_gl_xlib(
struct oxr_logger *log,
714 XrGraphicsBindingOpenGLXlibKHR
const *next,
716 #endif // XR_USE_PLATFORM_XLIB 721 const XrSwapchainCreateInfo *,
724 #endif // XR_USE_GRAPHICS_API_OPENGL 733 #ifdef XR_USE_GRAPHICS_API_VULKAN 736 oxr_vk_get_instance_exts(
struct oxr_logger *log,
738 uint32_t namesCapacityInput,
739 uint32_t *namesCountOutput,
743 oxr_vk_get_device_exts(
struct oxr_logger *log,
745 uint32_t namesCapacityInput,
746 uint32_t *namesCountOutput,
750 oxr_vk_get_requirements(
struct oxr_logger *log,
752 XrGraphicsRequirementsVulkanKHR *graphicsRequirements);
755 oxr_vk_get_physical_device(
struct oxr_logger *log,
758 VkInstance vkInstance,
759 PFN_vkGetInstanceProcAddr getProc,
760 VkPhysicalDevice *vkPhysicalDevice);
763 oxr_session_populate_vk(
struct oxr_logger *log,
765 XrGraphicsBindingVulkanKHR
const *next,
771 const XrSwapchainCreateInfo *,
783 #ifdef XR_USE_PLATFORM_EGL 786 oxr_session_populate_egl(
struct oxr_logger *log,
788 XrGraphicsBindingEGLMND
const *next,
857 XrFormFactor form_factor;
858 XrViewConfigurationType view_config_type;
859 XrViewConfigurationView views[2];
860 uint32_t num_blend_modes;
861 XrEnvironmentBlendMode blend_modes[3];
864 #define MAKE_EXT_STATUS(mixed_case, all_caps) bool mixed_case; 919 XrPath khr_simple_controller;
920 XrPath google_daydream_controller;
921 XrPath htc_vive_controller;
923 XrPath microsoft_motion_controller;
924 XrPath microsoft_xbox_controller;
925 XrPath oculus_go_controller;
926 XrPath oculus_touch_controller;
927 XrPath valve_index_controller;
928 XrPath mnd_ball_on_stick_controller;
934 bool lifecycle_verbose;
954 XrSessionState
state;
984 float static_prediction_s;
991 const XrSwapchainCreateInfo *,
998 static inline XrResult
999 oxr_session_success_result(
struct oxr_session *session)
1001 switch (session->state) {
1002 case XR_SESSION_STATE_LOSS_PENDING:
return XR_SESSION_LOSS_PENDING;
1003 default:
return XR_SUCCESS;
1011 static inline XrResult
1012 oxr_session_success_focused_result(
struct oxr_session *session)
1014 switch (session->state) {
1015 case XR_SESSION_STATE_LOSS_PENDING:
return XR_SESSION_LOSS_PENDING;
1016 case XR_SESSION_STATE_FOCUSED:
return XR_SUCCESS;
1017 default:
return XR_SESSION_NOT_FOCUSED;
1028 size_t num_bindings;
1151 int64_t stop_output_time;
1229 XrResult (*enumerate_images)(
struct oxr_logger *,
1232 XrSwapchainImageBaseHeader *);
1234 XrResult (*acquire_image)(
struct oxr_logger *,
1236 const XrSwapchainImageAcquireInfo *,
1241 const XrSwapchainImageWaitInfo *);
1243 XrResult (*release_image)(
struct oxr_logger *,
1245 const XrSwapchainImageReleaseInfo *);
1262 char name[XR_MAX_ACTION_SET_NAME_SIZE];
1285 char name[XR_MAX_ACTION_NAME_SIZE];
float ipd_meters
IPD, to be expanded to a proper 3D relation.
Definition: oxr_objects.h:982
XrResult oxr_action_enumerate_bound_sources(struct oxr_logger *log, struct oxr_session *sess, uint64_t key, uint32_t sourceCapacityInput, uint32_t *sourceCountOutput, XrPath *sources)
Definition: oxr_binding.c:432
A simple uint64_t key to a void pointer hashmap.
Definition: u_hashmap.cpp:22
Can be one of 3 references or a space that are bound to actions.
Definition: oxr_objects.h:1183
XrResult oxr_source_get_pose_input(struct oxr_logger *log, struct oxr_session *sess, uint32_t key, const struct oxr_sub_paths *sub_paths, struct oxr_source_input **out_input)
Find the pose input for the set of sub_paths.
Definition: oxr_input.c:221
uint32_t act_key
Action key from which action this space was created from.
Definition: oxr_objects.h:1198
XrResult oxr_path_only_get(struct oxr_logger *log, struct oxr_instance *inst, const char *str, size_t length, XrPath *out_path)
Only get the path for the given string if it exists.
Definition: oxr_path.c:171
Include all of the Vulkan headers in one place.
Hashmap for integer values header.
Session input source.
Definition: oxr_objects.h:1069
XrResult oxr_session_get_view_pose_at(struct oxr_logger *, struct oxr_session *sess, XrTime at_time, struct xrt_pose *)
Get the view space position at the given time in relation to the local or stage space.
Definition: oxr_session.c:186
A pose composed of a position and orientation.
Definition: xrt_defines.h:229
XrResult oxr_session_begin(struct oxr_logger *log, struct oxr_session *sess, const XrSessionBeginInfo *beginInfo)
Definition: oxr_session.c:93
enum xrt_device_name name
Enum identifier of the device.
Definition: xrt_device.h:206
void oxr_binding_find_bindings_from_key(struct oxr_logger *log, struct oxr_interaction_profile *profile, uint32_t key, struct oxr_binding *bindings[32], size_t *num_bindings)
Find all bindings that is the given action key is bound to.
Definition: oxr_binding.c:261
A output source pair of a xrt_output_name and a xrt_device.
Definition: oxr_objects.h:1133
XrResult oxr_action_get_input_source_localized_name(struct oxr_logger *log, struct oxr_session *sess, const XrInputSourceLocalizedNameGetInfo *getInfo, uint32_t bufferCapacityInput, uint32_t *bufferCountOutput, char *buffer)
Definition: oxr_binding.c:419
bool oxr_xdev_find_output(struct xrt_device *xdev, enum xrt_output_name name, struct xrt_output **out_output)
Return true if it finds an output of that name on this device.
Definition: oxr_xdev.c:59
Object that client program interact with.
Definition: oxr_objects.h:945
State after successful oxr_handle_init.
Definition: oxr_objects.h:102
XrResult oxr_action_suggest_interaction_profile_bindings(struct oxr_logger *log, struct oxr_instance *inst, const XrInteractionProfileSuggestedBinding *suggestedBindings)
Definition: oxr_binding.c:337
void *XR_MAY_ALIAS user_data
Opaque user data.
Definition: oxr_objects.h:1320
struct oxr_handle_base * children[XRT_MAX_HANDLE_CHILDREN]
Array of children, if any.
Definition: oxr_objects.h:820
XrResult oxr_action_set_create(struct oxr_logger *log, struct oxr_instance *inst, const XrActionSetCreateInfo *createInfo, struct oxr_action_set **out_act_set)
Definition: oxr_input.c:98
struct oxr_source_set * next
Next source set on this session.
Definition: oxr_objects.h:1081
A group of actions.
Definition: oxr_objects.h:1253
struct oxr_instance * inst
Onwer of this messenger.
Definition: oxr_objects.h:1308
XrResult oxr_create_messenger(struct oxr_logger *, struct oxr_instance *inst, const XrDebugUtilsMessengerCreateInfoEXT *, struct oxr_debug_messenger **out_mssngr)
Definition: oxr_messenger.c:42
XrResult oxr_handle_destroy(struct oxr_logger *log, struct oxr_handle_base *hb)
Destroy the handle's object, as well as all child handles recursively.
Definition: oxr_handle_base.c:211
uint32_t key
Unique key for the session hashmap.
Definition: oxr_objects.h:1268
Header defining a xrt HMD device.
A relation with two spaces, includes velocity and acceleration.
Definition: xrt_defines.h:334
Macros for generating extension-related tables and code and inspecting Monado's extension support...
A set of images used for rendering.
Definition: oxr_objects.h:1212
State after successful oxr_handle_destroy.
Definition: oxr_objects.h:105
Logger struct that lives on the stack, one for each call client call.
Definition: oxr_logger.h:36
State during/before oxr_handle_init, or after failure.
Definition: oxr_objects.h:99
Kind of bespoke hashset implementation, where the user is responsible for allocating and freeing the ...
Definition: u_hashset.cpp:24
bool attached
Has this action set been attached.
Definition: oxr_objects.h:1265
XrResult oxr_space_locate(struct oxr_logger *log, struct oxr_space *spc, struct oxr_space *baseSpc, XrTime time, XrSpaceLocation *location)
Definition: oxr_space.c:327
uint64_t debug
Magic (per-handle-type) value for debugging.
Definition: oxr_objects.h:810
uint32_t key
Unique key for the session hashmap.
Definition: oxr_objects.h:1288
XrResult oxr_instance_create(struct oxr_logger *log, const XrInstanceCreateInfo *createInfo, struct oxr_instance **out_inst)
Definition: oxr_instance.c:100
oxr_handle_state
State of a handle base, to reduce likelihood of going "boom" on out-of-order destruction or other uns...
Definition: oxr_objects.h:96
XrResult oxr_path_get_or_create(struct oxr_logger *log, struct oxr_instance *inst, const char *str, size_t length, XrPath *out_path)
Get the path for the given string if it exists, or create it if it does not.
Definition: oxr_path.c:141
XrDebugUtilsMessageSeverityFlagsEXT message_severities
Severities to submit to this messenger.
Definition: oxr_objects.h:1311
xrt_output_name
Name of a output with a baked in type.
Definition: xrt_defines.h:494
To carry around a sementic selection of sub action paths.
Definition: oxr_objects.h:1054
XrResult oxr_session_views(struct oxr_logger *log, struct oxr_session *sess, const XrViewLocateInfo *viewLocateInfo, XrViewState *viewState, uint32_t viewCapacityInput, uint32_t *viewCountOutput, XrView *views)
Definition: oxr_session.c:299
The main prober that probes and manages found but not opened HMD devices that are connected to the sy...
Definition: xrt_prober.h:147
XrReferenceSpaceType type
What kind of reference space is this, if any.
Definition: oxr_objects.h:1195
Common swapchain base.
Definition: xrt_compositor.h:75
struct oxr_session * sess
Onwer of this space.
Definition: oxr_objects.h:1189
XrResult oxr_space_ref_relation(struct oxr_logger *log, struct oxr_session *sess, XrReferenceSpaceType space, XrReferenceSpaceType baseSpc, XrTime time, struct xrt_space_relation *out_relation)
This returns only the relation between two spaces without any of the app given relations applied...
Definition: oxr_space.c:135
XrResult oxr_path_get_string(struct oxr_logger *log, struct oxr_instance *inst, XrPath path, const char **out_str, size_t *out_length)
Get a pointer and length of the internal string.
Definition: oxr_path.c:192
The state of a action input source.
Definition: oxr_objects.h:1089
Time-keeping state structure.
Definition: u_time.cpp:46
Header defining a XRT graphics provider.
bool actionsAttached
Has xrAttachSessionActionSets been called?
Definition: oxr_objects.h:965
XrPath left
Currently bound interaction profile.
Definition: oxr_objects.h:971
struct xrt_swapchain * swapchain
Compositor swapchain.
Definition: oxr_objects.h:1221
XrTime timestamp
When was this last changed.
Definition: oxr_objects.h:1112
struct oxr_source_set * src_set_list
List of created source sets.
Definition: oxr_objects.h:962
struct oxr_session * sess
Onwer of this swapchain.
Definition: oxr_objects.h:1218
int acquired_index
Actual state tracked! :D.
Definition: oxr_objects.h:1224
Header defining the tracking system integration in Monado.
XrResult oxr_system_enumerate_blend_modes(struct oxr_logger *log, struct oxr_system *sys, XrViewConfigurationType viewConfigurationType, uint32_t environmentBlendModeCapacityInput, uint32_t *environmentBlendModeCountOutput, XrEnvironmentBlendMode *environmentBlendModes)
Definition: oxr_system.c:246
Common compositor base.
Definition: xrt_compositor.h:116
A single action.
Definition: oxr_objects.h:1276
const char * oxr_handle_state_to_string(enum oxr_handle_state state)
Returns a human-readable label for a handle state.
Definition: oxr_handle_base.c:43
oxr_sub_action_path
Sub action paths.
Definition: oxr_objects.h:111
XrResult oxr_session_frame_wait(struct oxr_logger *log, struct oxr_session *sess, XrFrameState *frameState)
Definition: oxr_session.c:386
XrResult oxr_session_request_exit(struct oxr_logger *log, struct oxr_session *sess)
Definition: oxr_session.c:158
struct oxr_handle_base * parent
Pointer to this object's parent handle holder, if any.
Definition: oxr_objects.h:815
Definition: oxr_event.c:21
struct oxr_session * sess
Owning session.
Definition: oxr_objects.h:1075
Session input source.
Definition: oxr_objects.h:1161
void oxr_classify_sub_action_paths(struct oxr_logger *log, struct oxr_instance *inst, uint32_t num_subaction_paths, const XrPath *subaction_paths, struct oxr_sub_paths *sub_paths)
Helper function to classify sub_paths.
Definition: oxr_input.c:179
Single or multiple devices grouped together to form a system that sessions can be created from...
Definition: oxr_objects.h:840
Structure tracking which extensions are enabled for a given instance.
Definition: oxr_objects.h:870
Definition: xrt_device.h:193
Definition: p_prober.h:127
Include all of the openxr headers in one place.
Used to hold diverse child handles and ensure orderly destruction.
Definition: oxr_objects.h:807
Main object that ties everything together.
Definition: oxr_objects.h:880
bool oxr_xdev_find_input(struct xrt_device *xdev, enum xrt_input_name name, struct xrt_input **out_input)
Return true if it finds an input of that name on this device.
Definition: oxr_xdev.c:38
XrDebugUtilsMessageTypeFlagsEXT message_types
Types to submit to this messenger.
Definition: oxr_objects.h:1314
Debug object created by the client program.
Definition: oxr_objects.h:1302
struct u_hashset * path_store
Path store, for looking up paths.
Definition: oxr_objects.h:900
struct oxr_action_set * act_set
Onwer of this messenger.
Definition: oxr_objects.h:1282
A single interaction profile.
Definition: oxr_objects.h:1024
PFN_xrDebugUtilsMessengerCallbackEXT user_callback
Callback function.
Definition: oxr_objects.h:1317
bool is_reference
Is this a reference space?
Definition: oxr_objects.h:1201
void oxr_find_profile_for_device(struct oxr_logger *log, struct oxr_instance *inst, struct xrt_device *xdev, struct oxr_interaction_profile **out_p)
Find the best matching profile for the given xrt_device.
Definition: oxr_binding.c:228
XrResult oxr_session_frame_end(struct oxr_logger *log, struct oxr_session *sess, const XrFrameEndInfo *frameEndInfo)
Definition: oxr_session.c:459
A single HMD or input device.
Definition: xrt_device.h:203
XrResult oxr_system_get_properties(struct oxr_logger *log, struct oxr_system *sys, XrSystemProperties *properties)
Definition: oxr_system.c:208
XrActionType action_type
Type the action this source was created from is.
Definition: oxr_objects.h:1167
oxr_handle_destroyer destroy
Destroy the object this handle refers to.
Definition: oxr_objects.h:830
#define OXR_EXTENSION_SUPPORT_GENERATE(_)
Call this, passing a macro taking two parameters, to generate tables, code, etc.
Definition: oxr_extension_support.h:127
void oxr_path_destroy_all(struct oxr_logger *log, struct oxr_instance *inst)
Destroy all paths that the instance has created.
Definition: oxr_path.c:215
xrt_input_name
Name of a input with a baked in type.
Definition: xrt_defines.h:417
enum oxr_handle_state state
Current handle state.
Definition: oxr_objects.h:825
void oxr_binding_destroy_all(struct oxr_logger *log, struct oxr_instance *inst)
Free all memory allocated by the binding system.
Definition: oxr_binding.c:296
struct oxr_instance * inst
Onwer of this messenger.
Definition: oxr_objects.h:1259
XrActionType action_type
Type this action was created with.
Definition: oxr_objects.h:1291
Interaction profile binding state.
Definition: oxr_objects.h:1034
A set of inputs for a single sub action path.
Definition: oxr_objects.h:1144