diff --git a/src/xrt/state_trackers/oxr/oxr_instance.c b/src/xrt/state_trackers/oxr/oxr_instance.c index e7a963e72..46259e591 100644 --- a/src/xrt/state_trackers/oxr/oxr_instance.c +++ b/src/xrt/state_trackers/oxr/oxr_instance.c @@ -167,15 +167,14 @@ detect_engine(struct oxr_logger *log, struct oxr_instance *inst, const XrInstanc static void apply_quirks(struct oxr_logger *log, struct oxr_instance *inst) { -#if 0 - // This is no longer needed. + inst->quirks.skip_end_session = false; + inst->quirks.disable_vulkan_format_depth_stencil = false; + if (starts_with("UnrealEngine", inst->appinfo.detected.engine.name) && // inst->appinfo.detected.engine.major == 4 && // - inst->appinfo.detected.engine.minor <= 27 && // - inst->appinfo.detected.engine.patch <= 0) { - inst->quirks.disable_vulkan_format_depth_stencil = true; + inst->appinfo.detected.engine.minor <= 27) { + inst->quirks.skip_end_session = true; } -#endif } XrResult diff --git a/src/xrt/state_trackers/oxr/oxr_objects.h b/src/xrt/state_trackers/oxr/oxr_objects.h index 689537ac2..ebd62e579 100644 --- a/src/xrt/state_trackers/oxr/oxr_objects.h +++ b/src/xrt/state_trackers/oxr/oxr_objects.h @@ -1509,6 +1509,8 @@ struct oxr_instance { //! Unreal has a bug in the VulkanRHI backend. bool disable_vulkan_format_depth_stencil; + //! Unreal 4 has a bug calling xrEndSession; the function should just exit + bool skip_end_session; } quirks; //! Debug messengers diff --git a/src/xrt/state_trackers/oxr/oxr_session.c b/src/xrt/state_trackers/oxr/oxr_session.c index e0b0ef3f9..a9356a3cc 100644 --- a/src/xrt/state_trackers/oxr/oxr_session.c +++ b/src/xrt/state_trackers/oxr/oxr_session.c @@ -164,6 +164,11 @@ oxr_session_begin(struct oxr_logger *log, struct oxr_session *sess, const XrSess XrResult oxr_session_end(struct oxr_logger *log, struct oxr_session *sess) { + // there is a bug in Unreal 4 where calling this function will result in a crash, so skip it. + if (sess->sys->inst->quirks.skip_end_session) { + return XR_SUCCESS; + } + struct xrt_compositor *xc = sess->compositor; if (!is_running(sess)) {