Monado OpenXR Runtime
Loading...
Searching...
No Matches
oxr_binding.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 Holds binding related functions.
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_device.h"
15
16#include "oxr_extension_support.h"
18
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24
25/*
26 *
27 * Binding functions
28 *
29 */
30
31/*!
32 * Destroy an interaction profile.
33 *
34 * @param profile Interaction profile to destroy
35 * @public @memberof oxr_interaction_profile
36 */
37void
38oxr_interaction_profile_destroy(struct oxr_interaction_profile *profile);
39
40/*!
41 * Clone an interaction profile.
42 *
43 * @param src_profile Source interaction profile to clone
44 * @return Cloned interaction profile, or NULL if src_profile is NULL
45 * @public @memberof oxr_interaction_profile
46 */
49
50/*!
51 * Find bindings from action key in a profile.
52 *
53 * @param log Logger
54 * @param profile Interaction profile
55 * @param key Action key
56 * @param max_binding_count Maximum number of bindings to return
57 * @param out_bindings Output bindings array
58 * @param out_binding_count Output binding count
59 * @public @memberof oxr_interaction_profile
60 */
61void
63 struct oxr_interaction_profile *profile,
64 uint32_t key,
65 size_t max_binding_count,
66 struct oxr_binding **out_bindings,
67 size_t *out_binding_count);
68
69/*!
70 * Suggest bindings for an interaction profile. Finds or creates the profile
71 * for the given path, resets its binding keys, applies the suggested
72 * action–path bindings and takes ownership of the given dpad state.
73 *
74 * @param log Logger
75 * @param store Path store; paths may be created in the store.
76 * @param cache Instance path cache; used to get the profile template.
77 * @param inst_context Instance action context
78 * @param suggestedBindings Suggested bindings for the interaction profile
79 * @param state Dpad state (ownership transferred into the profile)
80 * @return XR_SUCCESS on success
81 * @public @memberof oxr_instance
82 */
83XrResult
84oxr_action_suggest_interaction_profile_bindings(struct oxr_logger *log,
85 struct oxr_path_store *store,
86 const struct oxr_instance_path_cache *cache,
87 struct oxr_instance_action_context *inst_context,
88 const XrInteractionProfileSuggestedBinding *suggestedBindings,
89 struct oxr_dpad_state *state);
90
91/*!
92 * Get the currently active interaction profile for a top-level user path
93 * on the session action context (e.g. /user/hand/left). Requires action sets to
94 * be attached.
95 *
96 * @param log Logger
97 * @param cache Instance path cache
98 * @param action_context Action context
99 * @param topLevelUserPath Top-level user path (e.g. left hand)
100 * @param interactionProfile Output interaction profile state
101 * @return XR_SUCCESS on success
102 * @public @memberof oxr_instance
103 */
104XrResult
105oxr_action_get_current_interaction_profile(struct oxr_logger *log,
106 const struct oxr_instance_path_cache *cache,
107 const struct oxr_session_action_context *action_context,
108 XrPath topLevelUserPath,
109 XrInteractionProfileState *interactionProfile);
110
111/*!
112 * Get input source localized name.
113 *
114 * @param log Logger
115 * @param path_store Needed to look up path strings.
116 * @param action_context Action context
117 * @param getInfo Input source localized name get info
118 * @param bufferCapacityInput Buffer capacity
119 * @param bufferCountOutput Buffer count output
120 * @param buffer Buffer
121 * @return XR_SUCCESS on success
122 * @public @memberof oxr_session
123 */
124XrResult
126 const struct oxr_path_store *store,
127 const struct oxr_session_action_context *action_context,
128 const XrInputSourceLocalizedNameGetInfo *getInfo,
129 uint32_t bufferCapacityInput,
130 uint32_t *bufferCountOutput,
131 char *buffer);
132
133
134#ifdef __cplusplus
135}
136#endif
void oxr_binding_find_bindings_from_act_key(struct oxr_logger *log, struct oxr_interaction_profile *profile, uint32_t key, size_t max_binding_count, struct oxr_binding **out_bindings, size_t *out_binding_count)
Definition oxr_binding.c:510
XrResult oxr_action_get_input_source_localized_name(struct oxr_logger *log, const struct oxr_path_store *store, const struct oxr_session_action_context *action_context, const XrInputSourceLocalizedNameGetInfo *getInfo, uint32_t bufferCapacityInput, uint32_t *bufferCountOutput, char *buffer)
Definition oxr_binding.c:635
Forward declarations for OpenXR state tracker structs.
Interaction profile binding state.
Definition oxr_objects.h:1529
Holds dpad binding state for a single interaction profile.
Definition oxr_dpad_state.h:73
Holds all action-related state that lives at the instance level (shared across sessions).
Definition oxr_instance_action_context.h:47
This holds cached paths for subaction paths.
Definition oxr_instance_path_cache.h:27
A single interaction profile.
Definition oxr_objects.h:1507
struct oxr_interaction_profile * oxr_interaction_profile_clone(const struct oxr_interaction_profile *src_profile)
Clone an interaction profile.
Definition oxr_binding.c:428
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
This holds all of the action state that belongs on the session level.
Definition oxr_session_action_context.h:62
Header defining an xrt display or controller device.