From ccfac98d3622129bacc802c6bffcf304c7350c48 Mon Sep 17 00:00:00 2001 From: Christoph Haag Date: Wed, 29 May 2024 22:51:12 +0200 Subject: [PATCH] st/oxr: Ignore primaryViewConfigurationType in headless Spec: "In a headless session, the XrSessionBeginInfo::primaryViewConfigurationType must be ignored and may be 0." --- src/xrt/state_trackers/oxr/oxr_api_session.c | 6 +++++- src/xrt/state_trackers/oxr/oxr_session.c | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/xrt/state_trackers/oxr/oxr_api_session.c b/src/xrt/state_trackers/oxr/oxr_api_session.c index 43d1d9bd1..c73438984 100644 --- a/src/xrt/state_trackers/oxr/oxr_api_session.c +++ b/src/xrt/state_trackers/oxr/oxr_api_session.c @@ -94,7 +94,11 @@ oxr_xrBeginSession(XrSession session, const XrSessionBeginInfo *beginInfo) OXR_VERIFY_SESSION_AND_INIT_LOG(&log, session, sess, "xrBeginSession"); OXR_VERIFY_SESSION_NOT_LOST(&log, sess); OXR_VERIFY_ARG_TYPE_AND_NOT_NULL(&log, beginInfo, XR_TYPE_SESSION_BEGIN_INFO); - OXR_VERIFY_VIEW_CONFIG_TYPE(&log, sess->sys->inst, beginInfo->primaryViewConfigurationType); + + // in a headless session there is no compositor and primaryViewConfigurationType must be ignored + if (sess->compositor != NULL) { + OXR_VERIFY_VIEW_CONFIG_TYPE(&log, sess->sys->inst, beginInfo->primaryViewConfigurationType); + } if (sess->has_begun) { return oxr_error(&log, XR_ERROR_SESSION_RUNNING, "Session is already running"); diff --git a/src/xrt/state_trackers/oxr/oxr_session.c b/src/xrt/state_trackers/oxr/oxr_session.c index 4468fc847..773391d5c 100644 --- a/src/xrt/state_trackers/oxr/oxr_session.c +++ b/src/xrt/state_trackers/oxr/oxr_session.c @@ -210,7 +210,8 @@ oxr_session_begin(struct oxr_logger *log, struct oxr_session *sess, const XrSess if (xc != NULL) { XrViewConfigurationType view_type = beginInfo->primaryViewConfigurationType; - if (view_type != sess->sys->view_config_type) { + // in a headless session there is no compositor and primaryViewConfigurationType must be ignored + if (sess->compositor != NULL && view_type != sess->sys->view_config_type) { /*! @todo we only support a single view config type per * system right now */ return oxr_error(log, XR_ERROR_VIEW_CONFIGURATION_TYPE_UNSUPPORTED,