MCXR icon indicating copy to clipboard operation
MCXR copied to clipboard

MCXR Linux is not working with SteamVR

Open LambdAurora opened this issue 3 years ago • 8 comments

MCXR doesn't work on Linux with SteamVR (1.14 or 1.21.4) with NVIDIA GPUs.

Either the bindings or MCXR has an implementation issue since other OpenXR-based VR games has been confirmed working with the same setup (Boneworks, hello_xr for example).

All testing had to be done using https://github.com/ChristophHaag/gl_context_fix_layer, without the game would get stuck due to the OpenGL context being changed and Minecraft not fetching it back, meaning all remaining draw commands will get executed "in the void".

With the context fix layer, the game simply crashes:

[17:15:50] [Render thread/INFO]: OpenAL initialized on device JACK Default
[17:15:50] [Render thread/INFO]: Sound engine started
[17:15:50] [Render thread/INFO]: Created: 1024x1024x4 minecraft:textures/atlas/blocks.png-atlas
[17:15:51] [Render thread/INFO]: Created: 256x128x4 minecraft:textures/atlas/signs.png-atlas
[17:15:51] [Render thread/INFO]: Created: 1024x512x4 minecraft:textures/atlas/banner_patterns.png-atlas
[17:15:51] [Render thread/INFO]: Created: 1024x512x4 minecraft:textures/atlas/shield_patterns.png-atlas
[17:15:51] [Render thread/INFO]: Created: 256x256x4 minecraft:textures/atlas/chest.png-atlas
[17:15:51] [Render thread/INFO]: Created: 512x256x4 minecraft:textures/atlas/beds.png-atlas
[17:15:51] [Render thread/INFO]: Created: 512x256x4 minecraft:textures/atlas/shulker_boxes.png-atlas
[17:15:52] [Render thread/INFO]: Created: 256x256x0 minecraft:textures/atlas/particles.png-atlas
[17:15:52] [Render thread/INFO]: Created: 256x256x0 minecraft:textures/atlas/paintings.png-atlas
[17:15:52] [Render thread/INFO]: Created: 256x128x0 minecraft:textures/atlas/mob_effects.png-atlas
XR_APILAYER_HAAGCH_gl_context_fix:: : Using API layer: XR_APILAYER_HAAGCH_gl_context_fix
XR_APILAYER_HAAGCH_gl_context_fix:: : loader API version min: 1.0.0. max: 1.1023.4095.
XR_APILAYER_HAAGCH_gl_context_fix:: : loader interface version min: 0.0.1. max: 0.0.1.
XR_APILAYER_HAAGCH_gl_context_fix:: graphics binding: XR_KHR_opengl_enableXR_APILAYER_HAAGCH_gl_context_fix:: : Created api layer instance for app [MCXR] Minecraft VR
[17:15:54] [Render thread/INFO]: Found device with id: 1152950633075048966
[17:15:54] [Render thread/INFO]: Headset Name:SteamVR/OpenXR : lighthouse Vendor:10462 
[17:15:54] [Render thread/INFO]: Headset Orientation Tracking:true Position Tracking:true 
[17:15:54] [Render thread/INFO]: Headset Max Width:1512 Max Height:1680 Max Layer Count:16 
XR_APILAYER_HAAGCH_gl_context_fix:: _xrCreateSession
XR_APILAYER_HAAGCH_gl_context_fix:: GLX graphics binding: display 0x7efc99fed5c0, drawable 155189257, context 0x7efc9a1dedc8
[17:15:55] [Render thread/INFO]: OpenGL debug message: id=1282, source=API, type=ERROR, severity=HIGH, message='GL_INVALID_OPERATION error generated. Texture name does not refer to a texture object generated by OpenGL.'
[17:15:55] [Render thread/ERROR]: Exception caught while initializing OpenXR
net.sorenon.mcxr.play.openxr.XrRuntimeException: xrCreateSwapchain returned:XR_ERROR_RUNTIME_FAILURE
	at net.sorenon.mcxr.play.openxr.OpenXRInstance.check(OpenXRInstance.java:152) ~[mcxr-play-0.1.1.jar:?]
	at net.sorenon.mcxr.play.openxr.OpenXRSession.createSwapchains(OpenXRSession.java:153) ~[mcxr-play-0.1.1.jar:?]
	at net.sorenon.mcxr.play.openxr.OpenXR.tryInitialize(OpenXR.java:71) [mcxr-play-0.1.1.jar:?]
	at net.minecraft.class_442.handler$zik000$render(class_442.java:562) [client-intermediary.jar:?]
	at net.minecraft.class_442.method_25394(class_442.java:290) [client-intermediary.jar:?]
	at net.minecraft.class_757.method_3192(class_757.java:875) [client-intermediary.jar:?]
	at net.minecraft.class_310.method_1523(class_310.java:1117) [client-intermediary.jar:?]
	at net.minecraft.class_310.redirect$zje000$loop(class_310.java:6628) [client-intermediary.jar:?]
	at net.minecraft.class_310.method_1514(class_310.java:733) [client-intermediary.jar:?]
	at net.minecraft.client.main.Main.main(Main.java:238) [client-intermediary.jar:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:608) [fabric-loader-0.12.12.jar:?]
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:77) [fabric-loader-0.12.12.jar:?]
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) [fabric-loader-0.12.12.jar:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:210) [NewLaunch.jar:?]
	at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:245) [NewLaunch.jar:?]
	at org.multimc.EntryPoint.listen(EntryPoint.java:143) [NewLaunch.jar:?]
	at org.multimc.EntryPoint.main(EntryPoint.java:34) [NewLaunch.jar:?]

And SteamVR displays this: image

LambdAurora avatar Dec 29 '21 16:12 LambdAurora

Hi sorry for the delayed response. This is an issue which I've been aware of for a few months now but I have not been able to make much progress beyond using the layer you mentioned.

As far as I know this crash is entirely due to SteamVR's shoddy OpenXR OpenGL support as MCXR works perfectly with Monado. Since applications like Vivecraft and Boneworks use OpenVR they are not affected by this.

As hello_xr does work (with the layer) I have tried rewriting MCXR to match it however it still crashes on the xrCreateSwapchain call (with a different crash message in Arabic for some reason).

The solution I am working on now is a different OpenXR layer which will request a Vulkan swapchain from SteamVR and use interop to pass those as OpenGL textures to the application. Since this is what SteamVR already does internally there shouldn't be much of a performance hit. This might seem like overkill but I am already working on a similar layer to allow MCXR, Blender and Godot to run directly on the Windows Mixed Reality runtime which only exposes DirectX 11/12 swapchains.

Sorenon avatar Jan 19 '22 19:01 Sorenon

For the record, that SteamVR OpenGL bug is NOT unique in any way, the exact same thing happens with StereoKit and is uber annoying

technobaboo avatar Jan 19 '22 19:01 technobaboo

For example Godot works too. But SteroKit and StardustXR doesn't. The problem is that I cannot use Monado because of a regression with the Nvidia drivers, which causes Monado to just segfault.

As hello_xr does work (with the layer) I have tried rewriting MCXR to match it however it still crashes on the xrCreateSwapchain call (with a different crash message in Arabic for some reason).

That's unfortunate and very weird, I wonder why MCXR is not able to reproduce. I wonder if rewriting hello_xr in Java could help pin out the issue? if it doesn't work with the Java version of it, it could be an issue somewhere in how Java interacts with the native part, which would be quite weird.

LambdAurora avatar Jan 19 '22 20:01 LambdAurora

stardust xr is based on stereokit so... yea of course it won't work :p

technobaboo avatar Jan 19 '22 21:01 technobaboo

I've made some headway with the compatibility layer. With it enabled MCXR (and presumably all other OpenGL applications) work just as well as Vulkan applications on SteamVR.

For the time being there may be some performance issues as I'm only using a very basic submit call for copying the interop swapchain to the OpenXR swapchain and I've only been able to test it with the Monado null driver as I don't have access to an Index or Vive.

Sorenon avatar Feb 14 '22 14:02 Sorenon

Try just download windows lol

TNT-King avatar Mar 03 '22 10:03 TNT-King

shutt, steamvr on linux is only bad because valve doesn't put the time into it and monado actually works much more reliably than even steamvr on windows (i'm an XR dev who's worked on Monado myself)

On Thu, Mar 3, 2022 at 5:21 AM TNT-King @.***> wrote:

Try just download windows lol

— Reply to this email directly, view it on GitHub https://github.com/Sorenon/MCXR/issues/22#issuecomment-1057894104, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCU4EGTEJPB2H27TD7MOILU6CHBZANCNFSM5K6HIQEA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

technobaboo avatar Mar 03 '22 11:03 technobaboo

Try just download windows lol

image

WilsontheWolf avatar Mar 03 '22 16:03 WilsontheWolf