st/oxr: Enable core local floor space in OpenXR 1.1

v2: st/oxr: Handle local floor in OpenXR 1.1 when extension is not available

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2194>
This commit is contained in:
Christoph Haag 2024-03-06 14:42:42 +01:00 committed by Marge Bot
parent eaf747eca2
commit bbe33da56e
2 changed files with 24 additions and 4 deletions

View file

@ -53,6 +53,10 @@ is_reference_space_type_valid(struct oxr_logger *log,
return XR_SUCCESS;
}
#endif
if (OXR_API_VERSION_AT_LEAST(sys->inst, 1, 1)) {
return XR_SUCCESS;
}
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",

View file

@ -22,6 +22,7 @@
#include "oxr_logger.h"
#include "oxr_two_call.h"
#include "oxr_chain.h"
#include "oxr_api_verify.h"
DEBUG_GET_ONCE_NUM_OPTION(scale_percentage, "OXR_VIEWPORT_SCALE_PERCENTAGE", 100)
@ -198,16 +199,31 @@ oxr_system_fill_in(
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 (OXR_API_VERSION_AT_LEAST(sys->inst, 1, 1)) {
if (sys->xso->semantic.local_floor != NULL) {
sys->reference_spaces[sys->reference_space_count++] = XR_REFERENCE_SPACE_TYPE_LOCAL_FLOOR_EXT;
sys->reference_spaces[sys->reference_space_count++] = XR_REFERENCE_SPACE_TYPE_LOCAL_FLOOR;
} else {
oxr_warn(log,
"XR_EXT_local_floor enabled but system doesn't support local_floor,"
"OpenXR 1.1 used but system doesn't support local_floor,"
" breaking spec by not exposing the reference space.");
}
}
#ifdef OXR_HAVE_EXT_local_floor
// If OpenXR 1.1 and the extension is enabled, don't add a second reference.
// Note that XR_REFERENCE_SPACE_TYPE_LOCAL_FLOOR is aliased to XR_REFERENCE_SPACE_TYPE_LOCAL_FLOOR_EXT.
if (!OXR_API_VERSION_AT_LEAST(sys->inst, 1, 1)) {
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) {