godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.6k stars 21.28k forks source link

OpenXR: Requested OpenGL version does not meet the minimum version #73008

Open flobotics opened 1 year ago

flobotics commented 1 year ago

Godot version

4.0.rc1

System information

win 11 , hp-reverb-g2

Issue description

When running a simplest VR app, this output is shown. I dont know if it is bad/good , but as i dont know , if my app is running correct because of this output, i think its a kind of a bug :)

I use win 11, hp-reverb-g2 VR headset, wmr and steamvr set to use openxr

here the output:

--- Debugging process started --- Godot Engine v4.0.rc.custom_build.630dd191c - https://godotengine.org OpenXR: Running on OpenXR runtime: SteamVR/OpenXR 0.1.0 OpenGL API 3.3.0 NVIDIA 522.06 - Compatibility - Using Device: NVIDIA Corporation - NVIDIA GeForce RTX 3080 Laptop GPU

OpenXR: Requested OpenGL version does not meet the minimum version this runtime supports.

Steps to reproduce

simplest VR app with win 11 and hp-reverb-g2

Minimal reproduction project

above

clayjohn commented 1 year ago

Does your app run okay despite having this warning printed?

Cc @BastiaanOlij @dsnopek I guess we may need to be more lenient in the OpenXR initialization somewhere. As using a higher version than 3.3 should always be fine as every post 3.3 version is backwards compatible

dsnopek commented 1 year ago

It's not us setting the min/max values, we get those from the OpenXR runtime. In this case, the OpenXR runtime has reported to us that it'll only work with a minimum OpenGL version of 4.3.0 and a maximum version of 4.6.0:

minApiVersionSupported 4.3.0
maxApiVersionSupported 4.6.0

It just so happens that it usually works despite the fact that our OpenGL context's version (3.3.0) is outside that range. :-)

We could simply not report that? However, if we do ever encounter an OpenXR runtime that really has problems with the OpenGL version, it's min/max version would be good information to know. So, maybe we could only report that when using "verbose" output?

BastiaanOlij commented 1 year ago

Indeed, we're just reporting it as the OpenXR driver specifies it. We have a number of drivers reporting they only work under Vulkan 1.0 for instance. Most XR runtimes report needing some version of OpenGL 4.x.

So far it doesn't seem to be much of a problem, we could maybe put it under a verbose print. I think it's handy for debugging purposes if we ever run into issues.

flobotics commented 1 year ago

@clayjohn yes, the app is running.

i dont know if it belongs to that, but i still got this https://github.com/godotengine/godot/issues/72211 issue, which is very weird. Because sometimes e.g. a beta16 and lower versions work, but sometimes they got the same behaviour and also dont work ? steam-vr also opens without set to openxr, so i need todo that again and again. Also Windows-mixed-reality-portal always reports that "openxr is not correctly setup, should it be repaired" ? I dont know how i can setup openxr as standard default ?

BastiaanOlij commented 1 year ago

Ok, so from the feedback I have gotten, if the XR runtime reports its minimum version as 4.3.0 it expects us to run on OpenGL 4.3 or higher. It's maximum version is more of a "it's tested up to this, use at your own risk" sort of deal.

So the fact that we're running a 3.x context is not guaranteed to work, I guess we've been lucky that it has.

@clayjohn whats holding us back from creating an OpenGL 4.x context if supported? We don't have to use any of the newer capabilities, but it does open up the option to using 4.x APIs from plugins etc.

clayjohn commented 1 year ago

Ok, so from the feedback I have gotten, if the XR runtime reports its minimum version as 4.3.0 it expects us to run on OpenGL 4.3 or higher. It's maximum version is more of a "it's tested up to this, use at your own risk" sort of deal.

So the fact that we're running a 3.x context is not guaranteed to work, I guess we've been lucky that it has.

@clayjohn whats holding us back from creating an OpenGL 4.x context if supported? We don't have to use any of the newer capabilities, but it does open up the option to using 4.x APIs from plugins etc.

Creating a newer context should be fine as long as it is supported. The only risk is that some drivers report support for higher versions than they actually support. So my preference would be to default to initializing to 3.3/ES 3.0 unless requested to initialize to a higher version.

BastiaanOlij commented 1 year ago

I think we should leave the context alone and maybe changes these prints to verbose. It really is a diagnostics thing in case we ever run into trouble. So far this doesn't seem to have any real effect and I wager this is just a matter of XR Runtime developers playing it safe.

DanielKinsman commented 4 months ago

Welp, looks like I have a case where we do run into trouble. On linux, ALVR, pico 4, newish mesa (arch btw) I just get a black screen in the headset when using the compat renderer. The desktop view still appears ok though.

Godot Engine v4.2.2.stable.arch_linux - https://godotengine.org
OpenXR: Running on OpenXR runtime:  SteamVR/OpenXR   2.6.2
OpenGL API 4.6 (Core Profile) Mesa 24.1.3-arch1.1 - Compatibility - Using Device: AMD - AMD Radeon RX 6800 XT (radeonsi, navi21, LLVM 18.1.8, DRM 3.57, 6.9.9-arch1-1)

OpenXR: Requested OpenGL version does not meet the minimum version this runtime supports.
- desired_version  3.3.0
- minApiVersionSupported  4.3.0
- maxApiVersionSupported  4.6.0
OpenXR: Trying to initialize with OpenGL anyway...
OpenXR: No viewport was marked with use_xr, there is no rendered output!

I tried switching the driver to opengl_es but it couldn't start xr at all with that.

dsnopek commented 4 months ago

@DanielKinsman Are you using normal X11 or xwayland? I don't think Godot's OpenXR support will work through Wayland/xwayland, but I'm not sure.

Anyway, assuming you are using normal X11, can you try changing the requested OpenGL version in gl_manager_x11.cpp and see what happens?

You'd change this line:

                GLX_CONTEXT_MAJOR_VERSION_ARB, 3,

... to:

                GLX_CONTEXT_MAJOR_VERSION_ARB, 4,

If that fixes the issue, then we know it's a result of the OpenGL version thing.

DanielKinsman commented 4 months ago

I'm using wayland, it's been the default on most desktop distributions for a few years now. But I'm not using the experimental godot wayland stuff in 4.3 yet, this is just bog standard 4.2.

To test it I logged out and logged back in to an X11 session instead and got the same results.

I then branched off 4.2.2-stable and made these changes: https://github.com/DanielKinsman/godot/commit/c389e77dde211299b571378a725f2dcbc2d207ef

Using that on X11 this got rid of the version mismatch warning but still had the black screen in the headset. It gave this output on console:

Godot Engine v4.2.2.stable.custom_build.15073afe3 - https://godotengine.org
Inconsistent value (1) for DRI_PRIME. Should be < 1 (GPU devices count). Using: 0
OpenGL API 4.6 (Core Profile) Mesa 24.1.3-arch1.1 - Compatibility - Using Device: AMD - AMD Radeon RX 6800 XT (radeonsi, navi21, LL
VM 18.1.8, DRM 3.57, 6.9.9-arch1-1)                                                                                                

Running project: /home/daniel/scratch/glcompattest                                                                                 
Godot Engine v4.2.2.stable.custom_build.15073afe3 - https://godotengine.org
OpenXR: Running on OpenXR runtime:  SteamVR/OpenXR   2.6.2                                                                         
Inconsistent value (1) for DRI_PRIME. Should be < 1 (GPU devices count). Using: 0
OpenGL API 4.6 (Core Profile) Mesa 24.1.3-arch1.1 - Compatibility - Using Device: AMD - AMD Radeon RX 6800 XT (radeonsi, navi21, LL
VM 18.1.8, DRM 3.57, 6.9.9-arch1-1)                                                                                                

ERROR: OpenXR: Unsupported toplevel path /user/eyes_ext                                                                            
   at: is_top_level_path_supported (modules/openxr/openxr_api.cpp:200)  
ERROR: OpenXR: Unsupported interaction profile /interaction_profiles/ext/eye_gaze_interaction
   at: is_interaction_profile_supported (modules/openxr/openxr_api.cpp:220)
OpenXR: No viewport was marked with use_xr, there is no rendered output!

So at a guess the opengl context version isn't at fault for the black screen, something else is.

On wayland it just plain crashed, giving this output:

Godot Engine v4.2.2.stable.custom_build.15073afe3 - https://godotengine.org
Inconsistent value (1) for DRI_PRIME. Should be < 1 (GPU devices count). Using: 0
OpenGL API 4.6 (Core Profile) Mesa 24.1.3-arch1.1 - Compatibility - Using Device: AMD - AMD Radeon RX 6800 XT (radeonsi, navi21, LL
VM 18.1.8, DRM 3.57, 6.9.9-arch1-1)                                                                                                

Running project: /home/daniel/scratch/glcompattest
Godot Engine v4.2.2.stable.custom_build.15073afe3 - https://godotengine.org
OpenXR: Running on OpenXR runtime:  SteamVR/OpenXR   2.6.2
Inconsistent value (1) for DRI_PRIME. Should be < 1 (GPU devices count). Using: 0
OpenGL API 4.6 (Core Profile) Mesa 24.1.3-arch1.1 - Compatibility - Using Device: AMD - AMD Radeon RX 6800 XT (radeonsi, navi21, LL
VM 18.1.8, DRM 3.57, 6.9.9-arch1-1)           

ERROR: OpenXR: Unsupported toplevel path /user/eyes_ext
   at: is_top_level_path_supported (modules/openxr/openxr_api.cpp:200)
ERROR: OpenXR: Unsupported interaction profile /interaction_profiles/ext/eye_gaze_interaction
   at: is_interaction_profile_supported (modules/openxr/openxr_api.cpp:220)
OpenXR: No viewport was marked with use_xr, there is no rendered output!
OpenXR: No viewport was marked with use_xr, there is no rendered output!
ERROR: Caller thread can't call this function in this node (/root). Use call_deferred() or call_thread_group() instead.
   at: propagate_notification (scene/main/node.cpp:2249)                                                                           

================================================================                                                                   
handle_crash: Program crashed with signal 11                                                                                       
Engine version: Godot Engine v4.2.2.stable.custom_build (15073afe3856abd2aa1622492fe50026c7d63dc1)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /usr/lib/libc.so.6(+0x3cae0) [0x7ca5507ecae0] (??:0)     
[2] /home/daniel/.local/share/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so(+0x2450c8) [0x7ca5448450c8] (??:0)
[3] /home/daniel/.local/share/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so(+0x1b6cba) [0x7ca5447b6cba] (??:0)
[4] /home/daniel/.local/share/Steam/steamapps/common/SteamVR/bin/linux64/vrclient.so(+0x256d99) [0x7ca544856d99] (??:0)
[5] /usr/lib/libc.so.6(+0x92ded) [0x7ca550842ded] (??:0)
[6] /usr/lib/libc.so.6(+0x1160dc) [0x7ca5508c60dc] (??:0)
-- END OF BACKTRACE --
================================================================

I wouldn't be surprised if I got the same results on a quest 2 because ALVR is kind of middle manning us from the headset anyway.

dsnopek commented 4 months ago

@DanielKinsman Since we know your issue isn't related to the OpenGL version mismatch, we should probably move further debugging to a new issue.

However, the next to things I would try: (a) enable verbose output in your project and see if you get any more interesting errors, (b) check that you are setting get_viewport().use_xr = true in your project after initializing OpenXR (this is what this error is complaining about: OpenXR: No viewport was marked with use_xr, there is no rendered output!)

DanielKinsman commented 4 months ago

I did some more digging and opened a new issue: https://github.com/godotengine/godot/issues/94455