mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-29 18:08:29 +00:00
st/oxr: Expose local_floor if extension enabled and space is supported
This commit is contained in:
parent
2fbe588f66
commit
c2c74b8b85
|
@ -44,6 +44,16 @@ is_reference_space_type_valid(struct oxr_logger *log,
|
|||
case XR_REFERENCE_SPACE_TYPE_VIEW:
|
||||
case XR_REFERENCE_SPACE_TYPE_LOCAL:
|
||||
case XR_REFERENCE_SPACE_TYPE_STAGE: return XR_SUCCESS;
|
||||
case XR_REFERENCE_SPACE_TYPE_LOCAL_FLOOR_EXT:
|
||||
#ifdef OXR_HAVE_EXT_local_floor
|
||||
if (sys->inst->extensions.EXT_local_floor) {
|
||||
return XR_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
return oxr_error(
|
||||
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);
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1276,7 +1276,7 @@ struct oxr_system
|
|||
uint32_t blend_mode_count;
|
||||
XrEnvironmentBlendMode blend_modes[3];
|
||||
|
||||
XrReferenceSpaceType reference_spaces[3];
|
||||
XrReferenceSpaceType reference_spaces[4];
|
||||
uint32_t reference_space_count;
|
||||
|
||||
//! Cache of the last known system roles, see @xrt_system_roles::generation_id
|
||||
|
|
|
@ -92,7 +92,7 @@ get_xrt_space(struct oxr_logger *log, struct oxr_space *spc, struct xrt_space **
|
|||
case OXR_SPACE_TYPE_ACTION: return get_xrt_space_action(log, spc, out_xspace);
|
||||
case OXR_SPACE_TYPE_REFERENCE_VIEW: xspace = spc->sess->sys->xso->semantic.view; break;
|
||||
case OXR_SPACE_TYPE_REFERENCE_LOCAL: xspace = spc->sess->sys->xso->semantic.local; break;
|
||||
case OXR_SPACE_TYPE_REFERENCE_LOCAL_FLOOR: xspace = NULL; break;
|
||||
case OXR_SPACE_TYPE_REFERENCE_LOCAL_FLOOR: xspace = spc->sess->sys->xso->semantic.local_floor; break;
|
||||
case OXR_SPACE_TYPE_REFERENCE_STAGE: xspace = spc->sess->sys->xso->semantic.stage; break;
|
||||
case OXR_SPACE_TYPE_REFERENCE_UNBOUNDED_MSFT: xspace = spc->sess->sys->xso->semantic.unbounded; break;
|
||||
case OXR_SPACE_TYPE_REFERENCE_COMBINED_EYE_VARJO: xspace = NULL; break;
|
||||
|
|
|
@ -194,7 +194,7 @@ oxr_system_fill_in(struct oxr_logger *log, struct oxr_instance *inst, XrSystemId
|
|||
* Reference space support.
|
||||
*/
|
||||
|
||||
static_assert(3 <= ARRAY_SIZE(sys->reference_spaces), "Not enough space in array");
|
||||
static_assert(4 <= 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;
|
||||
|
@ -204,6 +204,18 @@ oxr_system_fill_in(struct oxr_logger *log, struct oxr_instance *inst, XrSystemId
|
|||
sys->reference_spaces[sys->reference_space_count++] = XR_REFERENCE_SPACE_TYPE_LOCAL;
|
||||
}
|
||||
|
||||
#ifdef OXR_HAVE_EXT_local_floor
|
||||
if (sys->inst->extensions.EXT_local_floor) {
|
||||
if (sys->xso->semantic.local_floor != NULL) {
|
||||
sys->reference_spaces[sys->reference_space_count++] = XR_REFERENCE_SPACE_TYPE_LOCAL_FLOOR_EXT;
|
||||
} else {
|
||||
oxr_warn(log,
|
||||
"XR_EXT_local_floor enabled but system doesn't support local_floor,"
|
||||
" breaking spec by not exposing the reference space.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (sys->xso->semantic.stage != NULL) {
|
||||
sys->reference_spaces[sys->reference_space_count++] = XR_REFERENCE_SPACE_TYPE_STAGE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue