Monado OpenXR Runtime
Loading...
Searching...
No Matches
oxr_subaction_store.h
Go to the documentation of this file.
1// Copyright 2026, NVIDIA CORPORATION.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Store of registry-wide OpenXR subaction path payloads.
6 * @ingroup oxr_main
7 */
8
9#pragma once
10
11#include "xrt/xrt_defines.h"
12
13#include "oxr_extension_support.h"
15
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21/*!
22 * Runtime payload for one OpenXR subaction path.
23 *
24 * Subaction paths let applications use the same action handle on multiple
25 * devices and query state per device (e.g. `/user/hand/left` vs
26 * `/user/hand/right`). Binding points and interaction profiles share these
27 * singleton payloads from the registry subaction store.
28 *
29 * @ingroup oxr_main
30 * @memberof oxr_binding_subaction
31 */
33{
34 //! User-facing localized name for this subaction (e.g. "Left").
35 const char *localized_name;
36
37 //! Runtime XrPath for this subaction (e.g. `/user/hand/left`).
38 XrPath path;
39};
40
41/*!
42 * Registry-wide store of subaction payloads keyed by XrPath.
43 *
44 * Populated once when the binding registry is created with the known
45 * top-level subaction paths. Binding points look up shared payloads here
46 * instead of owning their own copies.
47 *
48 * @ingroup oxr_main
49 * @memberof oxr_subaction_store
50 */
52{
53 //! Maps subaction XrPath to @ref oxr_binding_subaction.
55};
56
57/*!
58 * Initialize an empty subaction store.
59 *
60 * @public @memberof oxr_subaction_store
61 */
62XRT_CHECK_RESULT XrResult
63oxr_subaction_store_init(struct oxr_subaction_store *store);
64
65/*!
66 * Release all stored subactions and destroy the store.
67 *
68 * @public @memberof oxr_subaction_store
69 */
70void
71oxr_subaction_store_fini(struct oxr_subaction_store *store);
72
73/*!
74 * Insert a subaction path if not already present.
75 *
76 * Duplicate paths are ignored and return success.
77 *
78 * @public @memberof oxr_subaction_store
79 */
80XRT_CHECK_RESULT XrResult
81oxr_subaction_store_add(struct oxr_subaction_store *store, XrPath path, const char *localized_name);
82
83/*!
84 * Look up a subaction payload by path.
85 *
86 * @return true if @p path was found, with @p out_subaction set
87 * @return false if @p path is unknown, with @p out_subaction set to NULL
88 *
89 * @public @memberof oxr_subaction_store
90 */
91bool
92oxr_subaction_store_get(const struct oxr_subaction_store *store,
93 XrPath path,
94 const struct oxr_binding_subaction **out_subaction);
95
96
97#ifdef __cplusplus
98}
99#endif
Forward declarations for OpenXR state tracker structs.
Runtime payload for one OpenXR subaction path.
Definition oxr_subaction_store.h:33
XrPath path
Runtime XrPath for this subaction (e.g. /user/hand/left).
Definition oxr_subaction_store.h:38
const char * localized_name
User-facing localized name for this subaction (e.g. "Left").
Definition oxr_subaction_store.h:35
Registry-wide store of subaction payloads keyed by XrPath.
Definition oxr_subaction_store.h:52
struct u_hashmap_int * subactions_by_path
Maps subaction XrPath to oxr_binding_subaction.
Definition oxr_subaction_store.h:54
A simple uint64_t key to a void pointer hashmap.
Definition u_hashmap.cpp:24
Common defines and enums for XRT.