2020-06-01 20:32:43 +00:00
|
|
|
// Copyright 2018-2020, Collabora, Ltd.
|
2019-03-18 05:52:32 +00:00
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
|
|
/*!
|
|
|
|
* @file
|
2019-04-05 19:18:03 +00:00
|
|
|
* @brief Contains the instance struct that a lot of things hang from.
|
2019-03-18 05:52:32 +00:00
|
|
|
* @author Jakob Bornecrantz <jakob@collabora.com>
|
|
|
|
* @ingroup oxr_main
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "xrt/xrt_device.h"
|
2019-05-07 12:47:18 +00:00
|
|
|
#include "xrt/xrt_tracking.h"
|
2019-03-18 05:52:32 +00:00
|
|
|
#include "xrt/xrt_compositor.h"
|
|
|
|
#include "xrt/xrt_vulkan_includes.h"
|
|
|
|
#include "xrt/xrt_openxr_includes.h"
|
2020-05-30 12:56:23 +00:00
|
|
|
|
|
|
|
#include "os/os_threading.h"
|
|
|
|
|
2020-05-30 16:01:00 +00:00
|
|
|
#include "util/u_index_fifo.h"
|
2019-04-05 12:44:21 +00:00
|
|
|
#include "util/u_hashset.h"
|
2019-05-07 12:47:18 +00:00
|
|
|
#include "util/u_hashmap.h"
|
2019-03-18 05:52:32 +00:00
|
|
|
|
2019-08-19 17:37:50 +00:00
|
|
|
#include "oxr_extension_support.h"
|
2020-07-20 19:53:52 +00:00
|
|
|
#include "oxr_subaction.h"
|
2019-08-19 17:37:50 +00:00
|
|
|
|
2020-05-30 12:56:23 +00:00
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* @defgroup oxr OpenXR state tracker
|
|
|
|
*
|
|
|
|
* Client application facing code.
|
|
|
|
*
|
|
|
|
* @ingroup xrt
|
|
|
|
*/
|
|
|
|
|
2020-04-28 22:38:57 +00:00
|
|
|
/*!
|
|
|
|
* @brief Cast a pointer to an OpenXR handle in such a way as to avoid warnings.
|
|
|
|
*
|
|
|
|
* Avoids -Wpointer-to-int-cast by first casting to the same size int, then
|
|
|
|
* promoting to the 64-bit int, then casting to the handle type. That's a lot of
|
|
|
|
* no-ops on 64-bit, but a widening conversion on 32-bit.
|
|
|
|
*
|
|
|
|
* @ingroup oxr
|
|
|
|
*/
|
|
|
|
#define XRT_CAST_PTR_TO_OXR_HANDLE(HANDLE_TYPE, PTR) \
|
|
|
|
((HANDLE_TYPE)(uint64_t)(uintptr_t)(PTR))
|
|
|
|
|
2020-04-28 22:46:22 +00:00
|
|
|
/*!
|
|
|
|
* @brief Cast an OpenXR handle to a pointer in such a way as to avoid warnings.
|
|
|
|
*
|
|
|
|
* Avoids -Wint-to-pointer-cast by first casting to a 64-bit int, then to a
|
|
|
|
* pointer-sized int, then to the desired pointer type. That's a lot of no-ops
|
|
|
|
* on 64-bit, but a narrowing (!) conversion on 32-bit.
|
|
|
|
*
|
|
|
|
* @ingroup oxr
|
|
|
|
*/
|
|
|
|
#define XRT_CAST_OXR_HANDLE_TO_PTR(PTR_TYPE, HANDLE) \
|
|
|
|
((PTR_TYPE)(uintptr_t)(uint64_t)(HANDLE))
|
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
/*!
|
|
|
|
* @defgroup oxr_main OpenXR main code
|
|
|
|
*
|
|
|
|
* Gets called from @ref oxr_api functions and talks to devices and
|
|
|
|
* @ref comp using @ref xrt_iface.
|
|
|
|
*
|
|
|
|
* @ingroup oxr
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
// For corruption and layer checking.
|
|
|
|
// clang-format off
|
|
|
|
#define OXR_XR_DEBUG_INSTANCE (*(uint64_t *)"oxrinst\0")
|
|
|
|
#define OXR_XR_DEBUG_SESSION (*(uint64_t *)"oxrsess\0")
|
|
|
|
#define OXR_XR_DEBUG_SPACE (*(uint64_t *)"oxrspac\0")
|
2019-04-05 12:44:21 +00:00
|
|
|
#define OXR_XR_DEBUG_PATH (*(uint64_t *)"oxrpath\0")
|
2019-03-18 05:52:32 +00:00
|
|
|
#define OXR_XR_DEBUG_ACTION (*(uint64_t *)"oxracti\0")
|
|
|
|
#define OXR_XR_DEBUG_SWAPCHAIN (*(uint64_t *)"oxrswap\0")
|
|
|
|
#define OXR_XR_DEBUG_ACTIONSET (*(uint64_t *)"oxraset\0")
|
|
|
|
#define OXR_XR_DEBUG_MESSENGER (*(uint64_t *)"oxrmess\0")
|
2019-05-07 12:47:18 +00:00
|
|
|
#define OXR_XR_DEBUG_SOURCESET (*(uint64_t *)"oxrsrcs\0")
|
|
|
|
#define OXR_XR_DEBUG_SOURCE (*(uint64_t *)"oxrsrc_\0")
|
2019-03-18 05:52:32 +00:00
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Forward declare structs.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-04-10 09:53:27 +00:00
|
|
|
struct xrt_instance;
|
2019-03-18 05:52:32 +00:00
|
|
|
struct oxr_logger;
|
|
|
|
struct oxr_instance;
|
|
|
|
struct oxr_system;
|
|
|
|
struct oxr_session;
|
|
|
|
struct oxr_event;
|
|
|
|
struct oxr_swapchain;
|
|
|
|
struct oxr_space;
|
|
|
|
struct oxr_action_set;
|
|
|
|
struct oxr_action;
|
2019-04-04 22:56:31 +00:00
|
|
|
struct oxr_debug_messenger;
|
2019-04-05 19:18:03 +00:00
|
|
|
struct oxr_handle_base;
|
2019-05-07 12:47:18 +00:00
|
|
|
struct oxr_sub_paths;
|
2020-06-15 19:16:38 +00:00
|
|
|
struct oxr_action_attachment;
|
|
|
|
struct oxr_action_set_attachment;
|
|
|
|
struct oxr_action_input;
|
|
|
|
struct oxr_action_output;
|
2019-09-02 21:04:13 +00:00
|
|
|
struct oxr_binding;
|
|
|
|
struct oxr_interaction_profile;
|
2020-06-15 23:05:42 +00:00
|
|
|
struct oxr_action_set_ref;
|
|
|
|
struct oxr_action_ref;
|
2019-04-05 19:18:03 +00:00
|
|
|
|
|
|
|
#define XRT_MAX_HANDLE_CHILDREN 256
|
2020-05-30 16:01:00 +00:00
|
|
|
#define OXR_MAX_SWAPCHAIN_IMAGES 8
|
2019-04-05 19:18:03 +00:00
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
struct time_state;
|
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
|
|
|
* Function pointer type for a handle destruction function.
|
|
|
|
*
|
|
|
|
* @relates oxr_handle_base
|
|
|
|
*/
|
2019-04-05 19:18:03 +00:00
|
|
|
typedef XrResult (*oxr_handle_destroyer)(struct oxr_logger *log,
|
|
|
|
struct oxr_handle_base *hb);
|
|
|
|
|
|
|
|
/*!
|
2019-06-18 16:17:26 +00:00
|
|
|
* State of a handle base, to reduce likelihood of going "boom" on
|
2019-04-05 19:18:03 +00:00
|
|
|
* out-of-order destruction or other unsavory behavior.
|
|
|
|
*/
|
|
|
|
enum oxr_handle_state
|
|
|
|
{
|
|
|
|
/*! State during/before oxr_handle_init, or after failure */
|
|
|
|
OXR_HANDLE_STATE_UNINITIALIZED = 0,
|
|
|
|
|
|
|
|
/*! State after successful oxr_handle_init */
|
|
|
|
OXR_HANDLE_STATE_LIVE,
|
|
|
|
|
|
|
|
/*! State after successful oxr_handle_destroy */
|
|
|
|
OXR_HANDLE_STATE_DESTROYED,
|
|
|
|
};
|
|
|
|
|
2019-09-02 21:04:13 +00:00
|
|
|
/*!
|
|
|
|
* Sub action paths.
|
|
|
|
*/
|
|
|
|
enum oxr_sub_action_path
|
|
|
|
{
|
|
|
|
OXR_SUB_ACTION_PATH_USER,
|
|
|
|
OXR_SUB_ACTION_PATH_HEAD,
|
|
|
|
OXR_SUB_ACTION_PATH_LEFT,
|
|
|
|
OXR_SUB_ACTION_PATH_RIGHT,
|
|
|
|
OXR_SUB_ACTION_PATH_GAMEPAD,
|
|
|
|
};
|
|
|
|
|
2020-05-30 16:01:00 +00:00
|
|
|
/*!
|
|
|
|
* Tracks the state of a image that belongs to a @ref oxr_swapchain.
|
|
|
|
*/
|
|
|
|
enum oxr_image_state
|
|
|
|
{
|
|
|
|
OXR_IMAGE_STATE_READY,
|
|
|
|
OXR_IMAGE_STATE_ACQUIRED,
|
|
|
|
OXR_IMAGE_STATE_WAITED,
|
|
|
|
};
|
|
|
|
|
2019-05-07 12:47:18 +00:00
|
|
|
|
2019-04-05 19:18:03 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* oxr_handle_base.c
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Destroy the handle's object, as well as all child handles recursively.
|
|
|
|
*
|
|
|
|
* This should be how all handle-associated objects are destroyed.
|
2020-06-03 22:25:21 +00:00
|
|
|
*
|
|
|
|
* @public @memberof oxr_handle_base
|
2019-04-05 19:18:03 +00:00
|
|
|
*/
|
|
|
|
XrResult
|
|
|
|
oxr_handle_destroy(struct oxr_logger *log, struct oxr_handle_base *hb);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Returns a human-readable label for a handle state.
|
2020-06-03 22:25:21 +00:00
|
|
|
*
|
|
|
|
* @relates oxr_handle_base
|
2019-04-05 19:18:03 +00:00
|
|
|
*/
|
|
|
|
const char *
|
|
|
|
oxr_handle_state_to_string(enum oxr_handle_state state);
|
2019-03-18 05:52:32 +00:00
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
2019-03-18 05:52:32 +00:00
|
|
|
*
|
2020-06-03 22:25:21 +00:00
|
|
|
* @name oxr_instance.c
|
|
|
|
* @{
|
2019-03-18 05:52:32 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* To go back to a OpenXR object.
|
2020-06-03 22:25:21 +00:00
|
|
|
*
|
|
|
|
* @relates oxr_instance
|
2019-03-18 05:52:32 +00:00
|
|
|
*/
|
2020-03-03 23:29:59 +00:00
|
|
|
static inline XrInstance
|
2019-03-18 05:52:32 +00:00
|
|
|
oxr_instance_to_openxr(struct oxr_instance *inst)
|
|
|
|
{
|
2020-04-28 22:38:57 +00:00
|
|
|
return XRT_CAST_PTR_TO_OXR_HANDLE(XrInstance, inst);
|
2019-03-18 05:52:32 +00:00
|
|
|
}
|
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
|
|
|
* @public @static @memberof oxr_instance
|
|
|
|
*/
|
2019-03-18 05:52:32 +00:00
|
|
|
XrResult
|
|
|
|
oxr_instance_create(struct oxr_logger *log,
|
|
|
|
const XrInstanceCreateInfo *createInfo,
|
|
|
|
struct oxr_instance **out_inst);
|
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
|
|
|
* @public @memberof oxr_instance
|
|
|
|
*/
|
2019-03-18 05:52:32 +00:00
|
|
|
XrResult
|
|
|
|
oxr_instance_get_properties(struct oxr_logger *log,
|
|
|
|
struct oxr_instance *inst,
|
|
|
|
XrInstanceProperties *instanceProperties);
|
|
|
|
|
|
|
|
#if XR_USE_TIMESPEC
|
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
|
|
|
* @public @memberof oxr_instance
|
|
|
|
*/
|
2019-03-18 05:52:32 +00:00
|
|
|
XrResult
|
|
|
|
oxr_instance_convert_time_to_timespec(struct oxr_logger *log,
|
|
|
|
struct oxr_instance *inst,
|
|
|
|
XrTime time,
|
|
|
|
struct timespec *timespecTime);
|
2020-06-03 22:25:21 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* @public @memberof oxr_instance
|
|
|
|
*/
|
2019-03-18 05:52:32 +00:00
|
|
|
XrResult
|
|
|
|
oxr_instance_convert_timespec_to_time(struct oxr_logger *log,
|
|
|
|
struct oxr_instance *inst,
|
|
|
|
const struct timespec *timespecTime,
|
|
|
|
XrTime *time);
|
|
|
|
#endif // XR_USE_TIMESPEC
|
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
|
|
|
* @}
|
|
|
|
*/
|
2019-04-05 12:44:21 +00:00
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
2019-04-05 12:44:21 +00:00
|
|
|
*
|
2020-06-03 22:25:21 +00:00
|
|
|
* @name oxr_path.c
|
|
|
|
* @{
|
2019-04-05 12:44:21 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-05-27 20:04:58 +00:00
|
|
|
/*!
|
|
|
|
* Initialize the path system.
|
2020-06-03 22:25:21 +00:00
|
|
|
* @private @memberof oxr_instance
|
2020-05-27 20:04:58 +00:00
|
|
|
*/
|
|
|
|
XrResult
|
|
|
|
oxr_path_init(struct oxr_logger *log, struct oxr_instance *inst);
|
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
|
|
|
* @public @memberof oxr_instance
|
|
|
|
*/
|
2020-06-01 19:54:12 +00:00
|
|
|
bool
|
|
|
|
oxr_path_is_valid(struct oxr_logger *log,
|
|
|
|
struct oxr_instance *inst,
|
|
|
|
XrPath path);
|
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
|
|
|
* @public @memberof oxr_instance
|
|
|
|
*/
|
2019-04-05 12:44:21 +00:00
|
|
|
void *
|
|
|
|
oxr_path_get_attached(struct oxr_logger *log,
|
|
|
|
struct oxr_instance *inst,
|
|
|
|
XrPath path);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Get the path for the given string if it exists, or create it if it does not.
|
2020-06-03 22:25:21 +00:00
|
|
|
*
|
|
|
|
* @public @memberof oxr_instance
|
2019-04-05 12:44:21 +00:00
|
|
|
*/
|
|
|
|
XrResult
|
|
|
|
oxr_path_get_or_create(struct oxr_logger *log,
|
|
|
|
struct oxr_instance *inst,
|
|
|
|
const char *str,
|
|
|
|
size_t length,
|
|
|
|
XrPath *out_path);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Only get the path for the given string if it exists.
|
2020-06-03 22:25:21 +00:00
|
|
|
*
|
|
|
|
* @public @memberof oxr_instance
|
2019-04-05 12:44:21 +00:00
|
|
|
*/
|
|
|
|
XrResult
|
|
|
|
oxr_path_only_get(struct oxr_logger *log,
|
|
|
|
struct oxr_instance *inst,
|
|
|
|
const char *str,
|
|
|
|
size_t length,
|
|
|
|
XrPath *out_path);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Get a pointer and length of the internal string.
|
|
|
|
*
|
|
|
|
* The pointer has the same life time as the instance. The length is the number
|
2020-07-21 22:34:19 +00:00
|
|
|
* of valid characters, not including the null termination character (but an
|
2019-04-05 12:44:21 +00:00
|
|
|
* extra null byte is always reserved at the end so can strings can be given
|
|
|
|
* to functions expecting null terminated strings).
|
2020-06-03 22:25:21 +00:00
|
|
|
*
|
|
|
|
* @public @memberof oxr_instance
|
2019-04-05 12:44:21 +00:00
|
|
|
*/
|
|
|
|
XrResult
|
|
|
|
oxr_path_get_string(struct oxr_logger *log,
|
|
|
|
struct oxr_instance *inst,
|
|
|
|
XrPath path,
|
|
|
|
const char **out_str,
|
|
|
|
size_t *out_length);
|
|
|
|
|
|
|
|
/*!
|
2020-05-27 20:04:58 +00:00
|
|
|
* Destroy the path system and all paths that the instance has created.
|
2020-06-03 22:25:21 +00:00
|
|
|
*
|
|
|
|
* @private @memberof oxr_instance
|
2019-04-05 12:44:21 +00:00
|
|
|
*/
|
|
|
|
void
|
2020-05-27 20:04:58 +00:00
|
|
|
oxr_path_destroy(struct oxr_logger *log, struct oxr_instance *inst);
|
2019-04-05 12:44:21 +00:00
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* To go back to a OpenXR object.
|
|
|
|
*
|
|
|
|
* @relates oxr_action_set
|
|
|
|
*/
|
|
|
|
static inline XrActionSet
|
|
|
|
oxr_action_set_to_openxr(struct oxr_action_set *act_set)
|
|
|
|
{
|
|
|
|
return XRT_CAST_PTR_TO_OXR_HANDLE(XrActionSet, act_set);
|
|
|
|
}
|
2019-04-05 12:44:21 +00:00
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
|
|
|
* To go back to a OpenXR object.
|
2019-05-07 12:47:18 +00:00
|
|
|
*
|
2020-06-03 22:25:21 +00:00
|
|
|
* @relates oxr_action
|
|
|
|
*/
|
|
|
|
static inline XrAction
|
|
|
|
oxr_action_to_openxr(struct oxr_action *act)
|
|
|
|
{
|
|
|
|
return XRT_CAST_PTR_TO_OXR_HANDLE(XrAction, act);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
*
|
|
|
|
* @name oxr_input.c
|
|
|
|
* @{
|
2019-05-07 12:47:18 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-05-07 12:47:18 +00:00
|
|
|
/*!
|
|
|
|
* Helper function to classify sub_paths.
|
2020-06-03 22:25:21 +00:00
|
|
|
*
|
2020-06-15 19:16:38 +00:00
|
|
|
* Sets all members of @p sub_paths ( @ref oxr_sub_paths ) as appropriate based
|
|
|
|
* on the subaction paths found in the list.
|
|
|
|
*
|
|
|
|
* If no paths are provided, @p sub_paths->any will be true.
|
|
|
|
*
|
|
|
|
* @return false if an invalid subaction path is provided.
|
|
|
|
*
|
2020-06-03 22:25:21 +00:00
|
|
|
* @public @memberof oxr_instance
|
2020-06-15 19:16:38 +00:00
|
|
|
* @relatesalso oxr_sub_paths
|
2019-05-07 12:47:18 +00:00
|
|
|
*/
|
2020-06-15 19:16:38 +00:00
|
|
|
bool
|
2019-05-07 12:47:18 +00:00
|
|
|
oxr_classify_sub_action_paths(struct oxr_logger *log,
|
|
|
|
struct oxr_instance *inst,
|
|
|
|
uint32_t num_subaction_paths,
|
|
|
|
const XrPath *subaction_paths,
|
|
|
|
struct oxr_sub_paths *sub_paths);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Find the pose input for the set of sub_paths
|
2020-06-03 22:25:21 +00:00
|
|
|
*
|
|
|
|
* @public @memberof oxr_session
|
2019-05-07 12:47:18 +00:00
|
|
|
*/
|
|
|
|
XrResult
|
2020-06-16 21:31:29 +00:00
|
|
|
oxr_action_get_pose_input(struct oxr_logger *log,
|
2019-05-07 12:47:18 +00:00
|
|
|
struct oxr_session *sess,
|
2020-07-21 13:53:02 +00:00
|
|
|
uint32_t act_key,
|
2019-05-07 12:47:18 +00:00
|
|
|
const struct oxr_sub_paths *sub_paths,
|
2020-06-15 19:16:38 +00:00
|
|
|
struct oxr_action_input **out_input);
|
2020-07-21 13:53:02 +00:00
|
|
|
|
2019-05-07 12:47:18 +00:00
|
|
|
/*!
|
2020-06-03 22:25:21 +00:00
|
|
|
* @public @memberof oxr_instance
|
2019-05-07 12:47:18 +00:00
|
|
|
*/
|
|
|
|
XrResult
|
|
|
|
oxr_action_set_create(struct oxr_logger *log,
|
2019-07-13 16:17:57 +00:00
|
|
|
struct oxr_instance *inst,
|
2019-05-07 12:47:18 +00:00
|
|
|
const XrActionSetCreateInfo *createInfo,
|
|
|
|
struct oxr_action_set **out_act_set);
|
|
|
|
|
|
|
|
/*!
|
2020-06-03 22:25:21 +00:00
|
|
|
* @public @memberof oxr_action
|
2019-05-07 12:47:18 +00:00
|
|
|
*/
|
|
|
|
XrResult
|
|
|
|
oxr_action_create(struct oxr_logger *log,
|
|
|
|
struct oxr_action_set *act_set,
|
|
|
|
const XrActionCreateInfo *createInfo,
|
|
|
|
struct oxr_action **out_act);
|
2020-07-21 13:53:02 +00:00
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
|
|
|
* @public @memberof oxr_session
|
|
|
|
* @relatesalso oxr_action_set
|
|
|
|
*/
|
2019-07-13 16:17:57 +00:00
|
|
|
XrResult
|
|
|
|
oxr_session_attach_action_sets(struct oxr_logger *log,
|
|
|
|
struct oxr_session *sess,
|
|
|
|
const XrSessionActionSetsAttachInfo *bindInfo);
|
2020-07-21 13:53:02 +00:00
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
|
|
|
* @public @memberof oxr_session
|
|
|
|
*/
|
2019-05-07 12:47:18 +00:00
|
|
|
XrResult
|
|
|
|
oxr_action_sync_data(struct oxr_logger *log,
|
|
|
|
struct oxr_session *sess,
|
|
|
|
uint32_t countActionSets,
|
|
|
|
const XrActiveActionSet *actionSets);
|
2020-07-21 13:57:21 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* @public @memberof oxr_session
|
|
|
|
*/
|
|
|
|
XrResult
|
|
|
|
oxr_action_enumerate_bound_sources(struct oxr_logger *log,
|
|
|
|
struct oxr_session *sess,
|
|
|
|
uint32_t act_key,
|
|
|
|
uint32_t sourceCapacityInput,
|
|
|
|
uint32_t *sourceCountOutput,
|
|
|
|
XrPath *sources);
|
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
|
|
|
* @public @memberof oxr_session
|
|
|
|
*/
|
2019-05-07 12:47:18 +00:00
|
|
|
XrResult
|
|
|
|
oxr_action_get_boolean(struct oxr_logger *log,
|
2019-07-13 16:17:57 +00:00
|
|
|
struct oxr_session *sess,
|
2020-06-15 22:05:32 +00:00
|
|
|
uint32_t act_key,
|
2019-05-07 12:47:18 +00:00
|
|
|
struct oxr_sub_paths sub_paths,
|
2019-05-07 12:47:18 +00:00
|
|
|
XrActionStateBoolean *data);
|
2020-07-21 13:53:02 +00:00
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
|
|
|
* @public @memberof oxr_session
|
|
|
|
*/
|
2019-05-07 12:47:18 +00:00
|
|
|
XrResult
|
|
|
|
oxr_action_get_vector1f(struct oxr_logger *log,
|
2019-07-13 16:17:57 +00:00
|
|
|
struct oxr_session *sess,
|
2020-06-15 22:05:32 +00:00
|
|
|
uint32_t act_key,
|
2019-05-07 12:47:18 +00:00
|
|
|
struct oxr_sub_paths sub_paths,
|
2019-07-13 16:17:57 +00:00
|
|
|
XrActionStateFloat *data);
|
2019-05-07 12:47:18 +00:00
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
|
|
|
* @public @memberof oxr_session
|
|
|
|
*/
|
2019-05-07 12:47:18 +00:00
|
|
|
XrResult
|
|
|
|
oxr_action_get_vector2f(struct oxr_logger *log,
|
2019-07-13 16:17:57 +00:00
|
|
|
struct oxr_session *sess,
|
2020-06-15 22:05:32 +00:00
|
|
|
uint32_t act_key,
|
2019-05-07 12:47:18 +00:00
|
|
|
struct oxr_sub_paths sub_paths,
|
2019-05-07 12:47:18 +00:00
|
|
|
XrActionStateVector2f *data);
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
|
|
|
* @public @memberof oxr_session
|
|
|
|
*/
|
2019-05-07 12:47:18 +00:00
|
|
|
XrResult
|
|
|
|
oxr_action_get_pose(struct oxr_logger *log,
|
2019-07-13 16:17:57 +00:00
|
|
|
struct oxr_session *sess,
|
2020-06-15 22:05:32 +00:00
|
|
|
uint32_t act_key,
|
2019-05-07 12:47:18 +00:00
|
|
|
struct oxr_sub_paths sub_paths,
|
2019-05-07 12:47:18 +00:00
|
|
|
XrActionStatePose *data);
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
|
|
|
* @public @memberof oxr_session
|
|
|
|
*/
|
2019-05-07 12:47:18 +00:00
|
|
|
XrResult
|
|
|
|
oxr_action_apply_haptic_feedback(struct oxr_logger *log,
|
2019-07-13 16:17:57 +00:00
|
|
|
struct oxr_session *sess,
|
2020-06-15 22:05:32 +00:00
|
|
|
uint32_t act_key,
|
2019-07-13 16:17:57 +00:00
|
|
|
struct oxr_sub_paths sub_paths,
|
2019-05-07 12:47:18 +00:00
|
|
|
const XrHapticBaseHeader *hapticEvent);
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
|
|
|
* @public @memberof oxr_session
|
|
|
|
*/
|
2019-05-07 12:47:18 +00:00
|
|
|
XrResult
|
|
|
|
oxr_action_stop_haptic_feedback(struct oxr_logger *log,
|
2019-07-13 16:17:57 +00:00
|
|
|
struct oxr_session *sess,
|
2020-06-15 22:05:32 +00:00
|
|
|
uint32_t act_key,
|
2019-07-13 16:17:57 +00:00
|
|
|
struct oxr_sub_paths sub_paths);
|
2019-05-07 12:47:18 +00:00
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
|
|
|
* @}
|
|
|
|
*/
|
2019-05-07 12:47:18 +00:00
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
2019-09-02 21:04:13 +00:00
|
|
|
*
|
2020-06-03 22:25:21 +00:00
|
|
|
* @name oxr_binding.c
|
|
|
|
* @{
|
2019-09-02 21:04:13 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Find the best matching profile for the given @ref xrt_device.
|
|
|
|
*
|
2019-11-02 22:40:26 +00:00
|
|
|
* @param log Logger.
|
|
|
|
* @param inst Instance.
|
|
|
|
* @param xdev Can be null.
|
|
|
|
* @param[out] out_p Returned interaction profile.
|
2020-06-03 22:25:21 +00:00
|
|
|
*
|
|
|
|
* @public @memberof oxr_instance
|
2019-09-02 21:04:13 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
oxr_find_profile_for_device(struct oxr_logger *log,
|
|
|
|
struct oxr_instance *inst,
|
|
|
|
struct xrt_device *xdev,
|
|
|
|
struct oxr_interaction_profile **out_p);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Free all memory allocated by the binding system.
|
2020-06-03 22:25:21 +00:00
|
|
|
*
|
|
|
|
* @public @memberof oxr_instance
|
2019-09-02 21:04:13 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
oxr_binding_destroy_all(struct oxr_logger *log, struct oxr_instance *inst);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Find all bindings that is the given action key is bound to.
|
2020-06-03 22:25:21 +00:00
|
|
|
* @public @memberof oxr_interaction_profile
|
2019-09-02 21:04:13 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
oxr_binding_find_bindings_from_key(struct oxr_logger *log,
|
|
|
|
struct oxr_interaction_profile *profile,
|
|
|
|
uint32_t key,
|
|
|
|
struct oxr_binding *bindings[32],
|
|
|
|
size_t *num_bindings);
|
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
|
|
|
* @public @memberof oxr_instance
|
|
|
|
*/
|
2019-09-02 21:04:13 +00:00
|
|
|
XrResult
|
|
|
|
oxr_action_suggest_interaction_profile_bindings(
|
|
|
|
struct oxr_logger *log,
|
|
|
|
struct oxr_instance *inst,
|
|
|
|
const XrInteractionProfileSuggestedBinding *suggestedBindings);
|
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
|
|
|
* @public @memberof oxr_instance
|
|
|
|
*/
|
2019-09-02 21:04:13 +00:00
|
|
|
XrResult
|
|
|
|
oxr_action_get_current_interaction_profile(
|
|
|
|
struct oxr_logger *log,
|
|
|
|
struct oxr_session *sess,
|
|
|
|
XrPath topLevelUserPath,
|
|
|
|
XrInteractionProfileState *interactionProfile);
|
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
|
|
|
* @public @memberof oxr_session
|
|
|
|
*/
|
2019-09-02 21:04:13 +00:00
|
|
|
XrResult
|
|
|
|
oxr_action_get_input_source_localized_name(
|
|
|
|
struct oxr_logger *log,
|
|
|
|
struct oxr_session *sess,
|
|
|
|
const XrInputSourceLocalizedNameGetInfo *getInfo,
|
|
|
|
uint32_t bufferCapacityInput,
|
|
|
|
uint32_t *bufferCountOutput,
|
|
|
|
char *buffer);
|
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
|
|
|
* @}
|
|
|
|
*/
|
2019-09-02 21:04:13 +00:00
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
/*!
|
2019-03-18 05:52:32 +00:00
|
|
|
*
|
2020-06-03 22:25:21 +00:00
|
|
|
* @name oxr_session.c
|
|
|
|
* @{
|
2019-03-18 05:52:32 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* To go back to a OpenXR object.
|
2020-06-03 22:25:21 +00:00
|
|
|
*
|
|
|
|
* @relates oxr_session
|
2019-03-18 05:52:32 +00:00
|
|
|
*/
|
2020-03-03 23:29:59 +00:00
|
|
|
static inline XrSession
|
2019-03-18 05:52:32 +00:00
|
|
|
oxr_session_to_openxr(struct oxr_session *sess)
|
|
|
|
{
|
2020-04-28 22:38:57 +00:00
|
|
|
return XRT_CAST_PTR_TO_OXR_HANDLE(XrSession, sess);
|
2019-03-18 05:52:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_session_create(struct oxr_logger *log,
|
|
|
|
struct oxr_system *sys,
|
2019-06-03 19:17:45 +00:00
|
|
|
const XrSessionCreateInfo *createInfo,
|
2019-03-18 05:52:32 +00:00
|
|
|
struct oxr_session **out_session);
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_session_enumerate_formats(struct oxr_logger *log,
|
|
|
|
struct oxr_session *sess,
|
|
|
|
uint32_t formatCapacityInput,
|
|
|
|
uint32_t *formatCountOutput,
|
|
|
|
int64_t *formats);
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_session_begin(struct oxr_logger *log,
|
|
|
|
struct oxr_session *sess,
|
|
|
|
const XrSessionBeginInfo *beginInfo);
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_session_end(struct oxr_logger *log, struct oxr_session *sess);
|
|
|
|
|
2019-10-22 12:35:09 +00:00
|
|
|
XrResult
|
|
|
|
oxr_session_request_exit(struct oxr_logger *log, struct oxr_session *sess);
|
|
|
|
|
2019-10-08 15:24:16 +00:00
|
|
|
void
|
2020-06-17 06:36:38 +00:00
|
|
|
oxr_session_poll(struct oxr_logger *log, struct oxr_session *sess);
|
2019-10-08 15:24:16 +00:00
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
/*!
|
|
|
|
* Get the view space position at the given time in relation to the
|
|
|
|
* local or stage space.
|
|
|
|
*/
|
|
|
|
XrResult
|
|
|
|
oxr_session_get_view_pose_at(struct oxr_logger *,
|
|
|
|
struct oxr_session *sess,
|
|
|
|
XrTime at_time,
|
|
|
|
struct xrt_pose *);
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_session_views(struct oxr_logger *log,
|
|
|
|
struct oxr_session *sess,
|
|
|
|
const XrViewLocateInfo *viewLocateInfo,
|
|
|
|
XrViewState *viewState,
|
|
|
|
uint32_t viewCapacityInput,
|
|
|
|
uint32_t *viewCountOutput,
|
|
|
|
XrView *views);
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_session_frame_wait(struct oxr_logger *log,
|
|
|
|
struct oxr_session *sess,
|
|
|
|
XrFrameState *frameState);
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_session_frame_begin(struct oxr_logger *log, struct oxr_session *sess);
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_session_frame_end(struct oxr_logger *log,
|
|
|
|
struct oxr_session *sess,
|
|
|
|
const XrFrameEndInfo *frameEndInfo);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* oxr_space.c
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* To go back to a OpenXR object.
|
|
|
|
*/
|
2020-03-03 23:29:59 +00:00
|
|
|
static inline XrSpace
|
2019-03-18 05:52:32 +00:00
|
|
|
oxr_space_to_openxr(struct oxr_space *spc)
|
|
|
|
{
|
2020-04-28 22:38:57 +00:00
|
|
|
return XRT_CAST_PTR_TO_OXR_HANDLE(XrSpace, spc);
|
2019-03-18 05:52:32 +00:00
|
|
|
}
|
|
|
|
|
2019-04-05 19:18:03 +00:00
|
|
|
XrResult
|
|
|
|
oxr_space_action_create(struct oxr_logger *log,
|
2019-07-13 16:17:57 +00:00
|
|
|
struct oxr_session *sess,
|
|
|
|
uint64_t key,
|
2019-04-05 19:18:03 +00:00
|
|
|
const XrActionSpaceCreateInfo *createInfo,
|
|
|
|
struct oxr_space **out_space);
|
2019-07-13 16:17:57 +00:00
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
XrResult
|
|
|
|
oxr_space_reference_create(struct oxr_logger *log,
|
|
|
|
struct oxr_session *sess,
|
|
|
|
const XrReferenceSpaceCreateInfo *createInfo,
|
|
|
|
struct oxr_space **out_space);
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_space_locate(struct oxr_logger *log,
|
|
|
|
struct oxr_space *spc,
|
|
|
|
struct oxr_space *baseSpc,
|
|
|
|
XrTime time,
|
2019-08-16 22:02:18 +00:00
|
|
|
XrSpaceLocation *location);
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_space_ref_relation(struct oxr_logger *log,
|
|
|
|
struct oxr_session *sess,
|
|
|
|
XrReferenceSpaceType space,
|
|
|
|
XrReferenceSpaceType baseSpc,
|
|
|
|
XrTime time,
|
|
|
|
struct xrt_space_relation *out_relation);
|
|
|
|
|
2020-07-19 21:44:24 +00:00
|
|
|
bool
|
|
|
|
initial_head_relation_valid(struct oxr_session *sess);
|
|
|
|
|
|
|
|
bool
|
|
|
|
global_to_local_space(struct oxr_session *sess, struct xrt_pose *pose);
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* oxr_swapchain.c
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* To go back to a OpenXR object.
|
|
|
|
*/
|
2020-03-03 23:29:59 +00:00
|
|
|
static inline XrSwapchain
|
2019-03-18 05:52:32 +00:00
|
|
|
oxr_swapchain_to_openxr(struct oxr_swapchain *sc)
|
|
|
|
{
|
2020-04-28 22:38:57 +00:00
|
|
|
return XRT_CAST_PTR_TO_OXR_HANDLE(XrSwapchain, sc);
|
2019-03-18 05:52:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_create_swapchain(struct oxr_logger *,
|
|
|
|
struct oxr_session *sess,
|
|
|
|
const XrSwapchainCreateInfo *,
|
2019-08-16 22:02:18 +00:00
|
|
|
struct oxr_swapchain **out_swapchain);
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
2019-04-04 22:56:31 +00:00
|
|
|
* oxr_messenger.c
|
|
|
|
*
|
|
|
|
*/
|
2019-04-05 19:18:03 +00:00
|
|
|
|
2019-04-04 22:56:31 +00:00
|
|
|
/*!
|
|
|
|
* To go back to a OpenXR object.
|
|
|
|
*/
|
2020-03-03 23:29:59 +00:00
|
|
|
static inline XrDebugUtilsMessengerEXT
|
2019-04-04 22:56:31 +00:00
|
|
|
oxr_messenger_to_openxr(struct oxr_debug_messenger *mssngr)
|
|
|
|
{
|
2020-04-28 22:38:57 +00:00
|
|
|
return XRT_CAST_PTR_TO_OXR_HANDLE(XrDebugUtilsMessengerEXT, mssngr);
|
2019-04-04 22:56:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_create_messenger(struct oxr_logger *,
|
|
|
|
struct oxr_instance *inst,
|
|
|
|
const XrDebugUtilsMessengerCreateInfoEXT *,
|
|
|
|
struct oxr_debug_messenger **out_mssngr);
|
|
|
|
XrResult
|
|
|
|
oxr_destroy_messenger(struct oxr_logger *log,
|
|
|
|
struct oxr_debug_messenger *mssngr);
|
2019-08-19 22:12:14 +00:00
|
|
|
|
|
|
|
|
2019-04-04 22:56:31 +00:00
|
|
|
/*
|
|
|
|
*
|
2019-03-18 05:52:32 +00:00
|
|
|
* oxr_system.c
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_system_select(struct oxr_logger *log,
|
|
|
|
struct oxr_system **systems,
|
|
|
|
uint32_t num_systems,
|
|
|
|
XrFormFactor form_factor,
|
|
|
|
struct oxr_system **out_selected);
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_system_fill_in(struct oxr_logger *log,
|
|
|
|
struct oxr_instance *inst,
|
|
|
|
XrSystemId systemId,
|
2020-08-06 13:05:27 +00:00
|
|
|
struct oxr_system *sys);
|
2019-03-18 05:52:32 +00:00
|
|
|
|
2019-06-05 19:21:25 +00:00
|
|
|
XrResult
|
|
|
|
oxr_system_verify_id(struct oxr_logger *log,
|
|
|
|
const struct oxr_instance *inst,
|
|
|
|
XrSystemId systemId);
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_system_get_by_id(struct oxr_logger *log,
|
|
|
|
struct oxr_instance *inst,
|
|
|
|
XrSystemId systemId,
|
|
|
|
struct oxr_system **system);
|
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
XrResult
|
|
|
|
oxr_system_get_properties(struct oxr_logger *log,
|
|
|
|
struct oxr_system *sys,
|
|
|
|
XrSystemProperties *properties);
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_system_enumerate_view_confs(
|
|
|
|
struct oxr_logger *log,
|
|
|
|
struct oxr_system *sys,
|
|
|
|
uint32_t viewConfigurationTypeCapacityInput,
|
|
|
|
uint32_t *viewConfigurationTypeCountOutput,
|
|
|
|
XrViewConfigurationType *viewConfigurationTypes);
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_system_enumerate_blend_modes(struct oxr_logger *log,
|
|
|
|
struct oxr_system *sys,
|
2019-07-13 16:17:57 +00:00
|
|
|
XrViewConfigurationType viewConfigurationType,
|
2019-03-18 05:52:32 +00:00
|
|
|
uint32_t environmentBlendModeCapacityInput,
|
|
|
|
uint32_t *environmentBlendModeCountOutput,
|
|
|
|
XrEnvironmentBlendMode *environmentBlendModes);
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_system_get_view_conf_properties(
|
|
|
|
struct oxr_logger *log,
|
|
|
|
struct oxr_system *sys,
|
|
|
|
XrViewConfigurationType viewConfigurationType,
|
|
|
|
XrViewConfigurationProperties *configurationProperties);
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_system_enumerate_view_conf_views(
|
|
|
|
struct oxr_logger *log,
|
|
|
|
struct oxr_system *sys,
|
|
|
|
XrViewConfigurationType viewConfigurationType,
|
|
|
|
uint32_t viewCapacityInput,
|
|
|
|
uint32_t *viewCountOutput,
|
|
|
|
XrViewConfigurationView *views);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* oxr_event.cpp
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_poll_event(struct oxr_logger *log,
|
|
|
|
struct oxr_instance *inst,
|
|
|
|
XrEventDataBuffer *eventData);
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_event_push_XrEventDataSessionStateChanged(struct oxr_logger *log,
|
|
|
|
struct oxr_session *sess,
|
|
|
|
XrSessionState state,
|
|
|
|
XrTime time);
|
|
|
|
|
2020-06-17 06:36:38 +00:00
|
|
|
XrResult
|
|
|
|
oxr_event_push_XrEventDataMainSessionVisibilityChangedEXTX(
|
|
|
|
struct oxr_logger *log, struct oxr_session *sess, bool visible);
|
|
|
|
|
2020-07-20 18:34:02 +00:00
|
|
|
XrResult
|
|
|
|
oxr_event_push_XrEventDataInteractionProfileChanged(struct oxr_logger *log,
|
|
|
|
struct oxr_session *sess);
|
|
|
|
|
2020-05-30 12:26:46 +00:00
|
|
|
/*!
|
|
|
|
* This clears all pending events refers to the given session.
|
|
|
|
*/
|
|
|
|
XrResult
|
|
|
|
oxr_event_remove_session_events(struct oxr_logger *log,
|
|
|
|
struct oxr_session *sess);
|
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
|
2019-05-07 12:47:18 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* oxr_xdev.c
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-07-24 16:15:15 +00:00
|
|
|
void
|
|
|
|
oxr_xdev_destroy(struct xrt_device **xdev_ptr);
|
|
|
|
|
2019-05-07 12:47:18 +00:00
|
|
|
void
|
2020-04-16 12:23:12 +00:00
|
|
|
oxr_xdev_update(struct xrt_device *xdev);
|
2019-05-07 12:47:18 +00:00
|
|
|
|
2019-06-21 23:39:20 +00:00
|
|
|
/*!
|
|
|
|
* Return true if it finds an input of that name on this device.
|
|
|
|
*/
|
|
|
|
bool
|
2019-05-07 12:47:18 +00:00
|
|
|
oxr_xdev_find_input(struct xrt_device *xdev,
|
|
|
|
enum xrt_input_name name,
|
|
|
|
struct xrt_input **out_input);
|
|
|
|
|
2019-08-16 15:52:15 +00:00
|
|
|
/*!
|
|
|
|
* Return true if it finds an output of that name on this device.
|
|
|
|
*/
|
|
|
|
bool
|
2019-05-07 12:47:18 +00:00
|
|
|
oxr_xdev_find_output(struct xrt_device *xdev,
|
|
|
|
enum xrt_output_name name,
|
|
|
|
struct xrt_output **out_output);
|
|
|
|
|
2020-04-16 12:23:12 +00:00
|
|
|
/*!
|
|
|
|
* Returns the pose of the named input from the device, if the pose isn't valid
|
|
|
|
* uses the device offset instead.
|
|
|
|
*/
|
2019-05-07 12:47:18 +00:00
|
|
|
void
|
|
|
|
oxr_xdev_get_pose_at(struct oxr_logger *log,
|
|
|
|
struct oxr_instance *inst,
|
|
|
|
struct xrt_device *xdev,
|
|
|
|
enum xrt_input_name name,
|
2020-04-16 12:23:12 +00:00
|
|
|
XrTime at_time,
|
|
|
|
uint64_t *out_pose_timestamp_ns,
|
2020-05-28 23:24:29 +00:00
|
|
|
struct xrt_space_relation *out_relation);
|
2020-04-16 12:23:12 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* Returns the relation of the named input from the device, always ensures
|
|
|
|
* that position and orientation is valid by using the device offset.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
oxr_xdev_get_relation_at(struct oxr_logger *log,
|
|
|
|
struct oxr_instance *inst,
|
|
|
|
struct xrt_device *xdev,
|
|
|
|
enum xrt_input_name name,
|
|
|
|
XrTime at_time,
|
|
|
|
uint64_t *out_relation_timestamp_ns,
|
|
|
|
struct xrt_space_relation *out_relation);
|
2019-05-07 12:47:18 +00:00
|
|
|
|
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* OpenGL, located in various files.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef XR_USE_GRAPHICS_API_OPENGL
|
|
|
|
#ifdef XR_USE_PLATFORM_XLIB
|
|
|
|
|
|
|
|
XrResult
|
2019-04-05 22:13:58 +00:00
|
|
|
oxr_session_populate_gl_xlib(struct oxr_logger *log,
|
|
|
|
struct oxr_system *sys,
|
2019-06-03 19:17:45 +00:00
|
|
|
XrGraphicsBindingOpenGLXlibKHR const *next,
|
2019-04-05 22:13:58 +00:00
|
|
|
struct oxr_session *sess);
|
2019-12-03 19:08:10 +00:00
|
|
|
#endif // XR_USE_PLATFORM_XLIB
|
2019-03-18 05:52:32 +00:00
|
|
|
|
2020-07-16 22:22:59 +00:00
|
|
|
#endif // XR_USE_GRAPHICS_API_OPENGL
|
|
|
|
|
|
|
|
#if defined(XR_USE_GRAPHICS_API_OPENGL) || \
|
|
|
|
defined(XR_USE_GRAPHICS_API_OPENGL_ES)
|
2019-03-18 05:52:32 +00:00
|
|
|
XrResult
|
|
|
|
oxr_swapchain_gl_create(struct oxr_logger *,
|
|
|
|
struct oxr_session *sess,
|
|
|
|
const XrSwapchainCreateInfo *,
|
|
|
|
struct oxr_swapchain **out_swapchain);
|
|
|
|
|
2020-07-16 22:22:59 +00:00
|
|
|
#endif // XR_USE_GRAPHICS_API_OPENGL || XR_USE_GRAPHICS_API_OPENGL_ES
|
|
|
|
|
2020-08-14 23:07:14 +00:00
|
|
|
#if defined(XR_USE_GRAPHICS_API_OPENGL_ES)
|
|
|
|
#if defined(XR_USE_PLATFORM_ANDROID)
|
|
|
|
XrResult
|
|
|
|
oxr_session_populate_gles_android(
|
|
|
|
struct oxr_logger *log,
|
|
|
|
struct oxr_system *sys,
|
|
|
|
XrGraphicsBindingOpenGLESAndroidKHR const *next,
|
|
|
|
struct oxr_session *sess);
|
|
|
|
#endif // XR_USE_PLATFORM_ANDROID
|
|
|
|
#endif // XR_USE_GRAPHICS_API_OPENGL_ES
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Vulkan, located in various files.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef XR_USE_GRAPHICS_API_VULKAN
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_vk_get_instance_exts(struct oxr_logger *log,
|
|
|
|
struct oxr_system *sys,
|
|
|
|
uint32_t namesCapacityInput,
|
|
|
|
uint32_t *namesCountOutput,
|
|
|
|
char *namesString);
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_vk_get_device_exts(struct oxr_logger *log,
|
|
|
|
struct oxr_system *sys,
|
|
|
|
uint32_t namesCapacityInput,
|
|
|
|
uint32_t *namesCountOutput,
|
|
|
|
char *namesString);
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_vk_get_requirements(struct oxr_logger *log,
|
|
|
|
struct oxr_system *sys,
|
|
|
|
XrGraphicsRequirementsVulkanKHR *graphicsRequirements);
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_vk_get_physical_device(struct oxr_logger *log,
|
|
|
|
struct oxr_instance *inst,
|
|
|
|
struct oxr_system *sys,
|
|
|
|
VkInstance vkInstance,
|
|
|
|
PFN_vkGetInstanceProcAddr getProc,
|
|
|
|
VkPhysicalDevice *vkPhysicalDevice);
|
|
|
|
|
|
|
|
XrResult
|
2019-04-05 22:13:58 +00:00
|
|
|
oxr_session_populate_vk(struct oxr_logger *log,
|
|
|
|
struct oxr_system *sys,
|
2019-06-03 19:17:45 +00:00
|
|
|
XrGraphicsBindingVulkanKHR const *next,
|
2019-04-05 22:13:58 +00:00
|
|
|
struct oxr_session *sess);
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_swapchain_vk_create(struct oxr_logger *,
|
|
|
|
struct oxr_session *sess,
|
|
|
|
const XrSwapchainCreateInfo *,
|
|
|
|
struct oxr_swapchain **out_swapchain);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2019-10-29 16:11:48 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* EGL, located in various files.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef XR_USE_PLATFORM_EGL
|
|
|
|
|
|
|
|
XrResult
|
|
|
|
oxr_session_populate_egl(struct oxr_logger *log,
|
|
|
|
struct oxr_system *sys,
|
2020-05-20 15:55:07 +00:00
|
|
|
XrGraphicsBindingEGLMNDX const *next,
|
2019-10-29 16:11:48 +00:00
|
|
|
struct oxr_session *sess);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Structs
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-04-05 19:18:03 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* Used to hold diverse child handles and ensure orderly destruction.
|
|
|
|
*
|
|
|
|
* Each object referenced by an OpenXR handle should have one of these as its
|
2020-06-03 22:25:21 +00:00
|
|
|
* first element, thus "extending" this class.
|
2019-04-05 19:18:03 +00:00
|
|
|
*/
|
|
|
|
struct oxr_handle_base
|
|
|
|
{
|
|
|
|
//! Magic (per-handle-type) value for debugging.
|
|
|
|
uint64_t debug;
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Pointer to this object's parent handle holder, if any.
|
|
|
|
*/
|
|
|
|
struct oxr_handle_base *parent;
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Array of children, if any.
|
|
|
|
*/
|
|
|
|
struct oxr_handle_base *children[XRT_MAX_HANDLE_CHILDREN];
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Current handle state.
|
|
|
|
*/
|
|
|
|
enum oxr_handle_state state;
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Destroy the object this handle refers to.
|
|
|
|
*/
|
|
|
|
oxr_handle_destroyer destroy;
|
|
|
|
};
|
|
|
|
|
2020-07-07 00:14:29 +00:00
|
|
|
#define XRT_DEVICE_ROLE_UNASSIGNED (-1)
|
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
/*!
|
|
|
|
* Single or multiple devices grouped together to form a system that sessions
|
|
|
|
* can be created from. Might need to open devices in order to get all
|
|
|
|
* properties from it, but shouldn't.
|
|
|
|
*
|
2020-06-03 22:25:21 +00:00
|
|
|
* Not strictly an object, but an atom.
|
|
|
|
*
|
|
|
|
* Valid only within a XrInstance (@ref oxr_instance)
|
|
|
|
*
|
2019-03-18 05:52:32 +00:00
|
|
|
* @obj{XrSystemId}
|
|
|
|
*/
|
|
|
|
struct oxr_system
|
|
|
|
{
|
|
|
|
struct oxr_instance *inst;
|
2020-08-06 13:05:27 +00:00
|
|
|
|
|
|
|
//! Native compositor that is wrapped by client compositors.
|
|
|
|
struct xrt_compositor_native *xcn;
|
|
|
|
|
2020-07-07 00:14:29 +00:00
|
|
|
struct xrt_device *xdevs[16];
|
2019-07-24 16:15:15 +00:00
|
|
|
size_t num_xdevs;
|
2020-08-06 13:05:27 +00:00
|
|
|
|
2020-07-07 00:14:29 +00:00
|
|
|
/* index for xdevs array */
|
|
|
|
struct
|
|
|
|
{
|
2020-07-22 21:25:49 +00:00
|
|
|
#define OXR_ROLE_FIELD(X) int X;
|
|
|
|
OXR_FOR_EACH_VALID_SUBACTION_PATH(OXR_ROLE_FIELD)
|
|
|
|
#undef OXR_ROLE_FIELD
|
2020-07-07 00:14:29 +00:00
|
|
|
} role;
|
2019-05-07 12:47:18 +00:00
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
XrSystemId systemId;
|
|
|
|
|
2020-05-30 11:42:41 +00:00
|
|
|
//! Have the client application called the gfx api requirements func?
|
|
|
|
bool gotten_requirements;
|
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
XrFormFactor form_factor;
|
|
|
|
XrViewConfigurationType view_config_type;
|
|
|
|
XrViewConfigurationView views[2];
|
|
|
|
uint32_t num_blend_modes;
|
|
|
|
XrEnvironmentBlendMode blend_modes[3];
|
|
|
|
};
|
|
|
|
|
2020-07-07 00:14:29 +00:00
|
|
|
#define GET_XDEV_BY_ROLE(SYS, ROLE) \
|
|
|
|
SYS->role.ROLE == XRT_DEVICE_ROLE_UNASSIGNED \
|
|
|
|
? NULL \
|
|
|
|
: SYS->xdevs[SYS->role.ROLE]
|
|
|
|
|
2019-08-19 17:37:50 +00:00
|
|
|
#define MAKE_EXT_STATUS(mixed_case, all_caps) bool mixed_case;
|
|
|
|
/*!
|
|
|
|
* Structure tracking which extensions are enabled for a given instance.
|
|
|
|
*
|
|
|
|
* Names are systematic: the extension name with the XR_ prefix removed.
|
|
|
|
*/
|
|
|
|
struct oxr_extension_status
|
|
|
|
{
|
|
|
|
OXR_EXTENSION_SUPPORT_GENERATE(MAKE_EXT_STATUS)
|
|
|
|
};
|
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
/*!
|
|
|
|
* Main object that ties everything together.
|
|
|
|
*
|
2020-06-03 22:25:21 +00:00
|
|
|
* No parent type/handle: this is the root handle.
|
|
|
|
*
|
2019-03-18 05:52:32 +00:00
|
|
|
* @obj{XrInstance}
|
2020-06-03 22:25:21 +00:00
|
|
|
* @extends oxr_handle_base
|
2019-03-18 05:52:32 +00:00
|
|
|
*/
|
|
|
|
struct oxr_instance
|
|
|
|
{
|
2019-04-05 19:18:03 +00:00
|
|
|
//! Common structure for things referred to by OpenXR handles.
|
|
|
|
struct oxr_handle_base handle;
|
|
|
|
|
2019-10-10 14:36:05 +00:00
|
|
|
/* ---- HACK ---- */
|
|
|
|
void *hack;
|
|
|
|
/* ---- HACK ---- */
|
|
|
|
|
2020-04-10 09:53:27 +00:00
|
|
|
struct xrt_instance *xinst;
|
2019-03-18 05:52:32 +00:00
|
|
|
|
2019-08-19 17:37:50 +00:00
|
|
|
//! Enabled extensions
|
|
|
|
struct oxr_extension_status extensions;
|
2019-03-23 01:11:14 +00:00
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
// Hardcoded single system.
|
|
|
|
struct oxr_system system;
|
|
|
|
|
|
|
|
struct time_state *timekeeping;
|
|
|
|
|
2020-05-30 22:44:03 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
struct u_hashset *name_store;
|
|
|
|
struct u_hashset *loc_store;
|
|
|
|
} action_sets;
|
|
|
|
|
2019-04-05 12:44:21 +00:00
|
|
|
//! Path store, for looking up paths.
|
|
|
|
struct u_hashset *path_store;
|
2020-05-27 20:04:58 +00:00
|
|
|
//! Mapping from ID to path.
|
|
|
|
struct oxr_path **path_array;
|
|
|
|
//! Total length of path array.
|
|
|
|
size_t path_array_length;
|
|
|
|
//! Number of paths in the array (0 is always null).
|
|
|
|
size_t path_num;
|
2019-04-05 12:44:21 +00:00
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
// Event queue.
|
2020-05-30 12:56:23 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
struct os_mutex mutex;
|
|
|
|
struct oxr_event *last;
|
|
|
|
struct oxr_event *next;
|
|
|
|
} event;
|
2019-04-04 22:56:31 +00:00
|
|
|
|
2019-09-02 21:04:13 +00:00
|
|
|
struct oxr_interaction_profile **profiles;
|
|
|
|
size_t num_profiles;
|
|
|
|
|
2019-10-08 15:24:16 +00:00
|
|
|
struct oxr_session *sessions;
|
2019-05-07 12:47:18 +00:00
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
2020-07-20 19:53:52 +00:00
|
|
|
|
|
|
|
#define SUBACTION_PATH_MEMBER(X) XrPath X;
|
|
|
|
OXR_FOR_EACH_SUBACTION_PATH(SUBACTION_PATH_MEMBER)
|
|
|
|
|
|
|
|
#undef SUBACTION_PATH_MEMBER
|
|
|
|
|
2019-09-02 21:04:13 +00:00
|
|
|
|
|
|
|
XrPath khr_simple_controller;
|
|
|
|
XrPath google_daydream_controller;
|
|
|
|
XrPath htc_vive_controller;
|
|
|
|
XrPath htc_vive_pro;
|
|
|
|
XrPath microsoft_motion_controller;
|
|
|
|
XrPath microsoft_xbox_controller;
|
|
|
|
XrPath oculus_go_controller;
|
|
|
|
XrPath oculus_touch_controller;
|
|
|
|
XrPath valve_index_controller;
|
2020-07-06 10:31:38 +00:00
|
|
|
XrPath mndx_ball_on_a_stick_controller;
|
2019-05-07 12:47:18 +00:00
|
|
|
} path_cache;
|
|
|
|
|
2019-04-04 22:56:31 +00:00
|
|
|
//! Debug messengers
|
|
|
|
struct oxr_debug_messenger *messengers[XRT_MAX_HANDLE_CHILDREN];
|
2019-10-22 10:47:25 +00:00
|
|
|
|
|
|
|
bool lifecycle_verbose;
|
|
|
|
bool debug_views;
|
|
|
|
bool debug_spaces;
|
|
|
|
bool debug_bindings;
|
2019-03-18 05:52:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Object that client program interact with.
|
|
|
|
*
|
2020-06-03 22:25:21 +00:00
|
|
|
* Parent type/handle is @ref oxr_instance
|
|
|
|
*
|
2019-03-18 05:52:32 +00:00
|
|
|
* @obj{XrSession}
|
2020-06-03 22:25:21 +00:00
|
|
|
* @extends oxr_handle_base
|
2019-03-18 05:52:32 +00:00
|
|
|
*/
|
|
|
|
struct oxr_session
|
|
|
|
{
|
2019-04-05 19:18:03 +00:00
|
|
|
//! Common structure for things referred to by OpenXR handles.
|
|
|
|
struct oxr_handle_base handle;
|
2019-03-18 05:52:32 +00:00
|
|
|
struct oxr_system *sys;
|
|
|
|
struct xrt_compositor *compositor;
|
|
|
|
|
2019-10-08 15:24:16 +00:00
|
|
|
struct oxr_session *next;
|
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
XrSessionState state;
|
2020-05-30 17:30:27 +00:00
|
|
|
bool has_begun;
|
|
|
|
/*!
|
|
|
|
* There is a extra state between xrBeginSession has been called and
|
|
|
|
* the first xrWaitFrame has been called. These are to track this.
|
|
|
|
*/
|
|
|
|
bool has_waited_once;
|
2019-03-18 05:52:32 +00:00
|
|
|
bool frame_started;
|
2019-10-22 18:51:37 +00:00
|
|
|
bool exiting;
|
2019-03-18 05:52:32 +00:00
|
|
|
|
2020-06-23 16:11:39 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
int64_t waited;
|
|
|
|
int64_t begun;
|
|
|
|
} frame_id;
|
|
|
|
|
2020-06-23 17:02:08 +00:00
|
|
|
struct os_semaphore sem;
|
|
|
|
|
2020-06-15 21:46:21 +00:00
|
|
|
/*!
|
|
|
|
* An array of action set attachments that this session owns.
|
2020-07-06 18:58:17 +00:00
|
|
|
*
|
|
|
|
* If non-null, this means action sets have been attached to this
|
|
|
|
* session.
|
2020-06-15 21:46:21 +00:00
|
|
|
*/
|
|
|
|
struct oxr_action_set_attachment *act_set_attachments;
|
2020-07-06 18:58:17 +00:00
|
|
|
|
2020-06-15 21:46:21 +00:00
|
|
|
/*!
|
|
|
|
* Length of @ref oxr_session::act_set_attachments.
|
|
|
|
*/
|
|
|
|
size_t num_action_set_attachments;
|
2019-05-07 12:47:18 +00:00
|
|
|
|
2020-06-15 21:46:21 +00:00
|
|
|
/*!
|
|
|
|
* A map of action set key to action set attachments.
|
2020-07-06 18:58:17 +00:00
|
|
|
*
|
|
|
|
* If non-null, this means action sets have been attached to this
|
|
|
|
* session, since this map points to elements of
|
|
|
|
* oxr_session::act_set_attachments
|
2020-06-15 21:46:21 +00:00
|
|
|
*/
|
|
|
|
struct u_hashmap_int *act_sets_attachments_by_key;
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* A map of action key to action attachment.
|
|
|
|
*
|
|
|
|
* The action attachments are actually owned by the action set
|
|
|
|
* attachments, but we own the action set attachments, so this is OK.
|
2020-07-06 18:58:17 +00:00
|
|
|
*
|
|
|
|
* If non-null, this means action sets have been attached to this
|
|
|
|
* session, since this map points to @p oxr_action_attachment members of
|
|
|
|
* oxr_session::act_set_attachments elements.
|
2020-06-15 21:46:21 +00:00
|
|
|
*/
|
|
|
|
struct u_hashmap_int *act_attachments_by_key;
|
2019-10-28 14:57:35 +00:00
|
|
|
|
2019-09-02 21:04:13 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* Currently bound interaction profile.
|
|
|
|
* @{
|
|
|
|
*/
|
2020-07-22 21:25:49 +00:00
|
|
|
|
|
|
|
#define OXR_PATH_MEMBER(X) XrPath X;
|
|
|
|
|
|
|
|
OXR_FOR_EACH_VALID_SUBACTION_PATH(OXR_PATH_MEMBER)
|
|
|
|
#undef OXR_PATH_MEMBER
|
2019-09-02 21:04:13 +00:00
|
|
|
/*!
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
/*!
|
|
|
|
* IPD, to be expanded to a proper 3D relation.
|
|
|
|
*/
|
|
|
|
float ipd_meters;
|
|
|
|
|
|
|
|
float static_prediction_s;
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* To pipe swapchain creation to right code.
|
|
|
|
*/
|
|
|
|
XrResult (*create_swapchain)(struct oxr_logger *,
|
|
|
|
struct oxr_session *sess,
|
|
|
|
const XrSwapchainCreateInfo *,
|
|
|
|
struct oxr_swapchain **);
|
2020-07-19 21:44:24 +00:00
|
|
|
|
|
|
|
/*! initial relation of head in "global" space.
|
|
|
|
* Used as reference for local space. */
|
|
|
|
struct xrt_space_relation initial_head_relation;
|
2019-03-18 05:52:32 +00:00
|
|
|
};
|
|
|
|
|
2019-09-26 20:25:05 +00:00
|
|
|
/*!
|
|
|
|
* Returns XR_SUCCESS or XR_SESSION_LOSS_PENDING as appropriate.
|
2020-06-03 22:25:21 +00:00
|
|
|
*
|
|
|
|
* @public @memberof oxr_session
|
2019-09-26 20:25:05 +00:00
|
|
|
*/
|
2020-03-03 23:29:59 +00:00
|
|
|
static inline XrResult
|
2019-09-26 20:25:05 +00:00
|
|
|
oxr_session_success_result(struct oxr_session *session)
|
|
|
|
{
|
|
|
|
switch (session->state) {
|
|
|
|
case XR_SESSION_STATE_LOSS_PENDING: return XR_SESSION_LOSS_PENDING;
|
|
|
|
default: return XR_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Returns XR_SUCCESS, XR_SESSION_LOSS_PENDING, or XR_SESSION_NOT_FOCUSED, as
|
|
|
|
* appropriate.
|
2020-06-03 22:25:21 +00:00
|
|
|
*
|
|
|
|
* @public @memberof oxr_session
|
2019-09-26 20:25:05 +00:00
|
|
|
*/
|
2020-03-03 23:29:59 +00:00
|
|
|
static inline XrResult
|
2019-09-26 20:25:05 +00:00
|
|
|
oxr_session_success_focused_result(struct oxr_session *session)
|
|
|
|
{
|
|
|
|
switch (session->state) {
|
|
|
|
case XR_SESSION_STATE_LOSS_PENDING: return XR_SESSION_LOSS_PENDING;
|
|
|
|
case XR_SESSION_STATE_FOCUSED: return XR_SUCCESS;
|
|
|
|
default: return XR_SESSION_NOT_FOCUSED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-02 21:04:13 +00:00
|
|
|
/*!
|
|
|
|
* A single interaction profile.
|
|
|
|
*/
|
|
|
|
struct oxr_interaction_profile
|
|
|
|
{
|
|
|
|
XrPath path;
|
|
|
|
struct oxr_binding *bindings;
|
|
|
|
size_t num_bindings;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Interaction profile binding state.
|
|
|
|
*/
|
|
|
|
struct oxr_binding
|
|
|
|
{
|
|
|
|
XrPath *paths;
|
|
|
|
size_t num_paths;
|
|
|
|
|
|
|
|
enum oxr_sub_action_path sub_path;
|
|
|
|
|
|
|
|
size_t num_keys;
|
2020-05-04 15:22:15 +00:00
|
|
|
uint32_t *keys;
|
|
|
|
//! store which entry in paths was suggested, for each action key
|
|
|
|
uint32_t *preferred_binding_path_index;
|
2019-09-02 21:04:13 +00:00
|
|
|
|
|
|
|
enum xrt_input_name *inputs;
|
|
|
|
size_t num_inputs;
|
|
|
|
|
|
|
|
enum xrt_output_name *outputs;
|
|
|
|
size_t num_outputs;
|
|
|
|
};
|
|
|
|
|
2020-07-21 22:10:25 +00:00
|
|
|
/*!
|
|
|
|
* @defgroup oxr_input OpenXR input
|
|
|
|
* @ingroup oxr_main
|
|
|
|
*
|
|
|
|
* @brief The action-set/action-based input subsystem of OpenXR.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Action sets are created as children of the Instance, but are primarily used
|
|
|
|
* with one or more Sessions. They may be used with multiple sessions at a time,
|
|
|
|
* so we can't just put the per-session information directly in the action set
|
|
|
|
* or action. Instead, we have the `_attachment `structures, which mirror the
|
|
|
|
* action sets and actions but are rooted under the Session:
|
|
|
|
*
|
|
|
|
* - For every action set attached to a session, that session owns a @ref
|
|
|
|
* oxr_action_set_attachment.
|
|
|
|
* - For each action in those attached action sets, the action set attachment
|
|
|
|
* owns an @ref oxr_action_attachment.
|
|
|
|
*
|
|
|
|
* We go from the public handle to the `_attachment` structure by using a `key`
|
|
|
|
* value and a hash map: specifically, we look up the
|
|
|
|
* oxr_action_set::act_set_key and oxr_action::act_key in the session.
|
|
|
|
*
|
|
|
|
* ![](monado-input-class-relationships.drawio.svg)
|
|
|
|
*/
|
|
|
|
|
2019-05-07 12:47:18 +00:00
|
|
|
/*!
|
2020-06-15 19:16:38 +00:00
|
|
|
* A parsed equivalent of a list of sub-action paths.
|
|
|
|
*
|
|
|
|
* If @p any is true, then no paths were provided, which typically means any
|
|
|
|
* input is acceptable.
|
2020-07-21 22:10:25 +00:00
|
|
|
*
|
2020-07-22 21:25:49 +00:00
|
|
|
* @ingroup oxr_main
|
2020-07-21 22:10:25 +00:00
|
|
|
* @ingroup oxr_input
|
2019-05-07 12:47:18 +00:00
|
|
|
*/
|
|
|
|
struct oxr_sub_paths
|
|
|
|
{
|
|
|
|
bool any;
|
2020-07-22 21:25:49 +00:00
|
|
|
#define OXR_SUBPATH_MEMBER(X) bool X;
|
|
|
|
OXR_FOR_EACH_SUBACTION_PATH(OXR_SUBPATH_MEMBER)
|
|
|
|
#undef OXR_SUBPATH_MEMBER
|
2019-05-07 12:47:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
2020-06-15 19:16:38 +00:00
|
|
|
* The data associated with the attachment of an Action Set (@ref
|
|
|
|
* oxr_action_set) to as Session (@ref oxr_session).
|
2019-05-07 12:47:18 +00:00
|
|
|
*
|
2020-06-15 21:46:21 +00:00
|
|
|
* This structure has no pointer to the @ref oxr_action_set that created it
|
|
|
|
* because the application is allowed to destroy an action before the session,
|
|
|
|
* which should change nothing except not allow the application to access the
|
|
|
|
* corresponding data anymore.
|
|
|
|
*
|
2020-07-21 22:10:25 +00:00
|
|
|
* @ingroup oxr_input
|
|
|
|
*
|
2019-05-07 12:47:18 +00:00
|
|
|
* @see oxr_action_set
|
|
|
|
*/
|
2020-06-15 19:16:38 +00:00
|
|
|
struct oxr_action_set_attachment
|
2019-05-07 12:47:18 +00:00
|
|
|
{
|
2019-09-02 21:04:13 +00:00
|
|
|
//! Owning session.
|
|
|
|
struct oxr_session *sess;
|
2019-10-28 14:57:35 +00:00
|
|
|
|
2020-06-15 23:05:42 +00:00
|
|
|
//! Action set refcounted data
|
|
|
|
struct oxr_action_set_ref *act_set_ref;
|
|
|
|
|
2020-06-15 21:46:21 +00:00
|
|
|
//! Unique key for the session hashmap.
|
2020-06-15 22:05:32 +00:00
|
|
|
uint32_t act_set_key;
|
2020-06-15 21:46:21 +00:00
|
|
|
|
2019-10-28 14:57:35 +00:00
|
|
|
//! Which sub-action paths are requested on the latest sync.
|
|
|
|
struct oxr_sub_paths requested_sub_paths;
|
|
|
|
|
2020-06-15 21:46:21 +00:00
|
|
|
//! An array of action attachments we own.
|
|
|
|
struct oxr_action_attachment *act_attachments;
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Length of @ref oxr_action_set_attachment::act_attachments.
|
|
|
|
*/
|
|
|
|
size_t num_action_attachments;
|
2019-05-07 12:47:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
2020-06-15 19:16:38 +00:00
|
|
|
* De-initialize an action set attachment and its action attachments.
|
2019-05-07 12:47:18 +00:00
|
|
|
*
|
2020-06-15 19:16:38 +00:00
|
|
|
* Frees the action attachments, but does not de-allocate the action set
|
|
|
|
* attachment.
|
|
|
|
*
|
|
|
|
* @public @memberof oxr_action_set_attachment
|
2019-05-07 12:47:18 +00:00
|
|
|
*/
|
2020-06-15 19:16:38 +00:00
|
|
|
void
|
|
|
|
oxr_action_set_attachment_teardown(
|
|
|
|
struct oxr_action_set_attachment *act_set_attached);
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* The state of a action input.
|
|
|
|
*
|
2020-07-21 22:10:25 +00:00
|
|
|
* @ingroup oxr_input
|
|
|
|
*
|
2020-06-15 19:16:38 +00:00
|
|
|
* @see oxr_action_attachment
|
|
|
|
*/
|
|
|
|
struct oxr_action_state
|
2019-05-07 12:47:18 +00:00
|
|
|
{
|
2020-06-15 18:46:22 +00:00
|
|
|
/*!
|
|
|
|
* The actual value - must interpret using action type
|
|
|
|
*/
|
|
|
|
union xrt_input_value value;
|
2019-05-07 12:47:18 +00:00
|
|
|
|
2020-06-15 18:46:22 +00:00
|
|
|
//! Is this active (bound and providing input)?
|
2019-05-07 12:47:18 +00:00
|
|
|
bool active;
|
|
|
|
|
|
|
|
// Was this changed.
|
|
|
|
bool changed;
|
|
|
|
|
|
|
|
//! When was this last changed.
|
|
|
|
XrTime timestamp;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
2020-06-15 15:58:48 +00:00
|
|
|
* A input action pair of a @ref xrt_input and a @ref xrt_device, along with the
|
|
|
|
* required transform.
|
2019-05-07 12:47:18 +00:00
|
|
|
*
|
2020-07-21 22:10:25 +00:00
|
|
|
* @ingroup oxr_input
|
|
|
|
*
|
2019-05-07 12:47:18 +00:00
|
|
|
* @see xrt_device
|
|
|
|
* @see xrt_input
|
|
|
|
*/
|
2020-06-15 19:16:38 +00:00
|
|
|
struct oxr_action_input
|
2019-05-07 12:47:18 +00:00
|
|
|
{
|
|
|
|
struct xrt_device *xdev;
|
|
|
|
struct xrt_input *input;
|
2020-06-15 15:58:48 +00:00
|
|
|
struct oxr_input_transform *transforms;
|
|
|
|
size_t num_transforms;
|
2020-07-21 22:21:28 +00:00
|
|
|
XrPath bound_path;
|
2019-05-07 12:47:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
2020-06-15 19:16:38 +00:00
|
|
|
* A output action pair of a @ref xrt_output_name and a @ref xrt_device.
|
2019-05-07 12:47:18 +00:00
|
|
|
*
|
2020-07-21 22:10:25 +00:00
|
|
|
* @ingroup oxr_input
|
|
|
|
*
|
2019-05-07 12:47:18 +00:00
|
|
|
* @see xrt_device
|
|
|
|
* @see xrt_output_name
|
|
|
|
*/
|
2020-06-15 19:16:38 +00:00
|
|
|
struct oxr_action_output
|
2019-05-07 12:47:18 +00:00
|
|
|
{
|
|
|
|
struct xrt_device *xdev;
|
|
|
|
enum xrt_output_name name;
|
2020-07-21 22:21:28 +00:00
|
|
|
XrPath bound_path;
|
2019-05-07 12:47:18 +00:00
|
|
|
};
|
|
|
|
|
2020-07-21 22:21:28 +00:00
|
|
|
|
|
|
|
#define OXR_MAX_BINDINGS_PER_ACTION 16
|
|
|
|
|
2019-05-07 12:47:18 +00:00
|
|
|
/*!
|
2020-06-15 15:58:48 +00:00
|
|
|
* The set of inputs/outputs for a single sub-action path for an action.
|
|
|
|
*
|
|
|
|
* Each @ref oxr_action_attachment has one of these for every known sub-action
|
|
|
|
* path in the spec. Many, or even most, will be "empty".
|
2019-05-07 12:47:18 +00:00
|
|
|
*
|
2020-07-21 22:10:25 +00:00
|
|
|
* A single action will either be input or output, not both.
|
|
|
|
*
|
|
|
|
* @ingroup oxr_input
|
|
|
|
*
|
2020-06-15 19:16:38 +00:00
|
|
|
* @see oxr_action_attachment
|
2019-05-07 12:47:18 +00:00
|
|
|
*/
|
2020-06-16 21:31:29 +00:00
|
|
|
struct oxr_action_cache
|
2019-05-07 12:47:18 +00:00
|
|
|
{
|
2020-06-15 19:16:38 +00:00
|
|
|
struct oxr_action_state current;
|
2019-05-07 12:47:18 +00:00
|
|
|
|
|
|
|
size_t num_inputs;
|
2020-06-15 19:16:38 +00:00
|
|
|
struct oxr_action_input *inputs;
|
2019-05-07 12:47:18 +00:00
|
|
|
|
|
|
|
int64_t stop_output_time;
|
|
|
|
size_t num_outputs;
|
2020-06-15 19:16:38 +00:00
|
|
|
struct oxr_action_output *outputs;
|
2019-05-07 12:47:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
2020-06-15 19:16:38 +00:00
|
|
|
* Data associated with an Action that has been attached to a Session.
|
|
|
|
*
|
|
|
|
* More information on the action vs action attachment and action set vs action
|
2020-07-21 22:10:25 +00:00
|
|
|
* set attachment parallel is in the docs for @ref oxr_input
|
|
|
|
*
|
|
|
|
* @ingroup oxr_input
|
2019-05-07 12:47:18 +00:00
|
|
|
*
|
|
|
|
* @see oxr_action
|
|
|
|
*/
|
2020-06-15 19:16:38 +00:00
|
|
|
struct oxr_action_attachment
|
2019-05-07 12:47:18 +00:00
|
|
|
{
|
2020-06-15 21:46:21 +00:00
|
|
|
//! The owning action set attachment
|
|
|
|
struct oxr_action_set_attachment *act_set_attached;
|
|
|
|
|
2020-06-15 23:05:42 +00:00
|
|
|
//! This action's refcounted data
|
|
|
|
struct oxr_action_ref *act_ref;
|
|
|
|
|
2020-06-12 21:51:27 +00:00
|
|
|
/*!
|
2020-06-15 21:46:21 +00:00
|
|
|
* The corresponding session.
|
|
|
|
*
|
|
|
|
* This will always be valid: the session outlives this object because
|
|
|
|
* it owns act_set_attached.
|
2020-06-12 21:51:27 +00:00
|
|
|
*/
|
2020-06-15 21:46:21 +00:00
|
|
|
struct oxr_session *sess;
|
|
|
|
|
|
|
|
//! Unique key for the session hashmap.
|
2020-06-15 22:05:32 +00:00
|
|
|
uint32_t act_key;
|
2019-05-07 12:47:18 +00:00
|
|
|
|
2020-08-27 13:01:49 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* For pose actions any sub paths are special treated, at bind time we
|
|
|
|
* pick one sub path and stick to it as long as the action lives.
|
|
|
|
*/
|
|
|
|
struct oxr_sub_paths any_pose_sub_path;
|
|
|
|
|
2020-06-15 19:16:38 +00:00
|
|
|
struct oxr_action_state any_state;
|
2019-10-28 10:56:45 +00:00
|
|
|
|
2020-07-22 21:25:49 +00:00
|
|
|
#define OXR_CACHE_MEMBER(X) struct oxr_action_cache X;
|
|
|
|
OXR_FOR_EACH_SUBACTION_PATH(OXR_CACHE_MEMBER)
|
|
|
|
#undef OXR_CACHE_MEMBER
|
2019-05-07 12:47:18 +00:00
|
|
|
};
|
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
/*!
|
2020-06-03 22:25:21 +00:00
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Can be one of several reference space types, or a space that is bound to an
|
|
|
|
* action.
|
|
|
|
*
|
|
|
|
* Parent type/handle is @ref oxr_session
|
2019-03-18 05:52:32 +00:00
|
|
|
*
|
|
|
|
* @obj{XrSpace}
|
2020-06-03 22:25:21 +00:00
|
|
|
* @extends oxr_handle_base
|
2019-03-18 05:52:32 +00:00
|
|
|
*/
|
|
|
|
struct oxr_space
|
|
|
|
{
|
2019-04-05 19:18:03 +00:00
|
|
|
//! Common structure for things referred to by OpenXR handles.
|
|
|
|
struct oxr_handle_base handle;
|
2019-03-18 05:52:32 +00:00
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
//! Owner of this space.
|
2019-03-18 05:52:32 +00:00
|
|
|
struct oxr_session *sess;
|
|
|
|
|
|
|
|
//! Pose that was given during creation.
|
|
|
|
struct xrt_pose pose;
|
|
|
|
|
|
|
|
//! What kind of reference space is this, if any.
|
|
|
|
XrReferenceSpaceType type;
|
|
|
|
|
2019-05-07 12:47:18 +00:00
|
|
|
//! Action key from which action this space was created from.
|
|
|
|
uint32_t act_key;
|
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
//! Is this a reference space?
|
|
|
|
bool is_reference;
|
2019-05-07 12:47:18 +00:00
|
|
|
|
|
|
|
//! Which sub action path is this?
|
|
|
|
struct oxr_sub_paths sub_paths;
|
2019-03-18 05:52:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* A set of images used for rendering.
|
|
|
|
*
|
2020-06-03 22:25:21 +00:00
|
|
|
* Parent type/handle is @ref oxr_session
|
|
|
|
*
|
2019-03-18 05:52:32 +00:00
|
|
|
* @obj{XrSwapchain}
|
2020-06-03 22:25:21 +00:00
|
|
|
* @extends oxr_handle_base
|
2019-03-18 05:52:32 +00:00
|
|
|
*/
|
|
|
|
struct oxr_swapchain
|
|
|
|
{
|
2019-04-05 19:18:03 +00:00
|
|
|
//! Common structure for things referred to by OpenXR handles.
|
|
|
|
struct oxr_handle_base handle;
|
2019-03-18 05:52:32 +00:00
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
//! Owner of this swapchain.
|
2019-03-18 05:52:32 +00:00
|
|
|
struct oxr_session *sess;
|
|
|
|
|
|
|
|
//! Compositor swapchain.
|
|
|
|
struct xrt_swapchain *swapchain;
|
|
|
|
|
2020-05-30 20:05:55 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
//! Swapchain size.
|
|
|
|
uint32_t width, height;
|
|
|
|
//! For 1 is 2D texture, greater then 1 2D array texture.
|
|
|
|
uint32_t num_array_layers;
|
|
|
|
};
|
|
|
|
|
2020-05-30 16:01:00 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
enum oxr_image_state state;
|
|
|
|
} images[OXR_MAX_SWAPCHAIN_IMAGES];
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
size_t num;
|
|
|
|
struct u_index_fifo fifo;
|
|
|
|
} acquired;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
bool yes;
|
|
|
|
int index;
|
|
|
|
} waited;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
bool yes;
|
|
|
|
int index;
|
|
|
|
} released;
|
|
|
|
|
2020-05-30 16:13:07 +00:00
|
|
|
// Is this a static swapchain, needed for acquire semantics.
|
|
|
|
bool is_static;
|
2020-05-30 16:01:00 +00:00
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
XrResult (*destroy)(struct oxr_logger *, struct oxr_swapchain *);
|
|
|
|
|
|
|
|
XrResult (*enumerate_images)(struct oxr_logger *,
|
|
|
|
struct oxr_swapchain *,
|
|
|
|
uint32_t,
|
|
|
|
XrSwapchainImageBaseHeader *);
|
|
|
|
|
|
|
|
XrResult (*acquire_image)(struct oxr_logger *,
|
|
|
|
struct oxr_swapchain *,
|
|
|
|
const XrSwapchainImageAcquireInfo *,
|
|
|
|
uint32_t *);
|
|
|
|
|
|
|
|
XrResult (*wait_image)(struct oxr_logger *,
|
|
|
|
struct oxr_swapchain *,
|
|
|
|
const XrSwapchainImageWaitInfo *);
|
|
|
|
|
|
|
|
XrResult (*release_image)(struct oxr_logger *,
|
|
|
|
struct oxr_swapchain *,
|
|
|
|
const XrSwapchainImageReleaseInfo *);
|
|
|
|
};
|
|
|
|
|
2020-06-15 23:05:42 +00:00
|
|
|
struct oxr_refcounted
|
|
|
|
{
|
|
|
|
struct xrt_reference base;
|
|
|
|
//! Destruction callback
|
|
|
|
void (*destroy)(struct oxr_refcounted *);
|
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Increase the reference count of @p orc.
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
oxr_refcounted_ref(struct oxr_refcounted *orc)
|
|
|
|
{
|
|
|
|
xrt_reference_inc(&orc->base);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Decrease the reference count of @p orc, destroying it if it reaches 0.
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
oxr_refcounted_unref(struct oxr_refcounted *orc)
|
|
|
|
{
|
|
|
|
if (xrt_reference_dec(&orc->base)) {
|
|
|
|
orc->destroy(orc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* The reference-counted data of an action set.
|
|
|
|
*
|
|
|
|
* One or more sessions may still need this data after the application destroys
|
|
|
|
* its XrActionSet handle, so this data is refcounted.
|
|
|
|
*
|
2020-07-21 22:10:25 +00:00
|
|
|
* @ingroup oxr_input
|
|
|
|
*
|
2020-06-15 23:05:42 +00:00
|
|
|
* @see oxr_action_set
|
|
|
|
* @extends oxr_refcounted
|
|
|
|
*/
|
|
|
|
struct oxr_action_set_ref
|
|
|
|
{
|
|
|
|
struct oxr_refcounted base;
|
|
|
|
|
|
|
|
//! Application supplied name of this action.
|
|
|
|
char name[XR_MAX_ACTION_SET_NAME_SIZE];
|
|
|
|
|
2020-07-06 18:58:17 +00:00
|
|
|
/*!
|
|
|
|
* Has this action set even been attached to any session, marking it as
|
|
|
|
* immutable.
|
|
|
|
*/
|
|
|
|
bool ever_attached;
|
2020-06-15 23:05:42 +00:00
|
|
|
|
|
|
|
//! Unique key for the session hashmap.
|
|
|
|
uint32_t act_set_key;
|
|
|
|
|
2020-07-28 13:29:31 +00:00
|
|
|
//! Application supplied action set priority.
|
|
|
|
uint32_t priority;
|
|
|
|
|
2020-06-15 23:05:42 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
struct u_hashset *name_store;
|
|
|
|
struct u_hashset *loc_store;
|
|
|
|
} actions;
|
|
|
|
};
|
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
/*!
|
|
|
|
* A group of actions.
|
|
|
|
*
|
2020-06-03 22:25:21 +00:00
|
|
|
* Parent type/handle is @ref oxr_instance
|
|
|
|
*
|
2020-06-15 21:46:21 +00:00
|
|
|
* Note, however, that an action set must be "attached" to a session
|
|
|
|
* ( @ref oxr_session ) to be used and not just configured.
|
|
|
|
* The corresponding data is in @ref oxr_action_set_attachment.
|
2020-06-03 22:25:21 +00:00
|
|
|
*
|
2020-07-21 22:10:25 +00:00
|
|
|
* @ingroup oxr_input
|
|
|
|
*
|
2019-03-18 05:52:32 +00:00
|
|
|
* @obj{XrActionSet}
|
2020-06-03 22:25:21 +00:00
|
|
|
* @extends oxr_handle_base
|
2019-03-18 05:52:32 +00:00
|
|
|
*/
|
|
|
|
struct oxr_action_set
|
|
|
|
{
|
2019-04-05 19:18:03 +00:00
|
|
|
//! Common structure for things referred to by OpenXR handles.
|
|
|
|
struct oxr_handle_base handle;
|
2019-03-18 05:52:32 +00:00
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
//! Owner of this action set.
|
2019-07-13 16:17:57 +00:00
|
|
|
struct oxr_instance *inst;
|
2019-05-07 12:47:18 +00:00
|
|
|
|
2020-06-15 23:05:42 +00:00
|
|
|
/*!
|
|
|
|
* The data for this action set that must live as long as any session we
|
|
|
|
* are attached to.
|
|
|
|
*/
|
|
|
|
struct oxr_action_set_ref *data;
|
2019-09-02 21:04:13 +00:00
|
|
|
|
2019-05-07 12:47:18 +00:00
|
|
|
|
2020-06-15 23:05:42 +00:00
|
|
|
/*!
|
|
|
|
* Unique key for the session hashmap.
|
|
|
|
*
|
|
|
|
* Duplicated from oxr_action_set_ref::act_set_key for efficiency.
|
|
|
|
*/
|
2020-06-15 22:05:32 +00:00
|
|
|
uint32_t act_set_key;
|
2020-05-30 22:44:03 +00:00
|
|
|
|
|
|
|
//! The item in the name hashset.
|
|
|
|
struct u_hashset_item *name_item;
|
|
|
|
|
|
|
|
//! The item in the localized hashset.
|
|
|
|
struct u_hashset_item *loc_item;
|
2020-06-15 23:05:42 +00:00
|
|
|
};
|
2020-05-30 22:44:03 +00:00
|
|
|
|
2020-06-15 23:05:42 +00:00
|
|
|
/*!
|
|
|
|
* The reference-counted data of an action.
|
|
|
|
*
|
|
|
|
* One or more sessions may still need this data after the application destroys
|
|
|
|
* its XrAction handle, so this data is refcounted.
|
|
|
|
*
|
2020-07-21 22:10:25 +00:00
|
|
|
* @ingroup oxr_input
|
|
|
|
*
|
2020-06-15 23:05:42 +00:00
|
|
|
* @see oxr_action
|
|
|
|
* @extends oxr_refcounted
|
|
|
|
*/
|
|
|
|
struct oxr_action_ref
|
|
|
|
{
|
|
|
|
struct oxr_refcounted base;
|
|
|
|
|
|
|
|
//! Application supplied name of this action.
|
|
|
|
char name[XR_MAX_ACTION_NAME_SIZE];
|
|
|
|
|
|
|
|
//! Unique key for the session hashmap.
|
|
|
|
uint32_t act_key;
|
|
|
|
|
|
|
|
//! Type this action was created with.
|
|
|
|
XrActionType action_type;
|
|
|
|
|
|
|
|
//! Which sub action paths that this action was created with.
|
|
|
|
struct oxr_sub_paths sub_paths;
|
2019-03-18 05:52:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* A single action.
|
|
|
|
*
|
2020-06-03 22:25:21 +00:00
|
|
|
* Parent type/handle is @ref oxr_action_set
|
|
|
|
*
|
2020-06-15 21:46:21 +00:00
|
|
|
* For actual usage, an action is attached to a session: the corresponding data
|
|
|
|
* is in @ref oxr_action_attachment
|
|
|
|
*
|
2020-07-21 22:10:25 +00:00
|
|
|
* @ingroup oxr_input
|
|
|
|
*
|
2019-03-18 05:52:32 +00:00
|
|
|
* @obj{XrAction}
|
2020-06-03 22:25:21 +00:00
|
|
|
* @extends oxr_handle_base
|
2019-03-18 05:52:32 +00:00
|
|
|
*/
|
|
|
|
struct oxr_action
|
|
|
|
{
|
2019-04-05 19:18:03 +00:00
|
|
|
//! Common structure for things referred to by OpenXR handles.
|
|
|
|
struct oxr_handle_base handle;
|
2019-03-18 05:52:32 +00:00
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
//! Owner of this action.
|
2019-03-18 05:52:32 +00:00
|
|
|
struct oxr_action_set *act_set;
|
2019-05-07 12:47:18 +00:00
|
|
|
|
2020-06-15 23:05:42 +00:00
|
|
|
//! The data for this action that must live as long as any session we
|
|
|
|
//! are attached to.
|
|
|
|
struct oxr_action_ref *data;
|
2019-05-07 12:47:18 +00:00
|
|
|
|
2020-06-15 23:05:42 +00:00
|
|
|
/*!
|
|
|
|
* Unique key for the session hashmap.
|
|
|
|
*
|
|
|
|
* Duplicated from oxr_action_ref::act_key for efficiency.
|
|
|
|
*/
|
2020-06-15 22:05:32 +00:00
|
|
|
uint32_t act_key;
|
2019-05-07 12:47:18 +00:00
|
|
|
|
2020-05-30 22:44:03 +00:00
|
|
|
//! The item in the name hashset.
|
|
|
|
struct u_hashset_item *name_item;
|
|
|
|
|
|
|
|
//! The item in the localized hashset.
|
|
|
|
struct u_hashset_item *loc_item;
|
2019-03-18 05:52:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Debug object created by the client program.
|
|
|
|
*
|
2020-06-03 22:25:21 +00:00
|
|
|
* Parent type/handle is @ref oxr_instance
|
|
|
|
*
|
2019-03-18 05:52:32 +00:00
|
|
|
* @obj{XrDebugUtilsMessengerEXT}
|
|
|
|
*/
|
|
|
|
struct oxr_debug_messenger
|
|
|
|
{
|
2019-04-05 19:18:03 +00:00
|
|
|
//! Common structure for things referred to by OpenXR handles.
|
|
|
|
struct oxr_handle_base handle;
|
2019-03-18 05:52:32 +00:00
|
|
|
|
2020-06-03 22:25:21 +00:00
|
|
|
//! Owner of this messenger.
|
2019-03-18 05:52:32 +00:00
|
|
|
struct oxr_instance *inst;
|
2019-04-04 22:56:31 +00:00
|
|
|
|
|
|
|
//! Severities to submit to this messenger
|
|
|
|
XrDebugUtilsMessageSeverityFlagsEXT message_severities;
|
|
|
|
|
|
|
|
//! Types to submit to this messenger
|
|
|
|
XrDebugUtilsMessageTypeFlagsEXT message_types;
|
|
|
|
|
|
|
|
//! Callback function
|
|
|
|
PFN_xrDebugUtilsMessengerCallbackEXT user_callback;
|
|
|
|
|
|
|
|
//! Opaque user data
|
|
|
|
void *XR_MAY_ALIAS user_data;
|
2019-03-18 05:52:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|