Monado OpenXR Runtime
oxr_objects.h
Go to the documentation of this file.
1 // Copyright 2018-2019, Collabora, Ltd.
2 // SPDX-License-Identifier: BSL-1.0
3 /*!
4  * @file
5  * @brief Contains the instance struct that a lot of things hang from.
6  * @author Jakob Bornecrantz <jakob@collabora.com>
7  * @ingroup oxr_main
8  */
9 
10 #pragma once
11 
12 #include "xrt/xrt_device.h"
13 #include "xrt/xrt_tracking.h"
14 #include "xrt/xrt_compositor.h"
17 #include "util/u_hashset.h"
18 #include "util/u_hashmap.h"
19 
20 #include "oxr_extension_support.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 
27 /*!
28  * @defgroup oxr OpenXR state tracker
29  *
30  * Client application facing code.
31  *
32  * @ingroup xrt
33  */
34 
35 /*!
36  * @defgroup oxr_main OpenXR main code
37  *
38  * Gets called from @ref oxr_api functions and talks to devices and
39  * @ref comp using @ref xrt_iface.
40  *
41  * @ingroup oxr
42  * @{
43  */
44 
45 // For corruption and layer checking.
46 // clang-format off
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")
57 // clang-format on
58 
59 
60 /*
61  *
62  * Forward declare structs.
63  *
64  */
65 
66 struct xrt_instance;
67 struct oxr_logger;
68 struct oxr_instance;
69 struct oxr_system;
70 struct oxr_session;
71 struct oxr_event;
72 struct oxr_swapchain;
73 struct oxr_space;
74 struct oxr_action_set;
75 struct oxr_action;
76 struct oxr_debug_messenger;
77 struct oxr_handle_base;
78 struct oxr_sub_paths;
79 struct oxr_source;
80 struct oxr_source_set;
81 struct oxr_source_input;
82 struct oxr_source_output;
83 struct oxr_binding;
85 
86 #define XRT_MAX_HANDLE_CHILDREN 256
87 
88 struct time_state;
89 
90 typedef XrResult (*oxr_handle_destroyer)(struct oxr_logger *log,
91  struct oxr_handle_base *hb);
92 
93 /*!
94  * State of a handle base, to reduce likelihood of going "boom" on
95  * out-of-order destruction or other unsavory behavior.
96  */
98 {
99  /*! State during/before oxr_handle_init, or after failure */
101 
102  /*! State after successful oxr_handle_init */
104 
105  /*! State after successful oxr_handle_destroy */
107 };
108 
109 /*!
110  * Sub action paths.
111  */
113 {
119 };
120 
121 
122 /*
123  *
124  * oxr_handle_base.c
125  *
126  */
127 
128 /*!
129  * Destroy the handle's object, as well as all child handles recursively.
130  *
131  * This should be how all handle-associated objects are destroyed.
132  */
133 XrResult
134 oxr_handle_destroy(struct oxr_logger *log, struct oxr_handle_base *hb);
135 
136 /*!
137  * Returns a human-readable label for a handle state.
138  */
139 const char *
141 
142 /*
143  *
144  * oxr_instance.c
145  *
146  */
147 
148 /*!
149  * To go back to a OpenXR object.
150  */
151 static inline XrInstance
152 oxr_instance_to_openxr(struct oxr_instance *inst)
153 {
154  return (XrInstance)inst;
155 }
156 
157 XrResult
158 oxr_instance_create(struct oxr_logger *log,
159  const XrInstanceCreateInfo *createInfo,
160  struct oxr_instance **out_inst);
161 
162 XrResult
164  struct oxr_instance *inst,
165  XrInstanceProperties *instanceProperties);
166 
167 #if XR_USE_TIMESPEC
168 
169 XrResult
171  struct oxr_instance *inst,
172  XrTime time,
173  struct timespec *timespecTime);
174 XrResult
176  struct oxr_instance *inst,
177  const struct timespec *timespecTime,
178  XrTime *time);
179 #endif // XR_USE_TIMESPEC
180 
181 
182 /*
183  *
184  * oxr_path.c
185  *
186  */
187 
188 void *
190  struct oxr_instance *inst,
191  XrPath path);
192 
193 /*!
194  * Get the path for the given string if it exists, or create it if it does not.
195  */
196 XrResult
198  struct oxr_instance *inst,
199  const char *str,
200  size_t length,
201  XrPath *out_path);
202 
203 /*!
204  * Only get the path for the given string if it exists.
205  */
206 XrResult
207 oxr_path_only_get(struct oxr_logger *log,
208  struct oxr_instance *inst,
209  const char *str,
210  size_t length,
211  XrPath *out_path);
212 
213 /*!
214  * Get a pointer and length of the internal string.
215  *
216  * The pointer has the same life time as the instance. The length is the number
217  * of valid characters, not including the null termination character (but a
218  * extra null byte is always reserved at the end so can strings can be given
219  * to functions expecting null terminated strings).
220  */
221 XrResult
222 oxr_path_get_string(struct oxr_logger *log,
223  struct oxr_instance *inst,
224  XrPath path,
225  const char **out_str,
226  size_t *out_length);
227 
228 /*!
229  * Destroy all paths that the instance has created.
230  */
231 void
232 oxr_path_destroy_all(struct oxr_logger *log, struct oxr_instance *inst);
233 
234 
235 /*
236  *
237  * oxr_input.c
238  *
239  */
240 
241 /*!
242  * Helper function to classify sub_paths.
243  */
244 void
246  struct oxr_instance *inst,
247  uint32_t num_subaction_paths,
248  const XrPath *subaction_paths,
249  struct oxr_sub_paths *sub_paths);
250 
251 /*!
252  * Find the pose input for the set of sub_paths
253  */
254 XrResult
256  struct oxr_session *sess,
257  uint32_t key,
258  const struct oxr_sub_paths *sub_paths,
259  struct oxr_source_input **out_input);
260 
261 /*!
262  * To go back to a OpenXR object.
263  */
264 static inline XrActionSet
265 oxr_action_set_to_openxr(struct oxr_action_set *act_set)
266 {
267  return (XrActionSet)act_set;
268 }
269 
270 XrResult
272  struct oxr_instance *inst,
273  const XrActionSetCreateInfo *createInfo,
274  struct oxr_action_set **out_act_set);
275 
276 /*!
277  * To go back to a OpenXR object.
278  */
279 static inline XrAction
280 oxr_action_to_openxr(struct oxr_action *act)
281 {
282  return (XrAction)act;
283 }
284 
285 XrResult
286 oxr_action_create(struct oxr_logger *log,
287  struct oxr_action_set *act_set,
288  const XrActionCreateInfo *createInfo,
289  struct oxr_action **out_act);
290 
291 XrResult
293  struct oxr_session *sess,
294  const XrSessionActionSetsAttachInfo *bindInfo);
295 
296 XrResult
297 oxr_action_sync_data(struct oxr_logger *log,
298  struct oxr_session *sess,
299  uint32_t countActionSets,
300  const XrActiveActionSet *actionSets);
301 
302 XrResult
304  struct oxr_session *sess,
305  uint64_t key,
306  struct oxr_sub_paths sub_paths,
307  XrActionStateBoolean *data);
308 
309 XrResult
311  struct oxr_session *sess,
312  uint64_t key,
313  struct oxr_sub_paths sub_paths,
314  XrActionStateFloat *data);
315 
316 
317 XrResult
319  struct oxr_session *sess,
320  uint64_t key,
321  struct oxr_sub_paths sub_paths,
322  XrActionStateVector2f *data);
323 
324 XrResult
325 oxr_action_get_pose(struct oxr_logger *log,
326  struct oxr_session *sess,
327  uint64_t key,
328  struct oxr_sub_paths sub_paths,
329  XrActionStatePose *data);
330 
331 XrResult
333  struct oxr_session *sess,
334  uint64_t key,
335  struct oxr_sub_paths sub_paths,
336  const XrHapticBaseHeader *hapticEvent);
337 
338 XrResult
340  struct oxr_session *sess,
341  uint64_t key,
342  struct oxr_sub_paths sub_paths);
343 
344 
345 /*
346  *
347  * oxr_binding.c
348  *
349  */
350 
351 /*!
352  * Find the best matching profile for the given @ref xrt_device.
353  *
354  * @param log Logger.
355  * @param inst Instance.
356  * @param xdev Can be null.
357  * @param[out] out_p Returned interaction profile.
358  */
359 void
361  struct oxr_instance *inst,
362  struct xrt_device *xdev,
363  struct oxr_interaction_profile **out_p);
364 
365 /*!
366  * Free all memory allocated by the binding system.
367  */
368 void
369 oxr_binding_destroy_all(struct oxr_logger *log, struct oxr_instance *inst);
370 
371 /*!
372  * Find all bindings that is the given action key is bound to.
373  */
374 void
376  struct oxr_interaction_profile *profile,
377  uint32_t key,
378  struct oxr_binding *bindings[32],
379  size_t *num_bindings);
380 
381 XrResult
383  struct oxr_logger *log,
384  struct oxr_instance *inst,
385  const XrInteractionProfileSuggestedBinding *suggestedBindings);
386 
387 XrResult
389  struct oxr_logger *log,
390  struct oxr_session *sess,
391  XrPath topLevelUserPath,
392  XrInteractionProfileState *interactionProfile);
393 
394 XrResult
396  struct oxr_logger *log,
397  struct oxr_session *sess,
398  const XrInputSourceLocalizedNameGetInfo *getInfo,
399  uint32_t bufferCapacityInput,
400  uint32_t *bufferCountOutput,
401  char *buffer);
402 
403 XrResult
405  struct oxr_session *sess,
406  uint64_t key,
407  uint32_t sourceCapacityInput,
408  uint32_t *sourceCountOutput,
409  XrPath *sources);
410 
411 
412 /*
413  *
414  * oxr_session.c
415  *
416  */
417 
418 /*!
419  * To go back to a OpenXR object.
420  */
421 static inline XrSession
422 oxr_session_to_openxr(struct oxr_session *sess)
423 {
424  return (XrSession)sess;
425 }
426 
427 XrResult
428 oxr_session_create(struct oxr_logger *log,
429  struct oxr_system *sys,
430  const XrSessionCreateInfo *createInfo,
431  struct oxr_session **out_session);
432 
433 XrResult
435  struct oxr_session *sess,
436  uint32_t formatCapacityInput,
437  uint32_t *formatCountOutput,
438  int64_t *formats);
439 
440 XrResult
441 oxr_session_begin(struct oxr_logger *log,
442  struct oxr_session *sess,
443  const XrSessionBeginInfo *beginInfo);
444 
445 XrResult
446 oxr_session_end(struct oxr_logger *log, struct oxr_session *sess);
447 
448 XrResult
449 oxr_session_request_exit(struct oxr_logger *log, struct oxr_session *sess);
450 
451 void
452 oxr_session_poll(struct oxr_session *sess);
453 
454 /*!
455  * Get the view space position at the given time in relation to the
456  * local or stage space.
457  */
458 XrResult
460  struct oxr_session *sess,
461  XrTime at_time,
462  struct xrt_pose *);
463 
464 XrResult
465 oxr_session_views(struct oxr_logger *log,
466  struct oxr_session *sess,
467  const XrViewLocateInfo *viewLocateInfo,
468  XrViewState *viewState,
469  uint32_t viewCapacityInput,
470  uint32_t *viewCountOutput,
471  XrView *views);
472 
473 XrResult
475  struct oxr_session *sess,
476  XrFrameState *frameState);
477 
478 XrResult
479 oxr_session_frame_begin(struct oxr_logger *log, struct oxr_session *sess);
480 
481 XrResult
483  struct oxr_session *sess,
484  const XrFrameEndInfo *frameEndInfo);
485 
486 
487 /*
488  *
489  * oxr_space.c
490  *
491  */
492 
493 /*!
494  * To go back to a OpenXR object.
495  */
496 static inline XrSpace
497 oxr_space_to_openxr(struct oxr_space *spc)
498 {
499  return (XrSpace)spc;
500 }
501 
502 XrResult
504  struct oxr_session *sess,
505  uint64_t key,
506  const XrActionSpaceCreateInfo *createInfo,
507  struct oxr_space **out_space);
508 
509 XrResult
511  struct oxr_session *sess,
512  const XrReferenceSpaceCreateInfo *createInfo,
513  struct oxr_space **out_space);
514 
515 XrResult
516 oxr_space_locate(struct oxr_logger *log,
517  struct oxr_space *spc,
518  struct oxr_space *baseSpc,
519  XrTime time,
520  XrSpaceLocation *location);
521 
522 XrResult
524  struct oxr_session *sess,
525  XrReferenceSpaceType space,
526  XrReferenceSpaceType baseSpc,
527  XrTime time,
528  struct xrt_space_relation *out_relation);
529 
530 
531 /*
532  *
533  * oxr_swapchain.c
534  *
535  */
536 
537 /*!
538  * To go back to a OpenXR object.
539  */
540 static inline XrSwapchain
541 oxr_swapchain_to_openxr(struct oxr_swapchain *sc)
542 {
543  return (XrSwapchain)sc;
544 }
545 
546 XrResult
548  struct oxr_session *sess,
549  const XrSwapchainCreateInfo *,
550  struct oxr_swapchain **out_swapchain);
551 
552 
553 /*
554  *
555  * oxr_messenger.c
556  *
557  */
558 
559 /*!
560  * To go back to a OpenXR object.
561  */
562 static inline XrDebugUtilsMessengerEXT
563 oxr_messenger_to_openxr(struct oxr_debug_messenger *mssngr)
564 {
565  return (XrDebugUtilsMessengerEXT)mssngr;
566 }
567 
568 XrResult
570  struct oxr_instance *inst,
571  const XrDebugUtilsMessengerCreateInfoEXT *,
572  struct oxr_debug_messenger **out_mssngr);
573 XrResult
575  struct oxr_debug_messenger *mssngr);
576 
577 
578 /*
579  *
580  * oxr_system.c
581  *
582  */
583 
584 XrResult
585 oxr_system_select(struct oxr_logger *log,
586  struct oxr_system **systems,
587  uint32_t num_systems,
588  XrFormFactor form_factor,
589  struct oxr_system **out_selected);
590 
591 XrResult
592 oxr_system_fill_in(struct oxr_logger *log,
593  struct oxr_instance *inst,
594  XrSystemId systemId,
595  struct oxr_system *sys,
596  struct xrt_device **xdevs,
597  size_t num_xdevs);
598 
599 XrResult
600 oxr_system_verify_id(struct oxr_logger *log,
601  const struct oxr_instance *inst,
602  XrSystemId systemId);
603 
604 XrResult
605 oxr_system_get_by_id(struct oxr_logger *log,
606  struct oxr_instance *inst,
607  XrSystemId systemId,
608  struct oxr_system **system);
609 
610 XrResult
612  struct oxr_system *sys,
613  XrSystemProperties *properties);
614 
615 XrResult
617  struct oxr_logger *log,
618  struct oxr_system *sys,
619  uint32_t viewConfigurationTypeCapacityInput,
620  uint32_t *viewConfigurationTypeCountOutput,
621  XrViewConfigurationType *viewConfigurationTypes);
622 
623 XrResult
625  struct oxr_system *sys,
626  XrViewConfigurationType viewConfigurationType,
627  uint32_t environmentBlendModeCapacityInput,
628  uint32_t *environmentBlendModeCountOutput,
629  XrEnvironmentBlendMode *environmentBlendModes);
630 
631 XrResult
633  struct oxr_logger *log,
634  struct oxr_system *sys,
635  XrViewConfigurationType viewConfigurationType,
636  XrViewConfigurationProperties *configurationProperties);
637 
638 XrResult
640  struct oxr_logger *log,
641  struct oxr_system *sys,
642  XrViewConfigurationType viewConfigurationType,
643  uint32_t viewCapacityInput,
644  uint32_t *viewCountOutput,
645  XrViewConfigurationView *views);
646 
647 
648 /*
649  *
650  * oxr_event.cpp
651  *
652  */
653 
654 XrResult
655 oxr_poll_event(struct oxr_logger *log,
656  struct oxr_instance *inst,
657  XrEventDataBuffer *eventData);
658 
659 XrResult
661  struct oxr_session *sess,
662  XrSessionState state,
663  XrTime time);
664 
665 
666 /*
667  *
668  * oxr_xdev.c
669  *
670  */
671 
672 void
673 oxr_xdev_destroy(struct xrt_device **xdev_ptr);
674 
675 void
676 oxr_xdev_update(struct xrt_device *xdev);
677 
678 /*!
679  * Return true if it finds an input of that name on this device.
680  */
681 bool
682 oxr_xdev_find_input(struct xrt_device *xdev,
683  enum xrt_input_name name,
684  struct xrt_input **out_input);
685 
686 /*!
687  * Return true if it finds an output of that name on this device.
688  */
689 bool
690 oxr_xdev_find_output(struct xrt_device *xdev,
691  enum xrt_output_name name,
692  struct xrt_output **out_output);
693 
694 /*!
695  * Returns the pose of the named input from the device, if the pose isn't valid
696  * uses the device offset instead.
697  */
698 void
699 oxr_xdev_get_pose_at(struct oxr_logger *log,
700  struct oxr_instance *inst,
701  struct xrt_device *xdev,
702  enum xrt_input_name name,
703  XrTime at_time,
704  uint64_t *out_pose_timestamp_ns,
705  struct xrt_pose *out_pose);
706 
707 /*!
708  * Returns the relation of the named input from the device, always ensures
709  * that position and orientation is valid by using the device offset.
710  */
711 void
713  struct oxr_instance *inst,
714  struct xrt_device *xdev,
715  enum xrt_input_name name,
716  XrTime at_time,
717  uint64_t *out_relation_timestamp_ns,
718  struct xrt_space_relation *out_relation);
719 
720 
721 /*
722  *
723  * OpenGL, located in various files.
724  *
725  */
726 
727 #ifdef XR_USE_GRAPHICS_API_OPENGL
728 #ifdef XR_USE_PLATFORM_XLIB
729 
730 XrResult
732  struct oxr_system *sys,
733  XrGraphicsBindingOpenGLXlibKHR const *next,
734  struct oxr_session *sess);
735 #endif // XR_USE_PLATFORM_XLIB
736 
737 XrResult
739  struct oxr_session *sess,
740  const XrSwapchainCreateInfo *,
741  struct oxr_swapchain **out_swapchain);
742 
743 #endif // XR_USE_GRAPHICS_API_OPENGL
744 
745 
746 /*
747  *
748  * Vulkan, located in various files.
749  *
750  */
751 
752 #ifdef XR_USE_GRAPHICS_API_VULKAN
753 
754 XrResult
756  struct oxr_system *sys,
757  uint32_t namesCapacityInput,
758  uint32_t *namesCountOutput,
759  char *namesString);
760 
761 XrResult
763  struct oxr_system *sys,
764  uint32_t namesCapacityInput,
765  uint32_t *namesCountOutput,
766  char *namesString);
767 
768 XrResult
770  struct oxr_system *sys,
771  XrGraphicsRequirementsVulkanKHR *graphicsRequirements);
772 
773 XrResult
775  struct oxr_instance *inst,
776  struct oxr_system *sys,
777  VkInstance vkInstance,
778  PFN_vkGetInstanceProcAddr getProc,
779  VkPhysicalDevice *vkPhysicalDevice);
780 
781 XrResult
783  struct oxr_system *sys,
784  XrGraphicsBindingVulkanKHR const *next,
785  struct oxr_session *sess);
786 
787 XrResult
789  struct oxr_session *sess,
790  const XrSwapchainCreateInfo *,
791  struct oxr_swapchain **out_swapchain);
792 
793 #endif
794 
795 
796 /*
797  *
798  * EGL, located in various files.
799  *
800  */
801 
802 #ifdef XR_USE_PLATFORM_EGL
803 
804 XrResult
805 oxr_session_populate_egl(struct oxr_logger *log,
806  struct oxr_system *sys,
807  XrGraphicsBindingEGLMND const *next,
808  struct oxr_session *sess);
809 
810 #endif
811 
812 
813 /*
814  *
815  * Structs
816  *
817  */
818 
819 
820 /*!
821  * Used to hold diverse child handles and ensure orderly destruction.
822  *
823  * Each object referenced by an OpenXR handle should have one of these as its
824  * first element.
825  */
827 {
828  //! Magic (per-handle-type) value for debugging.
829  uint64_t debug;
830 
831  /*!
832  * Pointer to this object's parent handle holder, if any.
833  */
835 
836  /*!
837  * Array of children, if any.
838  */
840 
841  /*!
842  * Current handle state.
843  */
845 
846  /*!
847  * Destroy the object this handle refers to.
848  */
850 };
851 
852 /*!
853  * Single or multiple devices grouped together to form a system that sessions
854  * can be created from. Might need to open devices in order to get all
855  * properties from it, but shouldn't.
856  *
857  * @obj{XrSystemId}
858  */
860 {
862 
863  union {
864  struct
865  {
866  struct xrt_device *head;
867  struct xrt_device *left;
868  struct xrt_device *right;
869  };
870  struct xrt_device *xdevs[16];
871  };
872  size_t num_xdevs;
873 
874  XrSystemId systemId;
875 
876  XrFormFactor form_factor;
877  XrViewConfigurationType view_config_type;
878  XrViewConfigurationView views[2];
879  uint32_t num_blend_modes;
880  XrEnvironmentBlendMode blend_modes[3];
881 };
882 
883 #define MAKE_EXT_STATUS(mixed_case, all_caps) bool mixed_case;
884 /*!
885  * Structure tracking which extensions are enabled for a given instance.
886  *
887  * Names are systematic: the extension name with the XR_ prefix removed.
888  */
890 {
892 };
893 
894 /*!
895  * Main object that ties everything together.
896  *
897  * @obj{XrInstance}
898  */
900 {
901  //! Common structure for things referred to by OpenXR handles.
902  struct oxr_handle_base handle;
903 
904  /* ---- HACK ---- */
905  void *hack;
906  /* ---- HACK ---- */
907 
909 
910  //! Enabled extensions
911  struct oxr_extension_status extensions;
912 
913  // Hardcoded single system.
914  struct oxr_system system;
915 
917 
918  //! Path store, for looking up paths.
920 
921  // Event queue.
924 
926  size_t num_profiles;
927 
929 
930  struct
931  {
932  XrPath user;
933  XrPath head;
934  XrPath left;
935  XrPath right;
936  XrPath gamepad;
937 
941  XrPath htc_vive_pro;
948  } path_cache;
949 
950  //! Debug messengers
952 
957 };
958 
959 /*!
960  * Object that client program interact with.
961  *
962  * @obj{XrSession}
963  */
965 {
966  //! Common structure for things referred to by OpenXR handles.
967  struct oxr_handle_base handle;
968  struct oxr_system *sys;
970 
971  struct oxr_session *next;
972 
973  XrSessionState state;
975  bool exiting;
976 
979 
980  //! List of created source sets.
982 
983  //! Has xrAttachSessionActionSets been called?
985 
986  /*!
987  * Currently bound interaction profile.
988  * @{
989  */
990  XrPath left;
991  XrPath right;
992  XrPath head;
993  XrPath gamepad;
994  /*!
995  * @}
996  */
997 
998  /*!
999  * IPD, to be expanded to a proper 3D relation.
1000  */
1001  float ipd_meters;
1002 
1004 
1005  /*!
1006  * To pipe swapchain creation to right code.
1007  */
1008  XrResult (*create_swapchain)(struct oxr_logger *,
1009  struct oxr_session *sess,
1010  const XrSwapchainCreateInfo *,
1011  struct oxr_swapchain **);
1012 };
1013 
1014 /*!
1015  * Returns XR_SUCCESS or XR_SESSION_LOSS_PENDING as appropriate.
1016  */
1017 static inline XrResult
1018 oxr_session_success_result(struct oxr_session *session)
1019 {
1020  switch (session->state) {
1021  case XR_SESSION_STATE_LOSS_PENDING: return XR_SESSION_LOSS_PENDING;
1022  default: return XR_SUCCESS;
1023  }
1024 }
1025 
1026 /*!
1027  * Returns XR_SUCCESS, XR_SESSION_LOSS_PENDING, or XR_SESSION_NOT_FOCUSED, as
1028  * appropriate.
1029  */
1030 static inline XrResult
1031 oxr_session_success_focused_result(struct oxr_session *session)
1032 {
1033  switch (session->state) {
1034  case XR_SESSION_STATE_LOSS_PENDING: return XR_SESSION_LOSS_PENDING;
1035  case XR_SESSION_STATE_FOCUSED: return XR_SUCCESS;
1036  default: return XR_SESSION_NOT_FOCUSED;
1037  }
1038 }
1039 
1040 /*!
1041  * A single interaction profile.
1042  */
1044 {
1045  XrPath path;
1048 };
1049 
1050 /*!
1051  * Interaction profile binding state.
1052  */
1054 {
1055  XrPath *paths;
1056  size_t num_paths;
1057 
1058  enum oxr_sub_action_path sub_path;
1059 
1060  uint32_t *keys;
1061  size_t num_keys;
1062 
1064  size_t num_inputs;
1065 
1067  size_t num_outputs;
1068 };
1069 
1070 /*!
1071  * To carry around a sementic selection of sub action paths.
1072  */
1074 {
1075  bool any;
1076  bool user;
1077  bool head;
1078  bool left;
1079  bool right;
1080  bool gamepad;
1081 };
1082 
1083 /*!
1084  * Session input source.
1085  *
1086  * @see oxr_action_set
1087  */
1089 {
1090  //! Common structure for things referred to by OpenXR handles.
1091  struct oxr_handle_base handle;
1092 
1093  //! Owning session.
1095 
1096  //! Which sub-action paths are requested on the latest sync.
1097  struct oxr_sub_paths requested_sub_paths;
1098 
1099  //! Next source set on this session.
1101 };
1102 
1103 /*!
1104  * The state of a action input source.
1105  *
1106  * @see oxr_source
1107  */
1109 {
1110  union {
1111  struct
1112  {
1113  float x;
1114  } vec1;
1115 
1116  struct
1117  {
1118  float x;
1119  float y;
1120  } vec2;
1121 
1122  bool boolean;
1123  };
1124 
1125  bool active;
1126 
1127  // Was this changed.
1128  bool changed;
1129 
1130  //! When was this last changed.
1131  XrTime timestamp;
1132 };
1133 
1134 /*!
1135  * A input source pair of a @ref xrt_input and a @ref xrt_device.
1136  *
1137  * @see xrt_device
1138  * @see xrt_input
1139  */
1141 {
1142  struct xrt_device *xdev;
1143  struct xrt_input *input;
1144 };
1145 
1146 /*!
1147  * A output source pair of a @ref xrt_output_name and a @ref xrt_device.
1148  *
1149  * @see xrt_device
1150  * @see xrt_output_name
1151  */
1153 {
1154  struct xrt_device *xdev;
1156 };
1157 
1158 /*!
1159  * A set of inputs for a single sub action path.
1160  *
1161  * @see oxr_source
1162  */
1164 {
1165  struct oxr_source_state current;
1166 
1167  size_t num_inputs;
1169 
1171  size_t num_outputs;
1173 };
1174 
1175 /*!
1176  * Session input source.
1177  *
1178  * @see oxr_action
1179  */
1181 {
1182  //! Common structure for things referred to by OpenXR handles.
1183  struct oxr_handle_base handle;
1184 
1185  //! Type the action this source was created from is.
1186  XrActionType action_type;
1187 
1188  struct oxr_source_state any_state;
1189 
1190  struct oxr_source_cache user;
1191  struct oxr_source_cache head;
1192  struct oxr_source_cache left;
1193  struct oxr_source_cache right;
1194  struct oxr_source_cache gamepad;
1195 };
1196 
1197 /*!
1198  * Can be one of 3 references or a space that are bound to actions.
1199  *
1200  * @obj{XrSpace}
1201  */
1203 {
1204  //! Common structure for things referred to by OpenXR handles.
1205  struct oxr_handle_base handle;
1206 
1207  //! Onwer of this space.
1209 
1210  //! Pose that was given during creation.
1211  struct xrt_pose pose;
1212 
1213  //! What kind of reference space is this, if any.
1214  XrReferenceSpaceType type;
1215 
1216  //! Action key from which action this space was created from.
1217  uint32_t act_key;
1218 
1219  //! Is this a reference space?
1221 
1222  //! Which sub action path is this?
1223  struct oxr_sub_paths sub_paths;
1224 };
1225 
1226 /*!
1227  * A set of images used for rendering.
1228  *
1229  * @obj{XrSwapchain}
1230  */
1232 {
1233  //! Common structure for things referred to by OpenXR handles.
1234  struct oxr_handle_base handle;
1235 
1236  //! Onwer of this swapchain.
1238 
1239  //! Compositor swapchain.
1241 
1242  //! Actual state tracked! :D
1245 
1246  XrResult (*destroy)(struct oxr_logger *, struct oxr_swapchain *);
1247 
1248  XrResult (*enumerate_images)(struct oxr_logger *,
1249  struct oxr_swapchain *,
1250  uint32_t,
1251  XrSwapchainImageBaseHeader *);
1252 
1253  XrResult (*acquire_image)(struct oxr_logger *,
1254  struct oxr_swapchain *,
1255  const XrSwapchainImageAcquireInfo *,
1256  uint32_t *);
1257 
1258  XrResult (*wait_image)(struct oxr_logger *,
1259  struct oxr_swapchain *,
1260  const XrSwapchainImageWaitInfo *);
1261 
1262  XrResult (*release_image)(struct oxr_logger *,
1263  struct oxr_swapchain *,
1264  const XrSwapchainImageReleaseInfo *);
1265 };
1266 
1267 /*!
1268  * A group of actions.
1269  *
1270  * @obj{XrActionSet}
1271  */
1273 {
1274  //! Common structure for things referred to by OpenXR handles.
1275  struct oxr_handle_base handle;
1276 
1277  //! Onwer of this messenger.
1279 
1280  //! Application supplied name of this action.
1281  char name[XR_MAX_ACTION_SET_NAME_SIZE];
1282 
1283  //! Has this action set been attached.
1284  bool attached;
1285 
1286  //! Unique key for the session hashmap.
1287  uint32_t key;
1288 };
1289 
1290 /*!
1291  * A single action.
1292  *
1293  * @obj{XrAction}
1294  */
1296 {
1297  //! Common structure for things referred to by OpenXR handles.
1298  struct oxr_handle_base handle;
1299 
1300  //! Onwer of this messenger.
1302 
1303  //! Application supplied name of this action.
1304  char name[XR_MAX_ACTION_NAME_SIZE];
1305 
1306  //! Unique key for the session hashmap.
1307  uint32_t key;
1308 
1309  //! Type this action was created with.
1310  XrActionType action_type;
1311 
1312  //! Which sub action paths that this action was created with.
1313  struct oxr_sub_paths sub_paths;
1314 };
1315 
1316 /*!
1317  * Debug object created by the client program.
1318  *
1319  * @obj{XrDebugUtilsMessengerEXT}
1320  */
1322 {
1323  //! Common structure for things referred to by OpenXR handles.
1324  struct oxr_handle_base handle;
1325 
1326  //! Onwer of this messenger.
1328 
1329  //! Severities to submit to this messenger
1330  XrDebugUtilsMessageSeverityFlagsEXT message_severities;
1331 
1332  //! Types to submit to this messenger
1333  XrDebugUtilsMessageTypeFlagsEXT message_types;
1334 
1335  //! Callback function
1336  PFN_xrDebugUtilsMessengerCallbackEXT user_callback;
1337 
1338  //! Opaque user data
1339  void *XR_MAY_ALIAS user_data;
1340 };
1341 
1342 /*!
1343  * @}
1344  */
1345 
1346 
1347 #ifdef __cplusplus
1348 }
1349 #endif
float ipd_meters
IPD, to be expanded to a proper 3D relation.
Definition: oxr_objects.h:1001
XrResult oxr_session_populate_gl_xlib(struct oxr_logger *log, struct oxr_system *sys, XrGraphicsBindingOpenGLXlibKHR const *next, struct oxr_session *sess)
Definition: oxr_session_gl.c:31
XrPath htc_vive_pro
Definition: oxr_objects.h:941
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:444
XrResult oxr_create_swapchain(struct oxr_logger *, struct oxr_session *sess, const XrSwapchainCreateInfo *, struct oxr_swapchain **out_swapchain)
Definition: oxr_swapchain.c:107
A simple uint64_t key to a void pointer hashmap.
Definition: u_hashmap.cpp:22
XrPath left
Definition: oxr_objects.h:934
Can be one of 3 references or a space that are bound to actions.
Definition: oxr_objects.h:1202
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:1217
XrResult oxr_action_create(struct oxr_logger *log, struct oxr_action_set *act_set, const XrActionCreateInfo *createInfo, struct oxr_action **out_act)
Definition: oxr_input.c:141
bool lifecycle_verbose
Definition: oxr_objects.h:953
struct oxr_session * next
Definition: oxr_objects.h:971
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:1088
size_t num_inputs
Definition: oxr_objects.h:1064
XrResult oxr_action_sync_data(struct oxr_logger *log, struct oxr_session *sess, uint32_t countActionSets, const XrActiveActionSet *actionSets)
Definition: oxr_input.c:927
XrPath htc_vive_controller
Definition: oxr_objects.h:940
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:187
XrPath gamepad
Definition: oxr_objects.h:993
A pose composed of a position and orientation.
Definition: xrt_defines.h:231
struct xrt_compositor * compositor
Definition: oxr_objects.h:969
struct xrt_instance * xinst
Definition: oxr_objects.h:908
XrResult oxr_session_begin(struct oxr_logger *log, struct oxr_session *sess, const XrSessionBeginInfo *beginInfo)
Definition: oxr_session.c:94
bool gamepad
Definition: oxr_objects.h:1080
enum xrt_device_name name
Enum identifier of the device.
Definition: xrt_device.h:205
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:273
struct xrt_device * xdev
Definition: oxr_objects.h:1154
XrResult oxr_system_enumerate_view_confs(struct oxr_logger *log, struct oxr_system *sys, uint32_t viewConfigurationTypeCapacityInput, uint32_t *viewConfigurationTypeCountOutput, XrViewConfigurationType *viewConfigurationTypes)
Definition: oxr_system.c:233
XrFormFactor form_factor
Definition: oxr_objects.h:876
struct xrt_device * head
Definition: oxr_objects.h:866
XrResult oxr_action_get_current_interaction_profile(struct oxr_logger *log, struct oxr_session *sess, XrPath topLevelUserPath, XrInteractionProfileState *interactionProfile)
Definition: oxr_binding.c:401
XrPath path
Definition: oxr_objects.h:1045
XrViewConfigurationType view_config_type
Definition: oxr_objects.h:877
A output source pair of a xrt_output_name and a xrt_device.
Definition: oxr_objects.h:1152
XrResult oxr_swapchain_vk_create(struct oxr_logger *, struct oxr_session *sess, const XrSwapchainCreateInfo *, struct oxr_swapchain **out_swapchain)
Definition: oxr_swapchain_vk.c:56
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:431
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:63
Object that client program interact with.
Definition: oxr_objects.h:964
XrResult(* wait_image)(struct oxr_logger *, struct oxr_swapchain *, const XrSwapchainImageWaitInfo *)
Definition: oxr_objects.h:1258
State after successful oxr_handle_init.
Definition: oxr_objects.h:103
XrResult oxr_instance_get_properties(struct oxr_logger *log, struct oxr_instance *inst, XrInstanceProperties *instanceProperties)
Definition: oxr_instance.c:252
XrPath gamepad
Definition: oxr_objects.h:936
XrResult oxr_action_suggest_interaction_profile_bindings(struct oxr_logger *log, struct oxr_instance *inst, const XrInteractionProfileSuggestedBinding *suggestedBindings)
Definition: oxr_binding.c:349
void oxr_xdev_update(struct xrt_device *xdev)
Definition: oxr_xdev.c:34
struct xrt_device * left
Definition: oxr_objects.h:867
bool exiting
Definition: oxr_objects.h:975
struct oxr_system * sys
Definition: oxr_objects.h:968
XrResult oxr_instance_convert_time_to_timespec(struct oxr_logger *log, struct oxr_instance *inst, XrTime time, struct timespec *timespecTime)
Definition: oxr_instance.c:266
void *XR_MAY_ALIAS user_data
Opaque user data.
Definition: oxr_objects.h:1339
XrResult oxr_session_frame_begin(struct oxr_logger *log, struct oxr_session *sess)
Definition: oxr_session.c:407
struct oxr_handle_base * children[XRT_MAX_HANDLE_CHILDREN]
Array of children, if any.
Definition: oxr_objects.h:839
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
uint32_t num_blend_modes
Definition: oxr_objects.h:879
struct xrt_device * right
Definition: oxr_objects.h:868
struct oxr_source_set * next
Next source set on this session.
Definition: oxr_objects.h:1100
A group of actions.
Definition: oxr_objects.h:1272
enum xrt_input_name * inputs
Definition: oxr_objects.h:1063
struct oxr_instance * inst
Onwer of this messenger.
Definition: oxr_objects.h:1327
XrResult oxr_create_messenger(struct oxr_logger *, struct oxr_instance *inst, const XrDebugUtilsMessengerCreateInfoEXT *, struct oxr_debug_messenger **out_mssngr)
Definition: oxr_messenger.c:42
bool debug_bindings
Definition: oxr_objects.h:956
XrResult oxr_handle_destroy(struct oxr_logger *log, struct oxr_handle_base *hb)
Destroy the handle&#39;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:1287
XrPath google_daydream_controller
Definition: oxr_objects.h:939
XrPath microsoft_xbox_controller
Definition: oxr_objects.h:943
XrResult oxr_swapchain_gl_create(struct oxr_logger *, struct oxr_session *sess, const XrSwapchainCreateInfo *, struct oxr_swapchain **out_swapchain)
Definition: oxr_swapchain_gl.c:80
Header defining a xrt HMD device.
bool boolean
Definition: oxr_objects.h:1122
size_t num_outputs
Definition: oxr_objects.h:1171
A relation with two spaces, includes velocity and acceleration.
Definition: xrt_defines.h:336
XrPath oculus_touch_controller
Definition: oxr_objects.h:945
Macros for generating extension-related tables and code and inspecting Monado&#39;s extension support...
struct oxr_session * sessions
Definition: oxr_objects.h:928
bool changed
Definition: oxr_objects.h:1128
A set of images used for rendering.
Definition: oxr_objects.h:1231
bool user
Definition: oxr_objects.h:1076
XrResult oxr_space_action_create(struct oxr_logger *log, struct oxr_session *sess, uint64_t key, const XrActionSpaceCreateInfo *createInfo, struct oxr_space **out_space)
Definition: oxr_space.c:54
int released_index
Definition: oxr_objects.h:1244
Hashset struct header.
char name[XR_MAX_ACTION_SET_NAME_SIZE]
Application supplied name of this action.
Definition: oxr_objects.h:1281
State after successful oxr_handle_destroy.
Definition: oxr_objects.h:106
Logger struct that lives on the stack, one for each call client call.
Definition: oxr_logger.h:36
XrPath head
Definition: oxr_objects.h:933
State during/before oxr_handle_init, or after failure.
Definition: oxr_objects.h:100
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:1284
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
XrResult oxr_system_fill_in(struct oxr_logger *log, struct oxr_instance *inst, XrSystemId systemId, struct oxr_system *sys, struct xrt_device **xdevs, size_t num_xdevs)
Definition: oxr_system.c:105
XrResult(* release_image)(struct oxr_logger *, struct oxr_swapchain *, const XrSwapchainImageReleaseInfo *)
Definition: oxr_objects.h:1262
uint64_t debug
Magic (per-handle-type) value for debugging.
Definition: oxr_objects.h:829
uint32_t time
Definition: vive_protocol.h:211
uint32_t key
Unique key for the session hashmap.
Definition: oxr_objects.h:1307
XrResult oxr_space_reference_create(struct oxr_logger *log, struct oxr_session *sess, const XrReferenceSpaceCreateInfo *createInfo, struct oxr_space **out_space)
Definition: oxr_space.c:82
size_t num_xdevs
Definition: oxr_objects.h:872
XrResult oxr_instance_create(struct oxr_logger *log, const XrInstanceCreateInfo *createInfo, struct oxr_instance **out_inst)
Definition: oxr_instance.c:99
#define MAKE_EXT_STATUS(mixed_case, all_caps)
Definition: oxr_objects.h:883
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:97
bool left
Definition: oxr_objects.h:1078
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
size_t num_keys
Definition: oxr_objects.h:1061
XrDebugUtilsMessageSeverityFlagsEXT message_severities
Severities to submit to this messenger.
Definition: oxr_objects.h:1330
bool head
Definition: oxr_objects.h:1077
xrt_output_name
Name of a output with a baked in type.
Definition: xrt_defines.h:532
XrResult oxr_instance_convert_timespec_to_time(struct oxr_logger *log, struct oxr_instance *inst, const struct timespec *timespecTime, XrTime *time)
Definition: oxr_instance.c:276
To carry around a sementic selection of sub action paths.
Definition: oxr_objects.h:1073
struct xrt_input * input
Definition: oxr_objects.h:1143
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:287
Definition: oxr_objects.h:114
XrReferenceSpaceType type
What kind of reference space is this, if any.
Definition: oxr_objects.h:1214
Common swapchain base.
Definition: xrt_compositor.h:75
struct oxr_session * sess
Onwer of this space.
Definition: oxr_objects.h:1208
struct oxr_instance * inst
Definition: oxr_objects.h:861
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_session_create(struct oxr_logger *log, struct oxr_system *sys, const XrSessionCreateInfo *createInfo, struct oxr_session **out_session)
Definition: oxr_session.c:667
XrResult oxr_session_enumerate_formats(struct oxr_logger *log, struct oxr_session *sess, uint32_t formatCapacityInput, uint32_t *formatCountOutput, int64_t *formats)
Definition: oxr_session.c:70
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
XrResult oxr_vk_get_requirements(struct oxr_logger *log, struct oxr_system *sys, XrGraphicsRequirementsVulkanKHR *graphicsRequirements)
Definition: oxr_vulkan.c:54
The state of a action input source.
Definition: oxr_objects.h:1108
XrResult oxr_vk_get_device_exts(struct oxr_logger *log, struct oxr_system *sys, uint32_t namesCapacityInput, uint32_t *namesCountOutput, char *namesString)
Definition: oxr_vulkan.c:40
Definition: oxr_objects.h:115
XrResult oxr_action_apply_haptic_feedback(struct oxr_logger *log, struct oxr_session *sess, uint64_t key, struct oxr_sub_paths sub_paths, const XrHapticBaseHeader *hapticEvent)
Definition: oxr_input.c:1205
size_t num_bindings
Definition: oxr_objects.h:1047
XrResult oxr_destroy_messenger(struct oxr_logger *log, struct oxr_debug_messenger *mssngr)
float y
Definition: oxr_objects.h:1119
XrPath khr_simple_controller
Definition: oxr_objects.h:938
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:984
XrPath left
Currently bound interaction profile.
Definition: oxr_objects.h:990
struct xrt_swapchain * swapchain
Compositor swapchain.
Definition: oxr_objects.h:1240
size_t num_profiles
Definition: oxr_objects.h:926
void oxr_xdev_get_pose_at(struct oxr_logger *log, struct oxr_instance *inst, struct xrt_device *xdev, enum xrt_input_name name, XrTime at_time, uint64_t *out_pose_timestamp_ns, struct xrt_pose *out_pose)
Returns the pose of the named input from the device, if the pose isn&#39;t valid uses the device offset i...
Definition: oxr_xdev.c:139
XrSessionState state
Definition: oxr_objects.h:973
XrTime timestamp
When was this last changed.
Definition: oxr_objects.h:1131
XrResult oxr_vk_get_instance_exts(struct oxr_logger *log, struct oxr_system *sys, uint32_t namesCapacityInput, uint32_t *namesCountOutput, char *namesString)
Definition: oxr_vulkan.c:26
struct u_hashmap_int * act_sets
Definition: oxr_objects.h:977
struct oxr_source_set * src_set_list
List of created source sets.
Definition: oxr_objects.h:981
XrResult oxr_poll_event(struct oxr_logger *log, struct oxr_instance *inst, XrEventDataBuffer *eventData)
Definition: oxr_event.c:137
XrPath right
Definition: oxr_objects.h:935
struct oxr_session * sess
Onwer of this swapchain.
Definition: oxr_objects.h:1237
bool frame_started
Definition: oxr_objects.h:974
XrResult oxr_session_attach_action_sets(struct oxr_logger *log, struct oxr_session *sess, const XrSessionActionSetsAttachInfo *bindInfo)
Definition: oxr_input.c:877
size_t num_inputs
Definition: oxr_objects.h:1167
int acquired_index
Actual state tracked! :D.
Definition: oxr_objects.h:1243
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:169
A single action.
Definition: oxr_objects.h:1295
bool active
Definition: oxr_objects.h:1125
XrResult oxr_system_select(struct oxr_logger *log, struct oxr_system **systems, uint32_t num_systems, XrFormFactor form_factor, struct oxr_system **out_selected)
Definition: oxr_system.c:42
float x
Definition: oxr_objects.h:1113
bool debug_views
Definition: oxr_objects.h:954
XrResult oxr_session_end(struct oxr_logger *log, struct oxr_session *sess)
Definition: oxr_session.c:127
XrResult oxr_action_get_boolean(struct oxr_logger *log, struct oxr_session *sess, uint64_t key, struct oxr_sub_paths sub_paths, XrActionStateBoolean *data)
Definition: oxr_input.c:1070
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
XrResult(* acquire_image)(struct oxr_logger *, struct oxr_swapchain *, const XrSwapchainImageAcquireInfo *, uint32_t *)
Definition: oxr_objects.h:1253
Definition: oxr_objects.h:117
oxr_sub_action_path
Sub action paths.
Definition: oxr_objects.h:112
Definition: oxr_objects.h:116
XrResult oxr_session_frame_wait(struct oxr_logger *log, struct oxr_session *sess, XrFrameState *frameState)
Definition: oxr_session.c:374
XrResult oxr_session_request_exit(struct oxr_logger *log, struct oxr_session *sess)
Definition: oxr_session.c:159
struct oxr_handle_base * parent
Pointer to this object&#39;s parent handle holder, if any.
Definition: oxr_objects.h:834
Definition: oxr_event.c:21
XrPath * paths
Definition: oxr_objects.h:1055
XrPath oculus_go_controller
Definition: oxr_objects.h:944
#define XRT_MAX_HANDLE_CHILDREN
Definition: oxr_objects.h:86
XrResult oxr_system_get_view_conf_properties(struct oxr_logger *log, struct oxr_system *sys, XrViewConfigurationType viewConfigurationType, XrViewConfigurationProperties *configurationProperties)
Definition: oxr_system.c:261
XrPath head
Definition: oxr_objects.h:992
bool debug_spaces
Definition: oxr_objects.h:955
XrResult oxr_system_verify_id(struct oxr_logger *log, const struct oxr_instance *inst, XrSystemId systemId)
Definition: oxr_system.c:76
struct oxr_session * sess
Owning session.
Definition: oxr_objects.h:1094
XrResult oxr_event_push_XrEventDataSessionStateChanged(struct oxr_logger *log, struct oxr_session *sess, XrSessionState state, XrTime time)
Definition: oxr_event.c:109
struct oxr_source_output * outputs
Definition: oxr_objects.h:1172
void oxr_xdev_destroy(struct xrt_device **xdev_ptr)
Definition: oxr_xdev.c:21
Session input source.
Definition: oxr_objects.h:1180
void * oxr_path_get_attached(struct oxr_logger *log, struct oxr_instance *inst, XrPath path)
Definition: oxr_path.c:129
enum xrt_output_name * outputs
Definition: oxr_objects.h:1066
float static_prediction_s
Definition: oxr_objects.h:1003
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:859
Structure tracking which extensions are enabled for a given instance.
Definition: oxr_objects.h:889
struct u_hashmap_int * sources
Definition: oxr_objects.h:978
Definition: xrt_device.h:192
Include all of the openxr headers in one place.
Used to hold diverse child handles and ensure orderly destruction.
Definition: oxr_objects.h:826
void * hack
Definition: oxr_objects.h:905
struct oxr_event * next_event
Definition: oxr_objects.h:923
Main object that ties everything together.
Definition: oxr_objects.h:899
struct oxr_event * last_event
Definition: oxr_objects.h:922
size_t num_outputs
Definition: oxr_objects.h:1067
A single named input, that sits on a xrt_device.
Definition: xrt_device.h:180
XrResult oxr_action_get_vector2f(struct oxr_logger *log, struct oxr_session *sess, uint64_t key, struct oxr_sub_paths sub_paths, XrActionStateVector2f *data)
Definition: oxr_input.c:1116
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:42
void oxr_xdev_get_relation_at(struct oxr_logger *log, struct oxr_instance *inst, struct xrt_device *xdev, enum xrt_input_name name, XrTime at_time, uint64_t *out_relation_timestamp_ns, struct xrt_space_relation *out_relation)
Returns the relation of the named input from the device, always ensures that position and orientation...
Definition: oxr_xdev.c:104
XrResult oxr_action_stop_haptic_feedback(struct oxr_logger *log, struct oxr_session *sess, uint64_t key, struct oxr_sub_paths sub_paths)
Definition: oxr_input.c:1246
XrResult oxr_session_populate_vk(struct oxr_logger *log, struct oxr_system *sys, XrGraphicsBindingVulkanKHR const *next, struct oxr_session *sess)
Definition: oxr_session_vk.c:25
XrDebugUtilsMessageTypeFlagsEXT message_types
Types to submit to this messenger.
Definition: oxr_objects.h:1333
Debug object created by the client program.
Definition: oxr_objects.h:1321
struct u_hashset * path_store
Path store, for looking up paths.
Definition: oxr_objects.h:919
XrResult(* oxr_handle_destroyer)(struct oxr_logger *log, struct oxr_handle_base *hb)
Definition: oxr_objects.h:90
XrResult oxr_system_enumerate_view_conf_views(struct oxr_logger *log, struct oxr_system *sys, XrViewConfigurationType viewConfigurationType, uint32_t viewCapacityInput, uint32_t *viewCountOutput, XrViewConfigurationView *views)
Definition: oxr_system.c:296
This object acts as a root object for Monado, it either wraps a xrt_prober or forms a connection to a...
Definition: xrt_instance.h:34
XrResult oxr_action_get_vector1f(struct oxr_logger *log, struct oxr_session *sess, uint64_t key, struct oxr_sub_paths sub_paths, XrActionStateFloat *data)
Definition: oxr_input.c:1093
bool any
Definition: oxr_objects.h:1075
struct oxr_action_set * act_set
Onwer of this messenger.
Definition: oxr_objects.h:1301
uint32_t * keys
Definition: oxr_objects.h:1060
A single interaction profile.
Definition: oxr_objects.h:1043
XrPath user
Definition: oxr_objects.h:932
PFN_xrDebugUtilsMessengerCallbackEXT user_callback
Callback function.
Definition: oxr_objects.h:1336
bool is_reference
Is this a reference space?
Definition: oxr_objects.h:1220
struct oxr_binding * bindings
Definition: oxr_objects.h:1046
struct xrt_device * xdev
Definition: oxr_objects.h:1142
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:447
size_t num_paths
Definition: oxr_objects.h:1056
A single HMD or input device.
Definition: xrt_device.h:202
XrResult oxr_system_get_properties(struct oxr_logger *log, struct oxr_system *sys, XrSystemProperties *properties)
Definition: oxr_system.c:208
XrResult oxr_vk_get_physical_device(struct oxr_logger *log, struct oxr_instance *inst, struct oxr_system *sys, VkInstance vkInstance, PFN_vkGetInstanceProcAddr getProc, VkPhysicalDevice *vkPhysicalDevice)
Definition: oxr_vulkan.c:70
XrActionType action_type
Type the action this source was created from is.
Definition: oxr_objects.h:1186
oxr_handle_destroyer destroy
Destroy the object this handle refers to.
Definition: oxr_objects.h:849
struct oxr_interaction_profile ** profiles
Definition: oxr_objects.h:925
#define OXR_EXTENSION_SUPPORT_GENERATE(_)
Call this, passing a macro taking two parameters, to generate tables, code, etc.
Definition: oxr_extension_support.h:127
bool right
Definition: oxr_objects.h:1079
struct oxr_source_input * inputs
Definition: oxr_objects.h:1168
int64_t stop_output_time
Definition: oxr_objects.h:1170
XrPath right
Definition: oxr_objects.h:991
XrResult oxr_system_get_by_id(struct oxr_logger *log, struct oxr_instance *inst, XrSystemId systemId, struct oxr_system **system)
Definition: oxr_system.c:88
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:421
A input source pair of a xrt_input and a xrt_device.
Definition: oxr_objects.h:1140
enum oxr_handle_state state
Current handle state.
Definition: oxr_objects.h:844
XrPath valve_index_controller
Definition: oxr_objects.h:946
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:308
XrResult oxr_action_get_pose(struct oxr_logger *log, struct oxr_session *sess, uint64_t key, struct oxr_sub_paths sub_paths, XrActionStatePose *data)
Definition: oxr_input.c:1139
struct oxr_instance * inst
Onwer of this messenger.
Definition: oxr_objects.h:1278
struct time_state * timekeeping
Definition: oxr_objects.h:916
Definition: oxr_objects.h:118
XrPath microsoft_motion_controller
Definition: oxr_objects.h:942
XrPath mnd_ball_on_stick_controller
Definition: oxr_objects.h:947
XrResult(* enumerate_images)(struct oxr_logger *, struct oxr_swapchain *, uint32_t, XrSwapchainImageBaseHeader *)
Definition: oxr_objects.h:1248
XrSystemId systemId
Definition: oxr_objects.h:874
XrActionType action_type
Type this action was created with.
Definition: oxr_objects.h:1310
Interaction profile binding state.
Definition: oxr_objects.h:1053
A set of inputs for a single sub action path.
Definition: oxr_objects.h:1163
void oxr_session_poll(struct oxr_session *sess)
Definition: oxr_session.c:179