Monado OpenXR Runtime
oxr_binding.c File Reference

Holds binding related functions. More...

#include "util/u_misc.h"
#include "xrt/xrt_compiler.h"
#include "bindings/b_generated_bindings.h"
#include "oxr_objects.h"
#include "oxr_logger.h"
#include "oxr_two_call.h"
#include "oxr_subaction.h"
#include <stdio.h>
Include dependency graph for oxr_binding.c:

Macros

#define OXR_PATH_MEMBER(lower, CAP, _)    case OXR_SUB_ACTION_PATH_##CAP: return sess->lower;
 
#define IDENTIFY_TOP_LEVEL_PATH(X)
 

Functions

static void setup_paths (struct oxr_logger *log, struct oxr_instance *inst, const char **src_paths, XrPath **dest_paths, uint32_t *dest_path_count)
 
static bool interaction_profile_find_in_array (struct oxr_logger *log, const size_t profile_count, struct oxr_interaction_profile **profiles, XrPath path, struct oxr_interaction_profile **out_p)
 
static bool interaction_profile_find_in_instance (struct oxr_logger *log, struct oxr_instance *inst, XrPath path, struct oxr_interaction_profile **out_p)
 
static bool interaction_profile_find_in_session (struct oxr_logger *log, struct oxr_session *sess, XrPath path, struct oxr_interaction_profile **out_p)
 
static bool get_subaction_path_from_path (struct oxr_logger *log, struct oxr_instance *inst, XrPath path, enum oxr_subaction_path *out_subaction_path)
 
static bool interaction_profile_find_or_create_in_instance (struct oxr_logger *log, struct oxr_instance *inst, XrPath path, struct oxr_interaction_profile **out_p)
 
static void reset_binding_keys (struct oxr_binding *binding)
 
static void reset_all_keys (struct oxr_binding *bindings, size_t binding_count)
 
static void add_key_to_matching_bindings (struct oxr_binding *bindings, size_t binding_count, XrPath path, uint32_t key)
 
static void add_string (char *temp, size_t max, ssize_t *current, const char *str)
 
static const char * get_subaction_path_str (enum oxr_subaction_path subaction_path)
 
static XrPath get_interaction_bound_to_sub_path (struct oxr_session *sess, enum oxr_subaction_path subaction_path)
 
static const char * get_identifier_str_in_profile (struct oxr_logger *log, struct oxr_instance *inst, XrPath path, struct oxr_interaction_profile *oip)
 
void oxr_get_profile_for_device_name (struct oxr_logger *log, struct oxr_session *sess, enum xrt_device_name name, struct oxr_interaction_profile **out_p)
 
void oxr_find_profile_for_device (struct oxr_logger *log, struct oxr_session *sess, struct xrt_device *xdev, struct oxr_interaction_profile **out_p)
 
void oxr_binding_find_bindings_from_key (struct oxr_logger *log, struct oxr_interaction_profile *p, uint32_t key, size_t max_bounding_count, struct oxr_binding **bindings, size_t *out_binding_count)
 
struct oxr_interaction_profileoxr_clone_profile (const struct oxr_interaction_profile *src_profile)
 
static void oxr_destroy_profiles (struct oxr_interaction_profile **profiles, const size_t profile_count)
 
void oxr_binding_destroy_all (struct oxr_logger *log, struct oxr_instance *inst)
 
void oxr_session_binding_destroy_all (struct oxr_logger *log, struct oxr_session *sess)
 
XrResult oxr_action_suggest_interaction_profile_bindings (struct oxr_logger *log, struct oxr_instance *inst, const XrInteractionProfileSuggestedBinding *suggestedBindings, struct oxr_dpad_state *dpad_state)
 
XrResult oxr_action_get_current_interaction_profile (struct oxr_logger *log, struct oxr_session *sess, XrPath topLevelUserPath, XrInteractionProfileState *interactionProfile)
 
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)
 

Detailed Description

Macro Definition Documentation

◆ IDENTIFY_TOP_LEVEL_PATH

#define IDENTIFY_TOP_LEVEL_PATH (   X)
Value:
if (topLevelUserPath == inst->path_cache.X) { \
interactionProfile->interactionProfile = sess->X; \
} else

Function Documentation

◆ oxr_action_get_input_source_localized_name()

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 
)
Todo:
: If we ever rebind a profile that has not been suggested by the client, it will not be found.
Todo:
This implementation is very very very inelegant.

◆ oxr_binding_find_bindings_from_key()

void oxr_binding_find_bindings_from_key ( struct oxr_logger log,
struct oxr_interaction_profile p,
uint32_t  key,
size_t  max_bounding_count,
struct oxr_binding **  bindings,
size_t out_binding_count 
)
Todo:
Should return total count instead of fixed max.