Monado OpenXR Runtime
Loading...
Searching...
No Matches
oxr_objects.h
Go to the documentation of this file.
1// Copyright 2018-2024, Collabora, Ltd.
2// Copyright 2023-2026, 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
33#include "oxr_extension_support.h"
34#include "oxr_defines.h"
35#include "oxr_frame_sync.h"
37
38#include "path/oxr_path_store.h"
39
45
46
47#if defined(XRT_HAVE_D3D11) || defined(XRT_HAVE_D3D12)
48#include <dxgi.h>
49#include <d3dcommon.h>
50#endif
51
52#ifdef XRT_FEATURE_RENDERDOC
53#include "renderdoc_app.h"
54#ifndef XRT_OS_WINDOWS
55#include <dlfcn.h>
56#endif // !XRT_OS_WINDOWS
57#endif // XRT_FEATURE_RENDERDOC
58
59#ifdef XRT_OS_ANDROID
60#include "xrt/xrt_android.h"
61#endif // #ifdef XRT_OS_ANDROID
62
63#ifdef __cplusplus
64extern "C" {
65#endif
66
67
68/*!
69 * @defgroup oxr OpenXR state tracker
70 *
71 * Client application facing code.
72 *
73 * @ingroup xrt
74 */
75
76/*!
77 * @brief Cast a pointer to an OpenXR handle in such a way as to avoid warnings.
78 *
79 * Avoids -Wpointer-to-int-cast by first casting to the same size int, then
80 * promoting to the 64-bit int, then casting to the handle type. That's a lot of
81 * no-ops on 64-bit, but a widening conversion on 32-bit.
82 *
83 * @ingroup oxr
84 */
85#define XRT_CAST_PTR_TO_OXR_HANDLE(HANDLE_TYPE, PTR) ((HANDLE_TYPE)(uint64_t)(uintptr_t)(PTR))
86
87/*!
88 * @brief Cast an OpenXR handle to a pointer in such a way as to avoid warnings.
89 *
90 * Avoids -Wint-to-pointer-cast by first casting to a 64-bit int, then to a
91 * pointer-sized int, then to the desired pointer type. That's a lot of no-ops
92 * on 64-bit, but a narrowing (!) conversion on 32-bit.
93 *
94 * @ingroup oxr
95 */
96#define XRT_CAST_OXR_HANDLE_TO_PTR(PTR_TYPE, HANDLE) ((PTR_TYPE)(uintptr_t)(uint64_t)(HANDLE))
97
98/*!
99 * @defgroup oxr_main OpenXR main code
100 *
101 * Gets called from @ref oxr_api functions and talks to devices and
102 * @ref comp using @ref xrt_iface.
103 *
104 * @ingroup oxr
105 * @{
106 */
107
108
109#define XRT_MAX_HANDLE_CHILDREN 256
110#define OXR_MAX_BINDINGS_PER_ACTION 32
111
112/*!
113 * Function pointer type for a handle destruction function.
114 *
115 * @relates oxr_handle_base
116 */
117typedef XrResult (*oxr_handle_destroyer)(struct oxr_logger *log, struct oxr_handle_base *hb);
118
119
120
121/*
122 *
123 * Helpers
124 *
125 */
126
127/*!
128 * Safely copy an xrt_pose to an XrPosef.
129 */
130#define OXR_XRT_POSE_TO_XRPOSEF(FROM, TO) \
131 do { \
132 union { \
133 struct xrt_pose xrt; \
134 XrPosef oxr; \
135 } safe_copy = {FROM}; \
136 TO = safe_copy.oxr; \
137 } while (false)
138
139/*!
140 * Safely copy an xrt_fov to an XrFovf.
141 */
142#define OXR_XRT_FOV_TO_XRFOVF(FROM, TO) \
143 do { \
144 union { \
145 struct xrt_fov xrt; \
146 XrFovf oxr; \
147 } safe_copy = {FROM}; \
148 TO = safe_copy.oxr; \
149 } while (false)
150
151
152static inline const char *
153xr_action_type_to_str(XrActionType type)
154{
155 // clang-format off
156 switch (type) {
157 #define PRINT(name, value) \
158 case name: return #name;
159 XR_LIST_ENUM_XrActionType(PRINT)
160 #undef PRINT
161 default: return "XR_ACTION_TYPE_UNKNOWN";
162 }
163 // clang-format on
164}
165
166/*
167 *
168 * oxr_handle_base.c
169 *
170 */
171
172/*!
173 * Destroy the handle's object, as well as all child handles recursively.
174 *
175 * This should be how all handle-associated objects are destroyed.
176 *
177 * @public @memberof oxr_handle_base
178 */
179XrResult
180oxr_handle_destroy(struct oxr_logger *log, struct oxr_handle_base *hb);
181
182/*!
183 * Returns a human-readable label for a handle state.
184 *
185 * @relates oxr_handle_base
186 */
187const char *
189
190/*!
191 *
192 * @name oxr_instance.c
193 * @{
194 *
195 */
196
197/*!
198 * To go back to a OpenXR object.
199 *
200 * @relates oxr_instance
201 */
202static inline XrInstance
204{
205 return XRT_CAST_PTR_TO_OXR_HANDLE(XrInstance, inst);
206}
207
208/*!
209 * Creates a instance, does minimal validation of @p createInfo.
210 *
211 * @param[in] log Logger
212 * @param[in] createInfo OpenXR creation info.
213 * @param[in] extensions Parsed extension list to be enabled.
214 * @param[out] out_inst Pointer to pointer to a instance, returned instance.
215 *
216 * @public @static @memberof oxr_instance
217 */
218XrResult
220 const XrInstanceCreateInfo *createInfo,
221 XrVersion major_minor,
222 const struct oxr_extension_status *extensions,
223 struct oxr_instance **out_inst);
224
225/*!
226 * Must be called with oxr_instance::system_init_lock held.
227 *
228 * @public @memberof oxr_instance
229 */
230XrResult
231oxr_instance_init_system_locked(struct oxr_logger *log, struct oxr_instance *inst);
232
233/*!
234 * @public @memberof oxr_instance
235 */
236XrResult
237oxr_instance_get_properties(struct oxr_logger *log,
238 struct oxr_instance *inst,
239 XrInstanceProperties *instanceProperties);
240
241#if XR_USE_TIMESPEC
242
243/*!
244 * @public @memberof oxr_instance
245 */
246XrResult
247oxr_instance_convert_time_to_timespec(struct oxr_logger *log,
248 struct oxr_instance *inst,
249 XrTime time,
250 struct timespec *timespecTime);
251
252/*!
253 * @public @memberof oxr_instance
254 */
255XrResult
256oxr_instance_convert_timespec_to_time(struct oxr_logger *log,
257 struct oxr_instance *inst,
258 const struct timespec *timespecTime,
259 XrTime *time);
260#endif // XR_USE_TIMESPEC
261
262#ifdef XR_USE_PLATFORM_WIN32
263
264/*!
265 * @public @memberof oxr_instance
266 */
267XrResult
268oxr_instance_convert_time_to_win32perfcounter(struct oxr_logger *log,
269 struct oxr_instance *inst,
270 XrTime time,
271 LARGE_INTEGER *win32perfcounterTime);
272
273/*!
274 * @public @memberof oxr_instance
275 */
276XrResult
277oxr_instance_convert_win32perfcounter_to_time(struct oxr_logger *log,
278 struct oxr_instance *inst,
279 const LARGE_INTEGER *win32perfcounterTime,
280 XrTime *time);
281
282#endif // XR_USE_PLATFORM_WIN32
283
284/*!
285 * @}
286 */
287
288/*!
289 * To go back to a OpenXR object.
290 *
291 * @relates oxr_action_set
292 */
293static inline XrActionSet
295{
296 return XRT_CAST_PTR_TO_OXR_HANDLE(XrActionSet, act_set);
297}
298
299/*!
300 * To go back to a OpenXR object.
301 *
302 * @relates oxr_hand_tracker
303 */
304static inline XrHandTrackerEXT
306{
307 return XRT_CAST_PTR_TO_OXR_HANDLE(XrHandTrackerEXT, hand_tracker);
308}
309
310#ifdef OXR_HAVE_EXT_plane_detection
311/*!
312 * To go back to a OpenXR object.
313 *
314 * @relates oxr_plane_detector
315 */
316static inline XrPlaneDetectorEXT
317oxr_plane_detector_to_openxr(struct oxr_plane_detector_ext *plane_detector)
318{
319 return XRT_CAST_PTR_TO_OXR_HANDLE(XrPlaneDetectorEXT, plane_detector);
320}
321#endif // OXR_HAVE_EXT_plane_detection
322
323/*!
324 * To go back to a OpenXR object.
325 *
326 * @relates oxr_action
327 */
328static inline XrAction
330{
331 return XRT_CAST_PTR_TO_OXR_HANDLE(XrAction, act);
332}
333
334#ifdef OXR_HAVE_HTC_facial_tracking
335/*!
336 * To go back to a OpenXR object.
337 *
338 * @relates oxr_facial_tracker_htc
339 */
340static inline XrFacialTrackerHTC
341oxr_facial_tracker_htc_to_openxr(struct oxr_facial_tracker_htc *face_tracker_htc)
342{
343 return XRT_CAST_PTR_TO_OXR_HANDLE(XrFacialTrackerHTC, face_tracker_htc);
344}
345#endif
346
347#ifdef OXR_HAVE_FB_body_tracking
348/*!
349 * To go back to a OpenXR object.
350 *
351 * @relates oxr_facial_tracker_htc
352 */
353static inline XrBodyTrackerFB
354oxr_body_tracker_fb_to_openxr(struct oxr_body_tracker_fb *body_tracker_fb)
355{
356 return XRT_CAST_PTR_TO_OXR_HANDLE(XrBodyTrackerFB, body_tracker_fb);
357}
358#endif
359
360#ifdef OXR_HAVE_BD_body_tracking
361/*!
362 * To go back to a OpenXR object.
363 *
364 * @relates oxr_body_tracker_bd
365 */
366static inline XrBodyTrackerBD
367oxr_body_tracker_bd_to_openxr(struct oxr_body_tracker_bd *body_tracker_bd)
368{
369 return XRT_CAST_PTR_TO_OXR_HANDLE(XrBodyTrackerBD, body_tracker_bd);
370}
371#endif
372
373#ifdef OXR_HAVE_FB_face_tracking2
374/*!
375 * To go back to a OpenXR object.
376 *
377 * @relates oxr_face_tracker2_fb
378 */
379static inline XrFaceTracker2FB
380oxr_face_tracker2_fb_to_openxr(struct oxr_face_tracker2_fb *face_tracker2_fb)
381{
382 return XRT_CAST_PTR_TO_OXR_HANDLE(XrFaceTracker2FB, face_tracker2_fb);
383}
384#endif
385
386#ifdef OXR_HAVE_ANDROID_face_tracking
387/*!
388 * To go back to a OpenXR object.
389 *
390 * @relates oxr_facial_tracker_htc
391 */
392static inline XrFaceTrackerANDROID
393oxr_face_tracker_android_to_openxr(struct oxr_face_tracker_android *face_tracker_android)
394{
395 return XRT_CAST_PTR_TO_OXR_HANDLE(XrFaceTrackerANDROID, face_tracker_android);
396}
397#endif
398
399/*!
400 *
401 * @name oxr_session.c
402 * @{
403 *
404 */
405
406/*!
407 * To go back to a OpenXR object.
408 *
409 * @relates oxr_session
410 */
411static inline XrSession
413{
414 return XRT_CAST_PTR_TO_OXR_HANDLE(XrSession, sess);
415}
416
417XrResult
418oxr_session_create(struct oxr_logger *log,
419 struct oxr_system *sys,
420 const XrSessionCreateInfo *createInfo,
421 struct oxr_session **out_session);
422
423XrResult
424oxr_session_enumerate_formats(struct oxr_logger *log,
425 struct oxr_session *sess,
426 uint32_t formatCapacityInput,
427 uint32_t *formatCountOutput,
428 int64_t *formats);
429
430/*!
431 * Change the state of the session, queues a event.
432 */
433void
434oxr_session_change_state(struct oxr_logger *log, struct oxr_session *sess, XrSessionState state, XrTime time);
435
436XrResult
437oxr_session_begin(struct oxr_logger *log, struct oxr_session *sess, const XrSessionBeginInfo *beginInfo);
438
439XrResult
440oxr_session_end(struct oxr_logger *log, struct oxr_session *sess);
441
442XrResult
443oxr_session_request_exit(struct oxr_logger *log, struct oxr_session *sess);
444
445XRT_CHECK_RESULT XrResult
446oxr_session_poll(struct oxr_logger *log, struct oxr_session *sess);
447
448XrResult
449oxr_session_locate_views(struct oxr_logger *log,
450 struct oxr_session *sess,
451 const XrViewLocateInfo *viewLocateInfo,
452 XrViewState *viewState,
453 uint32_t viewCapacityInput,
454 uint32_t *viewCountOutput,
455 XrView *views);
456
457XrResult
458oxr_session_frame_wait(struct oxr_logger *log, struct oxr_session *sess, XrFrameState *frameState);
459
460XrResult
461oxr_session_frame_begin(struct oxr_logger *log, struct oxr_session *sess);
462
463XrResult
464oxr_session_frame_end(struct oxr_logger *log, struct oxr_session *sess, const XrFrameEndInfo *frameEndInfo);
465
466/*
467 * Gets the body pose in the base space.
468 */
469XrResult
470oxr_get_base_body_pose(struct oxr_logger *log,
471 const struct xrt_body_joint_set *body_joint_set,
472 struct oxr_space *base_spc,
473 struct xrt_device *body_xdev,
474 XrTime at_time,
475 struct xrt_space_relation *out_base_body);
476
477#ifdef OXR_HAVE_KHR_android_thread_settings
478XrResult
479oxr_session_android_thread_settings(struct oxr_logger *log,
480 struct oxr_session *sess,
481 XrAndroidThreadTypeKHR threadType,
482 uint32_t threadId);
483#endif // OXR_HAVE_KHR_android_thread_settings
484
485#ifdef OXR_HAVE_KHR_visibility_mask
486XrResult
487oxr_session_get_visibility_mask(struct oxr_logger *log,
488 struct oxr_session *session,
489 XrVisibilityMaskTypeKHR visibilityMaskType,
490 uint32_t viewIndex,
491 XrVisibilityMaskKHR *visibilityMask);
492
493XrResult
494oxr_event_push_XrEventDataVisibilityMaskChangedKHR(struct oxr_logger *log,
495 struct oxr_session *sess,
496 XrViewConfigurationType viewConfigurationType,
497 uint32_t viewIndex);
498#endif // OXR_HAVE_KHR_visibility_mask
499
500#ifdef OXR_HAVE_EXT_performance_settings
501XrResult
502oxr_session_set_perf_level(struct oxr_logger *log,
503 struct oxr_session *sess,
504 XrPerfSettingsDomainEXT domain,
505 XrPerfSettingsLevelEXT level);
506#endif // OXR_HAVE_EXT_performance_settings
507
508/*
509 *
510 * oxr_space.c
511 *
512 */
513
514/*!
515 * To go back to a OpenXR object.
516 */
517static inline XrSpace
519{
520 return XRT_CAST_PTR_TO_OXR_HANDLE(XrSpace, spc);
521}
522
523XrResult
524oxr_space_action_create(struct oxr_logger *log,
525 struct oxr_session *sess,
526 uint32_t key,
527 const XrActionSpaceCreateInfo *createInfo,
528 struct oxr_space **out_space);
529
530XrResult
531oxr_space_get_reference_bounds_rect(struct oxr_logger *log,
532 struct oxr_session *sess,
533 XrReferenceSpaceType referenceSpaceType,
534 XrExtent2Df *bounds);
535
536XrResult
537oxr_space_reference_create(struct oxr_logger *log,
538 struct oxr_session *sess,
539 const XrReferenceSpaceCreateInfo *createInfo,
540 struct oxr_space **out_space);
541
542/*!
543 * Monado special space that always points to a specific @ref xrt_device and
544 * pose, useful when you want to bypass the action binding system for instance.
545 */
546XrResult
548 struct oxr_session *sess,
549 struct xrt_device *xdev,
550 enum xrt_input_name name,
551 const struct xrt_pose *pose,
552 struct oxr_space **out_space);
553
554XrResult
556 struct oxr_logger *log, struct oxr_space *spc, struct oxr_space *baseSpc, XrTime time, XrSpaceLocation *location);
557
558XrResult
559oxr_spaces_locate(struct oxr_logger *log,
560 struct oxr_space **spcs,
561 uint32_t spc_count,
562 struct oxr_space *baseSpc,
563 XrTime time,
564 XrSpaceLocations *locations);
565
566/*!
567 * Locate the @ref xrt_device in the given base space, useful for implementing
568 * hand tracking location look ups and the like.
569 *
570 * @param log Logging struct.
571 * @param xdev Device to locate in the base space.
572 * @param baseSpc Base space where the device is to be located.
573 * @param[in] time Time in OpenXR domain.
574 * @param[out] out_relation Returns T_base_xdev, aka xdev in base space.
575 *
576 * @return Any errors, XR_SUCCESS, pose might not be valid on XR_SUCCESS.
577 */
578XRT_CHECK_RESULT XrResult
580 struct xrt_device *xdev,
581 struct oxr_space *baseSpc,
582 XrTime time,
583 struct xrt_space_relation *out_relation);
584
585/*!
586 * Get the xrt_space associated with this oxr_space, the @ref xrt_space will
587 * be reference counted by this function so the caller will need to call
588 * @ref xrt_space_reference to decrement the reference count.
589 *
590 * @param log Logging struct.
591 * @param spc Oxr space to get the xrt_space from.
592 * @param[out] out_xspace Returns the xrt_space associated with this oxr_space.
593 * @return Any errors, XR_SUCCESS, xspace is not set on XR_ERROR_*.
594 */
595XRT_CHECK_RESULT XrResult
596oxr_space_get_xrt_space(struct oxr_logger *log, struct oxr_space *spc, struct xrt_space **out_xspace);
597
598
599/*
600 *
601 * oxr_swapchain.c
602 *
603 */
604
605/*!
606 * To go back to a OpenXR object.
607 */
608static inline XrSwapchain
610{
611 return XRT_CAST_PTR_TO_OXR_HANDLE(XrSwapchain, sc);
612}
613
614
615/*
616 *
617 * oxr_messenger.c
618 *
619 */
620
621/*!
622 * To go back to a OpenXR object.
623 */
624static inline XrDebugUtilsMessengerEXT
626{
627 return XRT_CAST_PTR_TO_OXR_HANDLE(XrDebugUtilsMessengerEXT, mssngr);
628}
629
630XrResult
632 struct oxr_instance *inst,
633 const XrDebugUtilsMessengerCreateInfoEXT *,
634 struct oxr_debug_messenger **out_mssngr);
635XrResult
636oxr_destroy_messenger(struct oxr_logger *log, struct oxr_debug_messenger *mssngr);
637
638
639/*
640 *
641 * oxr_system.c
642 *
643 */
644
645XrResult
646oxr_system_select(struct oxr_logger *log,
647 struct oxr_system **systems,
648 uint32_t system_count,
649 XrFormFactor form_factor,
650 struct oxr_system **out_selected);
651
652XrResult
654 struct oxr_instance *inst,
655 XrSystemId systemId,
656 uint32_t view_count,
657 struct oxr_system *sys);
658
659XrResult
660oxr_system_verify_id(struct oxr_logger *log, const struct oxr_instance *inst, XrSystemId systemId);
661
662XrResult
663oxr_system_get_by_id(struct oxr_logger *log,
664 struct oxr_instance *inst,
665 XrSystemId systemId,
666 struct oxr_system **system);
667
668XrResult
669oxr_system_get_properties(struct oxr_logger *log, struct oxr_system *sys, XrSystemProperties *properties);
670
671XrResult
672oxr_system_enumerate_view_confs(struct oxr_logger *log,
673 struct oxr_system *sys,
674 uint32_t viewConfigurationTypeCapacityInput,
675 uint32_t *viewConfigurationTypeCountOutput,
676 XrViewConfigurationType *viewConfigurationTypes);
677
678XrResult
679oxr_system_enumerate_blend_modes(struct oxr_logger *log,
680 struct oxr_system *sys,
681 XrViewConfigurationType viewConfigurationType,
682 uint32_t environmentBlendModeCapacityInput,
683 uint32_t *environmentBlendModeCountOutput,
684 XrEnvironmentBlendMode *environmentBlendModes);
685
686XrResult
687oxr_system_get_view_conf_properties(struct oxr_logger *log,
688 struct oxr_system *sys,
689 XrViewConfigurationType viewConfigurationType,
690 XrViewConfigurationProperties *configurationProperties);
691
692XrResult
693oxr_system_enumerate_view_conf_views(struct oxr_logger *log,
694 struct oxr_system *sys,
695 XrViewConfigurationType viewConfigurationType,
696 uint32_t viewCapacityInput,
697 uint32_t *viewCountOutput,
698 XrViewConfigurationView *views);
699
700bool
701oxr_system_get_hand_tracking_support(struct oxr_logger *log, struct oxr_instance *inst);
702
703bool
704oxr_system_get_eye_gaze_support(struct oxr_logger *log, struct oxr_instance *inst);
705
706bool
707oxr_system_get_force_feedback_support(struct oxr_logger *log, struct oxr_instance *inst);
708
709void
710oxr_system_get_face_tracking_android_support(struct oxr_logger *log, struct oxr_instance *inst, bool *supported);
711
712void
713oxr_system_get_face_tracking_htc_support(struct oxr_logger *log,
714 struct oxr_instance *inst,
715 bool *supports_eye,
716 bool *supports_lip);
717
718void
719oxr_system_get_face_tracking2_fb_support(struct oxr_logger *log,
720 struct oxr_instance *inst,
721 bool *supports_audio,
722 bool *supports_visual);
723
724bool
725oxr_system_get_body_tracking_fb_support(struct oxr_logger *log, struct oxr_instance *inst);
726
727bool
728oxr_system_get_full_body_tracking_meta_support(struct oxr_logger *log, struct oxr_instance *inst);
729
730bool
731oxr_system_get_body_tracking_calibration_meta_support(struct oxr_logger *log, struct oxr_instance *inst);
732
733/*
734 *
735 * oxr_event.cpp
736 *
737 */
738
739XrResult
740oxr_event_push_XrEventDataSessionStateChanged(struct oxr_logger *log,
741 struct oxr_session *sess,
742 XrSessionState state,
743 XrTime time);
744
745XrResult
746oxr_event_push_XrEventDataInteractionProfileChanged(struct oxr_logger *log, struct oxr_session *sess);
747
748XrResult
749oxr_event_push_XrEventDataReferenceSpaceChangePending(struct oxr_logger *log,
750 struct oxr_session *sess,
751 XrReferenceSpaceType referenceSpaceType,
752 XrTime changeTime,
753 XrBool32 poseValid,
754 const XrPosef *poseInPreviousSpace);
755
756#ifdef OXR_HAVE_FB_display_refresh_rate
757XrResult
758oxr_event_push_XrEventDataDisplayRefreshRateChangedFB(struct oxr_logger *log,
759 struct oxr_session *sess,
760 float fromDisplayRefreshRate,
761 float toDisplayRefreshRate);
762#endif // OXR_HAVE_FB_display_refresh_rate
763
764#ifdef OXR_HAVE_EXTX_overlay
765XrResult
766oxr_event_push_XrEventDataMainSessionVisibilityChangedEXTX(struct oxr_logger *log,
767 struct oxr_session *sess,
768 bool visible);
769#endif // OXR_HAVE_EXTX_overlay
770
771#ifdef OXR_HAVE_EXT_performance_settings
772XrResult
773oxr_event_push_XrEventDataPerfSettingsEXTX(struct oxr_logger *log,
774 struct oxr_session *sess,
775 enum xrt_perf_domain domain,
776 enum xrt_perf_sub_domain subDomain,
777 enum xrt_perf_notify_level fromLevel,
778 enum xrt_perf_notify_level toLevel);
779#endif // OXR_HAVE_EXT_performance_settings
780/*!
781 * This clears all pending events refers to the given session.
782 */
783XrResult
785
786/*!
787 * Will return one event if available, also drain the sessions event queues.
788 */
789XrResult
790oxr_poll_event(struct oxr_logger *log, struct oxr_instance *inst, XrEventDataBuffer *eventData);
791
792
793/*
794 *
795 * oxr_xdev.c
796 *
797 */
798
799void
800oxr_xdev_destroy(struct xrt_device **xdev_ptr);
801
802/*!
803 * Return true if it finds an input of that name on this device.
804 */
805bool
806oxr_xdev_find_input(struct xrt_device *xdev, enum xrt_input_name name, struct xrt_input **out_input);
807
808/*!
809 * Return true if it finds an output of that name on this device.
810 */
811bool
812oxr_xdev_find_output(struct xrt_device *xdev, enum xrt_output_name name, struct xrt_output **out_output);
813
814#ifdef OXR_HAVE_MNDX_xdev_space
815static inline XrXDevListMNDX
816oxr_xdev_list_to_openxr(struct oxr_xdev_list *sc)
817{
818 return XRT_CAST_PTR_TO_OXR_HANDLE(XrXDevListMNDX, sc);
819}
820
821XrResult
822oxr_xdev_list_create(struct oxr_logger *log,
823 struct oxr_session *sess,
824 const XrCreateXDevListInfoMNDX *createInfo,
825 struct oxr_xdev_list **out_xdl);
826
827XrResult
828oxr_xdev_list_get_properties(struct oxr_logger *log,
829 struct oxr_xdev_list *xdl,
830 uint32_t index,
831 XrXDevPropertiesMNDX *properties);
832
833XrResult
834oxr_xdev_list_space_create(struct oxr_logger *log,
835 struct oxr_xdev_list *xdl,
836 const XrCreateXDevSpaceInfoMNDX *createInfo,
837 uint32_t index,
838 struct oxr_space **out_space);
839
840#endif // OXR_HAVE_MNDX_xdev_space
841
842
843/*
844 *
845 * OpenGL, located in various files.
846 *
847 */
848
849#ifdef XR_USE_GRAPHICS_API_OPENGL
850#ifdef XR_USE_PLATFORM_XLIB
851
852XrResult
853oxr_session_populate_gl_xlib(struct oxr_logger *log,
854 struct oxr_system *sys,
855 XrGraphicsBindingOpenGLXlibKHR const *next,
856 struct oxr_session *sess);
857#endif // XR_USE_PLATFORM_XLIB
858
859#ifdef XR_USE_PLATFORM_WIN32
860XrResult
861oxr_session_populate_gl_win32(struct oxr_logger *log,
862 struct oxr_system *sys,
863 XrGraphicsBindingOpenGLWin32KHR const *next,
864 struct oxr_session *sess);
865#endif // XR_USE_PLATFORM_WIN32
866#endif // XR_USE_GRAPHICS_API_OPENGL
867
868#if defined(XR_USE_GRAPHICS_API_OPENGL) || defined(XR_USE_GRAPHICS_API_OPENGL_ES)
869XrResult
870oxr_swapchain_gl_create(struct oxr_logger * /*log*/,
871 struct oxr_session *sess,
872 const XrSwapchainCreateInfo * /*createInfo*/,
873 struct oxr_swapchain **out_swapchain);
874
875#endif // XR_USE_GRAPHICS_API_OPENGL || XR_USE_GRAPHICS_API_OPENGL_ES
876
877#if defined(XR_USE_GRAPHICS_API_OPENGL_ES)
878#if defined(XR_USE_PLATFORM_ANDROID)
879XrResult
880oxr_session_populate_gles_android(struct oxr_logger *log,
881 struct oxr_system *sys,
882 XrGraphicsBindingOpenGLESAndroidKHR const *next,
883 struct oxr_session *sess);
884#endif // XR_USE_PLATFORM_ANDROID
885#endif // XR_USE_GRAPHICS_API_OPENGL_ES
886
887
888/*
889 *
890 * Vulkan, located in various files.
891 *
892 */
893
894#ifdef XR_USE_GRAPHICS_API_VULKAN
895
896XrResult
897oxr_vk_get_instance_exts(struct oxr_logger *log,
898 struct oxr_system *sys,
899 uint32_t namesCapacityInput,
900 uint32_t *namesCountOutput,
901 char *namesString);
902
903XrResult
904oxr_vk_get_device_exts(struct oxr_logger *log,
905 struct oxr_system *sys,
906 uint32_t namesCapacityInput,
907 uint32_t *namesCountOutput,
908 char *namesString);
909
910XrResult
911oxr_vk_get_requirements(struct oxr_logger *log,
912 struct oxr_system *sys,
913 XrGraphicsRequirementsVulkanKHR *graphicsRequirements);
914
915XrResult
917 struct oxr_system *sys,
918 const XrVulkanInstanceCreateInfoKHR *createInfo,
919 VkInstance *vulkanInstance,
920 VkResult *vulkanResult);
921
922XrResult
924 struct oxr_system *sys,
925 const XrVulkanDeviceCreateInfoKHR *createInfo,
926 VkDevice *vulkanDevice,
927 VkResult *vulkanResult);
928
929XrResult
930oxr_vk_get_physical_device(struct oxr_logger *log,
931 struct oxr_instance *inst,
932 struct oxr_system *sys,
933 VkInstance vkInstance,
934 PFN_vkGetInstanceProcAddr getProc,
935 VkPhysicalDevice *vkPhysicalDevice);
936
937XrResult
938oxr_session_populate_vk(struct oxr_logger *log,
939 struct oxr_system *sys,
940 XrGraphicsBindingVulkanKHR const *next,
941 struct oxr_session *sess);
942
943XrResult
944oxr_swapchain_vk_create(struct oxr_logger * /*log*/,
945 struct oxr_session *sess,
946 const XrSwapchainCreateInfo * /*createInfo*/,
947 struct oxr_swapchain **out_swapchain);
948
949#endif
950
951
952/*
953 *
954 * EGL, located in various files.
955 *
956 */
957
958#ifdef XR_USE_PLATFORM_EGL
959
960XrResult
961oxr_session_populate_egl(struct oxr_logger *log,
962 struct oxr_system *sys,
963 XrGraphicsBindingEGLMNDX const *next,
964 struct oxr_session *sess);
965
966#endif
967
968/*
969 *
970 * D3D version independent routines, located in oxr_d3d.cpp
971 *
972 */
973
974#if defined(XRT_HAVE_D3D11) || defined(XRT_HAVE_D3D12) || defined(XRT_DOXYGEN)
975/// Common GetRequirements call for D3D11 and D3D12
976XrResult
978 struct oxr_system *sys,
979 LUID *adapter_luid,
980 D3D_FEATURE_LEVEL *min_feature_level);
981
982/// Verify the provided LUID matches the expected one in @p sys
983XrResult
984oxr_d3d_check_luid(struct oxr_logger *log, struct oxr_system *sys, LUID *adapter_luid);
985#endif
986
987/*
988 *
989 * D3D11, located in various files.
990 *
991 */
992
993#ifdef XR_USE_GRAPHICS_API_D3D11
994
995XrResult
996oxr_d3d11_get_requirements(struct oxr_logger *log,
997 struct oxr_system *sys,
998 XrGraphicsRequirementsD3D11KHR *graphicsRequirements);
999
1000/**
1001 * @brief Check to ensure the device provided at session create matches the LUID we returned earlier.
1002 *
1003 * @return XR_SUCCESS if the device matches the LUID
1004 */
1005XrResult
1006oxr_d3d11_check_device(struct oxr_logger *log, struct oxr_system *sys, ID3D11Device *device);
1007
1008
1009XrResult
1010oxr_session_populate_d3d11(struct oxr_logger *log,
1011 struct oxr_system *sys,
1012 XrGraphicsBindingD3D11KHR const *next,
1013 struct oxr_session *sess);
1014
1015XrResult
1016oxr_swapchain_d3d11_create(struct oxr_logger *,
1017 struct oxr_session *sess,
1018 const XrSwapchainCreateInfo *,
1019 struct oxr_swapchain **out_swapchain);
1020
1021#endif
1022
1023/*
1024 *
1025 * D3D12, located in various files.
1026 *
1027 */
1028
1029#ifdef XR_USE_GRAPHICS_API_D3D12
1030
1031XrResult
1032oxr_d3d12_get_requirements(struct oxr_logger *log,
1033 struct oxr_system *sys,
1034 XrGraphicsRequirementsD3D12KHR *graphicsRequirements);
1035
1036/**
1037 * @brief Check to ensure the device provided at session create matches the LUID we returned earlier.
1038 *
1039 * @return XR_SUCCESS if the device matches the LUID
1040 */
1041XrResult
1042oxr_d3d12_check_device(struct oxr_logger *log, struct oxr_system *sys, ID3D12Device *device);
1043
1044
1045XrResult
1046oxr_session_populate_d3d12(struct oxr_logger *log,
1047 struct oxr_system *sys,
1048 XrGraphicsBindingD3D12KHR const *next,
1049 struct oxr_session *sess);
1050
1051XrResult
1052oxr_swapchain_d3d12_create(struct oxr_logger *,
1053 struct oxr_session *sess,
1054 const XrSwapchainCreateInfo *,
1055 struct oxr_swapchain **out_swapchain);
1056
1057#endif
1058
1059/*
1060 *
1061 * Structs
1062 *
1063 */
1064
1065
1066/*!
1067 * Used to hold diverse child handles and ensure orderly destruction.
1068 *
1069 * Each object referenced by an OpenXR handle should have one of these as its
1070 * first element, thus "extending" this class.
1071 */
1073{
1074 //! Magic (per-handle-type) value for debugging.
1075 uint64_t debug;
1076
1077 /*!
1078 * Pointer to this object's parent handle holder, if any.
1079 */
1081
1082 /*!
1083 * Array of children, if any.
1084 */
1085 struct oxr_handle_base *children[XRT_MAX_HANDLE_CHILDREN];
1086
1087 /*!
1088 * Current handle state.
1089 */
1091
1092 /*!
1093 * Destroy the object this handle refers to.
1094 */
1096};
1097
1098/*!
1099 * Holds the properties that a system supports for a view configuration type.
1100 *
1101 * @relates oxr_system
1102 */
1104{
1105 XrViewConfigurationType view_config_type;
1106
1107 uint32_t view_count;
1108 XrViewConfigurationView views[XRT_MAX_COMPOSITOR_VIEW_CONFIGS_VIEW_COUNT];
1109
1110 uint32_t blend_mode_count;
1111 XrEnvironmentBlendMode blend_modes[3];
1112};
1113
1114/*!
1115 * Single or multiple devices grouped together to form a system that sessions
1116 * can be created from. Might need to open devices to get all
1117 * properties from it, but shouldn't.
1118 *
1119 * Not strictly an object, but an atom.
1120 *
1121 * Valid only within an XrInstance (@ref oxr_instance)
1122 *
1123 * @obj{XrSystemId}
1124 */
1126{
1127 struct oxr_instance *inst;
1128
1129 //! The @ref xrt_iface level system.
1131
1132 //! System devices used in all session types.
1134
1135 //! Space overseer used in all session types.
1137
1138 //! System compositor, used to create session compositors.
1140
1141 XrSystemId systemId;
1142
1143 //! Have the client application called the gfx api requirements func?
1145
1146 uint32_t view_config_count;
1147 struct oxr_view_config_properties view_configs[XRT_MAX_COMPOSITOR_VIEW_CONFIGS_COUNT];
1148
1149 XrReferenceSpaceType reference_spaces[5];
1150 uint32_t reference_space_count;
1151
1152 struct xrt_visibility_mask *visibility_mask[2];
1153
1154#ifdef OXR_HAVE_MNDX_xdev_space
1155 bool supports_xdev_space;
1156#endif
1157
1158#ifdef XR_USE_GRAPHICS_API_VULKAN
1159 //! The instance/device we create when vulkan_enable2 is used
1161 //! The device returned with the last xrGetVulkanGraphicsDeviceKHR or xrGetVulkanGraphicsDevice2KHR call.
1162 //! XR_NULL_HANDLE if neither has been called.
1164
1165 /*!
1166 * Stores the vkGetInstanceProcAddr passed to xrCreateVulkanInstanceKHR to be
1167 * used when looking up Vulkan functions used by xrGetVulkanGraphicsDevice2KHR.
1168 */
1169 PFN_vkGetInstanceProcAddr vk_get_instance_proc_addr;
1170
1171 struct
1172 {
1173 // No better place to keep this state.
1174 bool external_fence_fd_enabled;
1175 bool external_semaphore_fd_enabled;
1176 bool timeline_semaphore_enabled;
1177 bool debug_utils_enabled;
1178 bool image_format_list_enabled;
1179 } vk;
1180
1181#endif
1182
1183#if defined(XR_USE_GRAPHICS_API_D3D11) || defined(XR_USE_GRAPHICS_API_D3D12)
1184 LUID suggested_d3d_luid;
1185 bool suggested_d3d_luid_valid;
1186#endif
1187};
1188
1189/*
1190 * Extensions helpers.
1191 */
1192
1193#define MAKE_EXT_STATUS(mixed_case, all_caps) bool mixed_case;
1194/*!
1195 * Structure tracking which extensions are enabled for a given instance.
1196 *
1197 * Names are systematic: the extension name with the XR_ prefix removed.
1198 */
1200{
1201 OXR_EXTENSION_SUPPORT_GENERATE(MAKE_EXT_STATUS)
1202};
1203#undef MAKE_EXT_STATUS
1204
1205/*!
1206 * Main object that ties everything together.
1207 *
1208 * No parent type/handle: this is the root handle.
1209 *
1210 * @obj{XrInstance}
1211 * @extends oxr_handle_base
1212 */
1214{
1215 //! Common structure for things referred to by OpenXR handles.
1217
1218 struct u_debug_gui *debug_ui;
1219
1220 struct xrt_instance *xinst;
1221
1222 //! Enabled extensions
1224
1225 //! The OpenXR version requested in the app info. It determines the instance's OpenXR version.
1226 struct
1227 {
1228 //! Stores only major.minor version. Simplifies comparisons for e.g. "at least OpenXR 1.1".
1229 XrVersion major_minor;
1231
1232 // Protects the function oxr_instance_init_system_locked.
1233 struct os_mutex system_init_lock;
1234
1235 // Hardcoded single system.
1236 struct oxr_system system;
1237
1238 struct time_state *timekeeping;
1239
1240 //! Path store for managing paths.
1242
1243 // Event queue.
1244 struct
1245 {
1246 struct os_mutex mutex;
1247 struct oxr_event *last;
1248 struct oxr_event *next;
1249 } event;
1250
1251 struct oxr_session *sessions;
1252
1253 //! Path cache for actions, needs path_store to work.
1255
1256 //! The default action context, holds things like suggested profiles.
1258
1259 struct
1260 {
1261 struct
1262 {
1263 struct
1264 {
1265 uint32_t major;
1266 uint32_t minor;
1267 uint32_t patch;
1268 const char *name; //< Engine name, not freed.
1269 } engine;
1270 } detected;
1271 } appinfo;
1272
1273 struct
1274 {
1275 /*!
1276 * Some applications can't handle depth formats, or they trigger
1277 * a bug in a specific version of the application or engine.
1278 * This flag only disables depth formats
1279 * @see disable_vulkan_format_depth_stencil for depth-stencil formats.
1280 */
1282
1283 /*!
1284 * Some applications can't handle depth stencil formats, or they
1285 * trigger a bug in a specific version of the application or
1286 * engine.
1287 *
1288 * This flag only disables depth-stencil formats,
1289 * @see disable_vulkan_format_depth flag for depth only formats.
1290 *
1291 * In the past it was used to work around a bug in Unreal's
1292 * VulkanRHI backend.
1293 */
1295
1296 //! Unreal 4 has a bug calling xrEndSession; the function should just exit
1298
1299 /*!
1300 * Return XR_ERROR_REFERENCE_SPACE_UNSUPPORTED instead of
1301 * XR_ERROR_VALIDATION_FAILURE in xrCreateReferenceSpace.
1302 */
1304
1305 //! For applications that rely on views being parallel, notably some OpenVR games with OpenComposite.
1307
1308 //! For applications that use stage and don't offer recentering.
1310
1311 /*!
1312 * Beat Saber submits its projection layer with XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT set.
1313 * This breaks rendering because the game uses the alpha texture to store data for the bloom shader,
1314 * causing most of the game to render as black, only showing glowing parts of the image.
1315 */
1317 } quirks;
1318
1319 //! Debug messengers
1320 struct oxr_debug_messenger *messengers[XRT_MAX_HANDLE_CHILDREN];
1321
1322 bool lifecycle_verbose;
1323 bool debug_views;
1324 bool debug_spaces;
1325 bool debug_bindings;
1326
1327#ifdef XRT_FEATURE_RENDERDOC
1328 RENDERDOC_API_1_4_1 *rdoc_api;
1329#endif
1330
1331#ifdef XRT_OS_ANDROID
1332 enum xrt_android_lifecycle_event activity_state;
1333#endif // XRT_OS_ANDROID
1334};
1335
1336/*
1337 * This includes needs to be here because it has static inline functions that
1338 * de-references the oxr_instance object. This refactor was made mid-patchset
1339 * so doing too many changes to other files would have been really disruptive
1340 * but this include will be removed soon.
1341 */
1342#include "path/oxr_path_wrappers.h"
1343
1344
1345/*!
1346 * Object that client program interact with.
1347 *
1348 * Parent type/handle is @ref oxr_instance
1349 *
1350 * @obj{XrSession}
1351 * @extends oxr_handle_base
1352 */
1354{
1355 //! Common structure for things referred to by OpenXR handles.
1357 struct oxr_system *sys;
1358
1359 //! What graphics type was this session created with.
1361
1362 //! The @ref xrt_session backing this session.
1364
1365 //! Native compositor that is wrapped by client compositors.
1367
1368 struct xrt_compositor *compositor;
1369
1370 struct oxr_session *next;
1371
1372 XrSessionState state;
1373
1374 /*!
1375 * This is set in xrBeginSession and is the primaryViewConfiguration
1376 * argument, this is then used in xrEndFrame to know which view
1377 * configuration the application is submitting it's frame in.
1378 */
1379 XrViewConfigurationType current_view_config_type;
1380
1381 /*!
1382 * There is a extra state between xrBeginSession has been called and
1383 * the first xrEndFrame has been called. These are to track this.
1384 */
1386
1387 bool compositor_visible;
1388 bool compositor_focused;
1389
1390 // the number of xrWaitFrame calls that did not yet have a corresponding
1391 // xrEndFrame or xrBeginFrame (discarded frame) call
1392 int active_wait_frames;
1393 struct os_mutex active_wait_frames_lock;
1394
1395 bool frame_started;
1396 bool exiting;
1397
1398 struct
1399 {
1400 int64_t waited;
1401 int64_t begun;
1402 } frame_id;
1403
1404 struct oxr_frame_sync frame_sync;
1405
1406 /*!
1407 * Used to implement precise extra sleeping in wait frame.
1408 */
1410
1411 /*!
1412 * An array of action set attachments that this session owns.
1413 *
1414 * If non-null, this means action sets have been attached to this
1415 * session.
1416 */
1418
1419 /*!
1420 * Length of @ref oxr_session::act_set_attachments.
1421 */
1423
1424 /*!
1425 * A map of action set key to action set attachments.
1426 *
1427 * If non-null, this means action sets have been attached to this
1428 * session, since this map points to elements of
1429 * oxr_session::act_set_attachments
1430 */
1432
1433 /*!
1434 * A map of action key to action attachment.
1435 *
1436 * The action attachments are actually owned by the action set
1437 * attachments, but we own the action set attachments, so this is OK.
1438 *
1439 * If non-null, this means action sets have been attached to this
1440 * session, since this map points to @p oxr_action_attachment members of
1441 * @ref oxr_session::act_set_attachments elements.
1442 */
1444
1445 /*!
1446 * Clone of all suggested binding profiles at the point of action set/session attachment.
1447 * @ref oxr_session_attach_action_sets
1448 */
1450
1451 //! Cache of the last known system roles generation_id
1453
1454 //! Protects access to dynamic_roles_generation_id during sync actions
1456
1457 /*!
1458 * Currently bound interaction profile.
1459 * @{
1460 */
1461
1462#define OXR_PATH_MEMBER(X) XrPath X;
1463
1465#undef OXR_PATH_MEMBER
1466 /*!
1467 * @}
1468 */
1469
1470 /*!
1471 * IPD, to be expanded to a proper 3D relation.
1472 */
1474
1475 /*!
1476 * Frame timing debug output.
1477 */
1479
1480 //! Extra sleep in wait frame.
1482
1483 /*!
1484 * To pipe swapchain creation to right code.
1485 */
1486 XrResult (*create_swapchain)(struct oxr_logger *,
1487 struct oxr_session *sess,
1488 const XrSwapchainCreateInfo *,
1489 struct oxr_swapchain **);
1490
1491 /*! initial relation of head in "global" space.
1492 * Used as reference for local space. */
1493 // struct xrt_space_relation local_space_pure_relation;
1494
1496};
1497
1498/*!
1499 * Returns XR_SUCCESS or XR_SESSION_LOSS_PENDING as appropriate.
1500 *
1501 * @public @memberof oxr_session
1502 */
1503static inline XrResult
1505{
1506 switch (session->state) {
1507 case XR_SESSION_STATE_LOSS_PENDING: return XR_SESSION_LOSS_PENDING;
1508 default: return XR_SUCCESS;
1509 }
1510}
1511
1512/*!
1513 * Returns XR_SUCCESS, XR_SESSION_LOSS_PENDING, or XR_SESSION_NOT_FOCUSED, as
1514 * appropriate.
1515 *
1516 * @public @memberof oxr_session
1517 */
1518static inline XrResult
1520{
1521 switch (session->state) {
1522 case XR_SESSION_STATE_LOSS_PENDING: return XR_SESSION_LOSS_PENDING;
1523 case XR_SESSION_STATE_FOCUSED: return XR_SUCCESS;
1524 default: return XR_SESSION_NOT_FOCUSED;
1525 }
1526}
1527
1528#ifdef OXR_HAVE_FB_display_refresh_rate
1529XrResult
1530oxr_session_get_display_refresh_rate(struct oxr_logger *log, struct oxr_session *sess, float *displayRefreshRate);
1531
1532XrResult
1533oxr_session_request_display_refresh_rate(struct oxr_logger *log, struct oxr_session *sess, float displayRefreshRate);
1534#endif // OXR_HAVE_FB_display_refresh_rate
1535
1536
1537/*!
1538 * dpad emulation settings from oxr_interaction_profile
1539 */
1541{
1542 enum oxr_subaction_path subaction_path;
1543 XrPath *paths;
1544 uint32_t path_count;
1545 enum xrt_input_name position;
1546 enum xrt_input_name activate; // Can be zero
1547};
1548
1549/*!
1550 * A single interaction profile.
1551 */
1553{
1554 XrPath path;
1555
1556 //! Used to lookup @ref xrt_binding_profile for fallback.
1558
1559 //! Name presented to the user.
1560 const char *localized_name;
1561
1562 struct oxr_binding *bindings;
1563 size_t binding_count;
1564
1565 struct oxr_dpad_emulation *dpads;
1566 size_t dpad_count;
1567
1568 struct oxr_dpad_state dpad_state;
1569};
1570
1571/*!
1572 * Interaction profile binding state.
1573 */
1575{
1576 XrPath *paths;
1577 uint32_t path_count;
1578
1579 //! Name presented to the user.
1580 const char *localized_name;
1581
1582 enum oxr_subaction_path subaction_path;
1583
1584 uint32_t act_key_count;
1585 uint32_t *act_keys;
1586 //! store which entry in paths was suggested, for each action key
1588
1589 enum xrt_input_name input;
1590 enum xrt_input_name dpad_activate;
1591
1592 enum xrt_output_name output;
1593};
1594
1595/*!
1596 * @defgroup oxr_input OpenXR input
1597 * @ingroup oxr_main
1598 *
1599 * @brief The action-set/action-based input subsystem of OpenXR.
1600 *
1601 *
1602 * Action sets are created as children of the Instance, but are primarily used
1603 * with one or more Sessions. They may be used with multiple sessions at a time,
1604 * so we can't just put the per-session information directly in the action set
1605 * or action. Instead, we have the `_attachment `structures, which mirror the
1606 * action sets and actions but are rooted under the Session:
1607 *
1608 * - For every action set attached to a session, that session owns a @ref
1609 * oxr_action_set_attachment.
1610 * - For each action in those attached action sets, the action set attachment
1611 * owns an @ref oxr_action_attachment.
1612 *
1613 * We go from the public handle to the `_attachment` structure by using a `key`
1614 * value and a hash map: specifically, we look up the
1615 * oxr_action_set::act_set_key and oxr_action::act_key in the session.
1616 *
1617 * ![](monado-input-class-relationships.drawio.svg)
1618 */
1619
1620/*!
1621 * A parsed equivalent of a list of sub-action paths.
1622 *
1623 * If @p any is true, then no paths were provided, which typically means any
1624 * input is acceptable.
1625 *
1626 * @ingroup oxr_main
1627 * @ingroup oxr_input
1628 */
1630{
1631 bool any;
1632#define OXR_SUBPATH_MEMBER(X) bool X;
1633 OXR_FOR_EACH_SUBACTION_PATH(OXR_SUBPATH_MEMBER)
1634#undef OXR_SUBPATH_MEMBER
1635};
1636
1637/*!
1638 * Helper function to determine if the set of paths in @p a is a subset of the
1639 * paths in @p b.
1640 *
1641 * @public @memberof oxr_subaction_paths
1642 */
1643static inline bool
1645{
1646#define OXR_CHECK_SUBACTION_PATHS(X) \
1647 if (a->X && !b->X) { \
1648 return false; \
1649 }
1650 OXR_FOR_EACH_SUBACTION_PATH(OXR_CHECK_SUBACTION_PATHS)
1651#undef OXR_CHECK_SUBACTION_PATHS
1652 return true;
1653}
1654
1655/*!
1656 * The data associated with the attachment of an Action Set (@ref
1657 * oxr_action_set) to as Session (@ref oxr_session).
1658 *
1659 * This structure has no pointer to the @ref oxr_action_set that created it
1660 * because the application is allowed to destroy an action before the session,
1661 * which should change nothing except not allow the application to use the
1662 * corresponding data anymore.
1663 *
1664 * @ingroup oxr_input
1665 *
1666 * @see oxr_action_set
1667 */
1669{
1670 //! Owning session.
1672
1673 //! Action set refcounted data
1675
1676 //! Unique key for the session hashmap.
1677 uint32_t act_set_key;
1678
1679 //! Which sub-action paths are requested on the latest sync.
1681
1682 //! An array of action attachments we own.
1684
1685 /*!
1686 * Length of @ref oxr_action_set_attachment::act_attachments.
1687 */
1689};
1690
1691
1692
1693/*!
1694 * The state of a action input.
1695 *
1696 * @ingroup oxr_input
1697 *
1698 * @see oxr_action_attachment
1699 */
1701{
1702 /*!
1703 * The actual value - must interpret using action type
1704 */
1705 union xrt_input_value value;
1706
1707 //! Is this active (bound and providing input)?
1709
1710 // Was this changed.
1711 bool changed;
1712
1713 //! When was this last changed.
1715};
1716
1717/*!
1718 * A input action pair of a @ref xrt_input and a @ref xrt_device, along with the
1719 * required transform.
1720 *
1721 * @ingroup oxr_input
1722 *
1723 * @see xrt_device
1724 * @see xrt_input
1725 */
1727{
1728 struct xrt_device *xdev; // Used for poses and transform is null.
1729 struct xrt_input *input; // Ditto
1730 enum xrt_input_name dpad_activate_name; // used to activate dpad emulation if present
1731 struct xrt_input *dpad_activate; // used to activate dpad emulation if present
1732 struct oxr_input_transform *transforms;
1733 size_t transform_count;
1734 XrPath bound_path;
1735};
1736
1737/*!
1738 * A output action pair of a @ref xrt_output_name and a @ref xrt_device.
1739 *
1740 * @ingroup oxr_input
1741 *
1742 * @see xrt_device
1743 * @see xrt_output_name
1744 */
1746{
1747 struct xrt_device *xdev;
1748 enum xrt_output_name name;
1749 XrPath bound_path;
1750};
1751
1752
1753/*!
1754 * The set of inputs/outputs for a single sub-action path for an action.
1755 *
1756 * Each @ref oxr_action_attachment has one of these for every known sub-action
1757 * path in the spec. Many, or even most, will be "empty".
1758 *
1759 * A single action will either be input or output, not both.
1760 *
1761 * @ingroup oxr_input
1762 *
1763 * @see oxr_action_attachment
1764 */
1766{
1767 struct oxr_action_state current;
1768
1769 size_t input_count;
1770 struct oxr_action_input *inputs;
1771
1772 int64_t stop_output_time;
1773 size_t output_count;
1774 struct oxr_action_output *outputs;
1775};
1776
1777/*!
1778 * Data associated with an Action that has been attached to a Session.
1779 *
1780 * More information on the action vs action attachment and action set vs action
1781 * set attachment parallel is in the docs for @ref oxr_input
1782 *
1783 * @ingroup oxr_input
1784 *
1785 * @see oxr_action
1786 */
1788{
1789 //! The owning action set attachment
1791
1792 //! This action's refcounted data
1794
1795 /*!
1796 * The corresponding session.
1797 *
1798 * This will always be valid: the session outlives this object because
1799 * it owns act_set_attached.
1800 */
1802
1803 //! Unique key for the session hashmap.
1804 uint32_t act_key;
1805
1806
1807 /*!
1808 * For pose actions any subaction paths are special treated, at bind
1809 * time we pick one subaction path and stick to it as long as the action
1810 * lives.
1811 */
1813
1814 struct oxr_action_state any_state;
1815
1816#define OXR_CACHE_MEMBER(X) struct oxr_action_cache X;
1817 OXR_FOR_EACH_SUBACTION_PATH(OXR_CACHE_MEMBER)
1818#undef OXR_CACHE_MEMBER
1819};
1820
1821/*!
1822 * @}
1823 */
1824
1825
1826static inline bool
1827oxr_space_type_is_reference(enum oxr_space_type space_type)
1828{
1829 switch (space_type) {
1830 case OXR_SPACE_TYPE_REFERENCE_VIEW:
1831 case OXR_SPACE_TYPE_REFERENCE_LOCAL:
1832 case OXR_SPACE_TYPE_REFERENCE_LOCAL_FLOOR:
1833 case OXR_SPACE_TYPE_REFERENCE_STAGE:
1834 case OXR_SPACE_TYPE_REFERENCE_UNBOUNDED_MSFT:
1835 case OXR_SPACE_TYPE_REFERENCE_COMBINED_EYE_VARJO:
1836 case OXR_SPACE_TYPE_REFERENCE_LOCALIZATION_MAP_ML:
1837 // These are reference spaces.
1838 return true;
1839
1840 case OXR_SPACE_TYPE_ACTION:
1841 case OXR_SPACE_TYPE_XDEV_POSE:
1842 // These are not reference spaces.
1843 return false;
1844 }
1845
1846 // Handles invalid value.
1847 return false;
1848}
1849
1850
1851/*!
1852 * Can be one of several reference space types, or a space that is bound to an
1853 * action.
1854 *
1855 * Parent type/handle is @ref oxr_session
1856 *
1857 * @obj{XrSpace}
1858 * @extends oxr_handle_base
1859 */
1861{
1862 //! Common structure for things referred to by OpenXR handles.
1864
1865 //! Owner of this space.
1867
1868 //! Pose that was given during creation.
1870
1871 //! Action key from which action this space was created from.
1872 uint32_t act_key;
1873
1874 //! What kind of space is this?
1876
1877 //! Which sub action path is this?
1879
1880 struct
1881 {
1882 struct xrt_space *xs;
1883 struct xrt_device *xdev;
1884 enum xrt_input_name name;
1885
1886 bool feature_eye_tracking;
1887 } action;
1888
1889 struct
1890 {
1891 struct xrt_space *xs;
1892 } xdev_pose;
1893};
1894
1895/*!
1896 * A set of images used for rendering.
1897 *
1898 * Parent type/handle is @ref oxr_session
1899 *
1900 * @obj{XrSwapchain}
1901 * @extends oxr_handle_base
1902 */
1904{
1905 //! Common structure for things referred to by OpenXR handles.
1907
1908 //! Owner of this swapchain.
1910
1911 //! Compositor swapchain.
1913
1914 //! Swapchain size.
1915 uint32_t width, height;
1916
1917 //! For 1 is 2D texture, greater then 1 2D array texture.
1919
1920 //! The number of cubemap faces. 6 for cubemaps, 1 otherwise.
1921 uint32_t face_count;
1922
1923 struct
1924 {
1925 enum oxr_image_state state;
1926 } images[XRT_MAX_SWAPCHAIN_IMAGES];
1927
1928 struct
1929 {
1930 size_t num;
1931 struct u_index_fifo fifo;
1932 } acquired;
1933
1934 struct
1935 {
1936 bool yes;
1937 int index;
1938 } inflight; // This is the image that the app is working on.
1939
1940 struct
1941 {
1942 bool yes;
1943 int index;
1944 } released;
1945
1946 // Is this a static swapchain, needed for acquire semantics.
1947 bool is_static;
1948
1949
1950 XrResult (*destroy)(struct oxr_logger *, struct oxr_swapchain *);
1951
1952 XrResult (*enumerate_images)(struct oxr_logger *,
1953 struct oxr_swapchain *,
1954 uint32_t,
1955 XrSwapchainImageBaseHeader *);
1956
1957 XrResult (*acquire_image)(struct oxr_logger *,
1958 struct oxr_swapchain *,
1959 const XrSwapchainImageAcquireInfo *,
1960 uint32_t *);
1961
1962 XrResult (*wait_image)(struct oxr_logger *, struct oxr_swapchain *, const XrSwapchainImageWaitInfo *);
1963
1964 XrResult (*release_image)(struct oxr_logger *, struct oxr_swapchain *, const XrSwapchainImageReleaseInfo *);
1965};
1966
1968{
1969 struct xrt_reference base;
1970 //! Destruction callback
1971 void (*destroy)(struct oxr_refcounted *);
1972};
1973
1974/*!
1975 * Increase the reference count of @p orc.
1976 */
1977static inline void
1979{
1980 xrt_reference_inc(&orc->base);
1981}
1982
1983/*!
1984 * Decrease the reference count of @p orc, destroying it if it reaches 0.
1985 */
1986static inline void
1988{
1989 if (xrt_reference_dec_and_is_zero(&orc->base)) {
1990 orc->destroy(orc);
1991 }
1992}
1993
1994/*!
1995 * The reference-counted data of an action set.
1996 *
1997 * One or more sessions may still need this data after the application destroys
1998 * its XrActionSet handle, so this data is refcounted.
1999 *
2000 * @ingroup oxr_input
2001 *
2002 * @see oxr_action_set
2003 * @extends oxr_refcounted
2004 */
2006{
2007 struct oxr_refcounted base;
2008
2009 //! Application supplied name of this action.
2010 char name[XR_MAX_ACTION_SET_NAME_SIZE];
2011
2012 /*!
2013 * Has this action set even been attached to any session, marking it as
2014 * immutable.
2015 */
2017
2018 //! Unique key for the session hashmap.
2019 uint32_t act_set_key;
2020
2021 //! Application supplied action set priority.
2022 uint32_t priority;
2023
2024 struct
2025 {
2026 struct u_hashset *name_store;
2027 struct u_hashset *loc_store;
2028 } actions;
2029
2030 struct oxr_subaction_paths permitted_subaction_paths;
2031};
2032
2033/*!
2034 * A group of actions.
2035 *
2036 * Parent type/handle is @ref oxr_instance
2037 *
2038 * Note, however, that an action set must be "attached" to a session
2039 * ( @ref oxr_session ) to be used and not just configured.
2040 * The corresponding data is in @ref oxr_action_set_attachment.
2041 *
2042 * @ingroup oxr_input
2043 *
2044 * @obj{XrActionSet}
2045 * @extends oxr_handle_base
2046 */
2048{
2049 //! Common structure for things referred to by OpenXR handles.
2051
2052 //! Owner of this action set.
2054
2055 /*!
2056 * The data for this action set that must live as long as any session we
2057 * are attached to.
2058 */
2060
2061
2062 /*!
2063 * Unique key for the session hashmap.
2064 *
2065 * Duplicated from oxr_action_set_ref::act_set_key for efficiency.
2066 */
2067 uint32_t act_set_key;
2068
2069 //! The item in the name hashset.
2071
2072 //! The item in the localized hashset.
2074};
2075
2076/*!
2077 * The reference-counted data of an action.
2078 *
2079 * One or more sessions may still need this data after the application destroys
2080 * its XrAction handle, so this data is refcounted.
2081 *
2082 * @ingroup oxr_input
2083 *
2084 * @see oxr_action
2085 * @extends oxr_refcounted
2086 */
2088{
2089 struct oxr_refcounted base;
2090
2091 //! Application supplied name of this action.
2092 char name[XR_MAX_ACTION_NAME_SIZE];
2093
2094 //! Unique key for the session hashmap.
2095 uint32_t act_key;
2096
2097 //! Type this action was created with.
2098 XrActionType action_type;
2099
2100 //! Which sub action paths that this action was created with.
2102};
2103
2104/*!
2105 * A single action.
2106 *
2107 * Parent type/handle is @ref oxr_action_set
2108 *
2109 * For actual usage, an action is attached to a session: the corresponding data
2110 * is in @ref oxr_action_attachment
2111 *
2112 * @ingroup oxr_input
2113 *
2114 * @obj{XrAction}
2115 * @extends oxr_handle_base
2116 */
2118{
2119 //! Common structure for things referred to by OpenXR handles.
2121
2122 //! Owner of this action.
2124
2125 //! The data for this action that must live as long as any session we
2126 //! are attached to.
2128
2129 /*!
2130 * Unique key for the session hashmap.
2131 *
2132 * Duplicated from oxr_action_ref::act_key for efficiency.
2133 */
2134 uint32_t act_key;
2135
2136 //! The item in the name hashset.
2138
2139 //! The item in the localized hashset.
2141};
2142
2143/*!
2144 * Debug object created by the client program.
2145 *
2146 * Parent type/handle is @ref oxr_instance
2147 *
2148 * @obj{XrDebugUtilsMessengerEXT}
2149 */
2151{
2152 //! Common structure for things referred to by OpenXR handles.
2154
2155 //! Owner of this messenger.
2157
2158 //! Severities to submit to this messenger
2159 XrDebugUtilsMessageSeverityFlagsEXT message_severities;
2160
2161 //! Types to submit to this messenger
2162 XrDebugUtilsMessageTypeFlagsEXT message_types;
2163
2164 //! Callback function
2165 PFN_xrDebugUtilsMessengerCallbackEXT user_callback;
2166
2167 //! Opaque user data
2168 void *XR_MAY_ALIAS user_data;
2169};
2170
2171#ifdef OXR_HAVE_FB_passthrough
2172
2173struct oxr_passthrough
2174{
2175 struct oxr_handle_base handle;
2176
2177 struct oxr_session *sess;
2178
2179 XrPassthroughFlagsFB flags;
2180
2181 bool paused;
2182};
2183
2184struct oxr_passthrough_layer
2185{
2186 struct oxr_handle_base handle;
2187
2188 struct oxr_session *sess;
2189
2190 XrPassthroughFB passthrough;
2191
2192 XrPassthroughFlagsFB flags;
2193
2194 XrPassthroughLayerPurposeFB purpose;
2195
2196 bool paused;
2197
2198 XrPassthroughStyleFB style;
2199 XrPassthroughColorMapMonoToRgbaFB monoToRgba;
2200 XrPassthroughColorMapMonoToMonoFB monoToMono;
2201 XrPassthroughBrightnessContrastSaturationFB brightnessContrastSaturation;
2202};
2203
2204XrResult
2205oxr_passthrough_create(struct oxr_logger *log,
2206 struct oxr_session *sess,
2207 const XrPassthroughCreateInfoFB *createInfo,
2208 struct oxr_passthrough **out_passthrough);
2209
2210XrResult
2211oxr_passthrough_layer_create(struct oxr_logger *log,
2212 struct oxr_session *sess,
2213 const XrPassthroughLayerCreateInfoFB *createInfo,
2214 struct oxr_passthrough_layer **out_layer);
2215
2216static inline XrPassthroughFB
2217oxr_passthrough_to_openxr(struct oxr_passthrough *passthrough)
2218{
2219 return XRT_CAST_PTR_TO_OXR_HANDLE(XrPassthroughFB, passthrough);
2220}
2221
2222static inline XrPassthroughLayerFB
2223oxr_passthrough_layer_to_openxr(struct oxr_passthrough_layer *passthroughLayer)
2224{
2225 return XRT_CAST_PTR_TO_OXR_HANDLE(XrPassthroughLayerFB, passthroughLayer);
2226}
2227
2228XrResult
2229oxr_event_push_XrEventDataPassthroughStateChangedFB(struct oxr_logger *log,
2230 struct oxr_session *sess,
2231 XrPassthroughStateChangedFlagsFB flags);
2232
2233#endif // OXR_HAVE_FB_passthrough
2234
2235#ifdef OXR_HAVE_HTC_facial_tracking
2236/*!
2237 * HTC specific Facial tracker.
2238 *
2239 * Parent type/handle is @ref oxr_instance
2240 *
2241 *
2242 * @obj{XrFacialTrackerHTC}
2243 * @extends oxr_handle_base
2244 */
2245struct oxr_facial_tracker_htc
2246{
2247 //! Common structure for things referred to by OpenXR handles.
2248 struct oxr_handle_base handle;
2249
2250 //! Owner of this face tracker.
2251 struct oxr_session *sess;
2252
2253 //! xrt_device backing this face tracker
2254 struct xrt_device *xdev;
2255
2256 //! Type of facial tracking, eyes or lips
2257 enum xrt_facial_tracking_type_htc facial_tracking_type;
2258
2259 //! To track if the feature set has been incremented since creation.
2260 bool feature_incremented;
2261};
2262
2263XrResult
2264oxr_facial_tracker_htc_create(struct oxr_logger *log,
2265 struct oxr_session *sess,
2266 const XrFacialTrackerCreateInfoHTC *createInfo,
2267 struct oxr_facial_tracker_htc **out_face_tracker_htc);
2268
2269XrResult
2270oxr_get_facial_expressions_htc(struct oxr_logger *log,
2271 struct oxr_facial_tracker_htc *facial_tracker_htc,
2272 XrFacialExpressionsHTC *facialExpressions);
2273#endif
2274
2275#ifdef OXR_HAVE_FB_body_tracking
2276/*!
2277 * FB specific Body tracker.
2278 *
2279 * Parent type/handle is @ref oxr_instance
2280 *
2281 * @obj{XrBodyTrackerFB}
2282 * @extends oxr_handle_base
2283 */
2284struct oxr_body_tracker_fb
2285{
2286 //! Common structure for things referred to by OpenXR handles.
2287 struct oxr_handle_base handle;
2288
2289 //! Owner of this face tracker.
2290 struct oxr_session *sess;
2291
2292 //! xrt_device backing this face tracker
2293 struct xrt_device *xdev;
2294
2295 //! Type of the body joint set e.g. XR_FB_body_tracking or XR_META_body_tracking_full_body
2296 enum xrt_body_joint_set_type_fb joint_set_type;
2297};
2298
2299XrResult
2300oxr_create_body_tracker_fb(struct oxr_logger *log,
2301 struct oxr_session *sess,
2302 const XrBodyTrackerCreateInfoFB *createInfo,
2303 struct oxr_body_tracker_fb **out_body_tracker_fb);
2304
2305XrResult
2306oxr_get_body_skeleton_fb(struct oxr_logger *log,
2307 struct oxr_body_tracker_fb *body_tracker_fb,
2308 XrBodySkeletonFB *skeleton);
2309
2310XrResult
2311oxr_locate_body_joints_fb(struct oxr_logger *log,
2312 struct oxr_body_tracker_fb *body_tracker_fb,
2313 struct oxr_space *base_spc,
2314 const XrBodyJointsLocateInfoFB *locateInfo,
2315 XrBodyJointLocationsFB *locations);
2316#endif
2317
2318#ifdef OXR_HAVE_BD_body_tracking
2319/*!
2320 * BD (PICO) specific Body tracker.
2321 *
2322 * Parent type/handle is @ref oxr_session
2323 *
2324 * @obj{XrBodyTrackerBD}
2325 * @extends oxr_handle_base
2326 */
2327struct oxr_body_tracker_bd
2328{
2329 //! Common structure for things referred to by OpenXR handles.
2330 struct oxr_handle_base handle;
2331
2332 //! Owner of this body tracker.
2333 struct oxr_session *sess;
2334
2335 //! xrt_device backing this body tracker
2336 struct xrt_device *xdev;
2337
2338 //! Type of the body joint set (with or without arms)
2339 enum xrt_body_joint_set_type_bd joint_set_type;
2340};
2341
2342XrResult
2343oxr_create_body_tracker_bd(struct oxr_logger *log,
2344 struct oxr_session *sess,
2345 const XrBodyTrackerCreateInfoBD *createInfo,
2346 struct oxr_body_tracker_bd **out_body_tracker_bd);
2347
2348XrResult
2349oxr_locate_body_joints_bd(struct oxr_logger *log,
2350 struct oxr_body_tracker_bd *body_tracker_bd,
2351 struct oxr_space *base_spc,
2352 const XrBodyJointsLocateInfoBD *locateInfo,
2353 XrBodyJointLocationsBD *locations);
2354
2355bool
2356oxr_system_get_body_tracking_bd_support(struct oxr_logger *log, struct oxr_instance *inst);
2357#endif
2358
2359#ifdef OXR_HAVE_FB_face_tracking2
2360/*!
2361 * FB specific Face tracker2.
2362 *
2363 * Parent type/handle is @ref oxr_instance
2364 *
2365 * @obj{XrFaceTracker2FB}
2366 * @extends oxr_handle_base
2367 */
2368struct oxr_face_tracker2_fb
2369{
2370 //! Common structure for things referred to by OpenXR handles.
2371 struct oxr_handle_base handle;
2372
2373 //! Owner of this face tracker.
2374 struct oxr_session *sess;
2375
2376 //! xrt_device backing this face tracker
2377 struct xrt_device *xdev;
2378
2379 bool audio_enabled;
2380 bool visual_enabled;
2381
2382 //! To track if the feature set has been incremented since creation.
2383 bool feature_incremented;
2384};
2385
2386XrResult
2387oxr_face_tracker2_fb_create(struct oxr_logger *log,
2388 struct oxr_session *sess,
2389 const XrFaceTrackerCreateInfo2FB *createInfo,
2390 struct oxr_face_tracker2_fb **out_face_tracker2_fb);
2391
2392XrResult
2393oxr_get_face_expression_weights2_fb(struct oxr_logger *log,
2394 struct oxr_face_tracker2_fb *face_tracker2_fb,
2395 const XrFaceExpressionInfo2FB *expression_info,
2396 XrFaceExpressionWeights2FB *expression_weights);
2397#endif
2398
2399#ifdef OXR_HAVE_MNDX_xdev_space
2400/*!
2401 * Object that holds a list of the current @ref xrt_devices.
2402 *
2403 * Parent type/handle is @ref oxr_session
2404 *
2405 * @obj{XrXDevList}
2406 * @extends oxr_handle_base
2407 */
2408struct oxr_xdev_list
2409{
2410 //! Common structure for things referred to by OpenXR handles.
2411 struct oxr_handle_base handle;
2412
2413 //! Owner of this @ref xrt_device list.
2414 struct oxr_session *sess;
2415
2416 //! Monotonically increasing number.
2417 uint64_t generation_number;
2418
2419 uint64_t ids[XRT_SYSTEM_MAX_DEVICES];
2420 struct xrt_device *xdevs[XRT_SYSTEM_MAX_DEVICES];
2422
2423 //! Counts ids, names and xdevs.
2424 uint32_t device_count;
2425};
2426#endif // OXR_HAVE_MNDX_xdev_space
2427
2428#ifdef OXR_HAVE_EXT_plane_detection
2429/*!
2430 * A Plane Detector.
2431 *
2432 * Parent type/handle is @ref oxr_session
2433 *
2434 *
2435 * @obj{XrPlaneDetectorEXT}
2436 * @extends oxr_handle_base
2437 */
2438struct oxr_plane_detector_ext
2439{
2440 //! Common structure for things referred to by OpenXR handles.
2441 struct oxr_handle_base handle;
2442
2443 //! Owner of this anchor.
2444 struct oxr_session *sess;
2445
2446 //! Plane detector flags.
2448
2449 //! The last known state of this plane detector.
2450 XrPlaneDetectionStateEXT state;
2451
2452 //! Whether the last DONE plane detection has been retrieved from the xdev.
2453 bool retrieved;
2454
2455 //! The device that this plane detector belongs to.
2456 struct xrt_device *xdev;
2457
2458 //! Detected planes. xrt_plane_detector_locations_ext::relation is kept in xdev space and not updated.
2459 struct xrt_plane_detections_ext detections;
2460
2461 //! Corresponds to xrt_plane_detections_ext::locations, but with OpenXR types and transformed into target space.
2462 //! Enables two call idiom.
2463 XrPlaneDetectorLocationEXT *xr_locations;
2464
2465 //! A globally unique id for the current plane detection or 0, generated by the xrt_device.
2466 uint64_t detection_id;
2467};
2468#endif // OXR_HAVE_EXT_plane_detection
2469
2470#ifdef OXR_HAVE_EXT_future
2471/*!
2472 * EXT futures.
2473 *
2474 * Parent type/handle is @ref oxr_instance
2475 *
2476 * @obj{XrFutureEXT}
2477 * @extends oxr_handle_base
2478 */
2479struct oxr_future_ext
2480{
2481 //! Common structure for things referred to by OpenXR handles.
2482 struct oxr_handle_base handle;
2483
2484 //! (weak) reference to instance (may or not be a direct parent handle")
2485 struct oxr_instance *inst;
2486
2487 //! Owning session.
2488 struct oxr_session *sess;
2489
2490 //! xrt_future backing this future
2491 struct xrt_future *xft;
2492};
2493
2494/*!
2495 * To go back to a OpenXR object.
2496 *
2497 * @relates oxr_future_ext
2498 */
2499static inline XrFutureEXT
2500oxr_future_ext_to_openxr(struct oxr_future_ext *future_ext)
2501{
2502 return XRT_CAST_PTR_TO_OXR_HANDLE(XrFutureEXT, future_ext);
2503}
2504
2505XrResult
2506oxr_future_create(struct oxr_logger *log,
2507 struct oxr_session *sess,
2508 struct xrt_future *xft,
2509 struct oxr_handle_base *parent_handle,
2510 struct oxr_future_ext **out_oxr_future_ext);
2511
2512XrResult
2513oxr_future_invalidate(struct oxr_logger *log, struct oxr_future_ext *oxr_future);
2514
2515XrResult
2516oxr_future_ext_poll(struct oxr_logger *log, const struct oxr_future_ext *oxr_future, XrFuturePollResultEXT *pollResult);
2517
2518XrResult
2519oxr_future_ext_cancel(struct oxr_logger *log, struct oxr_future_ext *oxr_future);
2520
2521XrResult
2522oxr_future_ext_complete(struct oxr_logger *log,
2523 struct oxr_future_ext *oxr_future,
2524 struct xrt_future_result *out_ft_result);
2525
2526#endif
2527
2528#ifdef OXR_HAVE_EXT_user_presence
2529XrResult
2530oxr_event_push_XrEventDataUserPresenceChangedEXT(struct oxr_logger *log, struct oxr_session *sess, bool isUserPresent);
2531#endif // OXR_HAVE_EXT_user_presence
2532
2533#ifdef OXR_HAVE_ANDROID_face_tracking
2534/*!
2535 * Android specific Facial tracker.
2536 *
2537 * Parent type/handle is @ref oxr_instance
2538 *
2539 *
2540 * @obj{XrFaceTrackerANDROID}
2541 * @extends oxr_handle_base
2542 */
2543struct oxr_face_tracker_android
2544{
2545 //! Common structure for things referred to by OpenXR handles.
2546 struct oxr_handle_base handle;
2547
2548 //! Owner of this face tracker.
2549 struct oxr_session *sess;
2550
2551 //! xrt_device backing this face tracker
2552 struct xrt_device *xdev;
2553
2554 //! To track if the feature set has been incremented since creation.
2555 bool feature_incremented;
2556};
2557
2558XrResult
2559oxr_face_tracker_android_create(struct oxr_logger *log,
2560 struct oxr_session *sess,
2561 const XrFaceTrackerCreateInfoANDROID *createInfo,
2562 XrFaceTrackerANDROID *faceTracker);
2563
2564XrResult
2566 struct oxr_face_tracker_android *facial_tracker_android,
2567 const XrFaceStateGetInfoANDROID *getInfo,
2568 XrFaceStateANDROID *faceStateOutput);
2569
2570XrResult
2571oxr_get_face_calibration_state_android(struct oxr_logger *log,
2572 struct oxr_face_tracker_android *facial_tracker_android,
2573 XrBool32 *faceIsCalibratedOutput);
2574#endif // OXR_HAVE_ANDROID_face_tracking
2575
2576/*!
2577 * @}
2578 */
2579
2580
2581#ifdef __cplusplus
2582}
2583#endif
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:1987
XrResult oxr_poll_event(struct oxr_logger *log, struct oxr_instance *inst, XrEventDataBuffer *eventData)
Will return one event if available, also drain the sessions event queues.
Definition oxr_event.c:400
XrResult oxr_spaces_locate(struct oxr_logger *log, struct oxr_space **spcs, uint32_t spc_count, struct oxr_space *baseSpc, XrTime time, XrSpaceLocations *locations)
Definition oxr_space.c:304
static XrSwapchain oxr_swapchain_to_openxr(struct oxr_swapchain *sc)
To go back to a OpenXR object.
Definition oxr_objects.h:609
oxr_image_state
Tracks the state of a image that belongs to a oxr_swapchain.
Definition oxr_defines.h:101
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_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:1504
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:1519
XrResult oxr_space_xdev_pose_create(struct oxr_logger *log, struct oxr_session *sess, struct xrt_device *xdev, enum xrt_input_name name, const struct xrt_pose *pose, struct oxr_space **out_space)
Monado special space that always points to a specific xrt_device and pose, useful when you want to by...
Definition oxr_space.c:251
XRT_CHECK_RESULT XrResult oxr_space_locate_device(struct oxr_logger *log, struct xrt_device *xdev, struct oxr_space *baseSpc, XrTime time, struct xrt_space_relation *out_relation)
Locate the xrt_device in the given base space, useful for implementing hand tracking location look up...
Definition oxr_space.c:594
static XrDebugUtilsMessengerEXT oxr_messenger_to_openxr(struct oxr_debug_messenger *mssngr)
To go back to a OpenXR object.
Definition oxr_objects.h:625
XrResult oxr_space_locate(struct oxr_logger *log, struct oxr_space *spc, struct oxr_space *baseSpc, XrTime time, XrSpaceLocation *location)
Definition oxr_space.c:461
XrResult oxr_session_frame_end(struct oxr_logger *log, struct oxr_session *sess, const XrFrameEndInfo *frameEndInfo)
Definition oxr_session_frame_end.c:1643
static XrInstance oxr_instance_to_openxr(struct oxr_instance *inst)
To go back to a OpenXR object.
Definition oxr_objects.h:203
static XrHandTrackerEXT oxr_hand_tracker_to_openxr(struct oxr_hand_tracker *hand_tracker)
To go back to a OpenXR object.
Definition oxr_objects.h:305
static XrActionSet oxr_action_set_to_openxr(struct oxr_action_set *act_set)
To go back to a OpenXR object.
Definition oxr_objects.h:294
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:1644
static XrSession oxr_session_to_openxr(struct oxr_session *sess)
To go back to a OpenXR object.
Definition oxr_objects.h:412
oxr_session_graphics_ext
What graphics API was this session created with.
Definition oxr_defines.h:132
static XrAction oxr_action_to_openxr(struct oxr_action *act)
To go back to a OpenXR object.
Definition oxr_objects.h:329
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:91
oxr_space_type
Internal enum for the type of space, lets us reason about action spaces.
Definition oxr_defines.h:113
XrResult oxr_vk_create_vulkan_instance(struct oxr_logger *log, struct oxr_system *sys, const XrVulkanInstanceCreateInfoKHR *createInfo, VkInstance *vulkanInstance, VkResult *vulkanResult)
Definition oxr_vulkan.c:229
static void oxr_refcounted_ref(struct oxr_refcounted *orc)
Increase the reference count of orc.
Definition oxr_objects.h:1978
XrResult oxr_session_request_exit(struct oxr_logger *log, struct oxr_session *sess)
Definition oxr_session.c:464
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:117
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:245
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:248
XrResult oxr_create_messenger(struct oxr_logger *, struct oxr_instance *inst, const XrDebugUtilsMessengerCreateInfoEXT *, struct oxr_debug_messenger **out_mssngr)
Definition oxr_messenger.c:41
XRT_CHECK_RESULT XrResult oxr_space_get_xrt_space(struct oxr_logger *log, struct oxr_space *spc, struct xrt_space **out_xspace)
Get the xrt_space associated with this oxr_space, the xrt_space will be reference counted by this fun...
Definition oxr_space.c:626
XrResult oxr_session_frame_wait(struct oxr_logger *log, struct oxr_session *sess, XrFrameState *frameState)
Definition oxr_session.c:939
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:55
static XrSpace oxr_space_to_openxr(struct oxr_space *spc)
To go back to a OpenXR object.
Definition oxr_objects.h:518
oxr_subaction_path
Sub action paths.
Definition oxr_defines.h:72
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:110
#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:85
#define XRT_SYSTEM_MAX_DEVICES
Maximum number of devices simultaneously usable by an implementation of xrt_system_devices.
Definition xrt_limits.h:26
#define XRT_MAX_SWAPCHAIN_IMAGES
Max swapchain images, artificial limit.
Definition xrt_limits.h:53
xrt_input_name
Every internal input source known to monado with a baked in type.
Definition xrt_defines.h:915
xrt_output_name
Name of a output with a baked in type.
Definition xrt_defines.h:1582
xrt_plane_detector_flags_ext
Flags used when running plane detection.
Definition xrt_plane_detector.h:46
Definition bindings.py:1
Wrapper around OS threading native functions.
Shared internal defines and enums in the state tracker.
Holds dpad state related functions.
XrResult oxr_get_face_state_android(struct oxr_logger *log, struct oxr_face_tracker_android *facial_tracker_android, const XrFaceStateGetInfoANDROID *getInfo, XrFaceStateANDROID *faceStateOutput)
Definition oxr_face_tracking_android.c:76
Forward declarations for OpenXR state tracker structs.
The objects that handle session running status and blocking of xrWaitFrame.
XrResult oxr_instance_create(struct oxr_logger *log, const XrInstanceCreateInfo *createInfo, XrVersion major_minor, const struct oxr_extension_status *extensions, struct oxr_instance **out_instance)
Definition oxr_instance.c:242
Holds per instance action context.
Holds per instance action cache.
Holds interaction profile array related functions.
#define OXR_PATH_MEMBER(X)
Currently bound interaction profile.
Definition oxr_objects.h:1462
Path store structure and functions.
Wrapper functions that take oxr_instance and call into path/cache functions.
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:40
#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:24
Definition m_space.cpp:87
A wrapper around a native mutex.
Definition os_threading.h:69
Definition os_time.h:219
Data associated with an Action that has been attached to a Session.
Definition oxr_objects.h:1788
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:1812
struct oxr_action_ref * act_ref
This action's refcounted data.
Definition oxr_objects.h:1793
struct oxr_action_set_attachment * act_set_attached
The owning action set attachment.
Definition oxr_objects.h:1790
uint32_t act_key
Unique key for the session hashmap.
Definition oxr_objects.h:1804
struct oxr_session * sess
The corresponding session.
Definition oxr_objects.h:1801
The set of inputs/outputs for a single sub-action path for an action.
Definition oxr_objects.h:1766
A input action pair of a xrt_input and a xrt_device, along with the required transform.
Definition oxr_objects.h:1727
A output action pair of a xrt_output_name and a xrt_device.
Definition oxr_objects.h:1746
The reference-counted data of an action.
Definition oxr_objects.h:2088
char name[XR_MAX_ACTION_NAME_SIZE]
Application supplied name of this action.
Definition oxr_objects.h:2092
struct oxr_subaction_paths subaction_paths
Which sub action paths that this action was created with.
Definition oxr_objects.h:2101
XrActionType action_type
Type this action was created with.
Definition oxr_objects.h:2098
uint32_t act_key
Unique key for the session hashmap.
Definition oxr_objects.h:2095
The data associated with the attachment of an Action Set (oxr_action_set) to as Session (oxr_session)...
Definition oxr_objects.h:1669
struct oxr_action_attachment * act_attachments
An array of action attachments we own.
Definition oxr_objects.h:1683
struct oxr_session * sess
Owning session.
Definition oxr_objects.h:1671
struct oxr_action_set_ref * act_set_ref
Action set refcounted data.
Definition oxr_objects.h:1674
uint32_t act_set_key
Unique key for the session hashmap.
Definition oxr_objects.h:1677
size_t action_attachment_count
Length of oxr_action_set_attachment::act_attachments.
Definition oxr_objects.h:1688
struct oxr_subaction_paths requested_subaction_paths
Which sub-action paths are requested on the latest sync.
Definition oxr_objects.h:1680
The reference-counted data of an action set.
Definition oxr_objects.h:2006
uint32_t act_set_key
Unique key for the session hashmap.
Definition oxr_objects.h:2019
char name[XR_MAX_ACTION_SET_NAME_SIZE]
Application supplied name of this action.
Definition oxr_objects.h:2010
bool ever_attached
Has this action set even been attached to any session, marking it as immutable.
Definition oxr_objects.h:2016
uint32_t priority
Application supplied action set priority.
Definition oxr_objects.h:2022
A group of actions.
Definition oxr_objects.h:2048
struct u_hashset_item * name_item
The item in the name hashset.
Definition oxr_objects.h:2070
struct u_hashset_item * loc_item
The item in the localized hashset.
Definition oxr_objects.h:2073
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:2059
uint32_t act_set_key
Unique key for the session hashmap.
Definition oxr_objects.h:2067
struct oxr_handle_base handle
Common structure for things referred to by OpenXR handles.
Definition oxr_objects.h:2050
struct oxr_instance * inst
Owner of this action set.
Definition oxr_objects.h:2053
The state of a action input.
Definition oxr_objects.h:1701
bool active
Is this active (bound and providing input)?
Definition oxr_objects.h:1708
XrTime timestamp
When was this last changed.
Definition oxr_objects.h:1714
A single action.
Definition oxr_objects.h:2118
struct oxr_action_set * act_set
Owner of this action.
Definition oxr_objects.h:2123
struct oxr_handle_base handle
Common structure for things referred to by OpenXR handles.
Definition oxr_objects.h:2120
struct u_hashset_item * loc_item
The item in the localized hashset.
Definition oxr_objects.h:2140
uint32_t act_key
Unique key for the session hashmap.
Definition oxr_objects.h:2134
struct u_hashset_item * name_item
The item in the name hashset.
Definition oxr_objects.h:2137
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:2127
Interaction profile binding state.
Definition oxr_objects.h:1575
uint32_t * preferred_binding_path_index
store which entry in paths was suggested, for each action key
Definition oxr_objects.h:1587
const char * localized_name
Name presented to the user.
Definition oxr_objects.h:1580
Debug object created by the client program.
Definition oxr_objects.h:2151
struct oxr_handle_base handle
Common structure for things referred to by OpenXR handles.
Definition oxr_objects.h:2153
XrDebugUtilsMessageTypeFlagsEXT message_types
Types to submit to this messenger.
Definition oxr_objects.h:2162
PFN_xrDebugUtilsMessengerCallbackEXT user_callback
Callback function.
Definition oxr_objects.h:2165
struct oxr_instance * inst
Owner of this messenger.
Definition oxr_objects.h:2156
void *XR_MAY_ALIAS user_data
Opaque user data.
Definition oxr_objects.h:2168
XrDebugUtilsMessageSeverityFlagsEXT message_severities
Severities to submit to this messenger.
Definition oxr_objects.h:2159
dpad emulation settings from oxr_interaction_profile
Definition oxr_objects.h:1541
Holds dpad binding state for a single interaction profile.
Definition oxr_dpad_state.h:73
Definition oxr_event.c:30
Structure tracking which extensions are enabled for a given instance.
Definition oxr_objects.h:1200
Helper that handles synchronizing the xr{Wait,Begin,End}Frame calls.
Definition oxr_frame_sync.h:37
A hand tracker.
Definition oxr_hand_tracking.h:58
Used to hold diverse child handles and ensure orderly destruction.
Definition oxr_objects.h:1073
struct oxr_handle_base * parent
Pointer to this object's parent handle holder, if any.
Definition oxr_objects.h:1080
uint64_t debug
Magic (per-handle-type) value for debugging.
Definition oxr_objects.h:1075
struct oxr_handle_base * children[256]
Array of children, if any.
Definition oxr_objects.h:1085
enum oxr_handle_state state
Current handle state.
Definition oxr_objects.h:1090
oxr_handle_destroyer destroy
Destroy the object this handle refers to.
Definition oxr_objects.h:1095
Variant type for input transforms.
Definition oxr_input_transform.h:144
Holds all action-related state that lives at the instance level (shared across sessions).
Definition oxr_instance_action_context.h:41
This holds cached paths for subaction paths.
Definition oxr_instance_path_cache.h:27
Main object that ties everything together.
Definition oxr_objects.h:1214
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:1281
bool parallel_views
For applications that rely on views being parallel, notably some OpenVR games with OpenComposite.
Definition oxr_objects.h:1306
struct oxr_path_store path_store
Path store for managing paths.
Definition oxr_objects.h:1241
struct oxr_instance_action_context action_context
The default action context, holds things like suggested profiles.
Definition oxr_objects.h:1257
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:1294
XrVersion major_minor
Stores only major.minor version. Simplifies comparisons for e.g. "at least OpenXR 1....
Definition oxr_objects.h:1229
bool skip_end_session
Unreal 4 has a bug calling xrEndSession; the function should just exit.
Definition oxr_objects.h:1297
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:1303
struct oxr_extension_status extensions
Enabled extensions.
Definition oxr_objects.h:1223
struct oxr_instance_path_cache path_cache
Path cache for actions, needs path_store to work.
Definition oxr_objects.h:1254
struct oxr_debug_messenger * messengers[256]
Debug messengers.
Definition oxr_objects.h:1320
struct oxr_instance::@288 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:1309
struct oxr_handle_base handle
Common structure for things referred to by OpenXR handles.
Definition oxr_objects.h:1216
bool no_texture_source_alpha
Beat Saber submits its projection layer with XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT set.
Definition oxr_objects.h:1316
Manages an array of interaction profiles, does not have a init function but must be zero initialized ...
Definition oxr_interaction_profile_array.h:29
A single interaction profile.
Definition oxr_objects.h:1553
enum xrt_device_name xname
Used to lookup xrt_binding_profile for fallback.
Definition oxr_objects.h:1557
const char * localized_name
Name presented to the user.
Definition oxr_objects.h:1560
Logger struct that lives on the stack, one for each call client call.
Definition oxr_logger.h:44
Path store structure for managing path storage and lookup.
Definition oxr_path_store.h:31
Definition oxr_objects.h:1968
void(* destroy)(struct oxr_refcounted *)
Destruction callback.
Definition oxr_objects.h:1971
Object that client program interact with.
Definition oxr_objects.h:1354
struct u_hashmap_int * act_attachments_by_key
A map of action key to action attachment.
Definition oxr_objects.h:1443
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:1486
struct xrt_compositor_native * xcn
Native compositor that is wrapped by client compositors.
Definition oxr_objects.h:1366
struct xrt_session * xs
The xrt_session backing this session.
Definition oxr_objects.h:1363
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:1379
struct oxr_action_set_attachment * act_set_attachments
An array of action set attachments that this session owns.
Definition oxr_objects.h:1417
uint32_t frame_timing_wait_sleep_ms
Extra sleep in wait frame.
Definition oxr_objects.h:1481
struct os_precise_sleeper sleeper
Used to implement precise extra sleeping in wait frame.
Definition oxr_objects.h:1409
uint64_t dynamic_roles_generation_id
Cache of the last known system roles generation_id.
Definition oxr_objects.h:1452
enum oxr_session_graphics_ext gfx_ext
What graphics type was this session created with.
Definition oxr_objects.h:1360
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:1385
struct u_hashmap_int * act_sets_attachments_by_key
A map of action set key to action set attachments.
Definition oxr_objects.h:1431
struct oxr_handle_base handle
Common structure for things referred to by OpenXR handles.
Definition oxr_objects.h:1356
bool has_lost
initial relation of head in "global" space.
Definition oxr_objects.h:1495
float ipd_meters
IPD, to be expanded to a proper 3D relation.
Definition oxr_objects.h:1473
struct os_mutex sync_actions_mutex
Protects access to dynamic_roles_generation_id during sync actions.
Definition oxr_objects.h:1455
size_t action_set_attachment_count
Length of oxr_session::act_set_attachments.
Definition oxr_objects.h:1422
struct oxr_interaction_profile_array profiles_on_attachment
Clone of all suggested binding profiles at the point of action set/session attachment.
Definition oxr_objects.h:1449
bool frame_timing_spew
Frame timing debug output.
Definition oxr_objects.h:1478
Can be one of several reference space types, or a space that is bound to an action.
Definition oxr_objects.h:1861
struct oxr_subaction_paths subaction_paths
Which sub action path is this?
Definition oxr_objects.h:1878
enum oxr_space_type space_type
What kind of space is this?
Definition oxr_objects.h:1875
uint32_t act_key
Action key from which action this space was created from.
Definition oxr_objects.h:1872
struct xrt_pose pose
Pose that was given during creation.
Definition oxr_objects.h:1869
struct oxr_session * sess
Owner of this space.
Definition oxr_objects.h:1866
struct oxr_handle_base handle
Common structure for things referred to by OpenXR handles.
Definition oxr_objects.h:1863
A parsed equivalent of a list of sub-action paths.
Definition oxr_objects.h:1630
A set of images used for rendering.
Definition oxr_objects.h:1904
struct oxr_session * sess
Owner of this swapchain.
Definition oxr_objects.h:1909
uint32_t face_count
The number of cubemap faces. 6 for cubemaps, 1 otherwise.
Definition oxr_objects.h:1921
struct xrt_swapchain * swapchain
Compositor swapchain.
Definition oxr_objects.h:1912
struct oxr_handle_base handle
Common structure for things referred to by OpenXR handles.
Definition oxr_objects.h:1906
uint32_t width
Swapchain size.
Definition oxr_objects.h:1915
uint32_t array_layer_count
For 1 is 2D texture, greater then 1 2D array texture.
Definition oxr_objects.h:1918
Single or multiple devices grouped together to form a system that sessions can be created from.
Definition oxr_objects.h:1126
struct xrt_system * xsys
The XRT interfaces level system.
Definition oxr_objects.h:1130
VkPhysicalDevice suggested_vulkan_physical_device
The device returned with the last xrGetVulkanGraphicsDeviceKHR or xrGetVulkanGraphicsDevice2KHR call.
Definition oxr_objects.h:1163
PFN_vkGetInstanceProcAddr vk_get_instance_proc_addr
Stores the vkGetInstanceProcAddr passed to xrCreateVulkanInstanceKHR to be used when looking up Vulka...
Definition oxr_objects.h:1169
struct xrt_system_devices * xsysd
System devices used in all session types.
Definition oxr_objects.h:1133
struct xrt_space_overseer * xso
Space overseer used in all session types.
Definition oxr_objects.h:1136
VkInstance vulkan_enable2_instance
The instance/device we create when vulkan_enable2 is used.
Definition oxr_objects.h:1160
bool gotten_requirements
Have the client application called the gfx api requirements func?
Definition oxr_objects.h:1144
struct xrt_system_compositor * xsysc
System compositor, used to create session compositors.
Definition oxr_objects.h:1139
Holds the properties that a system supports for a view configuration type.
Definition oxr_objects.h:1104
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:2258
Main compositor server interface.
Definition xrt_compositor.h:2236
Common compositor client interface/base.
Definition xrt_compositor.h:992
A single HMD or input device.
Definition xrt_device.h:310
The (future) result of an asynchronous operation.
Definition xrt_future.h:39
A future is a concurrency primitive that provides a mechanism to access results of asynchronous opera...
Definition xrt_future.h:75
A single named input, that sits on a xrt_device.
Definition xrt_device.h:188
This interface acts as a root object for Monado.
Definition xrt_instance.h:120
A single named output, that sits on a xrt_device.
Definition xrt_device.h:206
Each plane has n polygons; ultimately plane metadata from xrt_plane_detections_ext::locations and xrt...
Definition xrt_plane_detector.h:172
A pose composed of a position and orientation.
Definition xrt_defines.h:479
A base class for reference counted objects.
Definition xrt_defines.h:99
The XRT representation of XrSession, this object does not have all of the functionality of a session,...
Definition xrt_session.h:277
Object that oversees and manages spaces, one created for each XR system.
Definition xrt_space.h:97
A relation with two spaces, includes velocity and acceleration.
Definition xrt_defines.h:670
A space very similar to a OpenXR XrSpace but not a full one-to-one mapping, but used to power XrSpace...
Definition xrt_space.h:32
Common swapchain interface/base.
Definition xrt_compositor.h:540
The system compositor handles composition for a system.
Definition xrt_compositor.h:2448
A collection of xrt_device, and an interface for identifying the roles they have been assigned.
Definition xrt_system.h:214
A system is a collection of devices, policies and optionally a compositor that is organised into a ch...
Definition xrt_system.h:63
Visibility mask helper, the indices and vertices are tightly packed after this struct.
Definition xrt_visibility_mask.h:26
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:1507
Header holding Android-specific details.
xrt_android_lifecycle_event
Distinguishes the possible Android lifecycle events from each other.
Definition xrt_android.h:43
Header declaring XRT graphics interfaces.
Auto detect OS and certain features.
xrt_perf_notify_level
Performance level.
Definition xrt_defines.h:2412
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:724
xrt_perf_domain
Domain type.
Definition xrt_defines.h:2385
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.