st/oxr: Add OXR_PARALLEL_VIEWS debug var

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2312>
This commit is contained in:
Christoph Haag 2024-08-21 00:12:34 +02:00 committed by Marge Bot
parent 338d85543b
commit f672227153
3 changed files with 18 additions and 1 deletions

View file

@ -49,6 +49,7 @@ DEBUG_GET_ONCE_BOOL_OPTION(debug_views, "OXR_DEBUG_VIEWS", false)
DEBUG_GET_ONCE_BOOL_OPTION(debug_spaces, "OXR_DEBUG_SPACES", false)
DEBUG_GET_ONCE_BOOL_OPTION(debug_bindings, "OXR_DEBUG_BINDINGS", false)
DEBUG_GET_ONCE_BOOL_OPTION(lifecycle_verbose, "OXR_LIFECYCLE_VERBOSE", false)
DEBUG_GET_ONCE_TRISTATE_OPTION(parallel_views, "OXR_PARALLEL_VIEWS")
#ifdef XRT_OS_ANDROID
@ -202,6 +203,15 @@ apply_quirks(struct oxr_logger *log, struct oxr_instance *inst)
// Currently always true.
inst->quirks.no_validation_error_in_create_ref_space = true;
enum debug_tristate_option parallel_view = debug_get_tristate_option_parallel_views();
// Only override hardcoded quirks when explicitly enabling or disabling, not on auto.
if (parallel_view == DEBUG_TRISTATE_OFF) {
inst->quirks.parallel_views = false;
} else if (parallel_view == DEBUG_TRISTATE_ON) {
inst->quirks.parallel_views = true;
}
}
XrResult

View file

@ -1711,6 +1711,9 @@ struct oxr_instance
* XR_ERROR_VALIDATION_FAILURE in xrCreateReferenceSpace.
*/
bool no_validation_error_in_create_ref_space;
//! For applications that rely on views being parallel, notably some OpenVR games with OpenComposite.
bool parallel_views;
} quirks;
//! Debug messengers

View file

@ -614,7 +614,11 @@ oxr_session_locate_views(struct oxr_logger *log,
* Pose
*/
const struct xrt_pose view_pose = poses[i];
struct xrt_pose view_pose = poses[i];
if (sess->sys->inst->quirks.parallel_views) {
view_pose.orientation = (struct xrt_quat)XRT_QUAT_IDENTITY;
}
// Do the magical space relation dance here.
struct xrt_space_relation result = {0};