Download

4.27.1 Editor crash on start with SteamVR

Hi Everyone,
Cannot start UE4Editor or my project Editor when running SteamVR. It just crashes when loading. Appreciate any suggestions. (Other then run with opengl :slight_smile: )

  • Ubuntu 20.04.2 - Linux 5.11.0-40-generic
  • NVIDIA Titan RTX - 495.44 / CUDA 11.5 / Vulkan 1.2.131
  • Engine Version: 4.27.1

Related:

— Error Log —

Fatal error: [File:/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/VulkanRHI/Private/VulkanUtil.cpp] [Line: 958] Result failed, VkResult=-7 at /home/me/develop/github/UnrealEngine/Engine/Source/Runtime/VulkanRHI/Private/VulkanDevice.cpp:404 with error VK_ERROR_EXTENSION_NOT_PRESENT 0x00007f4d9c2afbcf libUE4Editor-VulkanRHI.so!VulkanRHI::VerifyVulkanResult(VkResult, char const*, char const*, unsigned int) [/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/VulkanRHI/Private/VulkanUtil.cpp:957] 0x00007f4d9c220254 libUE4Editor-VulkanRHI.so!FVulkanDevice::CreateDevice() [/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/VulkanRHI/Private/VulkanDevice.cpp:404] 0x00007f4d9c226d6f libUE4Editor-VulkanRHI.so!FVulkanDevice::InitGPU(int) [/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/VulkanRHI/Private/VulkanDevice.cpp:1112] 0x00007f4d9c2b0457 libUE4Editor-VulkanRHI.so!FVulkanDynamicRHI::SelectAndInitDevice() [/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/VulkanRHI/Private/VulkanRHI.cpp:660] 0x00007f4d9c2ac223 libUE4Editor-VulkanRHI.so!FVulkanDynamicRHI::InitInstance() [/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/VulkanRHI/Private/VulkanRHI.cpp:702] 0x00007f4d9c2abda8 libUE4Editor-VulkanRHI.so!FVulkanDynamicRHI::Init() [/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/VulkanRHI/Private/VulkanRHI.cpp:248] 0x00007f4e0fcf11e0 libUE4Editor-RHI.so!RHIInit(bool) [/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/RHI/Private/DynamicRHI.cpp:226] 0x0000000000280e20 UE4Editor!FEngineLoop::PreInitPreStartupScreen(char16_t const*) [/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/Launch/Private/LaunchEngineLoop.cpp:2599] 0x00000000002779bc UE4Editor!GuardedMain(char16_t const*) [/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/Launch/Private/Launch.cpp:132] 0x00007f4e0c9ff056 libUE4Editor-UnixCommonStartup.so!CommonUnixMain(int, char**, int (*)(char16_t const*), void (*)()) [/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/Unix/UnixCommonStartup/Private/UnixCommonStartup.cpp:264] 0x00007f4e0c6d40b3 libc.so.6!__libc_start_main(+0xf2) 0x0000000000261209 UE4Editor!_start()
libUE4Editor-Core.so!FGenericPlatformMisc::RaiseException(unsigned int) [/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/Core/Private/GenericPlatform/GenericPlatformMisc.cpp:472]
libUE4Editor-Core.so!FOutputDevice::LogfImpl(char16_t const*, ...) [/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/Core/Private/Misc/OutputDevice.cpp:61]
libUE4Editor-VulkanRHI.so!VulkanRHI::VerifyVulkanResult(VkResult, char const*, char const*, unsigned int) [/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/VulkanRHI/Private/VulkanUtil.cpp:957]
libUE4Editor-VulkanRHI.so!FVulkanDevice::CreateDevice() [/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/VulkanRHI/Private/VulkanDevice.cpp:404]
libUE4Editor-VulkanRHI.so!FVulkanDevice::InitGPU(int) [/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/VulkanRHI/Private/VulkanDevice.cpp:1112]
libUE4Editor-VulkanRHI.so!FVulkanDynamicRHI::SelectAndInitDevice() [/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/VulkanRHI/Private/VulkanRHI.cpp:660]
libUE4Editor-VulkanRHI.so!FVulkanDynamicRHI::InitInstance() [/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/VulkanRHI/Private/VulkanRHI.cpp:702]
libUE4Editor-VulkanRHI.so!FVulkanDynamicRHI::Init() [/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/VulkanRHI/Private/VulkanRHI.cpp:248]
libUE4Editor-RHI.so!RHIInit(bool) [/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/RHI/Private/DynamicRHI.cpp:226]
UE4Editor!FEngineLoop::PreInitPreStartupScreen(char16_t const*) [/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/Launch/Private/LaunchEngineLoop.cpp:2599]
UE4Editor!GuardedMain(char16_t const*) [/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/Launch/Private/Launch.cpp:132]
libUE4Editor-UnixCommonStartup.so!CommonUnixMain(int, char**, int (*)(char16_t const*), void (*)()) [/home/me/develop/github/UnrealEngine/Engine/Source/Runtime/Unix/UnixCommonStartup/Private/UnixCommonStartup.cpp:264]
libc.so.6!__libc_start_main(+0xf2)
UE4Editor!_start()

Update - Possible issue isolation.

I was able to create a stand-alone vulkan pipeline using SDL and hack in a lot of the VulkanRHI methods used in CreateDevice. It runs with SteamVR with no issue. … Kind of a waste of time, but was helpful to understand surface level UE4 Vulkan wrappers for setting up the graphics pipeline.

After instrumenting ngine/Source/Runtime/VulkanRHI/Private/VulkanDevice.cpp and recompiling, I can see there is an issue with the Extension Names UE4 is trying to activate.

I added the following to VulkanDevice.cpp here

https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Source/Runtime/VulkanRHI/Private/VulkanDevice.cpp#L396

UE_LOG(LogVulkanRHI, Display, TEXT("Using device layers"));
	for (const ANSICHAR* Layer : ValidationLayers)
	{
		UE_LOG(LogVulkanRHI, Display, TEXT("* %s"), ANSI_TO_TCHAR(Layer));
	}

	UE_LOG(LogVulkanRHI, Display, TEXT("Using device extensions"));
	for (const ANSICHAR* Extension : DeviceExtensions)
	{
		UE_LOG(LogVulkanRHI, Display, TEXT("* %s"), ANSI_TO_TCHAR(Extension));
	}

and got this output before the crash

[2021.12.01-18.16.00:036][ 0]LogVulkanRHI: Display: Using device layers
[2021.12.01-18.16.00:036][ 0]LogVulkanRHI: Display: Using device extensions
[2021.12.01-18.16.00:036][ 0]LogVulkanRHI: Display: * ???T?
[2021.12.01-18.16.00:036][ 0]LogVulkanRHI: Display: *
[2021.12.01-18.16.00:036][ 0]LogVulkanRHI: Display: * ?fU?
[2021.12.01-18.16.00:036][ 0]LogVulkanRHI: Display: *
[2021.12.01-18.16.00:036][ 0]LogVulkanRHI: Display: *
[2021.12.01-18.16.00:036][ 0]LogVulkanRHI: Display: *
[2021.12.01-18.16.00:036][ 0]LogVulkanRHI: Display: * VK_KHR_driver_properties
[2021.12.01-18.16.00:036][ 0]LogVulkanRHI: Display: * VK_KHR_shader_atomic_int64
[2021.12.01-18.16.00:036][ 0]LogVulkanRHI: Display: * VK_KHR_image_format_list
[2021.12.01-18.16.00:036][ 0]LogVulkanRHI: Display: * VK_KHR_swapchain
[2021.12.01-18.16.00:036][ 0]LogVulkanRHI: Display: * VK_KHR_maintenance1
[2021.12.01-18.16.00:036][ 0]LogVulkanRHI: Display: * VK_KHR_maintenance2
[2021.12.01-18.16.00:036][ 0]LogVulkanRHI: Display: * VK_EXT_memory_budget
[2021.12.01-18.16.00:036][ 0]LogVulkanRHI: Display: * VK_EXT_scalar_block_layout
[2021.12.01-18.16.00:036][ 0]LogVulkanRHI: Error: Result failed, VkResult=-7

Some progress, i can launch Editor with SteamVR w/ hack to VulkanDevice. But when i launch VR Preview in Editor, UE4 crashes. (Default VR Project, no mods). Crash log excerpt below.

I modified Engine/Source/Runtime/VulkanRHI::VulkanDevice to use the following specific VK Extensions instead of what is automatically determined.

  • VK_KHR_driver_properties
  • VK_KHR_shader_atomic_int64
  • VK_KHR_image_format_list
  • VK_KHR_swapchain
  • VK_KHR_maintenance1
  • VK_KHR_maintenance2
  • VK_EXT_memory_budget
  • VK_EXT_scalar_block_layout
  • VK_KHR_get_memory_requirements2
  • VK_KHR_dedicated_allocation

[2021.12.01-19.39.55:518][421]LogRenderer: Reallocating scene render targets to support 4936x2740 Format 10 NumSamples 4 (Frame:1).
Signal 11 caught.
Malloc Size=65538 LargeMemoryPoolOffset=65554
CommonUnixCrashHandler: Signal=11
[2021.12.01-19.39.55:600][421]LogCore: === Critical error: ===
Unhandled Exception: SIGSEGV: invalid attempt to read memory at address 0x0000000000000000

[2021.12.01-19.39.55:600][421]LogCore: Fatal error!

0x00007f3266343a02 libUE4Editor-Core.so!FUnixPlatformStackWalk::CaptureStackBackTrace(unsigned long long*, unsigned int, void*) [/home/wurrego/develop/github/UnrealEngine/Engine/Source/Runtime/Core/Private/Unix/UnixPlatformStackWalk.cpp:693]
0x00007f3265e035e1 libUE4Editor-Core.so!FGenericPlatformStackWalk::StackWalkAndDump(char*, unsigned long, int, void*) [/home/wurrego/develop/github/UnrealEngine/Engine/Source/Runtime/Core/Private/GenericPlatform/GenericPlatformStackWalk.cpp:191]
0x00007f326633dca5 libUE4Editor-Core.so!FUnixCrashContext::CaptureStackTrace() [/home/wurrego/develop/github/UnrealEngine/Engine/Source/Runtime/Core/Private/Unix/UnixPlatformCrashContext.cpp:291]
0x00007f325d07a678 libUE4Editor-UnixCommonStartup.so!CommonUnixCrashHandler(FGenericCrashContext const&) [/home/wurrego/develop/github/UnrealEngine/Engine/Source/Runtime/Unix/UnixCommonStartup/Private/UnixCommonStartup.cpp:35]
0x00007f326634374a libUE4Editor-Core.so!PlatformCrashHandler(int, siginfo_t*, void*) [/home/wurrego/develop/github/UnrealEngine/Engine/Source/Runtime/Core/Private/Unix/UnixPlatformCrashContext.cpp:853]
0x00007f32668163c0 libpthread.so.0!UnknownFunction(0x153bf)

I have a working solution and i got VR Preview working in the editor finally.

I discovered Valved Index HMD requires the following VK Extensions:

  • VK_KHR_external_semaphore
  • VK_KHR_dedicated_allocation
  • VK_KHR_get_memory_requirements2
  • VK_KHR_external_memory_fd
  • VK_KHR_external_semaphore_fd

So as an interim solution for my target environment and project I add the following VK Extensions in all:

  • VK_KHR_driver_properties
  • VK_KHR_shader_atomic_int64
  • VK_KHR_image_format_list
  • VK_KHR_swapchain
  • VK_KHR_maintenance1
  • VK_KHR_maintenance2
  • VK_EXT_memory_budget
  • VK_EXT_scalar_block_layout
  • VK_KHR_get_memory_requirements2
  • VK_KHR_dedicated_allocation
  • VK_KHR_external_memory_capabilities
  • VK_KHR_get_physical_device_properties2
  • VK_KHR_external_semaphore_capabilities
  • VK_KHR_surface
  • VK_KHR_xlib_surface
  • VK_KHR_multiview
  • VK_NV_device_diagnostics_config
  • VK_NV_device_diagnostic_checkpoints
  • VK_KHR_external_semaphore
  • VK_KHR_external_memory_fd
  • VK_KHR_external_semaphore_fd
  • VK_KHR_external_memory

Final update.

  • To get SteamVR motion controllers working you must also whitelist Linux as a platform in the SteamVR Plugin for SteamVRInput and SteamVRInputDevice

https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Plugins/Runtime/Steam/SteamVR/SteamVR.uplugin#L37

Here is a cleaner list of VK Extensions required by SteamVR and Valve Index HMD for Linux.

  • VK_KHR_get_physical_device_properties2

  • VK_KHR_surface

  • VK_KHR_xcb_surface

  • VK_KHR_display

  • VK_EXT_direct_mode_display

  • VK_EXT_acquire_xlib_display

  • VK_EXT_display_surface_counter

  • VK_KHR_external_memory_capabilities

  • VK_KHR_external_semaphore_capabilities

  • VK_KHR_get_physical_device_properties2

  • VK_KHR_swapchain

  • VK_KHR_maintenance1

  • VK_KHR_dedicated_allocation

  • VK_KHR_get_memory_requirements2

  • VK_KHR_external_memory

  • VK_KHR_external_semaphore

  • VK_EXT_display_control

  • VK_KHR_external_memory_fd

  • VK_KHR_external_semaphore_fd

  • VK_EXT_global_priority

Final Final update.

I went back to clean up my VulkanRHI hack, and further isolate the issue.

The issue is in theSteamVR Plugin and correctly limiting the Linux Vulkan Extensions Required.

If you comment out this line, the error will go away.
https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Plugins/Runtime/Steam/SteamVR/Source/SteamVR/Private/SteamVRHMD.cpp#L567

However VR will not work, unless you add in the required a minimal set of required vulkan extensions.

To do so.

  • add #include “VulkanRHIPrivate.h” to SteamVRHMD.cpp

  • replace all the logic to get the required extensions from VRCompositor with something like this in a #if PLATFORM_LINUX block

const TArray<const ANSICHAR*> ExtentionsToAdd{ 
		//VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, 
		//VK_KHR_SURFACE_EXTENSION_NAME,
		//VK_KHR_XCB_SURFACE_EXTENSION_NAME,
		//VK_KHR_XLIB_SURFACE_EXTENSION_NAME,
		//VK_KHR_DISPLAY_EXTENSION_NAME,
		//VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME,
		//VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME,
		//VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME,
		//VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME,
		//VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME,
		VK_KHR_SWAPCHAIN_EXTENSION_NAME,
		VK_KHR_MAINTENANCE1_EXTENSION_NAME,
		VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME,
		VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME,
		VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME,
		VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME,
		VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME,
		VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME,
		VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME,
		VK_EXT_GLOBAL_PRIORITY_EXTENSION_NAME
 	};

	for (const ANSICHAR* Extension : ExtentionsToAdd)
	{
		Out.Add(Extension);
	}


	return true;
1 Like

Any hint where this extensions should be added. I added them in SteamVRHMD.cpp function
bool FSteamVRHMD::FVulkanExtensions::GetVulkanDeviceExtensionsRequired(VkPhysicalDevice_T pPhysicalDevice, TArray<const ANSICHAR>& Out)

Startimg from line 570 after
while(Tok … Block. This looks obvious place and there extensions are appnded to end of list but it did not work.

I have Ubuntu 20.04, rtx3080ti, and Vive pro 2, nvidia470.86 drivers.

Attached is my version of SteamVRHMD.cpp, please feel free to use or reference.

Note there are some other modifications i made to this file to prevent SteamVR from initializing during engine start when -nohmd is passed through on the command line.

SteamVRHMD.cpp (61.0 KB)