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