Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use custom OpenXR runtime #7382

Open
Scrumplex opened this issue Jan 3, 2024 · 2 comments
Open

Cannot use custom OpenXR runtime #7382

Scrumplex opened this issue Jan 3, 2024 · 2 comments

Comments

@Scrumplex
Copy link

I am trying to run Beat Saber using Monado. Setting the following three environment variables doesn't work:

# Tell Proton to use OpenComposite instead of OpenVR
export VR_OVERRIDE=/nix/store/wbvv4scl5mn0br0n0kxm60452fi6fwd1-opencomposite-2ab29e49c96c5e446e439a408521a677737c4956/lib/opencomposite
# Help OpenComposite find the OpenXR runtime
export XR_RUNTIME_JSON=/nix/store/fdk7dh4b12kip0pm44prhxgpp5g4nl74-monado-bfa1c16ff9fc759327ca251a5d086b958b1a3b8a/share/openxr/1/openxr_monado.json
# Tell Steam Pressure Vessel to allow access to Monado
export PRESSURE_VESSEL_FILESYSTEMS_RW=$XDG_RUNTIME_DIR/monado_comp_ipc

Interestingly enough, those same environment variables work fine for OpenVR games.

From a PROTON_LOG, I discovered that XR_RUNTIME_JSON is ignored by OpenXR Loader (see https://github.com/KhronosGroup/OpenXR-SDK/blob/49e81bbd919af7c0cf513517a730d12253c28902/src/common/platform_utils.hpp#L329 and log below)

I also tried changing the active runtime by pointing ~/.config/openxr/1/active_runtime.json to my Monado runtime.

I have uploaded a Proton log for Beat Saber here: https://gist.github.com/Scrumplex/49390ce5bea8ce81fb672bfa656e82b8

It is being launched just with those env vars above

@eburema
Copy link

eburema commented Mar 1, 2024

Not 100% sure but I think it might have something to with the checks steam_helper does during initialize_vr_data that get checked during get_vulkan_extensions The initialize_vr_data checks get sometimes ignored for OpenVR games (or can be forced to OK by symlinking wineopenxr.dll to /dev/null), but wineopenxr.dll doesn't init unless the check is OK and wineopenxr.dll is present, under monado + opencomposite the check in initialize_vr_data fails due to not being able to open an openxr instance twice (this is a limited by openxrloader).

The result of the the check is stored in the volatile reg key "Software\Wine\VR"

Tried to make a patch to test this, but haven't been able to compile proton to test

emily-is-my-username added a commit to emily-is-my-username/Proton that referenced this issue Jul 11, 2024
When using opencomposite, both OpenVR and OpenXR will call
the same OpenXR loader, which only supports a single active instance.

After calling `xrCreateInstance` once (indirectly, through opencomposite),
creating another OpenXR instance in `__wineopenxr_get_extensions_internal` fails.

As a workaround, this commit moves the code that probes OpenXR extensions
(and destroys its instance afterwards) *before* OpenVR initialization.

Note that according to
[this comment](https://github.com/ValveSoftware/Proton/blob/b6d5618b6da9c90649590fedea70b0af8ba2e7e6/wineopenxr/openxr.c#L322),
the original order is needed because of a bug in SteamVR, so this commit
will probably break SteamVR in some way (i haven't checked, though)

Fixes:
https://gitlab.com/znixian/OpenOVR/-/issues/416
ValveSoftware#7382 (comment)
@emily-is-my-username
Copy link

emily-is-my-username commented Jul 11, 2024

@eburema

Tried to make a patch to test this, but haven't been able to compile proton to test

This patch successfully worked for me to get around the "Loader does not support simultaneous XrInstances" error. I tested both OpenVR and OpenXR games with Proton + Monado on NixOS.

EDIT:
As a note, using the opencomposite-helper to set VR_OVERRIDE (as @Scrumplex did) does not work for me.
I am using ~/.config/openvr/openvrpaths.vrpath instead, as described here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants