Monado OpenXR Runtime
oxr_objects.h
Go to the documentation of this file.
1// Copyright 2018-2024, Collabora, Ltd.
2// Copyright 2023, NVIDIA CORPORATION.
3// SPDX-License-Identifier: BSL-1.0
4/*!
5 * @file
6 * @brief The objects representing OpenXR handles, and prototypes for internal functions used in the state tracker.
7 * @author Jakob Bornecrantz <jakob@collabora.com>
8 * @author Korcan Hussein <korcan.hussein@collabora.com>
9 * @ingroup oxr_main
10 */
11
12#pragma once
13
14#include "xrt/xrt_space.h"
15#include "xrt/xrt_limits.h"
16#include "xrt/xrt_system.h"
17#include "xrt/xrt_future.h"
18#include "xrt/xrt_device.h"
19#include "xrt/xrt_tracking.h"
20#include "xrt/xrt_compositor.h"
23#include "xrt/xrt_config_os.h"
24#include "xrt/xrt_config_have.h"
25
26#include "os/os_threading.h"
27
28#include "util/u_index_fifo.h"
29#include "util/u_hashset.h"
30#include "util/u_hashmap.h"
31#include "util/u_device.h"
32
34#include "oxr_subaction.h"
35#include "oxr_defines.h"
36#include "oxr_frame_sync.h"
37
38#if defined(XRT_HAVE_D3D11) || defined(XRT_HAVE_D3D12)
39#include <dxgi.h>
40#include <d3dcommon.h>
41#endif
42
43#ifdef XRT_FEATURE_RENDERDOC
44#include "renderdoc_app.h"
45#ifndef XRT_OS_WINDOWS
46#include <dlfcn.h>
47#endif // !XRT_OS_WINDOWS
48#endif // XRT_FEATURE_RENDERDOC
49
50#ifdef XRT_OS_ANDROID
51#include "xrt/xrt_android.h"
52#endif // #ifdef XRT_OS_ANDROID
53
54#ifdef __cplusplus
55extern "C" {
56#endif
57
58
59/*!
60 * @defgroup oxr OpenXR state tracker
61 *
62 * Client application facing code.
63 *
64 * @ingroup xrt
65 */
66
67/*!
68 * @brief Cast a pointer to an OpenXR handle in such a way as to avoid warnings.
69 *
70 * Avoids -Wpointer-to-int-cast by first casting to the same size int, then
71 * promoting to the 64-bit int, then casting to the handle type. That's a lot of
72 * no-ops on 64-bit, but a widening conversion on 32-bit.
73 *
74 * @ingroup oxr
75 */
76#define XRT_CAST_PTR_TO_OXR_HANDLE(HANDLE_TYPE, PTR) ((HANDLE_TYPE)(uint64_t)(uintptr_t)(PTR))
77
78/*!
79 * @brief Cast an OpenXR handle to a pointer in such a way as to avoid warnings.
80 *
81 * Avoids -Wint-to-pointer-cast by first casting to a 64-bit int, then to a
82 * pointer-sized int, then to the desired pointer type. That's a lot of no-ops
83 * on 64-bit, but a narrowing (!) conversion on 32-bit.
84 *
85 * @ingroup oxr
86 */
87#define XRT_CAST_OXR_HANDLE_TO_PTR(PTR_TYPE, HANDLE) ((PTR_TYPE)(uintptr_t)(uint64_t)(HANDLE))
88
89/*!
90 * @defgroup oxr_main OpenXR main code
91 *
92 * Gets called from @ref oxr_api functions and talks to devices and
93 * @ref comp using @ref xrt_iface.
94 *
95 * @ingroup oxr
96 * @{
97 */
98
99
100/*
101 *
102 * Forward declare structs.
103 *
104 */
105
106struct xrt_instance;
107struct oxr_logger;
109struct oxr_instance;
110struct oxr_system;
111struct oxr_session;
112struct oxr_event;
113struct oxr_swapchain;
114struct oxr_space;
115struct oxr_action_set;
116struct oxr_action;
118struct oxr_handle_base;
122struct oxr_action_input;
123struct oxr_action_output;
124struct oxr_dpad_state;
125struct oxr_binding;
127struct oxr_action_set_ref;
128struct oxr_action_ref;
129struct oxr_hand_tracker;
130struct oxr_facial_tracker_htc;
131struct oxr_face_tracker2_fb;
132struct oxr_body_tracker_fb;
133struct oxr_xdev_list;
134struct oxr_plane_detector_ext;
135
136#define XRT_MAX_HANDLE_CHILDREN 256
137#define OXR_MAX_BINDINGS_PER_ACTION 32
138
139struct time_state;
140
141/*!
142 * Function pointer type for a handle destruction function.
143 *
144 * @relates oxr_handle_base
145 */
146typedef XrResult (*oxr_handle_destroyer)(struct oxr_logger *log, struct oxr_handle_base *hb);
147
148
149
150/*
151 *
152 * Helpers
153 *
154 */
155
156/*!
157 * Safely copy an xrt_pose to an XrPosef.
158 */
159#define OXR_XRT_POSE_TO_XRPOSEF(FROM, TO) \
160 do { \
161 union { \
162 struct xrt_pose xrt; \
163 XrPosef oxr; \
164 } safe_copy = {FROM}; \
165 TO = safe_copy.oxr; \
166 } while (false)
167
168/*!
169 * Safely copy an xrt_fov to an XrFovf.
170 */
171#define OXR_XRT_FOV_TO_XRFOVF(FROM, TO) \
172 do { \
173 union { \
174 struct xrt_fov xrt; \
175 XrFovf oxr; \
176 } safe_copy = {FROM}; \
177 TO = safe_copy.oxr; \
178 } while (false)
179
180
181static inline const char *
182xr_action_type_to_str(XrActionType type)
183{
184 // clang-format off
185 switch (type) {
186 #define PRINT(name, value) \
187 case name: return #name;
188 XR_LIST_ENUM_XrActionType(PRINT)
189 #undef PRINT
190 default: return "XR_ACTION_TYPE_UNKNOWN";
191 }
192 // clang-format on
193}
194
195/*
196 *
197 * oxr_handle_base.c
198 *
199 */
200
201/*!
202 * Destroy the handle's object, as well as all child handles recursively.
203 *
204 * This should be how all handle-associated objects are destroyed.
205 *
206 * @public @memberof oxr_handle_base
207 */
208XrResult
209oxr_handle_destroy(struct oxr_logger *log, struct oxr_handle_base *hb);
210
211/*!
212 * Returns a human-readable label for a handle state.
213 *
214 * @relates oxr_handle_base
215 */
216const char *
218
219/*!
220 *
221 * @name oxr_instance.c
222 * @{
223 *
224 */
225
226/*!
227 * To go back to a OpenXR object.
228 *
229 * @relates oxr_instance
230 */
231static inline XrInstance
233{
234 return XRT_CAST_PTR_TO_OXR_HANDLE(XrInstance, inst);
235}
236
237/*!
238 * Creates a instance, does minimal validation of @p createInfo.
239 *
240 * @param[in] log Logger
241 * @param[in] createInfo OpenXR creation info.
242 * @param[in] extensions Parsed extension list to be enabled.
243 * @param[out] out_inst Pointer to pointer to a instance, returned instance.
244 *
245 * @public @static @memberof oxr_instance
246 */
247XrResult
249 const XrInstanceCreateInfo *createInfo,
250 XrVersion major_minor,
251 const struct oxr_extension_status *extensions,
252 struct oxr_instance **out_inst);
253
254/*!
255 * @public @memberof oxr_instance
256 */
257XrResult
258oxr_instance_get_properties(struct oxr_logger *log,
259 struct oxr_instance *inst,
260 XrInstanceProperties *instanceProperties);
261
262#if XR_USE_TIMESPEC
263
264/*!
265 * @public @memberof oxr_instance
266 */
267XrResult
268oxr_instance_convert_time_to_timespec(struct oxr_logger *log,
269 struct oxr_instance *inst,
270 XrTime time,
271 struct timespec *timespecTime);
272
273/*!
274 * @public @memberof oxr_instance
275 */
276XrResult
277oxr_instance_convert_timespec_to_time(struct oxr_logger *log,
278 struct oxr_instance *inst,
279 const struct timespec *timespecTime,
280 XrTime *time);
281#endif // XR_USE_TIMESPEC
282
283#ifdef XR_USE_PLATFORM_WIN32
284
285/*!
286 * @public @memberof oxr_instance
287 */
288XrResult
289oxr_instance_convert_time_to_win32perfcounter(struct oxr_logger *log,
290 struct oxr_instance *inst,
291 XrTime time,
292 LARGE_INTEGER *win32perfcounterTime);
293
294/*!
295 * @public @memberof oxr_instance
296 */
297XrResult
298oxr_instance_convert_win32perfcounter_to_time(struct oxr_logger *log,
299 struct oxr_instance *inst,
300 const LARGE_INTEGER *win32perfcounterTime,
301 XrTime *time);
302
303#endif // XR_USE_PLATFORM_WIN32
304
305/*!
306 * @}
307 */
308
309/*!
310 *
311 * @name oxr_path.c
312 * @{
313 *
314 */
315
316/*!
317 * Initialize the path system.
318 * @private @memberof oxr_instance
319 */
320XrResult
321oxr_path_init(struct oxr_logger *log, struct oxr_instance *inst);
322
323/*!
324 * @public @memberof oxr_instance
325 */
326bool
327oxr_path_is_valid(struct oxr_logger *log, struct oxr_instance *inst, XrPath path);
328
329/*!
330 * @public @memberof oxr_instance
331 */
332void *
333oxr_path_get_attached(struct oxr_logger *log, struct oxr_instance *inst, XrPath path);
334
335/*!
336 * Get the path for the given string if it exists, or create it if it does not.
337 *
338 * @public @memberof oxr_instance
339 */
340XrResult
342 struct oxr_logger *log, struct oxr_instance *inst, const char *str, size_t length, XrPath *out_path);
343
344/*!
345 * Only get the path for the given string if it exists.
346 *
347 * @public @memberof oxr_instance
348 */
349XrResult
350oxr_path_only_get(struct oxr_logger *log, struct oxr_instance *inst, const char *str, size_t length, XrPath *out_path);
351
352/*!
353 * Get a pointer and length of the internal string.
354 *
355 * The pointer has the same life time as the instance. The length is the number
356 * of valid characters, not including the null termination character (but an
357 * extra null byte is always reserved at the end so can strings can be given
358 * to functions expecting null terminated strings).
359 *
360 * @public @memberof oxr_instance
361 */
362XrResult
364 struct oxr_logger *log, const struct oxr_instance *inst, XrPath path, const char **out_str, size_t *out_length);
365
366/*!
367 * Destroy the path system and all paths that the instance has created.
368 *
369 * @private @memberof oxr_instance
370 */
371void
372oxr_path_destroy(struct oxr_logger *log, struct oxr_instance *inst);
373
374/*!
375 * @}
376 */
377
378/*!
379 * To go back to a OpenXR object.
380 *
381 * @relates oxr_action_set
382 */
383static inline XrActionSet
385{
386 return XRT_CAST_PTR_TO_OXR_HANDLE(XrActionSet, act_set);
387}
388
389/*!
390 * To go back to a OpenXR object.
391 *
392 * @relates oxr_hand_tracker
393 */
394static inline XrHandTrackerEXT
396{
397 return XRT_CAST_PTR_TO_OXR_HANDLE(XrHandTrackerEXT, hand_tracker);
398}
399
400#ifdef OXR_HAVE_EXT_plane_detection
401/*!
402 * To go back to a OpenXR object.
403 *
404 * @relates oxr_plane_detector
405 */
406static inline XrPlaneDetectorEXT
407oxr_plane_detector_to_openxr(struct oxr_plane_detector_ext *plane_detector)
408{
409 return XRT_CAST_PTR_TO_OXR_HANDLE(XrPlaneDetectorEXT, plane_detector);
410}
411#endif // OXR_HAVE_EXT_plane_detection
412
413/*!
414 * To go back to a OpenXR object.
415 *
416 * @relates oxr_action
417 */
418static inline XrAction
420{
421 return XRT_CAST_PTR_TO_OXR_HANDLE(XrAction, act);
422}
423
424#ifdef OXR_HAVE_HTC_facial_tracking
425/*!
426 * To go back to a OpenXR object.
427 *
428 * @relates oxr_facial_tracker_htc
429 */
430static inline XrFacialTrackerHTC
431oxr_facial_tracker_htc_to_openxr(struct oxr_facial_tracker_htc *face_tracker_htc)
432{
433 return XRT_CAST_PTR_TO_OXR_HANDLE(XrFacialTrackerHTC, face_tracker_htc);
434}
435#endif
436
437#ifdef OXR_HAVE_FB_body_tracking
438/*!
439 * To go back to a OpenXR object.
440 *
441 * @relates oxr_facial_tracker_htc
442 */
443static inline XrBodyTrackerFB
444oxr_body_tracker_fb_to_openxr(struct oxr_body_tracker_fb *body_tracker_fb)
445{
446 return XRT_CAST_PTR_TO_OXR_HANDLE(XrBodyTrackerFB, body_tracker_fb);
447}
448#endif
449
450#ifdef OXR_HAVE_FB_face_tracking2
451/*!
452 * To go back to a OpenXR object.
453 *
454 * @relates oxr_face_tracker2_fb
455 */
456static inline XrFaceTracker2FB
457oxr_face_tracker2_fb_to_openxr(struct oxr_face_tracker2_fb *face_tracker2_fb)
458{
459 return XRT_CAST_PTR_TO_OXR_HANDLE(XrFaceTracker2FB, face_tracker2_fb);
460}
461#endif
462/*!
463 *
464 * @name oxr_input.c
465 * @{
466 *
467 */
468
469/*!
470 * Helper function to classify subaction_paths.
471 *
472 * Sets all members of @p subaction_paths ( @ref oxr_subaction_paths ) as
473 * appropriate based on the subaction paths found in the list.
474 *
475 * If no paths are provided, @p subaction_paths->any will be true.
476 *
477 * @return false if an invalid subaction path is provided.
478 *
479 * @public @memberof oxr_instance
480 * @see oxr_subaction_paths
481 */
482bool
484 const struct oxr_instance *inst,
485 uint32_t subaction_path_count,
486 const XrPath *subaction_paths,
487 struct oxr_subaction_paths *subaction_paths_out);
488
489/*!
490 * Find the pose input for the set of subaction_paths
491 *
492 * @public @memberof oxr_session
493 */
494XrResult
496 uint32_t act_key,
497 const struct oxr_subaction_paths *subaction_paths_ptr,
498 struct oxr_action_input **out_input);
499
500/*!
501 * @public @memberof oxr_instance
502 */
503XrResult
504oxr_action_set_create(struct oxr_logger *log,
505 struct oxr_instance *inst,
506 const XrActionSetCreateInfo *createInfo,
507 struct oxr_action_set **out_act_set);
508
509/*!
510 * @public @memberof oxr_action
511 */
512XrResult
513oxr_action_create(struct oxr_logger *log,
514 struct oxr_action_set *act_set,
515 const XrActionCreateInfo *createInfo,
516 struct oxr_action **out_act);
517
518/*!
519 * @public @memberof oxr_session
520 * @see oxr_action_set
521 */
522XrResult
524 struct oxr_session *sess,
525 const XrSessionActionSetsAttachInfo *bindInfo);
526
527
528XrResult
529oxr_session_update_action_bindings(struct oxr_logger *log, struct oxr_session *sess);
530
531/*!
532 * Given an action act_key, look up the @ref oxr_action_attachment of
533 * the associated action in the given Session.
534 *
535 * @private @memberof oxr_session
536 */
537void
538oxr_session_get_action_attachment(struct oxr_session *sess,
539 uint32_t act_key,
540 struct oxr_action_attachment **out_act_attached);
541
542/*!
543 * @public @memberof oxr_session
544 */
545XrResult
547 struct oxr_session *sess,
548 uint32_t countActionSets,
549 const XrActiveActionSet *actionSets,
550 const XrActiveActionSetPrioritiesEXT *activePriorities);
551
552/*!
553 * @public @memberof oxr_session
554 */
555XrResult
556oxr_action_enumerate_bound_sources(struct oxr_logger *log,
557 struct oxr_session *sess,
558 uint32_t act_key,
559 uint32_t sourceCapacityInput,
560 uint32_t *sourceCountOutput,
561 XrPath *sources);
562
563/*!
564 * @public @memberof oxr_session
565 */
566XrResult
567oxr_action_get_boolean(struct oxr_logger *log,
568 struct oxr_session *sess,
569 uint32_t act_key,
570 struct oxr_subaction_paths subaction_paths,
571 XrActionStateBoolean *data);
572
573/*!
574 * @public @memberof oxr_session
575 */
576XrResult
577oxr_action_get_vector1f(struct oxr_logger *log,
578 struct oxr_session *sess,
579 uint32_t act_key,
580 struct oxr_subaction_paths subaction_paths,
581 XrActionStateFloat *data);
582
583/*!
584 * @public @memberof oxr_session
585 */
586XrResult
587oxr_action_get_vector2f(struct oxr_logger *log,
588 struct oxr_session *sess,
589 uint32_t act_key,
590 struct oxr_subaction_paths subaction_paths,
591 XrActionStateVector2f *data);
592/*!
593 * @public @memberof oxr_session
594 */
595XrResult
596oxr_action_get_pose(struct oxr_logger *log,
597 struct oxr_session *sess,
598 uint32_t act_key,
599 struct oxr_subaction_paths subaction_paths,
600 XrActionStatePose *data);
601/*!
602 * @public @memberof oxr_session
603 */
604XrResult
605oxr_action_apply_haptic_feedback(struct oxr_logger *log,
606 struct oxr_session *sess,
607 uint32_t act_key,
608 struct oxr_subaction_paths subaction_paths,
609 const XrHapticBaseHeader *hapticEvent);
610/*!
611 * @public @memberof oxr_session
612 */
613XrResult
614oxr_action_stop_haptic_feedback(struct oxr_logger *log,
615 struct oxr_session *sess,
616 uint32_t act_key,
617 struct oxr_subaction_paths subaction_paths);
618
619/*!
620 * @public @memberof oxr_instance
621 */
622XrResult
623oxr_hand_tracker_create(struct oxr_logger *log,
624 struct oxr_session *sess,
625 const XrHandTrackerCreateInfoEXT *createInfo,
626 struct oxr_hand_tracker **out_hand_tracker);
627
628/*!
629 * @}
630 */
631
632/*!
633 *
634 * @name oxr_binding.c
635 * @{
636 *
637 */
638
639/*!
640 * Find the best matching profile for the given @ref xrt_device.
641 *
642 * @param log Logger.
643 * @param sess Session.
644 * @param xdev Can be null.
645 * @param[out] out_p Returned interaction profile.
646 *
647 * @public @memberof oxr_session
648 */
649void
651 struct oxr_session *sess,
652 struct xrt_device *xdev,
653 struct oxr_interaction_profile **out_p);
654
655bool
656oxr_get_profile_for_device_name(struct oxr_logger *log,
657 struct oxr_session *sess,
658 enum xrt_device_name name,
659 struct oxr_interaction_profile **out_p);
660
662oxr_clone_profile(const struct oxr_interaction_profile *src_profile);
663
664/*!
665 * Free all memory allocated by the binding system.
666 *
667 * @public @memberof oxr_instance
668 */
669void
670oxr_binding_destroy_all(struct oxr_logger *log, struct oxr_instance *inst);
671
672/*!
673 * Free all memory allocated by the binding system.
674 *
675 * @public @memberof oxr_instance
676 */
677void
679
680/*!
681 * Find all bindings that is the given action key is bound to.
682 * @public @memberof oxr_interaction_profile
683 */
684void
686 struct oxr_interaction_profile *profile,
687 uint32_t key,
688 size_t max_binding_count,
689 struct oxr_binding **out_bindings,
690 size_t *out_binding_count);
691
692/*!
693 * @public @memberof oxr_instance
694 */
695XrResult
696oxr_action_suggest_interaction_profile_bindings(struct oxr_logger *log,
697 struct oxr_instance *inst,
698 const XrInteractionProfileSuggestedBinding *suggestedBindings,
699 struct oxr_dpad_state *state);
700
701/*!
702 * @public @memberof oxr_instance
703 */
704XrResult
705oxr_action_get_current_interaction_profile(struct oxr_logger *log,
706 struct oxr_session *sess,
707 XrPath topLevelUserPath,
708 XrInteractionProfileState *interactionProfile);
709
710/*!
711 * @public @memberof oxr_session
712 */
713XrResult
715 struct oxr_session *sess,
716 const XrInputSourceLocalizedNameGetInfo *getInfo,
717 uint32_t bufferCapacityInput,
718 uint32_t *bufferCountOutput,
719 char *buffer);
720
721/*!
722 * @}
723 */
724
725
726/*!
727 *
728 * @name oxr_dpad.c
729 * @{
730 *
731 */
732
733/*!
734 * Initialises a dpad state, has to be zero init before a call to this function.
735 *
736 * @public @memberof oxr_dpad_state_get
737 */
738bool
739oxr_dpad_state_init(struct oxr_dpad_state *state);
740
741/*!
742 * Look for a entry in the state for the given action set key,
743 * returns NULL if no entry has been made for that action set.
744 *
745 * @public @memberof oxr_dpad_state_get
746 */
747struct oxr_dpad_entry *
748oxr_dpad_state_get(struct oxr_dpad_state *state, uint64_t key);
749
750/*!
751 * Look for a entry in the state for the given action set key,
752 * allocates a new entry if none was found.
753 *
754 * @public @memberof oxr_dpad_state_get
755 */
756struct oxr_dpad_entry *
757oxr_dpad_state_get_or_add(struct oxr_dpad_state *state, uint64_t key);
758
759/*!
760 * Frees all state and entries attached to this dpad state.
761 *
762 * @public @memberof oxr_dpad_state_get
763 */
764void
765oxr_dpad_state_deinit(struct oxr_dpad_state *state);
766
767/*!
768 * Clones all oxr_dpad_state
769 * @param dst_dpad_state destination of cloning
770 * @param src_dpad_state source of cloning
771 * @public @memberof oxr_dpad_state_clone
772 */
773bool
774oxr_dpad_state_clone(struct oxr_dpad_state *dst_dpad_state, const struct oxr_dpad_state *src_dpad_state);
775
776
777/*!
778 * @}
779 */
780
781
782/*!
783 *
784 * @name oxr_session.c
785 * @{
786 *
787 */
788
789/*!
790 * To go back to a OpenXR object.
791 *
792 * @relates oxr_session
793 */
794static inline XrSession
796{
797 return XRT_CAST_PTR_TO_OXR_HANDLE(XrSession, sess);
798}
799
800XrResult
801oxr_session_create(struct oxr_logger *log,
802 struct oxr_system *sys,
803 const XrSessionCreateInfo *createInfo,
804 struct oxr_session **out_session);
805
806XrResult
807oxr_session_enumerate_formats(struct oxr_logger *log,
808 struct oxr_session *sess,
809 uint32_t formatCapacityInput,
810 uint32_t *formatCountOutput,
811 int64_t *formats);
812
813/*!
814 * Change the state of the session, queues a event.
815 */
816void
817oxr_session_change_state(struct oxr_logger *log, struct oxr_session *sess, XrSessionState state, XrTime time);
818
819XrResult
820oxr_session_begin(struct oxr_logger *log, struct oxr_session *sess, const XrSessionBeginInfo *beginInfo);
821
822XrResult
823oxr_session_end(struct oxr_logger *log, struct oxr_session *sess);
824
825XrResult
826oxr_session_request_exit(struct oxr_logger *log, struct oxr_session *sess);
827
828XRT_CHECK_RESULT XrResult
829oxr_session_poll(struct oxr_logger *log, struct oxr_session *sess);
830
831XrResult
832oxr_session_locate_views(struct oxr_logger *log,
833 struct oxr_session *sess,
834 const XrViewLocateInfo *viewLocateInfo,
835 XrViewState *viewState,
836 uint32_t viewCapacityInput,
837 uint32_t *viewCountOutput,
838 XrView *views);
839
840XrResult
841oxr_session_frame_wait(struct oxr_logger *log, struct oxr_session *sess, XrFrameState *frameState);
842
843XrResult
844oxr_session_frame_begin(struct oxr_logger *log, struct oxr_session *sess);
845
846XrResult
847oxr_session_frame_end(struct oxr_logger *log, struct oxr_session *sess, const XrFrameEndInfo *frameEndInfo);
848
849XrResult
851 struct oxr_hand_tracker *hand_tracker,
852 const XrHandJointsLocateInfoEXT *locateInfo,
853 XrHandJointLocationsEXT *locations);
854
855/*
856 * Gets the body pose in the base space.
857 */
858XrResult
859oxr_get_base_body_pose(struct oxr_logger *log,
860 const struct xrt_body_joint_set *body_joint_set,
861 struct oxr_space *base_spc,
862 struct xrt_device *body_xdev,
863 XrTime at_time,
864 struct xrt_space_relation *out_base_body);
865
866XrResult
867oxr_session_apply_force_feedback(struct oxr_logger *log,
868 struct oxr_hand_tracker *hand_tracker,
869 const XrForceFeedbackCurlApplyLocationsMNDX *locations);
870
871#ifdef OXR_HAVE_KHR_android_thread_settings
872XrResult
873oxr_session_android_thread_settings(struct oxr_logger *log,
874 struct oxr_session *sess,
875 XrAndroidThreadTypeKHR threadType,
876 uint32_t threadId);
877#endif // OXR_HAVE_KHR_android_thread_settings
878
879#ifdef OXR_HAVE_KHR_visibility_mask
880XrResult
881oxr_session_get_visibility_mask(struct oxr_logger *log,
882 struct oxr_session *session,
883 XrVisibilityMaskTypeKHR visibilityMaskType,
884 uint32_t viewIndex,
885 XrVisibilityMaskKHR *visibilityMask);
886
887XrResult
888oxr_event_push_XrEventDataVisibilityMaskChangedKHR(struct oxr_logger *log,
889 struct oxr_session *sess,
890 XrViewConfigurationType viewConfigurationType,
891 uint32_t viewIndex);
892#endif // OXR_HAVE_KHR_visibility_mask
893
894#ifdef OXR_HAVE_EXT_performance_settings
895XrResult
896oxr_session_set_perf_level(struct oxr_logger *log,
897 struct oxr_session *sess,
898 XrPerfSettingsDomainEXT domain,
899 XrPerfSettingsLevelEXT level);
900#endif // OXR_HAVE_EXT_performance_settings
901
902/*
903 *
904 * oxr_space.c
905 *
906 */
907
908/*!
909 * To go back to a OpenXR object.
910 */
911static inline XrSpace
913{
914 return XRT_CAST_PTR_TO_OXR_HANDLE(XrSpace, spc);
915}
916
917XrResult
918oxr_space_action_create(struct oxr_logger *log,
919 struct oxr_session *sess,
920 uint32_t key,
921 const XrActionSpaceCreateInfo *createInfo,
922 struct oxr_space **out_space);
923
924XrResult
925oxr_space_get_reference_bounds_rect(struct oxr_logger *log,
926 struct oxr_session *sess,
927 XrReferenceSpaceType referenceSpaceType,
928 XrExtent2Df *bounds);
929
930XrResult
931oxr_space_reference_create(struct oxr_logger *log,
932 struct oxr_session *sess,
933 const XrReferenceSpaceCreateInfo *createInfo,
934 struct oxr_space **out_space);
935
936/*!
937 * Monado special space that always points to a specific @ref xrt_device and
938 * pose, useful when you want to bypass the action binding system for instance.
939 */
940XrResult
942 struct oxr_session *sess,
943 struct xrt_device *xdev,
944 enum xrt_input_name name,
945 const struct xrt_pose *pose,
946 struct oxr_space **out_space);
947
948XrResult
950 struct oxr_logger *log, struct oxr_space *spc, struct oxr_space *baseSpc, XrTime time, XrSpaceLocation *location);
951
952XrResult
953oxr_spaces_locate(struct oxr_logger *log,
954 struct oxr_space **spcs,
955 uint32_t spc_count,
956 struct oxr_space *baseSpc,
957 XrTime time,
958 XrSpaceLocations *locations);
959
960/*!
961 * Locate the @ref xrt_device in the given base space, useful for implementing
962 * hand tracking location look ups and the like.
963 *
964 * @param log Logging struct.
965 * @param xdev Device to locate in the base space.
966 * @param baseSpc Base space where the device is to be located.
967 * @param[in] time Time in OpenXR domain.
968 * @param[out] out_relation Returns T_base_xdev, aka xdev in base space.
969 *
970 * @return Any errors, XR_SUCCESS, pose might not be valid on XR_SUCCESS.
971 */
972XRT_CHECK_RESULT XrResult
974 struct xrt_device *xdev,
975 struct oxr_space *baseSpc,
976 XrTime time,
977 struct xrt_space_relation *out_relation);
978
979
980/*
981 *
982 * oxr_swapchain.c
983 *
984 */
985
986/*!
987 * To go back to a OpenXR object.
988 */
989static inline XrSwapchain
991{
992 return XRT_CAST_PTR_TO_OXR_HANDLE(XrSwapchain, sc);
993}
994
995
996/*
997 *
998 * oxr_messenger.c
999 *
1000 */
1001
1002/*!
1003 * To go back to a OpenXR object.
1004 */
1005static inline XrDebugUtilsMessengerEXT
1007{
1008 return XRT_CAST_PTR_TO_OXR_HANDLE(XrDebugUtilsMessengerEXT, mssngr);
1009}
1010
1011XrResult
1013 struct oxr_instance *inst,
1014 const XrDebugUtilsMessengerCreateInfoEXT *,
1015 struct oxr_debug_messenger **out_mssngr);
1016XrResult
1017oxr_destroy_messenger(struct oxr_logger *log, struct oxr_debug_messenger *mssngr);
1018
1019
1020/*
1021 *
1022 * oxr_system.c
1023 *
1024 */
1025
1026XrResult
1027oxr_system_select(struct oxr_logger *log,
1028 struct oxr_system **systems,
1029 uint32_t system_count,
1030 XrFormFactor form_factor,
1031 struct oxr_system **out_selected);
1032
1033XrResult
1034oxr_system_fill_in(struct oxr_logger *log,
1035 struct oxr_instance *inst,
1036 XrSystemId systemId,
1037 uint32_t view_count,
1038 struct oxr_system *sys);
1039
1040XrResult
1041oxr_system_verify_id(struct oxr_logger *log, const struct oxr_instance *inst, XrSystemId systemId);
1042
1043XrResult
1044oxr_system_get_by_id(struct oxr_logger *log,
1045 struct oxr_instance *inst,
1046 XrSystemId systemId,
1047 struct oxr_system **system);
1048
1049XrResult
1050oxr_system_get_properties(struct oxr_logger *log, struct oxr_system *sys, XrSystemProperties *properties);
1051
1052XrResult
1053oxr_system_enumerate_view_confs(struct oxr_logger *log,
1054 struct oxr_system *sys,
1055 uint32_t viewConfigurationTypeCapacityInput,
1056 uint32_t *viewConfigurationTypeCountOutput,
1057 XrViewConfigurationType *viewConfigurationTypes);
1058
1059XrResult
1061 struct oxr_system *sys,
1062 XrViewConfigurationType viewConfigurationType,
1063 uint32_t environmentBlendModeCapacityInput,
1064 uint32_t *environmentBlendModeCountOutput,
1065 XrEnvironmentBlendMode *environmentBlendModes);
1066
1067XrResult
1068oxr_system_get_view_conf_properties(struct oxr_logger *log,
1069 struct oxr_system *sys,
1070 XrViewConfigurationType viewConfigurationType,
1071 XrViewConfigurationProperties *configurationProperties);
1072
1073XrResult
1074oxr_system_enumerate_view_conf_views(struct oxr_logger *log,
1075 struct oxr_system *sys,
1076 XrViewConfigurationType viewConfigurationType,
1077 uint32_t viewCapacityInput,
1078 uint32_t *viewCountOutput,
1079 XrViewConfigurationView *views);
1080
1081bool
1082oxr_system_get_hand_tracking_support(struct oxr_logger *log, struct oxr_instance *inst);
1083
1084bool
1085oxr_system_get_eye_gaze_support(struct oxr_logger *log, struct oxr_instance *inst);
1086
1087bool
1088oxr_system_get_force_feedback_support(struct oxr_logger *log, struct oxr_instance *inst);
1089
1090void
1091oxr_system_get_face_tracking_htc_support(struct oxr_logger *log,
1092 struct oxr_instance *inst,
1093 bool *supports_eye,
1094 bool *supports_lip);
1095
1096void
1097oxr_system_get_face_tracking2_fb_support(struct oxr_logger *log,
1098 struct oxr_instance *inst,
1099 bool *supports_audio,
1100 bool *supports_visual);
1101
1102bool
1103oxr_system_get_body_tracking_fb_support(struct oxr_logger *log, struct oxr_instance *inst);
1104
1105bool
1106oxr_system_get_full_body_tracking_meta_support(struct oxr_logger *log, struct oxr_instance *inst);
1107
1108bool
1109oxr_system_get_body_tracking_calibration_meta_support(struct oxr_logger *log, struct oxr_instance *inst);
1110
1111/*
1112 *
1113 * oxr_event.cpp
1114 *
1115 */
1116
1117XrResult
1118oxr_event_push_XrEventDataSessionStateChanged(struct oxr_logger *log,
1119 struct oxr_session *sess,
1120 XrSessionState state,
1121 XrTime time);
1122
1123XrResult
1124oxr_event_push_XrEventDataInteractionProfileChanged(struct oxr_logger *log, struct oxr_session *sess);
1125
1126XrResult
1127oxr_event_push_XrEventDataReferenceSpaceChangePending(struct oxr_logger *log,
1128 struct oxr_session *sess,
1129 XrReferenceSpaceType referenceSpaceType,
1130 XrTime changeTime,
1131 XrBool32 poseValid,
1132 const XrPosef *poseInPreviousSpace);
1133
1134#ifdef OXR_HAVE_FB_display_refresh_rate
1135XrResult
1136oxr_event_push_XrEventDataDisplayRefreshRateChangedFB(struct oxr_logger *log,
1137 struct oxr_session *sess,
1138 float fromDisplayRefreshRate,
1139 float toDisplayRefreshRate);
1140#endif // OXR_HAVE_FB_display_refresh_rate
1141
1142#ifdef OXR_HAVE_EXTX_overlay
1143XrResult
1144oxr_event_push_XrEventDataMainSessionVisibilityChangedEXTX(struct oxr_logger *log,
1145 struct oxr_session *sess,
1146 bool visible);
1147#endif // OXR_HAVE_EXTX_overlay
1148
1149#ifdef OXR_HAVE_EXT_performance_settings
1150XrResult
1151oxr_event_push_XrEventDataPerfSettingsEXTX(struct oxr_logger *log,
1152 struct oxr_session *sess,
1153 enum xrt_perf_domain domain,
1154 enum xrt_perf_sub_domain subDomain,
1155 enum xrt_perf_notify_level fromLevel,
1156 enum xrt_perf_notify_level toLevel);
1157#endif // OXR_HAVE_EXT_performance_settings
1158/*!
1159 * This clears all pending events refers to the given session.
1160 */
1161XrResult
1162oxr_event_remove_session_events(struct oxr_logger *log, struct oxr_session *sess);
1163
1164/*!
1165 * Will return one event if available, also drain the sessions event queues.
1166 */
1167XrResult
1168oxr_poll_event(struct oxr_logger *log, struct oxr_instance *inst, XrEventDataBuffer *eventData);
1169
1170
1171/*
1172 *
1173 * oxr_xdev.c
1174 *
1175 */
1176
1177void
1178oxr_xdev_destroy(struct xrt_device **xdev_ptr);
1179
1180/*!
1181 * Return true if it finds an input of that name on this device.
1182 */
1183bool
1184oxr_xdev_find_input(struct xrt_device *xdev, enum xrt_input_name name, struct xrt_input **out_input);
1185
1186/*!
1187 * Return true if it finds an output of that name on this device.
1188 */
1189bool
1190oxr_xdev_find_output(struct xrt_device *xdev, enum xrt_output_name name, struct xrt_output **out_output);
1191
1192#ifdef OXR_HAVE_MNDX_xdev_space
1193static inline XrXDevListMNDX
1194oxr_xdev_list_to_openxr(struct oxr_xdev_list *sc)
1195{
1196 return XRT_CAST_PTR_TO_OXR_HANDLE(XrXDevListMNDX, sc);
1197}
1198
1199XrResult
1200oxr_xdev_list_create(struct oxr_logger *log,
1201 struct oxr_session *sess,
1202 const XrCreateXDevListInfoMNDX *createInfo,
1203 struct oxr_xdev_list **out_xdl);
1204
1205XrResult
1206oxr_xdev_list_get_properties(struct oxr_logger *log,
1207 struct oxr_xdev_list *xdl,
1208 uint32_t index,
1209 XrXDevPropertiesMNDX *properties);
1210
1211XrResult
1212oxr_xdev_list_space_create(struct oxr_logger *log,
1213 struct oxr_xdev_list *xdl,
1214 const XrCreateXDevSpaceInfoMNDX *createInfo,
1215 uint32_t index,
1216 struct oxr_space **out_space);
1217
1218#endif // OXR_HAVE_MNDX_xdev_space
1219
1220
1221/*
1222 *
1223 * OpenGL, located in various files.
1224 *
1225 */
1226
1227#ifdef XR_USE_GRAPHICS_API_OPENGL
1228#ifdef XR_USE_PLATFORM_XLIB
1229
1230XrResult
1231oxr_session_populate_gl_xlib(struct oxr_logger *log,
1232 struct oxr_system *sys,
1233 XrGraphicsBindingOpenGLXlibKHR const *next,
1234 struct oxr_session *sess);
1235#endif // XR_USE_PLATFORM_XLIB
1236
1237#ifdef XR_USE_PLATFORM_WIN32
1238XrResult
1239oxr_session_populate_gl_win32(struct oxr_logger *log,
1240 struct oxr_system *sys,
1241 XrGraphicsBindingOpenGLWin32KHR const *next,
1242 struct oxr_session *sess);
1243#endif // XR_USE_PLATFORM_WIN32
1244#endif // XR_USE_GRAPHICS_API_OPENGL
1245
1246#if defined(XR_USE_GRAPHICS_API_OPENGL) || defined(XR_USE_GRAPHICS_API_OPENGL_ES)
1247XrResult
1248oxr_swapchain_gl_create(struct oxr_logger * /*log*/,
1249 struct oxr_session *sess,
1250 const XrSwapchainCreateInfo * /*createInfo*/,
1251 struct oxr_swapchain **out_swapchain);
1252
1253#endif // XR_USE_GRAPHICS_API_OPENGL || XR_USE_GRAPHICS_API_OPENGL_ES
1254
1255#if defined(XR_USE_GRAPHICS_API_OPENGL_ES)
1256#if defined(XR_USE_PLATFORM_ANDROID)
1257XrResult
1258oxr_session_populate_gles_android(struct oxr_logger *log,
1259 struct oxr_system *sys,
1260 XrGraphicsBindingOpenGLESAndroidKHR const *next,
1261 struct oxr_session *sess);
1262#endif // XR_USE_PLATFORM_ANDROID
1263#endif // XR_USE_GRAPHICS_API_OPENGL_ES
1264
1265
1266/*
1267 *
1268 * Vulkan, located in various files.
1269 *
1270 */
1271
1272#ifdef XR_USE_GRAPHICS_API_VULKAN
1273
1274XrResult
1275oxr_vk_get_instance_exts(struct oxr_logger *log,
1276 struct oxr_system *sys,
1277 uint32_t namesCapacityInput,
1278 uint32_t *namesCountOutput,
1279 char *namesString);
1280
1281XrResult
1282oxr_vk_get_device_exts(struct oxr_logger *log,
1283 struct oxr_system *sys,
1284 uint32_t namesCapacityInput,
1285 uint32_t *namesCountOutput,
1286 char *namesString);
1287
1288XrResult
1289oxr_vk_get_requirements(struct oxr_logger *log,
1290 struct oxr_system *sys,
1291 XrGraphicsRequirementsVulkanKHR *graphicsRequirements);
1292
1293XrResult
1295 struct oxr_system *sys,
1296 const XrVulkanInstanceCreateInfoKHR *createInfo,
1297 VkInstance *vulkanInstance,
1298 VkResult *vulkanResult);
1299
1300XrResult
1302 struct oxr_system *sys,
1303 const XrVulkanDeviceCreateInfoKHR *createInfo,
1304 VkDevice *vulkanDevice,
1305 VkResult *vulkanResult);
1306
1307XrResult
1308oxr_vk_get_physical_device(struct oxr_logger *log,
1309 struct oxr_instance *inst,
1310 struct oxr_system *sys,
1311 VkInstance vkInstance,
1312 PFN_vkGetInstanceProcAddr getProc,
1313 VkPhysicalDevice *vkPhysicalDevice);
1314
1315XrResult
1316oxr_session_populate_vk(struct oxr_logger *log,
1317 struct oxr_system *sys,
1318 XrGraphicsBindingVulkanKHR const *next,
1319 struct oxr_session *sess);
1320
1321XrResult
1322oxr_swapchain_vk_create(struct oxr_logger * /*log*/,
1323 struct oxr_session *sess,
1324 const XrSwapchainCreateInfo * /*createInfo*/,
1325 struct oxr_swapchain **out_swapchain);
1326
1327#endif
1328
1329
1330/*
1331 *
1332 * EGL, located in various files.
1333 *
1334 */
1335
1336#ifdef XR_USE_PLATFORM_EGL
1337
1338XrResult
1339oxr_session_populate_egl(struct oxr_logger *log,
1340 struct oxr_system *sys,
1341 XrGraphicsBindingEGLMNDX const *next,
1342 struct oxr_session *sess);
1343
1344#endif
1345
1346/*
1347 *
1348 * D3D version independent routines, located in oxr_d3d.cpp
1349 *
1350 */
1351
1352#if defined(XRT_HAVE_D3D11) || defined(XRT_HAVE_D3D12) || defined(XRT_DOXYGEN)
1353/// Common GetRequirements call for D3D11 and D3D12
1354XrResult
1356 struct oxr_system *sys,
1357 LUID *adapter_luid,
1358 D3D_FEATURE_LEVEL *min_feature_level);
1359
1360/// Verify the provided LUID matches the expected one in @p sys
1361XrResult
1362oxr_d3d_check_luid(struct oxr_logger *log, struct oxr_system *sys, LUID *adapter_luid);
1363#endif
1364
1365/*
1366 *
1367 * D3D11, located in various files.
1368 *
1369 */
1370
1371#ifdef XR_USE_GRAPHICS_API_D3D11
1372
1373XrResult
1374oxr_d3d11_get_requirements(struct oxr_logger *log,
1375 struct oxr_system *sys,
1376 XrGraphicsRequirementsD3D11KHR *graphicsRequirements);
1377
1378/**
1379 * @brief Check to ensure the device provided at session create matches the LUID we returned earlier.
1380 *
1381 * @return XR_SUCCESS if the device matches the LUID
1382 */
1383XrResult
1384oxr_d3d11_check_device(struct oxr_logger *log, struct oxr_system *sys, ID3D11Device *device);
1385
1386
1387XrResult
1388oxr_session_populate_d3d11(struct oxr_logger *log,
1389 struct oxr_system *sys,
1390 XrGraphicsBindingD3D11KHR const *next,
1391 struct oxr_session *sess);
1392
1393XrResult
1394oxr_swapchain_d3d11_create(struct oxr_logger *,
1395 struct oxr_session *sess,
1396 const XrSwapchainCreateInfo *,
1397 struct oxr_swapchain **out_swapchain);
1398
1399#endif
1400
1401/*
1402 *
1403 * D3D12, located in various files.
1404 *
1405 */
1406
1407#ifdef XR_USE_GRAPHICS_API_D3D12
1408
1409XrResult
1410oxr_d3d12_get_requirements(struct oxr_logger *log,
1411 struct oxr_system *sys,
1412 XrGraphicsRequirementsD3D12KHR *graphicsRequirements);
1413
1414/**
1415 * @brief Check to ensure the device provided at session create matches the LUID we returned earlier.
1416 *
1417 * @return XR_SUCCESS if the device matches the LUID
1418 */
1419XrResult
1420oxr_d3d12_check_device(struct oxr_logger *log, struct oxr_system *sys, ID3D12Device *device);
1421
1422
1423XrResult
1424oxr_session_populate_d3d12(struct oxr_logger *log,
1425 struct oxr_system *sys,
1426 XrGraphicsBindingD3D12KHR const *next,
1427 struct oxr_session *sess);
1428
1429XrResult
1430oxr_swapchain_d3d12_create(struct oxr_logger *,
1431 struct oxr_session *sess,
1432 const XrSwapchainCreateInfo *,
1433 struct oxr_swapchain **out_swapchain);
1434
1435#endif
1436
1437/*
1438 *
1439 * Structs
1440 *
1441 */
1442
1443
1444/*!
1445 * Used to hold diverse child handles and ensure orderly destruction.
1446 *
1447 * Each object referenced by an OpenXR handle should have one of these as its
1448 * first element, thus "extending" this class.
1449 */
1451{
1452 //! Magic (per-handle-type) value for debugging.
1453 uint64_t debug;
1454
1455 /*!
1456 * Pointer to this object's parent handle holder, if any.
1457 */
1459
1460 /*!
1461 * Array of children, if any.
1462 */
1463 struct oxr_handle_base *children[XRT_MAX_HANDLE_CHILDREN];
1464
1465 /*!
1466 * Current handle state.
1467 */
1469
1470 /*!
1471 * Destroy the object this handle refers to.
1472 */
1474};
1475
1476/*!
1477 * Single or multiple devices grouped together to form a system that sessions
1478 * can be created from. Might need to open devices to get all
1479 * properties from it, but shouldn't.
1480 *
1481 * Not strictly an object, but an atom.
1482 *
1483 * Valid only within an XrInstance (@ref oxr_instance)
1484 *
1485 * @obj{XrSystemId}
1486 */
1488{
1489 struct oxr_instance *inst;
1490
1491 //! The @ref xrt_iface level system.
1493
1494 //! System devices used in all session types.
1496
1497 //! Space overseer used in all session types.
1499
1500 //! System compositor, used to create session compositors.
1502
1503 XrSystemId systemId;
1504
1505 //! Have the client application called the gfx api requirements func?
1507
1508 XrViewConfigurationType view_config_type;
1509 XrViewConfigurationView views[2];
1510 uint32_t blend_mode_count;
1511 XrEnvironmentBlendMode blend_modes[3];
1512
1513 XrReferenceSpaceType reference_spaces[5];
1514 uint32_t reference_space_count;
1515
1516 //! Cache of the last known system roles, see @ref xrt_system_roles::generation_id
1518 struct os_mutex sync_actions_mutex;
1519
1520 struct xrt_visibility_mask *visibility_mask[2];
1521
1522#ifdef OXR_HAVE_MNDX_xdev_space
1523 bool supports_xdev_space;
1524#endif
1525
1526#ifdef XR_USE_GRAPHICS_API_VULKAN
1527 //! The instance/device we create when vulkan_enable2 is used
1529 //! The device returned with the last xrGetVulkanGraphicsDeviceKHR or xrGetVulkanGraphicsDevice2KHR call.
1530 //! XR_NULL_HANDLE if neither has been called.
1532
1533 struct
1534 {
1535 // No better place to keep this state.
1536 bool external_fence_fd_enabled;
1537 bool external_semaphore_fd_enabled;
1538 bool timeline_semaphore_enabled;
1539 bool debug_utils_enabled;
1540 bool image_format_list_enabled;
1541 } vk;
1542
1543#endif
1544
1545#if defined(XR_USE_GRAPHICS_API_D3D11) || defined(XR_USE_GRAPHICS_API_D3D12)
1546 LUID suggested_d3d_luid;
1547 bool suggested_d3d_luid_valid;
1548#endif
1549};
1550
1551
1552/*
1553 * Device roles helpers.
1554 */
1555
1556// static roles
1557// clang-format off
1558static inline struct xrt_device *get_role_head(struct oxr_system *sys) {return sys->xsysd->static_roles.head; }
1559static inline struct xrt_device *get_role_eyes(struct oxr_system *sys) {return sys->xsysd->static_roles.eyes; }
1560static inline struct xrt_device *get_role_face(struct oxr_system* sys) { return sys->xsysd->static_roles.face; }
1561static inline struct xrt_device *get_role_body(struct oxr_system* sys) { return sys->xsysd->static_roles.body; }
1562static inline struct xrt_device *get_role_hand_tracking_unobstructed_left(struct oxr_system* sys) { return sys->xsysd->static_roles.hand_tracking.unobstructed.left; }
1563static inline struct xrt_device *get_role_hand_tracking_unobstructed_right(struct oxr_system* sys) { return sys->xsysd->static_roles.hand_tracking.unobstructed.right; }
1564static inline struct xrt_device *get_role_hand_tracking_conforming_left(struct oxr_system* sys) { return sys->xsysd->static_roles.hand_tracking.conforming.left; }
1565static inline struct xrt_device *get_role_hand_tracking_conforming_right(struct oxr_system* sys) { return sys->xsysd->static_roles.hand_tracking.conforming.right; }
1566
1567// clang-format on
1568
1569// dynamic roles
1570#define MAKE_GET_DYN_ROLES_FN(ROLE) \
1571 static inline struct xrt_device *get_role_##ROLE(struct oxr_system *sys) \
1572 { \
1573 const bool is_locked = 0 == os_mutex_trylock(&sys->sync_actions_mutex); \
1574 const int32_t xdev_idx = sys->dynamic_roles_cache.ROLE; \
1575 if (is_locked) { \
1576 os_mutex_unlock(&sys->sync_actions_mutex); \
1577 } \
1578 if (xdev_idx < 0 || xdev_idx >= (int32_t)ARRAY_SIZE(sys->xsysd->xdevs)) \
1579 return NULL; \
1580 return sys->xsysd->xdevs[xdev_idx]; \
1581 }
1582MAKE_GET_DYN_ROLES_FN(left)
1583MAKE_GET_DYN_ROLES_FN(right)
1584MAKE_GET_DYN_ROLES_FN(gamepad)
1585#undef MAKE_GET_DYN_ROLES_FN
1586
1587#define GET_XDEV_BY_ROLE(SYS, ROLE) (get_role_##ROLE((SYS)))
1588
1589
1590static inline enum xrt_device_name
1591get_role_profile_head(struct oxr_system *sys)
1592{
1593 return XRT_DEVICE_INVALID;
1594}
1595static inline enum xrt_device_name
1596get_role_profile_eyes(struct oxr_system *sys)
1597{
1598 return XRT_DEVICE_INVALID;
1599}
1600static inline enum xrt_device_name
1601get_role_profile_face(struct oxr_system *sys)
1602{
1603 return XRT_DEVICE_INVALID;
1604}
1605static inline enum xrt_device_name
1606get_role_profile_body(struct oxr_system *sys)
1607{
1608 return XRT_DEVICE_INVALID;
1609}
1610static inline enum xrt_device_name
1611get_role_profile_hand_tracking_unobstructed_left(struct oxr_system *sys)
1612{
1613 return XRT_DEVICE_INVALID;
1614}
1615static inline enum xrt_device_name
1616get_role_profile_hand_tracking_unobstructed_right(struct oxr_system *sys)
1617{
1618 return XRT_DEVICE_INVALID;
1619}
1620
1621static inline enum xrt_device_name
1622get_role_profile_hand_tracking_conforming_left(struct oxr_system *sys)
1623{
1624 return XRT_DEVICE_INVALID;
1625}
1626static inline enum xrt_device_name
1627get_role_profile_hand_tracking_conforming_right(struct oxr_system *sys)
1628{
1629 return XRT_DEVICE_INVALID;
1630}
1631
1632#define MAKE_GET_DYN_ROLE_PROFILE_FN(ROLE) \
1633 static inline enum xrt_device_name get_role_profile_##ROLE(struct oxr_system *sys) \
1634 { \
1635 const bool is_locked = 0 == os_mutex_trylock(&sys->sync_actions_mutex); \
1636 const enum xrt_device_name profile_name = sys->dynamic_roles_cache.ROLE##_profile; \
1637 if (is_locked) { \
1638 os_mutex_unlock(&sys->sync_actions_mutex); \
1639 } \
1640 return profile_name; \
1641 }
1642MAKE_GET_DYN_ROLE_PROFILE_FN(left)
1643MAKE_GET_DYN_ROLE_PROFILE_FN(right)
1644MAKE_GET_DYN_ROLE_PROFILE_FN(gamepad)
1645#undef MAKE_GET_DYN_ROLES_FN
1646
1647#define GET_PROFILE_NAME_BY_ROLE(SYS, ROLE) (get_role_profile_##ROLE((SYS)))
1648
1649/*
1650 * Extensions helpers.
1651 */
1652
1653#define MAKE_EXT_STATUS(mixed_case, all_caps) bool mixed_case;
1654/*!
1655 * Structure tracking which extensions are enabled for a given instance.
1656 *
1657 * Names are systematic: the extension name with the XR_ prefix removed.
1658 */
1660{
1661 OXR_EXTENSION_SUPPORT_GENERATE(MAKE_EXT_STATUS)
1662};
1663#undef MAKE_EXT_STATUS
1664
1665/*!
1666 * Main object that ties everything together.
1667 *
1668 * No parent type/handle: this is the root handle.
1669 *
1670 * @obj{XrInstance}
1671 * @extends oxr_handle_base
1673struct oxr_instance
1674{
1675 //! Common structure for things referred to by OpenXR handles.
1676 struct oxr_handle_base handle;
1677
1678 struct u_debug_gui *debug_ui;
1679
1680 struct xrt_instance *xinst;
1681
1682 //! Enabled extensions
1684
1685 //! The OpenXR version requested in the app info. It determines the instance's OpenXR version.
1686 struct
1687 {
1688 //! Stores only major.minor version. Simplifies comparisons for e.g. "at least OpenXR 1.1".
1689 XrVersion major_minor;
1691
1692 // Hardcoded single system.
1693 struct oxr_system system;
1694
1695 struct time_state *timekeeping;
1696
1697 struct
1698 {
1699 struct u_hashset *name_store;
1700 struct u_hashset *loc_store;
1701 } action_sets;
1702
1703 //! Path store, for looking up paths.
1704 struct u_hashset *path_store;
1705 //! Mapping from ID to path.
1706 struct oxr_path **path_array;
1707 //! Total length of path array.
1708 size_t path_array_length;
1709 //! Number of paths in the array (0 is always null).
1710 size_t path_num;
1711
1712 // Event queue.
1713 struct
1714 {
1715 struct os_mutex mutex;
1716 struct oxr_event *last;
1717 struct oxr_event *next;
1718 } event;
1719
1720 //! Interaction profile bindings that have been suggested by the client.
1722 size_t profile_count;
1723
1724 struct oxr_session *sessions;
1725
1726 struct
1727 {
1728
1729#define SUBACTION_PATH_MEMBER(X) XrPath X;
1730 OXR_FOR_EACH_SUBACTION_PATH(SUBACTION_PATH_MEMBER)
1731
1732#undef SUBACTION_PATH_MEMBER
1733 } path_cache;
1734
1735 struct
1736 {
1737 struct
1738 {
1739 struct
1740 {
1741 uint32_t major;
1742 uint32_t minor;
1743 uint32_t patch;
1744 const char *name; //< Engine name, not freed.
1745 } engine;
1746 } detected;
1747 } appinfo;
1748
1749 struct
1750 {
1751 //! Unreal has a bug in the VulkanRHI backend.
1753 //! Unreal 4 has a bug calling xrEndSession; the function should just exit
1754 bool skip_end_session;
1755
1756 /*!
1757 * Return XR_ERROR_REFERENCE_SPACE_UNSUPPORTED instead of
1758 * XR_ERROR_VALIDATION_FAILURE in xrCreateReferenceSpace.
1759 */
1761
1762 //! For applications that rely on views being parallel, notably some OpenVR games with OpenComposite.
1764
1765 //! For applications that use stage and don't offer recentering.
1767 } quirks;
1768
1769 //! Debug messengers
1770 struct oxr_debug_messenger *messengers[XRT_MAX_HANDLE_CHILDREN];
1771
1772 bool lifecycle_verbose;
1773 bool debug_views;
1774 bool debug_spaces;
1775 bool debug_bindings;
1776
1777#ifdef XRT_FEATURE_RENDERDOC
1778 RENDERDOC_API_1_4_1 *rdoc_api;
1779#endif
1780
1781#ifdef XRT_OS_ANDROID
1782 enum xrt_android_lifecycle_event activity_state;
1783#endif // XRT_OS_ANDROID
1784};
1785
1786/*!
1787 * Object that client program interact with.
1788 *
1789 * Parent type/handle is @ref oxr_instance
1790 *
1791 * @obj{XrSession}
1792 * @extends oxr_handle_base
1793 */
1795{
1796 //! Common structure for things referred to by OpenXR handles.
1797 struct oxr_handle_base handle;
1798 struct oxr_system *sys;
1799
1800 //! What graphics type was this session created with.
1802
1803 //! The @ref xrt_session backing this session.
1805
1806 //! Native compositor that is wrapped by client compositors.
1807 struct xrt_compositor_native *xcn;
1808
1809 struct xrt_compositor *compositor;
1810
1811 struct oxr_session *next;
1812
1813 XrSessionState state;
1814
1815 /*!
1816 * There is a extra state between xrBeginSession has been called and
1817 * the first xrEndFrame has been called. These are to track this.
1818 */
1819 bool has_ended_once;
1820
1821 bool compositor_visible;
1822 bool compositor_focused;
1823
1824 // the number of xrWaitFrame calls that did not yet have a corresponding
1825 // xrEndFrame or xrBeginFrame (discarded frame) call
1826 int active_wait_frames;
1827 struct os_mutex active_wait_frames_lock;
1828
1829 bool frame_started;
1830 bool exiting;
1831
1832 struct
1833 {
1834 int64_t waited;
1835 int64_t begun;
1836 } frame_id;
1837
1838 struct oxr_frame_sync frame_sync;
1839
1840 /*!
1841 * Used to implement precise extra sleeping in wait frame.
1842 */
1844
1845 /*!
1846 * An array of action set attachments that this session owns.
1847 *
1848 * If non-null, this means action sets have been attached to this
1849 * session.
1850 */
1852
1853 /*!
1854 * Length of @ref oxr_session::act_set_attachments.
1855 */
1857
1858 /*!
1859 * A map of action set key to action set attachments.
1860 *
1861 * If non-null, this means action sets have been attached to this
1862 * session, since this map points to elements of
1863 * oxr_session::act_set_attachments
1864 */
1866
1867 /*!
1868 * A map of action key to action attachment.
1869 *
1870 * The action attachments are actually owned by the action set
1871 * attachments, but we own the action set attachments, so this is OK.
1872 *
1873 * If non-null, this means action sets have been attached to this
1874 * session, since this map points to @p oxr_action_attachment members of
1875 * @ref oxr_session::act_set_attachments elements.
1876 */
1878
1879 /*!
1880 * Clone of all suggested binding profiles at the point of action set/session attachment.
1881 * @ref oxr_session_attach_action_sets
1882 */
1884 struct oxr_interaction_profile **profiles_on_attachment;
1885
1886 /*!
1887 * Currently bound interaction profile.
1888 * @{
1889 */
1890
1891#define OXR_PATH_MEMBER(X) XrPath X;
1892
1894#undef OXR_PATH_MEMBER
1895 /*!
1896 * @}
1897 */
1899 /*!
1900 * IPD, to be expanded to a proper 3D relation.
1901 */
1902 float ipd_meters;
1904 /*!
1905 * Frame timing debug output.
1907 bool frame_timing_spew;
1908
1909 //! Extra sleep in wait frame.
1912 /*!
1913 * To pipe swapchain creation to right code.
1914 */
1915 XrResult (*create_swapchain)(struct oxr_logger *,
1916 struct oxr_session *sess,
1917 const XrSwapchainCreateInfo *,
1918 struct oxr_swapchain **);
1919
1920 /*! initial relation of head in "global" space.
1921 * Used as reference for local space. */
1923
1924 bool has_lost;
1925};
1926
1927/*!
1928 * Returns XR_SUCCESS or XR_SESSION_LOSS_PENDING as appropriate.
1930 * @public @memberof oxr_session
1931 */
1932static inline XrResult
1934{
1935 switch (session->state) {
1936 case XR_SESSION_STATE_LOSS_PENDING: return XR_SESSION_LOSS_PENDING;
1937 default: return XR_SUCCESS;
1938 }
1939}
1940
1941/*!
1942 * Returns XR_SUCCESS, XR_SESSION_LOSS_PENDING, or XR_SESSION_NOT_FOCUSED, as
1943 * appropriate.
1945 * @public @memberof oxr_session
1946 */
1947static inline XrResult
1949{
1950 switch (session->state) {
1951 case XR_SESSION_STATE_LOSS_PENDING: return XR_SESSION_LOSS_PENDING;
1952 case XR_SESSION_STATE_FOCUSED: return XR_SUCCESS;
1953 default: return XR_SESSION_NOT_FOCUSED;
1954 }
1955}
1956
1957#ifdef OXR_HAVE_FB_display_refresh_rate
1958XrResult
1959oxr_session_get_display_refresh_rate(struct oxr_logger *log, struct oxr_session *sess, float *displayRefreshRate);
1960
1961XrResult
1962oxr_session_request_display_refresh_rate(struct oxr_logger *log, struct oxr_session *sess, float displayRefreshRate);
1963#endif // OXR_HAVE_FB_display_refresh_rate
1964
1965/*!
1966 * dpad settings we need extracted from XrInteractionProfileDpadBindingEXT
1967 *
1968 * @ingroup oxr_input
1969 */
1970struct oxr_dpad_settings
1971{
1972 float forceThreshold;
1973 float forceThresholdReleased;
1974 float centerRegion;
1975 float wedgeAngle;
1976 bool isSticky;
1977};
1979/*!
1980 * dpad binding extracted from XrInteractionProfileDpadBindingEXT
1981 */
1983{
1984 XrPath binding;
1985 struct oxr_dpad_settings settings;
1986};
1987
1988/*!
1989 * A entry in the dpad state for one action set.
1990 *
1991 * @ingroup oxr_input
1992 */
1993struct oxr_dpad_entry
1994{
1995#ifdef XR_EXT_dpad_binding
1996 struct oxr_dpad_binding_modification dpads[4];
1997 uint32_t dpad_count;
1998#endif
1999
2000 uint64_t key;
2001};
2002
2003/*!
2004 * Holds dpad binding state for a single interaction profile.
2005 *
2006 * @ingroup oxr_input
2007 */
2008struct oxr_dpad_state
2009{
2010 struct u_hashmap_int *uhi;
2011};
2013/*!
2014 * dpad emulation settings from oxr_interaction_profile
2015 */
2016struct oxr_dpad_emulation
2017{
2018 enum oxr_subaction_path subaction_path;
2019 XrPath *paths;
2020 uint32_t path_count;
2021 enum xrt_input_name position;
2022 enum xrt_input_name activate; // Can be zero
2023};
2025/*!
2026 * A single interaction profile.
2027 */
2030 XrPath path;
2031
2032 //! Used to lookup @ref xrt_binding_profile for fallback.
2034
2035 //! Name presented to the user.
2036 const char *localized_name;
2037
2038 struct oxr_binding *bindings;
2039 size_t binding_count;
2040
2041 struct oxr_dpad_emulation *dpads;
2042 size_t dpad_count;
2043
2044 struct oxr_dpad_state dpad_state;
2045};
2047/*!
2048 * Interaction profile binding state.
2049 */
2050struct oxr_binding
2051{
2052 XrPath *paths;
2053 uint32_t path_count;
2054
2055 //! Name presented to the user.
2056 const char *localized_name;
2057
2058 enum oxr_subaction_path subaction_path;
2060 uint32_t act_key_count;
2061 uint32_t *act_keys;
2062 //! store which entry in paths was suggested, for each action key
2064
2065 enum xrt_input_name input;
2066 enum xrt_input_name dpad_activate;
2067
2068 enum xrt_output_name output;
2069};
2070
2071/*!
2072 * @defgroup oxr_input OpenXR input
2073 * @ingroup oxr_main
2074 *
2075 * @brief The action-set/action-based input subsystem of OpenXR.
2076 *
2077 *
2078 * Action sets are created as children of the Instance, but are primarily used
2079 * with one or more Sessions. They may be used with multiple sessions at a time,
2080 * so we can't just put the per-session information directly in the action set
2081 * or action. Instead, we have the `_attachment `structures, which mirror the
2082 * action sets and actions but are rooted under the Session:
2083 *
2084 * - For every action set attached to a session, that session owns a @ref
2085 * oxr_action_set_attachment.
2086 * - For each action in those attached action sets, the action set attachment
2087 * owns an @ref oxr_action_attachment.
2088 *
2089 * We go from the public handle to the `_attachment` structure by using a `key`
2090 * value and a hash map: specifically, we look up the
2091 * oxr_action_set::act_set_key and oxr_action::act_key in the session.
2092 *
2093 * ![](monado-input-class-relationships.drawio.svg)
2094 */
2095
2096/*!
2097 * A parsed equivalent of a list of sub-action paths.
2098 *
2099 * If @p any is true, then no paths were provided, which typically means any
2100 * input is acceptable.
2102 * @ingroup oxr_main
2103 * @ingroup oxr_input
2104 */
2106{
2107 bool any;
2108#define OXR_SUBPATH_MEMBER(X) bool X;
2109 OXR_FOR_EACH_SUBACTION_PATH(OXR_SUBPATH_MEMBER)
2110#undef OXR_SUBPATH_MEMBER
2111};
2112
2113/*!
2114 * Helper function to determine if the set of paths in @p a is a subset of the
2115 * paths in @p b.
2116 *
2117 * @public @memberof oxr_subaction_paths
2118 */
2119static inline bool
2121{
2122#define OXR_CHECK_SUBACTION_PATHS(X) \
2123 if (a->X && !b->X) { \
2124 return false; \
2125 }
2126 OXR_FOR_EACH_SUBACTION_PATH(OXR_CHECK_SUBACTION_PATHS)
2127#undef OXR_CHECK_SUBACTION_PATHS
2128 return true;
2129}
2130
2131/*!
2132 * The data associated with the attachment of an Action Set (@ref
2133 * oxr_action_set) to as Session (@ref oxr_session).
2134 *
2135 * This structure has no pointer to the @ref oxr_action_set that created it
2136 * because the application is allowed to destroy an action before the session,
2137 * which should change nothing except not allow the application to use the
2138 * corresponding data anymore.
2139 *
2140 * @ingroup oxr_input
2142 * @see oxr_action_set
2143 */
2145{
2146 //! Owning session.
2148
2149 //! Action set refcounted data
2151
2152 //! Unique key for the session hashmap.
2153 uint32_t act_set_key;
2154
2155 //! Which sub-action paths are requested on the latest sync.
2157
2158 //! An array of action attachments we own.
2160
2161 /*!
2162 * Length of @ref oxr_action_set_attachment::act_attachments.
2163 */
2165};
2166
2167/*!
2168 * De-initialize an action set attachment and its action attachments.
2169 *
2170 * Frees the action attachments, but does not de-allocate the action set
2171 * attachment.
2172 *
2173 * @public @memberof oxr_action_set_attachment
2174 */
2175void
2177
2178
2179/*!
2180 * The state of a action input.
2181 *
2182 * @ingroup oxr_input
2183 *
2184 * @see oxr_action_attachment
2186struct oxr_action_state
2187{
2188 /*!
2189 * The actual value - must interpret using action type
2190 */
2191 union xrt_input_value value;
2192
2193 //! Is this active (bound and providing input)?
2195
2196 // Was this changed.
2197 bool changed;
2198
2199 //! When was this last changed.
2200 XrTime timestamp;
2201};
2202
2203/*!
2204 * A input action pair of a @ref xrt_input and a @ref xrt_device, along with the
2205 * required transform.
2207 * @ingroup oxr_input
2208 *
2209 * @see xrt_device
2210 * @see xrt_input
2211 */
2212struct oxr_action_input
2213{
2214 struct xrt_device *xdev; // Used for poses and transform is null.
2215 struct xrt_input *input; // Ditto
2216 enum xrt_input_name dpad_activate_name; // used to activate dpad emulation if present
2217 struct xrt_input *dpad_activate; // used to activate dpad emulation if present
2218 struct oxr_input_transform *transforms;
2219 size_t transform_count;
2220 XrPath bound_path;
2221};
2222
2223/*!
2224 * A output action pair of a @ref xrt_output_name and a @ref xrt_device.
2226 * @ingroup oxr_input
2227 *
2228 * @see xrt_device
2229 * @see xrt_output_name
2230 */
2231struct oxr_action_output
2232{
2233 struct xrt_device *xdev;
2234 enum xrt_output_name name;
2235 XrPath bound_path;
2236};
2237
2238
2239/*!
2240 * The set of inputs/outputs for a single sub-action path for an action.
2241 *
2242 * Each @ref oxr_action_attachment has one of these for every known sub-action
2243 * path in the spec. Many, or even most, will be "empty".
2244 *
2245 * A single action will either be input or output, not both.
2246 *
2247 * @ingroup oxr_input
2248 *
2249 * @see oxr_action_attachment
2250 */
2251struct oxr_action_cache
2252{
2253 struct oxr_action_state current;
2254
2255 size_t input_count;
2256 struct oxr_action_input *inputs;
2257
2258 int64_t stop_output_time;
2259 size_t output_count;
2260 struct oxr_action_output *outputs;
2261};
2262
2263/*!
2264 * Data associated with an Action that has been attached to a Session.
2265 *
2266 * More information on the action vs action attachment and action set vs action
2267 * set attachment parallel is in the docs for @ref oxr_input
2268 *
2269 * @ingroup oxr_input
2271 * @see oxr_action
2272 */
2274{
2275 //! The owning action set attachment
2277
2278 //! This action's refcounted data
2279 struct oxr_action_ref *act_ref;
2280
2281 /*!
2282 * The corresponding session.
2283 *
2284 * This will always be valid: the session outlives this object because
2285 * it owns act_set_attached.
2286 */
2287 struct oxr_session *sess;
2288
2289 //! Unique key for the session hashmap.
2290 uint32_t act_key;
2291
2293 /*!
2294 * For pose actions any subaction paths are special treated, at bind
2295 * time we pick one subaction path and stick to it as long as the action
2296 * lives.
2297 */
2299
2300 struct oxr_action_state any_state;
2301
2302#define OXR_CACHE_MEMBER(X) struct oxr_action_cache X;
2303 OXR_FOR_EACH_SUBACTION_PATH(OXR_CACHE_MEMBER)
2304#undef OXR_CACHE_MEMBER
2305};
2306
2307/*!
2308 * @}
2309 */
2310
2311
2312static inline bool
2313oxr_space_type_is_reference(enum oxr_space_type space_type)
2314{
2315 switch (space_type) {
2316 case OXR_SPACE_TYPE_REFERENCE_VIEW:
2317 case OXR_SPACE_TYPE_REFERENCE_LOCAL:
2318 case OXR_SPACE_TYPE_REFERENCE_LOCAL_FLOOR:
2319 case OXR_SPACE_TYPE_REFERENCE_STAGE:
2320 case OXR_SPACE_TYPE_REFERENCE_UNBOUNDED_MSFT:
2321 case OXR_SPACE_TYPE_REFERENCE_COMBINED_EYE_VARJO:
2322 case OXR_SPACE_TYPE_REFERENCE_LOCALIZATION_MAP_ML:
2323 // These are reference spaces.
2324 return true;
2325
2326 case OXR_SPACE_TYPE_ACTION:
2327 case OXR_SPACE_TYPE_XDEV_POSE:
2328 // These are not reference spaces.
2329 return false;
2330 }
2331
2332 // Handles invalid value.
2333 return false;
2334}
2335
2336
2337/*!
2338 * Can be one of several reference space types, or a space that is bound to an
2339 * action.
2340 *
2341 * Parent type/handle is @ref oxr_session
2343 * @obj{XrSpace}
2344 * @extends oxr_handle_base
2346struct oxr_space
2347{
2348 //! Common structure for things referred to by OpenXR handles.
2349 struct oxr_handle_base handle;
2350
2351 //! Owner of this space.
2352 struct oxr_session *sess;
2353
2354 //! Pose that was given during creation.
2355 struct xrt_pose pose;
2356
2357 //! Action key from which action this space was created from.
2358 uint32_t act_key;
2359
2360 //! What kind of space is this?
2362
2363 //! Which sub action path is this?
2365
2366 struct
2367 {
2368 struct xrt_space *xs;
2369 struct xrt_device *xdev;
2370 enum xrt_input_name name;
2371 } action;
2372
2373 struct
2374 {
2375 struct xrt_space *xs;
2376 } xdev_pose;
2377};
2378
2379/*!
2380 * A set of images used for rendering.
2381 *
2382 * Parent type/handle is @ref oxr_session
2384 * @obj{XrSwapchain}
2385 * @extends oxr_handle_base
2387struct oxr_swapchain
2388{
2389 //! Common structure for things referred to by OpenXR handles.
2390 struct oxr_handle_base handle;
2391
2392 //! Owner of this swapchain.
2393 struct oxr_session *sess;
2394
2395 //! Compositor swapchain.
2396 struct xrt_swapchain *swapchain;
2397
2398 //! Swapchain size.
2399 uint32_t width, height;
2400
2401 //! For 1 is 2D texture, greater then 1 2D array texture.
2402 uint32_t array_layer_count;
2403
2404 //! The number of cubemap faces. 6 for cubemaps, 1 otherwise.
2405 uint32_t face_count;
2406
2407 struct
2408 {
2409 enum oxr_image_state state;
2410 } images[XRT_MAX_SWAPCHAIN_IMAGES];
2411
2412 struct
2413 {
2414 size_t num;
2415 struct u_index_fifo fifo;
2416 } acquired;
2417
2418 struct
2419 {
2420 bool yes;
2421 int index;
2422 } inflight; // This is the image that the app is working on.
2423
2424 struct
2425 {
2426 bool yes;
2427 int index;
2428 } released;
2429
2430 // Is this a static swapchain, needed for acquire semantics.
2431 bool is_static;
2432
2433
2434 XrResult (*destroy)(struct oxr_logger *, struct oxr_swapchain *);
2435
2436 XrResult (*enumerate_images)(struct oxr_logger *,
2437 struct oxr_swapchain *,
2438 uint32_t,
2439 XrSwapchainImageBaseHeader *);
2440
2441 XrResult (*acquire_image)(struct oxr_logger *,
2442 struct oxr_swapchain *,
2443 const XrSwapchainImageAcquireInfo *,
2444 uint32_t *);
2445
2446 XrResult (*wait_image)(struct oxr_logger *, struct oxr_swapchain *, const XrSwapchainImageWaitInfo *);
2447
2448 XrResult (*release_image)(struct oxr_logger *, struct oxr_swapchain *, const XrSwapchainImageReleaseInfo *);
2449};
2450
2451struct oxr_refcounted
2452{
2453 struct xrt_reference base;
2454 //! Destruction callback
2455 void (*destroy)(struct oxr_refcounted *);
2456};
2457
2458/*!
2459 * Increase the reference count of @p orc.
2460 */
2461static inline void
2463{
2465}
2466
2467/*!
2468 * Decrease the reference count of @p orc, destroying it if it reaches 0.
2469 */
2470static inline void
2472{
2473 if (xrt_reference_dec_and_is_zero(&orc->base)) {
2474 orc->destroy(orc);
2475 }
2476}
2477
2478/*!
2479 * The reference-counted data of an action set.
2480 *
2481 * One or more sessions may still need this data after the application destroys
2482 * its XrActionSet handle, so this data is refcounted.
2483 *
2484 * @ingroup oxr_input
2485 *
2486 * @see oxr_action_set
2487 * @extends oxr_refcounted
2488 */
2489struct oxr_action_set_ref
2490{
2491 struct oxr_refcounted base;
2492
2493 //! Application supplied name of this action.
2494 char name[XR_MAX_ACTION_SET_NAME_SIZE];
2495
2496 /*!
2497 * Has this action set even been attached to any session, marking it as
2498 * immutable.
2500 bool ever_attached;
2501
2502 //! Unique key for the session hashmap.
2503 uint32_t act_set_key;
2504
2505 //! Application supplied action set priority.
2506 uint32_t priority;
2507
2508 struct
2509 {
2510 struct u_hashset *name_store;
2511 struct u_hashset *loc_store;
2512 } actions;
2513
2514 struct oxr_subaction_paths permitted_subaction_paths;
2515};
2516
2517/*!
2518 * A group of actions.
2519 *
2520 * Parent type/handle is @ref oxr_instance
2521 *
2522 * Note, however, that an action set must be "attached" to a session
2523 * ( @ref oxr_session ) to be used and not just configured.
2524 * The corresponding data is in @ref oxr_action_set_attachment.
2525 *
2526 * @ingroup oxr_input
2528 * @obj{XrActionSet}
2529 * @extends oxr_handle_base
2531struct oxr_action_set
2532{
2533 //! Common structure for things referred to by OpenXR handles.
2534 struct oxr_handle_base handle;
2535
2536 //! Owner of this action set.
2537 struct oxr_instance *inst;
2538
2539 /*!
2540 * The data for this action set that must live as long as any session we
2541 * are attached to.
2542 */
2543 struct oxr_action_set_ref *data;
2545
2546 /*!
2547 * Unique key for the session hashmap.
2548 *
2549 * Duplicated from oxr_action_set_ref::act_set_key for efficiency.
2551 uint32_t act_set_key;
2552
2553 //! The item in the name hashset.
2554 struct u_hashset_item *name_item;
2555
2556 //! The item in the localized hashset.
2557 struct u_hashset_item *loc_item;
2558};
2559
2560/*!
2561 * The reference-counted data of an action.
2562 *
2563 * One or more sessions may still need this data after the application destroys
2564 * its XrAction handle, so this data is refcounted.
2565 *
2566 * @ingroup oxr_input
2567 *
2568 * @see oxr_action
2569 * @extends oxr_refcounted
2570 */
2571struct oxr_action_ref
2573 struct oxr_refcounted base;
2574
2575 //! Application supplied name of this action.
2576 char name[XR_MAX_ACTION_NAME_SIZE];
2577
2578 //! Unique key for the session hashmap.
2579 uint32_t act_key;
2580
2581 //! Type this action was created with.
2582 XrActionType action_type;
2583
2584 //! Which sub action paths that this action was created with.
2586};
2587
2588/*!
2589 * A single action.
2590 *
2591 * Parent type/handle is @ref oxr_action_set
2592 *
2593 * For actual usage, an action is attached to a session: the corresponding data
2594 * is in @ref oxr_action_attachment
2595 *
2596 * @ingroup oxr_input
2598 * @obj{XrAction}
2599 * @extends oxr_handle_base
2601struct oxr_action
2602{
2603 //! Common structure for things referred to by OpenXR handles.
2605
2606 //! Owner of this action.
2607 struct oxr_action_set *act_set;
2608
2609 //! The data for this action that must live as long as any session we
2610 //! are attached to.
2612
2613 /*!
2614 * Unique key for the session hashmap.
2615 *
2616 * Duplicated from oxr_action_ref::act_key for efficiency.
2618 uint32_t act_key;
2619
2620 //! The item in the name hashset.
2621 struct u_hashset_item *name_item;
2622
2623 //! The item in the localized hashset.
2624 struct u_hashset_item *loc_item;
2625};
2626
2628 * Debug object created by the client program.
2629 *
2630 * Parent type/handle is @ref oxr_instance
2631 *
2632 * @obj{XrDebugUtilsMessengerEXT}
2635{
2636 //! Common structure for things referred to by OpenXR handles.
2637 struct oxr_handle_base handle;
2638
2639 //! Owner of this messenger.
2640 struct oxr_instance *inst;
2641
2642 //! Severities to submit to this messenger
2643 XrDebugUtilsMessageSeverityFlagsEXT message_severities;
2644
2645 //! Types to submit to this messenger
2646 XrDebugUtilsMessageTypeFlagsEXT message_types;
2647
2648 //! Callback function
2649 PFN_xrDebugUtilsMessengerCallbackEXT user_callback;
2650
2651 //! Opaque user data
2652 void *XR_MAY_ALIAS user_data;
2653};
2656{
2657 //! xrt_device backing this hand tracker
2658 struct xrt_device *xdev;
2659
2660 //! the input name associated with this hand tracker
2662};
2663
2664static inline int
2665oxr_hand_tracking_data_source_cmp(const void *p1, const void *p2)
2666{
2667 const struct oxr_hand_tracking_data_source *lhs = (const struct oxr_hand_tracking_data_source *)p1;
2668 const struct oxr_hand_tracking_data_source *rhs = (const struct oxr_hand_tracking_data_source *)p2;
2669 assert(lhs && rhs);
2670 if (rhs->input_name < lhs->input_name)
2671 return -1;
2672 if (rhs->input_name > lhs->input_name)
2673 return 1;
2674 return 0;
2675}
2676
2677/*!
2678 * A hand tracker.
2680 * Parent type/handle is @ref oxr_instance
2681 *
2683 * @obj{XrHandTrackerEXT}
2684 * @extends oxr_handle_base
2686struct oxr_hand_tracker
2687{
2688 //! Common structure for things referred to by OpenXR handles.
2689 struct oxr_handle_base handle;
2690
2691 //! Owner of this hand tracker.
2692 struct oxr_session *sess;
2693
2694 struct oxr_hand_tracking_data_source unobstructed;
2695 struct oxr_hand_tracking_data_source conforming;
2696
2697 /*!
2698 * An ordered list of requested data-source from above options (@ref
2699 * oxr_hand_tracker::[unobstructed|conforming]), ordered by
2700 * @ref oxr_hand_tracker::input_name (see @ref oxr_hand_tracking_data_source_cmp)
2701 *
2702 * if OXR_HAVE_EXT_hand_tracking_data_source is not defined the list
2703 * will contain refs to all the above options.
2704 */
2706 uint32_t requested_sources_count;
2707
2708 XrHandEXT hand;
2709 XrHandJointSetEXT hand_joint_set;
2710};
2711
2712#ifdef OXR_HAVE_FB_passthrough
2713
2714struct oxr_passthrough
2715{
2716 struct oxr_handle_base handle;
2717
2718 struct oxr_session *sess;
2719
2720 XrPassthroughFlagsFB flags;
2721
2722 bool paused;
2723};
2724
2725struct oxr_passthrough_layer
2726{
2727 struct oxr_handle_base handle;
2728
2729 struct oxr_session *sess;
2730
2731 XrPassthroughFB passthrough;
2732
2733 XrPassthroughFlagsFB flags;
2734
2735 XrPassthroughLayerPurposeFB purpose;
2736
2737 bool paused;
2738
2739 XrPassthroughStyleFB style;
2740 XrPassthroughColorMapMonoToRgbaFB monoToRgba;
2741 XrPassthroughColorMapMonoToMonoFB monoToMono;
2742 XrPassthroughBrightnessContrastSaturationFB brightnessContrastSaturation;
2743};
2744
2745XrResult
2746oxr_passthrough_create(struct oxr_logger *log,
2747 struct oxr_session *sess,
2748 const XrPassthroughCreateInfoFB *createInfo,
2749 struct oxr_passthrough **out_passthrough);
2750
2751XrResult
2752oxr_passthrough_layer_create(struct oxr_logger *log,
2753 struct oxr_session *sess,
2754 const XrPassthroughLayerCreateInfoFB *createInfo,
2755 struct oxr_passthrough_layer **out_layer);
2756
2757static inline XrPassthroughFB
2758oxr_passthrough_to_openxr(struct oxr_passthrough *passthrough)
2759{
2760 return XRT_CAST_PTR_TO_OXR_HANDLE(XrPassthroughFB, passthrough);
2761}
2762
2763static inline XrPassthroughLayerFB
2764oxr_passthrough_layer_to_openxr(struct oxr_passthrough_layer *passthroughLayer)
2765{
2766 return XRT_CAST_PTR_TO_OXR_HANDLE(XrPassthroughLayerFB, passthroughLayer);
2767}
2768
2769XrResult
2770oxr_event_push_XrEventDataPassthroughStateChangedFB(struct oxr_logger *log,
2771 struct oxr_session *sess,
2772 XrPassthroughStateChangedFlagsFB flags);
2773
2774#endif // OXR_HAVE_FB_passthrough
2775
2776#ifdef OXR_HAVE_HTC_facial_tracking
2777/*!
2778 * HTC specific Facial tracker.
2779 *
2780 * Parent type/handle is @ref oxr_instance
2781 *
2782 *
2783 * @obj{XrFacialTrackerHTC}
2784 * @extends oxr_handle_base
2785 */
2786struct oxr_facial_tracker_htc
2787{
2788 //! Common structure for things referred to by OpenXR handles.
2789 struct oxr_handle_base handle;
2790
2791 //! Owner of this face tracker.
2792 struct oxr_session *sess;
2793
2794 //! xrt_device backing this face tracker
2795 struct xrt_device *xdev;
2796
2797 //! Type of facial tracking, eyes or lips
2798 enum xrt_facial_tracking_type_htc facial_tracking_type;
2799};
2800
2801XrResult
2802oxr_facial_tracker_htc_create(struct oxr_logger *log,
2803 struct oxr_session *sess,
2804 const XrFacialTrackerCreateInfoHTC *createInfo,
2805 struct oxr_facial_tracker_htc **out_face_tracker_htc);
2806
2807XrResult
2808oxr_get_facial_expressions_htc(struct oxr_logger *log,
2809 struct oxr_facial_tracker_htc *facial_tracker_htc,
2810 XrFacialExpressionsHTC *facialExpressions);
2811#endif
2812
2813#ifdef OXR_HAVE_FB_body_tracking
2814/*!
2815 * FB specific Body tracker.
2816 *
2817 * Parent type/handle is @ref oxr_instance
2818 *
2819 * @obj{XrBodyTrackerFB}
2820 * @extends oxr_handle_base
2821 */
2822struct oxr_body_tracker_fb
2823{
2824 //! Common structure for things referred to by OpenXR handles.
2825 struct oxr_handle_base handle;
2826
2827 //! Owner of this face tracker.
2828 struct oxr_session *sess;
2829
2830 //! xrt_device backing this face tracker
2831 struct xrt_device *xdev;
2832
2833 //! Type of the body joint set e.g. XR_FB_body_tracking or XR_META_body_tracking_full_body
2834 enum xrt_body_joint_set_type_fb joint_set_type;
2835};
2836
2837XrResult
2838oxr_create_body_tracker_fb(struct oxr_logger *log,
2839 struct oxr_session *sess,
2840 const XrBodyTrackerCreateInfoFB *createInfo,
2841 struct oxr_body_tracker_fb **out_body_tracker_fb);
2842
2843XrResult
2844oxr_get_body_skeleton_fb(struct oxr_logger *log,
2845 struct oxr_body_tracker_fb *body_tracker_fb,
2846 XrBodySkeletonFB *skeleton);
2847
2848XrResult
2849oxr_locate_body_joints_fb(struct oxr_logger *log,
2850 struct oxr_body_tracker_fb *body_tracker_fb,
2851 struct oxr_space *base_spc,
2852 const XrBodyJointsLocateInfoFB *locateInfo,
2853 XrBodyJointLocationsFB *locations);
2854#endif
2855
2856#ifdef OXR_HAVE_FB_face_tracking2
2857/*!
2858 * FB specific Face tracker2.
2859 *
2860 * Parent type/handle is @ref oxr_instance
2861 *
2862 * @obj{XrFaceTracker2FB}
2863 * @extends oxr_handle_base
2864 */
2865struct oxr_face_tracker2_fb
2866{
2867 //! Common structure for things referred to by OpenXR handles.
2868 struct oxr_handle_base handle;
2869
2870 //! Owner of this face tracker.
2871 struct oxr_session *sess;
2872
2873 //! xrt_device backing this face tracker
2874 struct xrt_device *xdev;
2875
2876 bool audio_enabled;
2877 bool visual_enabled;
2878};
2879
2880XrResult
2881oxr_face_tracker2_fb_create(struct oxr_logger *log,
2882 struct oxr_session *sess,
2883 const XrFaceTrackerCreateInfo2FB *createInfo,
2884 struct oxr_face_tracker2_fb **out_face_tracker2_fb);
2885
2886XrResult
2887oxr_get_face_expression_weights2_fb(struct oxr_logger *log,
2888 struct oxr_face_tracker2_fb *face_tracker2_fb,
2889 const XrFaceExpressionInfo2FB *expression_info,
2890 XrFaceExpressionWeights2FB *expression_weights);
2891#endif
2892
2893#ifdef OXR_HAVE_MNDX_xdev_space
2894/*!
2895 * Object that holds a list of the current @ref xrt_devices.
2896 *
2897 * Parent type/handle is @ref oxr_session
2898 *
2899 * @obj{XrXDevList}
2900 * @extends oxr_handle_base
2901 */
2902struct oxr_xdev_list
2903{
2904 //! Common structure for things referred to by OpenXR handles.
2905 struct oxr_handle_base handle;
2906
2907 //! Owner of this @ref xrt_device list.
2908 struct oxr_session *sess;
2909
2910 //! Monotonically increasing number.
2911 uint64_t generation_number;
2912
2913 uint64_t ids[XRT_SYSTEM_MAX_DEVICES];
2914 struct xrt_device *xdevs[XRT_SYSTEM_MAX_DEVICES];
2916
2917 //! Counts ids, names and xdevs.
2918 uint32_t device_count;
2919};
2920#endif // OXR_HAVE_MNDX_xdev_space
2921
2922#ifdef OXR_HAVE_EXT_plane_detection
2923/*!
2924 * A Plane Detector.
2925 *
2926 * Parent type/handle is @ref oxr_session
2927 *
2928 *
2929 * @obj{XrPlaneDetectorEXT}
2930 * @extends oxr_handle_base
2931 */
2932struct oxr_plane_detector_ext
2933{
2934 //! Common structure for things referred to by OpenXR handles.
2935 struct oxr_handle_base handle;
2936
2937 //! Owner of this anchor.
2938 struct oxr_session *sess;
2939
2940 //! Plane detector flags.
2942
2943 //! The last known state of this plane detector.
2944 XrPlaneDetectionStateEXT state;
2945
2946 //! Whether the last DONE plane detection has been retrieved from the xdev.
2947 bool retrieved;
2948
2949 //! The device that this plane detector belongs to.
2950 struct xrt_device *xdev;
2951
2952 //! Detected planes. xrt_plane_detector_locations_ext::relation is kept in xdev space and not updated.
2953 struct xrt_plane_detections_ext detections;
2954
2955 //! Corresponds to xrt_plane_detections_ext::locations, but with OpenXR types and transformed into target space.
2956 //! Enables two call idiom.
2957 XrPlaneDetectorLocationEXT *xr_locations;
2958
2959 //! A globally unique id for the current plane detection or 0, generated by the xrt_device.
2960 uint64_t detection_id;
2961};
2962#endif // OXR_HAVE_EXT_plane_detection
2963
2964#ifdef OXR_HAVE_EXT_future
2965/*!
2966 * EXT futures.
2967 *
2968 * Parent type/handle is @ref oxr_instance
2969 *
2970 * @obj{XrFutureEXT}
2971 * @extends oxr_handle_base
2972 */
2973struct oxr_future_ext
2974{
2975 //! Common structure for things referred to by OpenXR handles.
2976 struct oxr_handle_base handle;
2977
2978 //! (weak) reference to instance (may or not be a direct parent handle")
2979 struct oxr_instance *inst;
2980
2981 //! Owning session.
2982 struct oxr_session *sess;
2983
2984 //! xrt_future backing this future
2985 struct xrt_future *xft;
2986};
2987
2988/*!
2989 * To go back to a OpenXR object.
2990 *
2991 * @relates oxr_future_ext
2992 */
2993static inline XrFutureEXT
2994oxr_future_ext_to_openxr(struct oxr_future_ext *future_ext)
2995{
2996 return XRT_CAST_PTR_TO_OXR_HANDLE(XrFutureEXT, future_ext);
2997}
2998
2999XrResult
3000oxr_future_create(struct oxr_logger *log,
3001 struct oxr_session *sess,
3002 struct xrt_future *xft,
3003 struct oxr_handle_base *parent_handle,
3004 struct oxr_future_ext **out_oxr_future_ext);
3005
3006XrResult
3007oxr_future_invalidate(struct oxr_logger *log, struct oxr_future_ext *oxr_future);
3008
3009XrResult
3010oxr_future_ext_poll(struct oxr_logger *log, const struct oxr_future_ext *oxr_future, XrFuturePollResultEXT *pollResult);
3011
3012XrResult
3013oxr_future_ext_cancel(struct oxr_logger *log, struct oxr_future_ext *oxr_future);
3014
3015XrResult
3016oxr_future_ext_complete(struct oxr_logger *log,
3017 struct oxr_future_ext *oxr_future,
3018 struct xrt_future_result *out_ft_result);
3019
3020#endif
3021
3022#ifdef OXR_HAVE_EXT_user_presence
3023XrResult
3024oxr_event_push_XrEventDataUserPresenceChangedEXT(struct oxr_logger *log, struct oxr_session *sess, bool isUserPresent);
3025#endif // OXR_HAVE_EXT_user_presence
3026
3027/*!
3028 * @}
3029 */
3030
3031
3032#ifdef __cplusplus
3033}
3034#endif
void oxr_action_set_attachment_teardown(struct oxr_action_set_attachment *act_set_attached)
De-initialize an action set attachment and its action attachments.
Definition: oxr_input.c:224
static void oxr_refcounted_unref(struct oxr_refcounted *orc)
Decrease the reference count of orc, destroying it if it reaches 0.
Definition: oxr_objects.h:2464
XrResult oxr_poll_event(struct oxr_logger *log, struct oxr_instance *inst, XrEventDataBuffer *eventData)
Will return one event if available, also drain the sessions event queues.
Definition: oxr_event.c:400
XrResult oxr_spaces_locate(struct oxr_logger *log, struct oxr_space **spcs, uint32_t spc_count, struct oxr_space *baseSpc, XrTime time, XrSpaceLocations *locations)
Definition: oxr_space.c:295
XrResult oxr_session_begin(struct oxr_logger *log, struct oxr_session *sess, const XrSessionBeginInfo *beginInfo)
Definition: oxr_session.c:240
static XrSwapchain oxr_swapchain_to_openxr(struct oxr_swapchain *sc)
To go back to a OpenXR object.
Definition: oxr_objects.h:990
oxr_image_state
Tracks the state of a image that belongs to a oxr_swapchain.
Definition: oxr_defines.h:94
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:172
XrResult oxr_d3d_check_luid(struct oxr_logger *log, struct oxr_system *sys, LUID *adapter_luid)
Verify the provided LUID matches the expected one in sys.
Definition: oxr_d3d.cpp:80
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:603
XrResult oxr_session_hand_joints(struct oxr_logger *log, struct oxr_hand_tracker *hand_tracker, const XrHandJointsLocateInfoEXT *locateInfo, XrHandJointLocationsEXT *locations)
Definition: oxr_session.c:1346
void oxr_binding_find_bindings_from_act_key(struct oxr_logger *log, struct oxr_interaction_profile *profile, uint32_t key, size_t max_binding_count, struct oxr_binding **out_bindings, size_t *out_binding_count)
Find all bindings that is the given action key is bound to.
Definition: oxr_binding.c:512
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:197
XrResult oxr_event_remove_session_events(struct oxr_logger *log, struct oxr_session *sess)
This clears all pending events refers to the given session.
Definition: oxr_event.c:368
static XrResult oxr_session_success_result(struct oxr_session *session)
Returns XR_SUCCESS or XR_SESSION_LOSS_PENDING as appropriate.
Definition: oxr_objects.h:1929
XrResult oxr_action_get_pose_input(struct oxr_session *sess, uint32_t act_key, const struct oxr_subaction_paths *subaction_paths_ptr, struct oxr_action_input **out_input)
Find the pose input for the set of subaction_paths.
Definition: oxr_input.c:475
static XrResult oxr_session_success_focused_result(struct oxr_session *session)
Returns XR_SUCCESS, XR_SESSION_LOSS_PENDING, or XR_SESSION_NOT_FOCUSED, as appropriate.
Definition: oxr_objects.h:1944
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:199
XrResult oxr_space_xdev_pose_create(struct oxr_logger *log, struct oxr_session *sess, struct xrt_device *xdev, enum xrt_input_name name, const struct xrt_pose *pose, struct oxr_space **out_space)
Monado special space that always points to a specific xrt_device and pose, useful when you want to by...
Definition: oxr_space.c:242
void oxr_find_profile_for_device(struct oxr_logger *log, struct oxr_session *sess, struct xrt_device *xdev, struct oxr_interaction_profile **out_p)
Find the best matching profile for the given xrt_device.
Definition: oxr_binding.c:486
XrResult oxr_session_attach_action_sets(struct oxr_logger *log, struct oxr_session *sess, const XrSessionActionSetsAttachInfo *bindInfo)
Definition: oxr_input.c:1752
XRT_CHECK_RESULT XrResult oxr_space_locate_device(struct oxr_logger *log, struct xrt_device *xdev, struct oxr_space *baseSpc, XrTime time, struct xrt_space_relation *out_relation)
Locate the xrt_device in the given base space, useful for implementing hand tracking location look up...
Definition: oxr_space.c:585
static XrDebugUtilsMessengerEXT oxr_messenger_to_openxr(struct oxr_debug_messenger *mssngr)
To go back to a OpenXR object.
Definition: oxr_objects.h:1006
XrResult oxr_space_locate(struct oxr_logger *log, struct oxr_space *spc, struct oxr_space *baseSpc, XrTime time, XrSpaceLocation *location)
Definition: oxr_space.c:452
XrResult oxr_session_frame_end(struct oxr_logger *log, struct oxr_session *sess, const XrFrameEndInfo *frameEndInfo)
Definition: oxr_session_frame_end.c:1644
static XrInstance oxr_instance_to_openxr(struct oxr_instance *inst)
To go back to a OpenXR object.
Definition: oxr_objects.h:232
static XrHandTrackerEXT oxr_hand_tracker_to_openxr(struct oxr_hand_tracker *hand_tracker)
To go back to a OpenXR object.
Definition: oxr_objects.h:395
static XrActionSet oxr_action_set_to_openxr(struct oxr_action_set *act_set)
To go back to a OpenXR object.
Definition: oxr_objects.h:384
bool oxr_classify_subaction_paths(struct oxr_logger *log, const struct oxr_instance *inst, uint32_t subaction_path_count, const XrPath *subaction_paths, struct oxr_subaction_paths *subaction_paths_out)
Helper function to classify subaction_paths.
Definition: oxr_input.c:431
static bool oxr_subaction_paths_is_subset_of(const struct oxr_subaction_paths *a, const struct oxr_subaction_paths *b)
Helper function to determine if the set of paths in a is a subset of the paths in b.
Definition: oxr_objects.h:2115
static XrSession oxr_session_to_openxr(struct oxr_session *sess)
To go back to a OpenXR object.
Definition: oxr_objects.h:795
oxr_session_graphics_ext
What graphics API was this session created with.
Definition: oxr_defines.h:125
static XrAction oxr_action_to_openxr(struct oxr_action *act)
To go back to a OpenXR object.
Definition: oxr_objects.h:419
XrResult oxr_d3d_get_requirements(struct oxr_logger *log, struct oxr_system *sys, LUID *adapter_luid, D3D_FEATURE_LEVEL *min_feature_level)
Common GetRequirements call for D3D11 and D3D12.
Definition: oxr_d3d.cpp:42
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:90
oxr_space_type
Internal enum for the type of space, lets us reason about action spaces.
Definition: oxr_defines.h:106
XrResult oxr_vk_create_vulkan_instance(struct oxr_logger *log, struct oxr_system *sys, const XrVulkanInstanceCreateInfoKHR *createInfo, VkInstance *vulkanInstance, VkResult *vulkanResult)
Definition: oxr_vulkan.c:231
static void oxr_refcounted_ref(struct oxr_refcounted *orc)
Increase the reference count of orc.
Definition: oxr_objects.h:2455
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:675
XrResult oxr_session_request_exit(struct oxr_logger *log, struct oxr_session *sess)
Definition: oxr_session.c:398
XrResult(* oxr_handle_destroyer)(struct oxr_logger *log, struct oxr_handle_base *hb)
Function pointer type for a handle destruction function.
Definition: oxr_objects.h:146
void oxr_session_change_state(struct oxr_logger *log, struct oxr_session *sess, XrSessionState state, XrTime time)
Change the state of the session, queues a event.
Definition: oxr_session.c:190
XrResult oxr_system_fill_in(struct oxr_logger *log, struct oxr_instance *inst, XrSystemId systemId, uint32_t view_count, struct oxr_system *sys)
Definition: oxr_system.c:104
XrResult oxr_create_messenger(struct oxr_logger *, struct oxr_instance *inst, const XrDebugUtilsMessengerCreateInfoEXT *, struct oxr_debug_messenger **out_mssngr)
Definition: oxr_messenger.c:41
void oxr_session_binding_destroy_all(struct oxr_logger *log, struct oxr_session *sess)
Free all memory allocated by the binding system.
Definition: oxr_binding.c:683
XrResult oxr_path_get_string(struct oxr_logger *log, const 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:216
XrResult oxr_session_frame_wait(struct oxr_logger *log, struct oxr_session *sess, XrFrameState *frameState)
Definition: oxr_session.c:840
oxr_handle_state
State of a handle base, to reduce likelihood of going "boom" on out-of-order destruction or other uns...
Definition: oxr_defines.h:48
XrResult oxr_instance_create(struct oxr_logger *log, const XrInstanceCreateInfo *createInfo, XrVersion major_minor, const struct oxr_extension_status *extensions, struct oxr_instance **out_inst)
Creates a instance, does minimal validation of createInfo.
Definition: oxr_instance.c:227
static XrSpace oxr_space_to_openxr(struct oxr_space *spc)
To go back to a OpenXR object.
Definition: oxr_objects.h:912
oxr_subaction_path
Sub action paths.
Definition: oxr_defines.h:65
XrResult oxr_vk_create_vulkan_device(struct oxr_logger *log, struct oxr_system *sys, const XrVulkanDeviceCreateInfoKHR *createInfo, VkDevice *vulkanDevice, VkResult *vulkanResult)
Definition: oxr_vulkan.c:390
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:42
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:109
#define XRT_CAST_PTR_TO_OXR_HANDLE(HANDLE_TYPE, PTR)
Cast a pointer to an OpenXR handle in such a way as to avoid warnings.
Definition: oxr_objects.h:76
static XRT_CHECK_RESULT bool xrt_reference_dec_and_is_zero(struct xrt_reference *xref)
Decrement the reference and return true if the value is now zero.
Definition: xrt_defines.h:2233
#define XRT_SYSTEM_MAX_DEVICES
Maximum number of devices simultaneously usable by an implementation of xrt_system_devices.
Definition: xrt_system.h:141
#define XRT_MAX_SWAPCHAIN_IMAGES
Max swapchain images, artificial limit.
Definition: xrt_limits.h:34
xrt_input_name
Every internal input source known to monado with a baked in type.
Definition: xrt_defines.h:1335
static void xrt_reference_inc(struct xrt_reference *xref)
Increment the reference, probably want xrt_reference_inc_and_was_zero.
Definition: xrt_defines.h:2189
xrt_output_name
Name of a output with a baked in type.
Definition: xrt_defines.h:1965
xrt_plane_detector_flags_ext
Flags used when running plane detection.
Definition: xrt_plane_detector.h:46
Wrapper around OS threading native functions.
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:763
Shared internal defines and enums in the state tracker.
Macros for generating extension-related tables and code and inspecting Monado's extension support.
#define OXR_EXTENSION_SUPPORT_GENERATE(_)
Call this, passing a macro taking two parameters, to generate tables, code, etc.
Definition: oxr_extension_support.h:898
The objects that handle session running status and blocking of xrWaitFrame.
XrResult oxr_action_sync_data(struct oxr_logger *log, struct oxr_session *sess, uint32_t countActionSets, const XrActiveActionSet *actionSets, const XrActiveActionSetPrioritiesEXT *activePriorities)
Definition: oxr_input.c:1834
#define OXR_PATH_MEMBER(X)
Currently bound interaction profile.
Definition: oxr_objects.h:1888
Provides a utility macro for dealing with subaction paths.
#define OXR_FOR_EACH_SUBACTION_PATH(_)
Expansion macro (x-macro) that calls the macro you pass with the shorthand name of each subaction pat...
Definition: oxr_subaction.h:39
#define OXR_FOR_EACH_VALID_SUBACTION_PATH(_)
Expansion macro (x-macro) that calls the macro you pass with the shorthand name of each valid subacti...
Definition: oxr_subaction.h:23
Definition: m_space.cpp:87
A wrapper around a native mutex.
Definition: os_threading.h:55
Definition: os_time.h:208
Data associated with an Action that has been attached to a Session.
Definition: oxr_objects.h:2268
struct oxr_subaction_paths any_pose_subaction_path
For pose actions any subaction paths are special treated, at bind time we pick one subaction path and...
Definition: oxr_objects.h:2292
struct oxr_action_ref * act_ref
This action's refcounted data.
Definition: oxr_objects.h:2273
struct oxr_action_set_attachment * act_set_attached
The owning action set attachment.
Definition: oxr_objects.h:2270
uint32_t act_key
Unique key for the session hashmap.
Definition: oxr_objects.h:2284
struct oxr_session * sess
The corresponding session.
Definition: oxr_objects.h:2281
The set of inputs/outputs for a single sub-action path for an action.
Definition: oxr_objects.h:2246
A input action pair of a xrt_input and a xrt_device, along with the required transform.
Definition: oxr_objects.h:2207
A output action pair of a xrt_output_name and a xrt_device.
Definition: oxr_objects.h:2226
The reference-counted data of an action.
Definition: oxr_objects.h:2565
char name[XR_MAX_ACTION_NAME_SIZE]
Application supplied name of this action.
Definition: oxr_objects.h:2569
struct oxr_subaction_paths subaction_paths
Which sub action paths that this action was created with.
Definition: oxr_objects.h:2578
XrActionType action_type
Type this action was created with.
Definition: oxr_objects.h:2575
uint32_t act_key
Unique key for the session hashmap.
Definition: oxr_objects.h:2572
The data associated with the attachment of an Action Set (oxr_action_set) to as Session (oxr_session)...
Definition: oxr_objects.h:2139
struct oxr_action_attachment * act_attachments
An array of action attachments we own.
Definition: oxr_objects.h:2153
struct oxr_session * sess
Owning session.
Definition: oxr_objects.h:2141
struct oxr_action_set_ref * act_set_ref
Action set refcounted data.
Definition: oxr_objects.h:2144
uint32_t act_set_key
Unique key for the session hashmap.
Definition: oxr_objects.h:2147
size_t action_attachment_count
Length of oxr_action_set_attachment::act_attachments.
Definition: oxr_objects.h:2158
struct oxr_subaction_paths requested_subaction_paths
Which sub-action paths are requested on the latest sync.
Definition: oxr_objects.h:2150
The reference-counted data of an action set.
Definition: oxr_objects.h:2483
uint32_t act_set_key
Unique key for the session hashmap.
Definition: oxr_objects.h:2496
char name[XR_MAX_ACTION_SET_NAME_SIZE]
Application supplied name of this action.
Definition: oxr_objects.h:2487
bool ever_attached
Has this action set even been attached to any session, marking it as immutable.
Definition: oxr_objects.h:2493
uint32_t priority
Application supplied action set priority.
Definition: oxr_objects.h:2499
A group of actions.
Definition: oxr_objects.h:2525
struct u_hashset_item * name_item
The item in the name hashset.
Definition: oxr_objects.h:2547
struct u_hashset_item * loc_item
The item in the localized hashset.
Definition: oxr_objects.h:2550
struct oxr_action_set_ref * data
The data for this action set that must live as long as any session we are attached to.
Definition: oxr_objects.h:2536
uint32_t act_set_key
Unique key for the session hashmap.
Definition: oxr_objects.h:2544
struct oxr_handle_base handle
Common structure for things referred to by OpenXR handles.
Definition: oxr_objects.h:2527
struct oxr_instance * inst
Owner of this action set.
Definition: oxr_objects.h:2530
The state of a action input.
Definition: oxr_objects.h:2181
bool active
Is this active (bound and providing input)?
Definition: oxr_objects.h:2188
XrTime timestamp
When was this last changed.
Definition: oxr_objects.h:2194
A single action.
Definition: oxr_objects.h:2595
struct oxr_action_set * act_set
Owner of this action.
Definition: oxr_objects.h:2600
struct oxr_handle_base handle
Common structure for things referred to by OpenXR handles.
Definition: oxr_objects.h:2597
struct u_hashset_item * loc_item
The item in the localized hashset.
Definition: oxr_objects.h:2617
uint32_t act_key
Unique key for the session hashmap.
Definition: oxr_objects.h:2611
struct u_hashset_item * name_item
The item in the name hashset.
Definition: oxr_objects.h:2614
struct oxr_action_ref * data
The data for this action that must live as long as any session we are attached to.
Definition: oxr_objects.h:2604
Interaction profile binding state.
Definition: oxr_objects.h:2047
uint32_t * preferred_binding_path_index
store which entry in paths was suggested, for each action key
Definition: oxr_objects.h:2059
const char * localized_name
Name presented to the user.
Definition: oxr_objects.h:2052
Debug object created by the client program.
Definition: oxr_objects.h:2628
struct oxr_handle_base handle
Common structure for things referred to by OpenXR handles.
Definition: oxr_objects.h:2630
XrDebugUtilsMessageTypeFlagsEXT message_types
Types to submit to this messenger.
Definition: oxr_objects.h:2639
PFN_xrDebugUtilsMessengerCallbackEXT user_callback
Callback function.
Definition: oxr_objects.h:2642
struct oxr_instance * inst
Owner of this messenger.
Definition: oxr_objects.h:2633
void *XR_MAY_ALIAS user_data
Opaque user data.
Definition: oxr_objects.h:2645
XrDebugUtilsMessageSeverityFlagsEXT message_severities
Severities to submit to this messenger.
Definition: oxr_objects.h:2636
dpad binding extracted from XrInteractionProfileDpadBindingEXT
Definition: oxr_objects.h:1979
dpad emulation settings from oxr_interaction_profile
Definition: oxr_objects.h:2013
A entry in the dpad state for one action set.
Definition: oxr_objects.h:1990
dpad settings we need extracted from XrInteractionProfileDpadBindingEXT
Definition: oxr_objects.h:1967
Holds dpad binding state for a single interaction profile.
Definition: oxr_objects.h:2005
Definition: oxr_event.c:30
Structure tracking which extensions are enabled for a given instance.
Definition: oxr_objects.h:1660
Helper that handles synchronizing the xr{Wait,Begin,End}Frame calls.
Definition: oxr_frame_sync.h:36
A hand tracker.
Definition: oxr_objects.h:2680
struct oxr_session * sess
Owner of this hand tracker.
Definition: oxr_objects.h:2685
const struct oxr_hand_tracking_data_source * requested_sources[2]
An ordered list of requested data-source from above options (oxr_hand_tracker::[unobstructed|conformi...
Definition: oxr_objects.h:2698
struct oxr_handle_base handle
Common structure for things referred to by OpenXR handles.
Definition: oxr_objects.h:2682
Definition: oxr_objects.h:2649
enum xrt_input_name input_name
the input name associated with this hand tracker
Definition: oxr_objects.h:2654
struct xrt_device * xdev
xrt_device backing this hand tracker
Definition: oxr_objects.h:2651
Used to hold diverse child handles and ensure orderly destruction.
Definition: oxr_objects.h:1451
struct oxr_handle_base * parent
Pointer to this object's parent handle holder, if any.
Definition: oxr_objects.h:1458
uint64_t debug
Magic (per-handle-type) value for debugging.
Definition: oxr_objects.h:1453
struct oxr_handle_base * children[256]
Array of children, if any.
Definition: oxr_objects.h:1463
enum oxr_handle_state state
Current handle state.
Definition: oxr_objects.h:1468
oxr_handle_destroyer destroy
Destroy the object this handle refers to.
Definition: oxr_objects.h:1473
Variant type for input transforms.
Definition: oxr_input_transform.h:144
Main object that ties everything together.
Definition: oxr_objects.h:1673
bool parallel_views
For applications that rely on views being parallel, notably some OpenVR games with OpenComposite.
Definition: oxr_objects.h:1760
size_t path_num
Number of paths in the array (0 is always null).
Definition: oxr_objects.h:1709
bool disable_vulkan_format_depth_stencil
Unreal has a bug in the VulkanRHI backend.
Definition: oxr_objects.h:1749
XrVersion major_minor
Stores only major.minor version. Simplifies comparisons for e.g. "at least OpenXR 1....
Definition: oxr_objects.h:1688
bool skip_end_session
Unreal 4 has a bug calling xrEndSession; the function should just exit.
Definition: oxr_objects.h:1751
struct oxr_path ** path_array
Mapping from ID to path.
Definition: oxr_objects.h:1705
bool no_validation_error_in_create_ref_space
Return XR_ERROR_REFERENCE_SPACE_UNSUPPORTED instead of XR_ERROR_VALIDATION_FAILURE in xrCreateReferen...
Definition: oxr_objects.h:1757
size_t path_array_length
Total length of path array.
Definition: oxr_objects.h:1707
struct oxr_extension_status extensions
Enabled extensions.
Definition: oxr_objects.h:1682
struct oxr_debug_messenger * messengers[256]
Debug messengers.
Definition: oxr_objects.h:1767
struct u_hashset * path_store
Path store, for looking up paths.
Definition: oxr_objects.h:1703
bool map_stage_to_local_floor
For applications that use stage and don't offer recentering.
Definition: oxr_objects.h:1763
struct oxr_instance::@283 openxr_version
The OpenXR version requested in the app info. It determines the instance's OpenXR version.
struct oxr_interaction_profile ** profiles
Interaction profile bindings that have been suggested by the client.
Definition: oxr_objects.h:1720
struct oxr_handle_base handle
Common structure for things referred to by OpenXR handles.
Definition: oxr_objects.h:1675
A single interaction profile.
Definition: oxr_objects.h:2025
enum xrt_device_name xname
Used to lookup xrt_binding_profile for fallback.
Definition: oxr_objects.h:2029
const char * localized_name
Name presented to the user.
Definition: oxr_objects.h:2032
Logger struct that lives on the stack, one for each call client call.
Definition: oxr_logger.h:40
Internal representation of a path, item follows this struct in memory and that in turn is followed by...
Definition: oxr_path.c:28
Definition: oxr_objects.h:2445
void(* destroy)(struct oxr_refcounted *)
Destruction callback.
Definition: oxr_objects.h:2448
Object that client program interact with.
Definition: oxr_objects.h:1792
struct u_hashmap_int * act_attachments_by_key
A map of action key to action attachment.
Definition: oxr_objects.h:1874
XrResult(* create_swapchain)(struct oxr_logger *, struct oxr_session *sess, const XrSwapchainCreateInfo *, struct oxr_swapchain **)
To pipe swapchain creation to right code.
Definition: oxr_objects.h:1911
struct xrt_compositor_native * xcn
Native compositor that is wrapped by client compositors.
Definition: oxr_objects.h:1804
struct xrt_space_relation local_space_pure_relation
initial relation of head in "global" space.
Definition: oxr_objects.h:1918
struct xrt_session * xs
The xrt_session backing this session.
Definition: oxr_objects.h:1801
struct oxr_action_set_attachment * act_set_attachments
An array of action set attachments that this session owns.
Definition: oxr_objects.h:1848
uint32_t frame_timing_wait_sleep_ms
Extra sleep in wait frame.
Definition: oxr_objects.h:1906
struct os_precise_sleeper sleeper
Used to implement precise extra sleeping in wait frame.
Definition: oxr_objects.h:1840
enum oxr_session_graphics_ext gfx_ext
What graphics type was this session created with.
Definition: oxr_objects.h:1798
size_t profiles_on_attachment_size
Clone of all suggested binding profiles at the point of action set/session attachment.
Definition: oxr_objects.h:1880
bool has_ended_once
There is a extra state between xrBeginSession has been called and the first xrEndFrame has been calle...
Definition: oxr_objects.h:1816
struct u_hashmap_int * act_sets_attachments_by_key
A map of action set key to action set attachments.
Definition: oxr_objects.h:1862
struct oxr_handle_base handle
Common structure for things referred to by OpenXR handles.
Definition: oxr_objects.h:1794
float ipd_meters
IPD, to be expanded to a proper 3D relation.
Definition: oxr_objects.h:1898
size_t action_set_attachment_count
Length of oxr_session::act_set_attachments.
Definition: oxr_objects.h:1853
bool frame_timing_spew
Frame timing debug output.
Definition: oxr_objects.h:1903
Can be one of several reference space types, or a space that is bound to an action.
Definition: oxr_objects.h:2340
struct oxr_subaction_paths subaction_paths
Which sub action path is this?
Definition: oxr_objects.h:2357
enum oxr_space_type space_type
What kind of space is this?
Definition: oxr_objects.h:2354
uint32_t act_key
Action key from which action this space was created from.
Definition: oxr_objects.h:2351
struct xrt_pose pose
Pose that was given during creation.
Definition: oxr_objects.h:2348
struct oxr_session * sess
Owner of this space.
Definition: oxr_objects.h:2345
struct oxr_handle_base handle
Common structure for things referred to by OpenXR handles.
Definition: oxr_objects.h:2342
A parsed equivalent of a list of sub-action paths.
Definition: oxr_objects.h:2102
A set of images used for rendering.
Definition: oxr_objects.h:2381
struct oxr_session * sess
Owner of this swapchain.
Definition: oxr_objects.h:2386
uint32_t face_count
The number of cubemap faces. 6 for cubemaps, 1 otherwise.
Definition: oxr_objects.h:2398
struct xrt_swapchain * swapchain
Compositor swapchain.
Definition: oxr_objects.h:2389
struct oxr_handle_base handle
Common structure for things referred to by OpenXR handles.
Definition: oxr_objects.h:2383
uint32_t width
Swapchain size.
Definition: oxr_objects.h:2392
uint32_t array_layer_count
For 1 is 2D texture, greater then 1 2D array texture.
Definition: oxr_objects.h:2395
Single or multiple devices grouped together to form a system that sessions can be created from.
Definition: oxr_objects.h:1488
struct xrt_system * xsys
The XRT interfaces level system.
Definition: oxr_objects.h:1492
VkPhysicalDevice suggested_vulkan_physical_device
The device returned with the last xrGetVulkanGraphicsDeviceKHR or xrGetVulkanGraphicsDevice2KHR call.
Definition: oxr_objects.h:1531
struct xrt_system_devices * xsysd
System devices used in all session types.
Definition: oxr_objects.h:1495
struct xrt_space_overseer * xso
Space overseer used in all session types.
Definition: oxr_objects.h:1498
VkInstance vulkan_enable2_instance
The instance/device we create when vulkan_enable2 is used.
Definition: oxr_objects.h:1528
bool gotten_requirements
Have the client application called the gfx api requirements func?
Definition: oxr_objects.h:1506
struct xrt_system_compositor * xsysc
System compositor, used to create session compositors.
Definition: oxr_objects.h:1501
struct xrt_system_roles dynamic_roles_cache
Cache of the last known system roles, see xrt_system_roles::generation_id.
Definition: oxr_objects.h:1517
Time-keeping state structure.
Definition: u_time.cpp:30
A simple uint64_t key to a void pointer hashmap.
Definition: u_hashmap.cpp:24
A embeddable hashset item, note that the string directly follows the u_hashset_item.
Definition: u_hashset.h:37
Kind of bespoke hashset implementation, where the user is responsible for allocating and freeing the ...
Definition: u_hashset.cpp:26
Definition: u_index_fifo.h:21
Definition: xrt_defines.h:1948
Main compositor server interface.
Definition: xrt_compositor.h:2235
Common compositor client interface/base.
Definition: xrt_compositor.h:999
A single HMD or input device.
Definition: xrt_device.h:284
enum xrt_device_name name
Enum identifier of the device.
Definition: xrt_device.h:286
The (future) result of an asynchronous operation.
Definition: xrt_future.h:38
A future is a concurrency primitive that provides a mechanism to access results of asynchronous opera...
Definition: xrt_future.h:74
A single named input, that sits on a xrt_device.
Definition: xrt_device.h:165
This interface acts as a root object for Monado.
Definition: xrt_instance.h:118
A single named output, that sits on a xrt_device.
Definition: xrt_device.h:183
Each plane has n polygons; ultimately plane metadata from locations and vetices is reconstructed.
Definition: xrt_plane_detector.h:171
A pose composed of a position and orientation.
Definition: xrt_defines.h:478
A base class for reference counted objects.
Definition: xrt_defines.h:98
The XRT representation of XrSession, this object does not have all of the functionality of a session,...
Definition: xrt_session.h:259
Object that oversees and manages spaces, one created for each XR system.
Definition: xrt_space.h:96
A relation with two spaces, includes velocity and acceleration.
Definition: xrt_defines.h:669
A space very similar to a OpenXR XrSpace but not a full one-to-one mapping, but used to power XrSpace...
Definition: xrt_space.h:31
Common swapchain interface/base.
Definition: xrt_compositor.h:539
The system compositor handles composition for a system.
Definition: xrt_compositor.h:2428
A collection of xrt_device, and an interface for identifying the roles they have been assigned.
Definition: xrt_system.h:221
struct xrt_system_devices::@258::@259 hand_tracking
Devices providing optical (or otherwise more directly measured than from controller estimation) hand ...
struct xrt_device * head
An observing pointer to the device serving as the "head" (and HMD).
Definition: xrt_system.h:250
struct xrt_device * face
An observing pointer to the device providing face tracking (optional).
Definition: xrt_system.h:262
struct xrt_device * eyes
An observing pointer to the device providing eye tracking (optional).
Definition: xrt_system.h:256
struct xrt_system_devices::@258 static_roles
Observing pointers for devices in some static (unchangeable) roles.
struct xrt_device * left
An observing pointer to the device providing unobstructed hand-tracking for the left hand (optional).
Definition: xrt_system.h:285
struct xrt_device * right
An observing pointer to the device providing unobstructed hand-tracking for the right hand (optional)...
Definition: xrt_system.h:294
struct xrt_device * body
An observing pointer to the device providing body tracking (optional).
Definition: xrt_system.h:268
Data associating a device index (in xrt_system_devices::xdevs) with a given "role" for dynamic role s...
Definition: xrt_system.h:161
A system is a collection of devices, policies and optionally a compositor that is organised into a ch...
Definition: xrt_system.h:62
Visibility mask helper, the indices and vertices are tightly packed after this struct.
Definition: xrt_visibility_mask.h:25
Misc helpers for device drivers.
Hashmap for integer values header.
Hashset struct header.
A FIFO for indices.
A union of all input types.
Definition: xrt_defines.h:1450
Header holding Android-specific details.
xrt_android_lifecycle_event
Distinguishes the possible Android lifecycle events from each other.
Definition: xrt_android.h:32
Header declaring XRT graphics interfaces.
Auto detect OS and certain features.
xrt_perf_notify_level
Performance level.
Definition: xrt_defines.h:2143
xrt_device_name
A enum that is used to name devices so that the state trackers can reason about the devices easier.
Definition: xrt_defines.h:723
xrt_perf_domain
Domain type.
Definition: xrt_defines.h:2116
Header defining an xrt display or controller device.
Interface for creating futures.
Header for limits of the XRT interfaces.
Include all of the openxr headers in one place.
Header defining xrt space and space overseer.
Header for system objects.
Header defining the tracking system integration in Monado.
Include all of the Vulkan headers in one place, and cope with any "messy" includes implied by it.