Monado OpenXR Runtime
Loading...
Searching...
No Matches
oxr_instance_action_context.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 per instance action context.
7 * @ingroup oxr_main
8 */
9
10#pragma once
11
13#include "oxr_pair_hashset.h"
14#include "oxr_refcounted.h"
16
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22
23/*!
24 * Holds all action-related state that lives at the instance level (shared
25 * across sessions). Used for duplicate checking and storage of client-suggested
26 * that are later applied when action sets are attached to a session.
27 *
28 * Reference-counted; use @ref oxr_refcounted_ref and @ref oxr_refcounted_unref
29 * on the @ref base member to manage references. Destroy is only called when
30 * the reference count reaches zero.
31 *
32 * - @ref action_sets: Registry of action set name and localized name pairs.
33 * Used to enforce uniqueness in xrCreateActionSet and to remove entries when
34 * an action set is destroyed.
35 * - @ref suggested_profiles: Interaction profile binding suggestions from the
36 * app. When the app calls xrAttachSessionActionSets, this array is cloned
37 * into the session’s action context.
38 *
39 * In a future extension, this context is intended to support namespaced action
40 * sets and to allow plugins (e.g. in a game) to suggest their own bindings
41 * without affecting the main application’s bindings.
42 *
43 * @ingroup oxr_main
44 */
46{
47 struct oxr_refcounted base;
48
49 /*!
50 * Action set name and localized name stores.
51 */
53
54 /*!
55 * Interaction profile bindings that have been suggested by the client.
56 */
58
59 /*!
60 * Runtime binding registry used by this action context.
61 *
62 * Multiple action contexts may share the same registry, and future action
63 * contexts may install a modified registry.
64 */
66};
67
68
69/*
70 *
71 * Functions
72 *
73 */
74
75/*!
76 * Create a new instance action context (reference count 1).
77 *
78 * @param log Logger
79 * @param registry Binding registry used by the context, the context takes a
80 * reference to it.
81 * @param out_context On success, the new context (refcount 1). Caller must
82 * call @ref oxr_refcounted_unref on context->base when done.
83 * @public @memberof oxr_instance_action_context
84 * @ingroup oxr_main
85 */
86XRT_CHECK_RESULT XrResult
87oxr_instance_action_context_create(struct oxr_logger *log,
88 struct oxr_binding_registry *registry,
89 struct oxr_instance_action_context **out_context);
90
91
92#ifdef __cplusplus
93}
94#endif
Forward declarations for OpenXR state tracker structs.
Pair of name/localized hashets with atomic erase helper.
Reference-counted base for OpenXR state tracker objects.
Holds suggested profile array related functions.
Complete runtime binding registry for all action contexts of an XrInstance.
Definition oxr_binding_registry.h:35
Holds all action-related state that lives at the instance level (shared across sessions).
Definition oxr_instance_action_context.h:46
struct oxr_binding_registry * binding_registry
Runtime binding registry used by this action context.
Definition oxr_instance_action_context.h:65
struct oxr_suggested_profile_array suggested_profiles
Interaction profile bindings that have been suggested by the client.
Definition oxr_instance_action_context.h:57
struct oxr_pair_hashset action_sets
Action set name and localized name stores.
Definition oxr_instance_action_context.h:52
Logger struct that lives on the stack, one for each call client call.
Definition oxr_logger.h:44
A pair of hashets (name_store and loc_store) with an optional mutex so that both members can be remov...
Definition oxr_pair_hashset.h:36
Definition oxr_refcounted.h:21
Manages an array of suggested profiles, does not have a init function but must be zero initialized wh...
Definition oxr_suggested_profile_array.h:30