Skip to content

Commit

Permalink
steam_helper: clean up OpenVR before getting OpenXR extensions in `in…
Browse files Browse the repository at this point in the history
…itialize_vr_data`

When using OpenComposite, both OpenVR and OpenXR functions may
call the same underlying OpenXR loader.

Because the OpenXR loader only supports a single active instance,
`initialize_vr_data` currently fails as an OpenXR instance
has already been initialized ath the time XR extensions are queried.

This commit fixes the problem by cleaning up the temporary
OpenVR context *before* initializing OpenXR instead of keeping it
open until the end of the call.

Fix for:
ValveSoftware#7905
  • Loading branch information
emily-is-my-username committed Sep 29, 2024
1 parent 6c7cba9 commit 96bd85c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions steam_helper/steam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,11 @@ static DWORD WINAPI initialize_vr_data(void *arg)
}
}

if (vr_initialized) {
client_core->Cleanup();
vr_initialized = FALSE;
}

if ((hwineopenxr = LoadLibraryA("wineopenxr.dll")))
{
p__wineopenxr_get_extensions_internal = reinterpret_cast<decltype(p__wineopenxr_get_extensions_internal)>
Expand Down

0 comments on commit 96bd85c

Please sign in to comment.