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