st/oxr: Expose unbounded if extension enabled and space is supported

This commit is contained in:
Jakob Bornecrantz 2023-11-06 23:37:12 +00:00
parent c2c74b8b85
commit 0c2f1e83e0
3 changed files with 18 additions and 2 deletions

View file

@ -54,6 +54,16 @@ is_reference_space_type_valid(struct oxr_logger *log,
log, XR_ERROR_VALIDATION_FAILURE,
"(%s == XR_REFERENCE_SPACE_TYPE_LOCAL_FLOOR_EXT) is only valid if XR_EXT_local_floor is enabled",
field_name);
case XR_REFERENCE_SPACE_TYPE_UNBOUNDED_MSFT:
#ifdef OXR_HAVE_MSFT_unbounded_reference_space
if (sys->inst->extensions.MSFT_unbounded_reference_space) {
return XR_SUCCESS;
}
#endif
return oxr_error(log, XR_ERROR_VALIDATION_FAILURE,
"(%s == XR_REFERENCE_SPACE_TYPE_UNBOUNDED_MSFT) is only valid if "
"XR_MSFT_unbounded_reference_space is enabled",
field_name);
default: break;
}

View file

@ -1276,7 +1276,7 @@ struct oxr_system
uint32_t blend_mode_count;
XrEnvironmentBlendMode blend_modes[3];
XrReferenceSpaceType reference_spaces[4];
XrReferenceSpaceType reference_spaces[5];
uint32_t reference_space_count;
//! Cache of the last known system roles, see @xrt_system_roles::generation_id

View file

@ -194,7 +194,7 @@ oxr_system_fill_in(struct oxr_logger *log, struct oxr_instance *inst, XrSystemId
* Reference space support.
*/
static_assert(4 <= ARRAY_SIZE(sys->reference_spaces), "Not enough space in array");
static_assert(5 <= ARRAY_SIZE(sys->reference_spaces), "Not enough space in array");
if (sys->xso->semantic.view != NULL) {
sys->reference_spaces[sys->reference_space_count++] = XR_REFERENCE_SPACE_TYPE_VIEW;
@ -220,6 +220,12 @@ oxr_system_fill_in(struct oxr_logger *log, struct oxr_instance *inst, XrSystemId
sys->reference_spaces[sys->reference_space_count++] = XR_REFERENCE_SPACE_TYPE_STAGE;
}
#ifdef OXR_HAVE_MSFT_unbounded_reference_space
if (sys->inst->extensions.MSFT_unbounded_reference_space && sys->xso->semantic.unbounded != NULL) {
sys->reference_spaces[sys->reference_space_count++] = XR_REFERENCE_SPACE_TYPE_UNBOUNDED_MSFT;
}
#endif
/*
* Done.