mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
st/oxr: Implement xrEnumerateBoundSourcesForAction
This commit is contained in:
parent
9f684dbc21
commit
7818a5b9cf
2
doc/changes/state_trackers/mr.451.2.md
Normal file
2
doc/changes/state_trackers/mr.451.2.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
OpenXR: Implement the function `xrEnumerateBoundSourcesForAction`, currently we
|
||||
only bind one input per top level user path and it's easy to track this.
|
|
@ -16,6 +16,7 @@
|
|||
#include "oxr_objects.h"
|
||||
#include "oxr_logger.h"
|
||||
#include "oxr_handle.h"
|
||||
#include "oxr_two_call.h"
|
||||
#include "oxr_input_transform.h"
|
||||
|
||||
#include <math.h>
|
||||
|
@ -1154,6 +1155,7 @@ oxr_action_bind_inputs(struct oxr_logger *log,
|
|||
cache->inputs[i] = inputs[i];
|
||||
}
|
||||
cache->num_inputs = num_inputs;
|
||||
cache->bound_path = bound_path;
|
||||
}
|
||||
|
||||
if (num_outputs > 0) {
|
||||
|
@ -1164,6 +1166,7 @@ oxr_action_bind_inputs(struct oxr_logger *log,
|
|||
cache->outputs[i] = outputs[i];
|
||||
}
|
||||
cache->num_outputs = num_outputs;
|
||||
cache->bound_path = bound_path;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1403,6 +1406,45 @@ oxr_action_sync_data(struct oxr_logger *log,
|
|||
return oxr_session_success_focused_result(sess);
|
||||
}
|
||||
|
||||
XrResult
|
||||
oxr_action_enumerate_bound_sources(struct oxr_logger *log,
|
||||
struct oxr_session *sess,
|
||||
uint32_t act_key,
|
||||
uint32_t sourceCapacityInput,
|
||||
uint32_t *sourceCountOutput,
|
||||
XrPath *sources)
|
||||
{
|
||||
struct oxr_action_attachment *act_attached = NULL;
|
||||
size_t num_paths = 0;
|
||||
XrPath temp[32] = {0};
|
||||
|
||||
oxr_session_get_action_attachment(sess, act_key, &act_attached);
|
||||
if (act_attached == NULL) {
|
||||
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE,
|
||||
"act_key did not find any action");
|
||||
}
|
||||
|
||||
if (act_attached->head.bound_path != XR_NULL_PATH) {
|
||||
temp[num_paths++] = act_attached->head.bound_path;
|
||||
}
|
||||
if (act_attached->left.bound_path != XR_NULL_PATH) {
|
||||
temp[num_paths++] = act_attached->left.bound_path;
|
||||
}
|
||||
if (act_attached->right.bound_path != XR_NULL_PATH) {
|
||||
temp[num_paths++] = act_attached->right.bound_path;
|
||||
}
|
||||
if (act_attached->gamepad.bound_path != XR_NULL_PATH) {
|
||||
temp[num_paths++] = act_attached->gamepad.bound_path;
|
||||
}
|
||||
if (act_attached->user.bound_path != XR_NULL_PATH) {
|
||||
temp[num_paths++] = act_attached->user.bound_path;
|
||||
}
|
||||
|
||||
OXR_TWO_CALL_HELPER(log, sourceCapacityInput, sourceCountOutput,
|
||||
sources, num_paths, temp,
|
||||
oxr_session_success_result(sess));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
|
|
|
@ -429,6 +429,18 @@ oxr_action_sync_data(struct oxr_logger *log,
|
|||
struct oxr_session *sess,
|
||||
uint32_t countActionSets,
|
||||
const XrActiveActionSet *actionSets);
|
||||
|
||||
/*!
|
||||
* @public @memberof oxr_session
|
||||
*/
|
||||
XrResult
|
||||
oxr_action_enumerate_bound_sources(struct oxr_logger *log,
|
||||
struct oxr_session *sess,
|
||||
uint32_t act_key,
|
||||
uint32_t sourceCapacityInput,
|
||||
uint32_t *sourceCountOutput,
|
||||
XrPath *sources);
|
||||
|
||||
/*!
|
||||
* @public @memberof oxr_session
|
||||
*/
|
||||
|
@ -562,16 +574,6 @@ oxr_action_get_input_source_localized_name(
|
|||
uint32_t *bufferCountOutput,
|
||||
char *buffer);
|
||||
|
||||
/*!
|
||||
* @public @memberof oxr_session
|
||||
*/
|
||||
XrResult
|
||||
oxr_action_enumerate_bound_sources(struct oxr_logger *log,
|
||||
struct oxr_session *sess,
|
||||
uint64_t key,
|
||||
uint32_t sourceCapacityInput,
|
||||
uint32_t *sourceCountOutput,
|
||||
XrPath *sources);
|
||||
/*!
|
||||
* @}
|
||||
*/
|
||||
|
@ -1487,6 +1489,9 @@ struct oxr_action_cache
|
|||
{
|
||||
struct oxr_action_state current;
|
||||
|
||||
//! Which action is proving the binding.
|
||||
XrPath bound_path;
|
||||
|
||||
size_t num_inputs;
|
||||
struct oxr_action_input *inputs;
|
||||
|
||||
|
|
Loading…
Reference in a new issue