Monado OpenXR Runtime
Loading...
Searching...
No Matches
oxr_priority_group_cache.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 Cache of per-session priority group state.
6 * @ingroup oxr_main
7 */
8
9#pragma once
10
11#include "xrt/xrt_defines.h"
12
13#include "oxr_defines.h"
14#include "oxr_extension_support.h"
16
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22/*!
23 * Per-session accumulated priority state for one binding priority group,
24 * more detailed comments about the purpose of this struct are in the
25 * comments for the @ref oxr_priority_group_cache struct.
26 */
28{
29 XrPath path;
30 uint32_t highest_priority;
31};
32
33/*!
34 * Per-session cache of priority group states.
35 *
36 * Implements the OpenXR action-set priority rules described for
37 * XrActionSetCreateInfo::priority: when several active action sets bind
38 * actions to the same input source, higher priority wins and lower-priority
39 * bindings are suppressed (treated as inactive, with no feedback). Priority
40 * groups here are the runtime's notion of that shared input source, filled
41 * while resolving suggested bindings and re-evaluated each action sync.
42 *
43 * States are allocated individually so pointers stored on action inputs remain
44 * stable until the cache is cleared (for example when interaction profiles
45 * change and bindings are rebuilt).
46 */
48{
49 struct u_hashmap_int *states_by_path;
50};
51
52/*!
53 * Initialize a priority group cache.
54 *
55 * @memberof oxr_priority_group_cache
56 */
57XRT_CHECK_RESULT XrResult
58oxr_priority_group_cache_init(struct oxr_priority_group_cache *cache);
59
60/*!
61 * Finalize a priority group cache.
62 *
63 * @memberof oxr_priority_group_cache
64 */
65void
66oxr_priority_group_cache_fini(struct oxr_priority_group_cache *cache);
67
68/*!
69 * Clear a priority group cache.
70 *
71 * @memberof oxr_priority_group_cache
72 */
73void
74oxr_priority_group_cache_clear(struct oxr_priority_group_cache *cache);
75
76/*!
77 * Reset accumulated action-set priorities for every priority group.
78 *
79 * Called when syncing actions so the runtime can recompute, from the currently
80 * active action sets, which priority wins on each shared control surface. The
81 * group entries themselves stay alive so resolved inputs keep stable pointers.
82 *
83 * @memberof oxr_priority_group_cache
84 */
85void
86oxr_priority_group_cache_zero_priorities(struct oxr_priority_group_cache *cache);
87
88/*!
89 * Look up or allocate shared priority state for a binding priority group path.
90 *
91 * Used while resolving suggested bindings: inputs that share a priority group
92 * (typically the same physical control) all reference one accumulator so later
93 * action sync can suppress lower-priority action sets on that surface.
94 *
95 * @memberof oxr_priority_group_cache
96 */
97XRT_CHECK_RESULT XrResult
98oxr_priority_group_cache_get_or_create(struct oxr_priority_group_cache *cache,
99 XrPath path,
100 struct oxr_priority_group_state **out_state);
101
102
103#ifdef __cplusplus
104}
105#endif
Shared internal defines and enums in the state tracker.
Forward declarations for OpenXR state tracker structs.
Per-session cache of priority group states.
Definition oxr_priority_group_cache.h:48
Per-session accumulated priority state for one binding priority group, more detailed comments about t...
Definition oxr_priority_group_cache.h:28
A simple uint64_t key to a void pointer hashmap.
Definition u_hashmap.cpp:24
Common defines and enums for XRT.