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