godot: Godot 4.0 crashes when enabling use_xr on viewport

Godot version

4.0 alpha 5

System information

Windows 10, Vulkan, AMD RX460, SteamVR 1.21.12

Issue description

Godot 4.0 crashes when enabling use_xr on viewport. This applies to both the main viewport and subviewports.

I’ve tried it with Windows Mixed Reality and TrinusVR Cardboard, it crash the same way with both with SteamVR set as the OpenXR runtime.

Headset tracking seems to work fine, and can render to the normal display just fine, but once XR is enabled, the game just closes.

OpenXR: Running on OpenXR runtime:  SteamVR/OpenXR   0.1.0
Godot Engine v4.0.alpha5.official.d7d528c15 - https://godotengine.org
OpenXR: XrGraphicsRequirementsVulkan2KHR:
 - minApiVersionSupported:  1.0.0
 - maxApiVersionSupported:  1.2.0
ERROR: GENERAL - Message Id Number: 0 | Message Id Name: Loader Message
        loader_scanned_icd_add: Driver C:\Windows\System32\DriverStore\FileRepository\u0376944.inf_amd64_7a28758ed8b2ac21\B376966\.\amdvlk64.dll says it supports interface version 6 but still exports core entrypoints (Policy #LDP_DRIVER_6)
        Objects - 1
                Object[0] - VK_OBJECT_TYPE_INSTANCE, Handle 130841264
   at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:159)
Vulkan API 1.2.0 - Using Vulkan Device #0: AMD - Radeon (TM) RX 460

OpenXR: Found supported reference space  XR_REFERENCE_SPACE_TYPE_VIEW
OpenXR: Found supported reference space  XR_REFERENCE_SPACE_TYPE_LOCAL
OpenXR: Found supported reference space  XR_REFERENCE_SPACE_TYPE_STAGE
OpenXR: Found supported swapchain format  VK_FORMAT_R8G8B8A8_SRGB
OpenXR: Found supported swapchain format  VK_FORMAT_B8G8R8A8_SRGB
OpenXR: Found supported swapchain format  VK_FORMAT_R32G32B32A32_SFLOAT
OpenXR: Found supported swapchain format  VK_FORMAT_R32G32B32_SFLOAT
OpenXR: Found supported swapchain format  VK_FORMAT_R16G16B16A16_SFLOAT
OpenXR: Found supported swapchain format  VK_FORMAT_D32_SFLOAT
OpenXR: Found supported swapchain format  VK_FORMAT_D16_UNORM
OpenXR: Found supported swapchain format  VK_FORMAT_D24_UNORM_S8_UINT
OpenXR: Found supported swapchain format  VK_FORMAT_D32_SFLOAT_S8_UINT
Using swap chain format: VK_FORMAT_R8G8B8A8_SRGB

Steps to reproduce

Set use_xr to true on a viewport. get_viewport().use_xr = true

Minimal reproduction project

VR Test Project.zip

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 28 (21 by maintainers)

Most upvoted comments

@CherrySodaPop and @celyk can you test this issue with the latest master again? https://github.com/godotengine/godot/pull/68102 was merged yesterday and it fixed a AMD XR issue for me so maybe you are lucky too.

I can confirm it not working with #68102 but instead some commit from beta 5 fixing it! I believe #68080 might have actually been the fix.

@Frozenreflex let’s share more details as our setups are very similar but mine is working. Godot 4 Beta 5, RX 6600 and Ryzen 9 3900X, Valve Index, Arch Linux, Xorg session SteamVR beta 1.25.1, mesa 22.2.3

Turns out I needed to install the Vulkan SDK from here https://www.lunarg.com/vulkan-sdk/

For me https://github.com/godotengine/godot/pull/63288 fixed the issue by enabling full LTO but also increased the size of the godot.exe from 150MB to 1.5GB It’s the other way around. LTO creates smaller binaries and those optimized builds cause the crash while disabling LTO (build argument lto=none) creates an not crashing version.

Tried with the Oculus OpenXR and it also crashes, this time it gives me an error log though.

OpenXR: Running on OpenXR runtime:  Oculus   1.75.0
Godot Engine v4.0.alpha15.official.432b25d36 - https://godotengine.org
OpenXR: XrGraphicsRequirementsVulkan2KHR:
 - minApiVersionSupported:  1.0.0
 - maxApiVersionSupported:  1.0.0
OpenXR: Requested Vulkan version exceeds the maximum version this runtime has been tested on and is known to support.
- desired_version  1.2.0
- minApiVersionSupported  1.0.0
- maxApiVersionSupported  1.0.0
Vulkan API 1.2.0 - Using Vulkan Device #0: AMD - Radeon RX 580 Series
 
OpenXR: failed to create action  default_pose ! [ XR_ERROR_PATH_UNSUPPORTED ]
OpenXR: failed to create action  haptic ! [ XR_ERROR_PATH_UNSUPPORTED ]
OpenXR: failed to suggest bindings for  /interaction_profiles/htc/vive_tracker_htcx ! [ XR_ERROR_VALIDATION_FAILURE ]
OpenXR: Found supported reference space  XR_REFERENCE_SPACE_TYPE_VIEW
OpenXR: Found supported reference space  XR_REFERENCE_SPACE_TYPE_LOCAL
OpenXR: Found supported reference space  XR_REFERENCE_SPACE_TYPE_STAGE
OpenXR: Found supported swapchain format  VK_FORMAT_R8G8B8A8_UNORM
OpenXR: Found supported swapchain format  VK_FORMAT_R8G8B8A8_SRGB
OpenXR: Found supported swapchain format  VK_FORMAT_B8G8R8A8_UNORM
OpenXR: Found supported swapchain format  VK_FORMAT_B8G8R8A8_SRGB
OpenXR: Found supported swapchain format  VK_FORMAT_R16G16B16A16_SFLOAT
OpenXR: Found supported swapchain format  VK_FORMAT_B10G11R11_UFLOAT_PACK32
OpenXR: Found supported swapchain format  VK_FORMAT_D16_UNORM
OpenXR: Found supported swapchain format  VK_FORMAT_D32_SFLOAT
OpenXR: Found supported swapchain format  VK_FORMAT_D24_UNORM_S8_UINT
OpenXR: Found supported swapchain format  VK_FORMAT_D32_SFLOAT_S8_UINT
OpenXR: Found supported swapchain format  VK_FORMAT_BC1_RGBA_UNORM_BLOCK
OpenXR: Found supported swapchain format  VK_FORMAT_BC1_RGBA_SRGB_BLOCK
OpenXR: Found supported swapchain format  VK_FORMAT_BC2_UNORM_BLOCK
OpenXR: Found supported swapchain format  VK_FORMAT_BC2_SRGB_BLOCK
OpenXR: Found supported swapchain format  VK_FORMAT_BC3_UNORM_BLOCK
OpenXR: Found supported swapchain format  VK_FORMAT_BC3_SRGB_BLOCK
OpenXR: Found supported swapchain format  VK_FORMAT_BC6H_UFLOAT_BLOCK
OpenXR: Found supported swapchain format  VK_FORMAT_BC6H_SFLOAT_BLOCK
OpenXR: Found supported swapchain format  VK_FORMAT_BC7_UNORM_BLOCK
OpenXR: Found supported swapchain format  VK_FORMAT_BC7_SRGB_BLOCK
OpenXR initialised successfully
Using swap chain format: VK_FORMAT_R8G8B8A8_SRGB
OpenXR: Failed to get interaction profile for 54597624266928 [ XR_ERROR_PATH_UNSUPPORTED ]
OpenXR: Failed to get interaction profile for 54597624266929 [ XR_ERROR_PATH_UNSUPPORTED ]
OpenXR: Failed to get interaction profile for 54597624266930 [ XR_ERROR_PATH_UNSUPPORTED ]
OpenXR: Failed to get interaction profile for 54597624266931 [ XR_ERROR_PATH_UNSUPPORTED ]
OpenXR: Failed to get interaction profile for 54597624266932 [ XR_ERROR_PATH_UNSUPPORTED ]
OpenXR: Failed to get interaction profile for 54597624266933 [ XR_ERROR_PATH_UNSUPPORTED ]
OpenXR: Failed to get interaction profile for 54597624266934 [ XR_ERROR_PATH_UNSUPPORTED ]
OpenXR: Failed to get interaction profile for 54597624266935 [ XR_ERROR_PATH_UNSUPPORTED ]
OpenXR: Failed to get interaction profile for 54597624266936 [ XR_ERROR_PATH_UNSUPPORTED ]
OpenXR: Failed to get interaction profile for 54597624266937 [ XR_ERROR_PATH_UNSUPPORTED ]
OpenXR: Failed to get interaction profile for 54597624266938 [ XR_ERROR_PATH_UNSUPPORTED ]
OpenXR: Failed to get interaction profile for 54597624266939 [ XR_ERROR_PATH_UNSUPPORTED ]
--- Debugging process stopped ---

@Cyberrebell I’m using the Quest 2 via Link cable with SteamVR. I actually get no debug output and it immediately closes, I only got information through compiling and attaching a debugger.

Crash happens within rendering_device_vulkan.cpp

Trying alpha 5, issue still persists, no output info and immediately closes. I do have OBS installed and I’m getting the same debug info.

LAYER | DEBUG: Loading layer library C:\ProgramData\obs-studio-hook\.\graphics-hook64.dll
LAYER | INFO: Inserted device layer VK_LAYER_OBS_HOOK (C:\ProgramData\obs-studio-hook\.\graphics-hook64.dll)
LAYER | DEBUG: Loading layer library C:\WINDOWS\System32\DriverStore\FileRepository\u0379219.inf_amd64_3649648678001de4\B378972\.\amdvlk64.dll
LAYER | INFO: Failed to find vkGetDeviceProcAddr in layer C:\WINDOWS\System32\DriverStore\FileRepository\u0379219.inf_amd64_3649648678001de4\B378972\.\amdvlk64.dll
LAYER: vkCreateDevice layer callstack setup to:
LAYER:    <Application>
LAYER:      ||
LAYER:    <Loader>
LAYER:      ||
LAYER:    VK_LAYER_OBS_HOOK
LAYER:            Type: Implicit
LAYER:                Disable Env Var:  DISABLE_VULKAN_OBS_CAPTURE
LAYER:            Manifset: C:\ProgramData\obs-studio-hook\obs-vulkan64.json
LAYER:            Library:  C:\ProgramData\obs-studio-hook\.\graphics-hook64.dll
LAYER:      ||
LAYER:    <Device>

I’ll quickly uninstall OBS right now just to rule it out.

Edit: Still crashes even without OBS but now the error is different.

LAYER | DEBUG: Loading layer library C:\WINDOWS\System32\DriverStore\FileRepository\u0379219.inf_amd64_3649648678001de4\B378972\.\amdvlk64.dll
LAYER | INFO: Failed to find vkGetDeviceProcAddr in layer C:\WINDOWS\System32\DriverStore\FileRepository\u0379219.inf_amd64_3649648678001de4\B378972\.\amdvlk64.dll
LAYER: vkCreateDevice layer callstack setup to:
LAYER:    <Application>
LAYER:      ||
LAYER:    <Loader>
LAYER:      ||
LAYER:    <Device>