Disable LOCAL reference space on SteamVR;

Recent SteamVR versions have bugs with it, especially after triggering a
recenter operation.

In SteamVR, recentering fires referenceSpaceChangePending for the LOCAL
space, then the STAGE space, then the LOCAL space again, all with
different changeTimes.  No poseInPreviousSpace is given.

Recreating the main reference space whenever this event is received
leads to strange, inconsistent issues.  Sometimes the local/stage spaces
end up on top of each other, other times one or both will be way up in
the air (putting the headset at negative y coordinates).

This bug is even present when recentering in the compositor, so it's not
an issue with lovr.  Cautiously disabling the local-floor emulation on
SteamVR runtimes and just always using the STAGE space until things are
sorted out.
This commit is contained in:
bjorn 2023-07-16 14:32:45 -07:00
parent 83d6e64c6e
commit 61ffd5716f
1 changed files with 7 additions and 0 deletions

View File

@ -265,6 +265,7 @@ static XrTime getCurrentXrTime(void) {
return time;
}
static bool openxr_getDriverName(char* name, size_t length);
static void createReferenceSpace(XrTime time) {
XrReferenceSpaceCreateInfo info = {
.type = XR_TYPE_REFERENCE_SPACE_CREATE_INFO,
@ -277,6 +278,12 @@ static void createReferenceSpace(XrTime time) {
return;
}
char name[256];
if (openxr_getDriverName(name, sizeof(name)) && !memcmp(name, "SteamVR", strlen("SteamVR"))) {
state.referenceSpace = state.spaces[DEVICE_FLOOR];
return;
}
if (state.features.localFloor) {
info.referenceSpaceType = XR_REFERENCE_SPACE_TYPE_LOCAL_FLOOR_EXT;
} else if (state.config.seated) {