felixdoerre / primus_vk

Vulkan GPU-offloading layer
BSD 2-Clause "Simplified" License
230 stars 17 forks source link

The Talos Principle segfaults on vkGetPhysicalDeviceProperties #51

Closed MateusRodCosta closed 1 year ago

MateusRodCosta commented 5 years ago

I installed primus_vk 1.1-1 and lib32-primus_vk 1.1-1 from the Arch Linux repos.

Then, I deleted /usr/share/vulkan/icd.d/nvidia_icd.json and replaced with a symlink to the nv_vulkan_wrapper.json in the same folder.

After that I was able to run pvkrun vkcubewith no issues with it managing to detect my Nvidia MX150.

However, primus_vk fails when running The Talos Principle via Steam. I set pvkrun %command% as the launch command and when I run it, I get a black screen for a second (most likely the game starting) and then the following coredump in my journal:

ago 01 19:21:22 delart systemd-coredump[10464]: Process 10411 (Talos) of user 1000 dumped core.

                                                Stack trace of thread 10411:
                                                #0  0x00007f941c46dab0 vkGetPhysicalDeviceProperties (libvulkan.so.1)
                                                #1  0x00000000025f315a n/a (/home/mateusrc/Games/Steam/steamapps/common/The Talos Principle/Bin/x64/Talos)
                                                #2  0x00007ffdf14c94c0 n/a (n/a)
felixdoerre commented 5 years ago

So now you have:

/usr/share/vulkan/icd.d/nvidia_icd_wrapped.json
/usr/share/vulkan/icd.d/nvidia_icd.json -> nvidia_icd_wrapped.json

?

That's not good! Vulkan loads the drivers from /usr/share/vulkan/icd.d independently of their name, so now it loads the (wrapped) nvidia-driver twice. Could you please remove the symlink nvidia_icd.json, so that there is only one instance of the wrapped driver available? Does that solve the problem?

If that does not help: What is your libvulkan version? On my system (debian unstable, libvulkan 1.1.101.0-2, primus_vk 1.1 freshly compiled from source) the talos principle works flawlessly.

felixdoerre commented 5 years ago

Hi @MateusRodCosta Did the suggestions solve the problem? Did you try them out?

MateusRodCosta commented 5 years ago

Ah, sorry for that, I recently migrated from an HDD to a SSD and had to delete all my Steam games. I think I can download it right now and retry in a few hours.

MateusRodCosta commented 5 years ago

I installed the game and tried again. This time without the symlink.

Still the same issue.

For reference here is my icd.d folder:

$ ls -al /usr/share/vulkan/icd.d/
total 20
drwxr-xr-x 2 root root 4096 ago 10 19:03 .
drwxr-xr-x 6 root root 4096 ago  9 21:28 ..
-rw-r--r-- 1 root root  148 ago  7 14:45 intel_icd.i686.json
-rw-r--r-- 1 root root  146 ago  7 14:38 intel_icd.x86_64.json
-rw-r--r-- 1 root root  144 jul 22 10:02 nv_vulkan_wrapper.json

Runing Talos Principle with pvkrun %command% on the launch options still fails with this error:

ago 19 17:54:41 delart systemd-coredump[5864]: Process 5810 (Talos) of user 1000 dumped core.

                                               Stack trace of thread 5810:
                                               #0  0x00007f2bda992c90 vkGetPhysicalDeviceProperties (libvulkan.so.1)
                                               #1  0x00000000025f315a n/a (/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos)
                                               #2  0x00007fff2bc85360 n/a (n/a)
felixdoerre commented 5 years ago

Well that's strange. Can you install debug symbols for libvulkan and find out the exact version? Additionally it would be great to get the parameters that the game passes to vkGetPhysicalDeviceProperties. You'd need a gdb for that.

Another thing you could try: Does ENABLE_PRIMUS_LAYER=1 optirun vulkaninfo work?

MateusRodCosta commented 5 years ago

I recompiled the vulkan-icd-loader package with debug symbols and tried to run Talos again.

I got this in the backtrace:

Reading symbols from /home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos...
(No debugging symbols found in /home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos)
[New LWP 9689]
[New LWP 9722]
[New LWP 9727]
[New LWP 9724]
[New LWP 9725]
[New LWP 9723]
[New LWP 9726]
[New LWP 9728]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  vkGetPhysicalDeviceProperties (physicalDevice=0x1500000001, pProperties=0x7f5be58b5770) at /usr/src/debug/Vulkan-Loader-1.1.119/loader/trampoline.c:733
733 /usr/src/debug/Vulkan-Loader-1.1.119/loader/trampoline.c: No such file or directory.
[Current thread is 1 (Thread 0x7f5bebfc0340 (LWP 9689))]
(gdb) bt
#0  vkGetPhysicalDeviceProperties (physicalDevice=0x1500000001, pProperties=0x7f5be58b5770) at /usr/src/debug/Vulkan-Loader-1.1.119/loader/trampoline.c:733
#1  0x00000000025f315a in ?? ()
#2  0x00000000025f8909 in ?? ()
#3  0x0000000001e0bc53 in ?? ()
#4  0x0000000000eb441b in ?? ()
#5  0x0000000000eb7363 in ?? ()
#6  0x0000000000eb80da in ?? ()
#7  0x0000000001ca274a in ?? ()
#8  0x00000000022da5ee in ?? ()
#9  0x00000000022da930 in ?? ()
#10 0x00007f5bed484ee3 in __libc_start_main () from /usr/lib/libc.so.6
#11 0x0000000000e9ce57 in ?? ()
(gdb) 

I'm not sure what you mean by "find out the exact version", I compiled 1.1.119 version of the icd loader

And here is the result of vulkan info: vulkan_info.txt

felixdoerre commented 5 years ago

Ok. So vkGetPhysicalDeviceProperties works in principle (vulkaninfo can call it successfully), but somehow the game obtains an invalid VkPhysicalDevice of value 0x1500000001, which the loader tries to dereference and thereby segfaults. Do you run The Talos Principle from Steam? Or directly? Because this could be strange interactions with the two layers provided by Steam (overlay and fossilize).

Interestingly, I just tried to run The Talos Principle got a segfault at a different location (maybe because of a steam update?). However the game runs successfully, if I disable the steam overlay: DISABLE_VK_LAYER_VALVE_steam_overlay_1=1 ENABLE_PRIMUS_LAYER=1 optirun path/to/steamapps/common/The\ Talos\ Principle/Bin/x64/Talos Does the game work without steam overlay on your system, too?

MateusRodCosta commented 5 years ago

Do you run The Talos Principle from Steam? Or directly? Because this could be strange interactions with the two layers provided by Steam (overlay and fossilize).

From Steam

Interestingly, I just tried to run The Talos Principle got a segfault at a different location (maybe because of a steam update?). However the game runs successfully, if I disable the steam overlay: DISABLE_VK_LAYER_VALVE_steam_overlay_1=1 ENABLE_PRIMUS_LAYER=1 optirun path/to/steamapps/common/The\ Talos\ Principle/Bin/x64/Talos Does the game work without steam overlay on your system, too?

No, it doesn't:

[mateusrc@delart ~]$ DISABLE_VK_LAYER_VALVE_steam_overlay_1=1 ENABLE_PRIMUS_LAYER=1 optirun ~/Games/SteamLibrary/steamapps/common/The\ Talos\ Principle/Bin/x64/Talos
INF:  CPU Power saving is enabled and performance governor is not used.
Setting breakpad minidump AppID = 257510
Steam_SetMinidumpSteamID:  Caching Steam ID:  76561198067341561 [API loaded no]
INF:  Encoded user ID = 63f8e274:1d0bc334
INF:  Executing user startup config from UserCfg.lua
libpng warning: iCCP: known incorrect sRGB profile
INF:  
INF:  * Desktop settings...
INF:  Color depth: 32-bit
INF:  Desktop resolution: 1920 x 1080
PrimusVK: Getting devices
PrimusVK: Searching for display GPU:
PrimusVK: 0x717a370: 
PrimusVK: Got integrated gpu!
PrimusVK: Device: Intel(R) UHD Graphics 620 (Kabylake GT2)
PrimusVK:   Type: 1
PrimusVK: Searching for render GPU:
PrimusVK: 0x717a370.
PrimusVK: 0x71f76b0.
PrimusVK: Got discrete gpu!
PrimusVK: Device: GeForce MX150
PrimusVK:   Type: 2
INF:  [Vulkan] Detected devices:
INF:  Crash! (Segmentation fault)
DBG:  
DBG:  //=====================================================
DBG:  Report generated at: unsupported unsupported
DBG:  Version: $Version: SE2017_PC_dev; Talos_Executables-Linux-Final; 440323 2019-06-07 00:02:59 @builderl02; Linux-x64-Static-Final-Default$
DBG:  Build type: Linux-x64-Static-Final-Default
DBG:  Dump type: Crash
DBG:  
DBG:  Received signal 11 (Segmentation fault).
DBG:  
DBG:  Dumping registers:
DBG:  RAX:00007F48B71BF0C0
DBG:  RBX:00000000FFFFFFFF
DBG:  RCX:000000000000B531
DBG:  RDX:0000000000000000
DBG:  RSP:00007FFED3B53838
DBG:  RBP:00007FFED3B53C60
DBG:  
DBG:  RSI:00007F48C03AC000
DBG:  RDI:0000001500000001
DBG:  R08:0000001500000001
DBG:  R09:0000000000000000
DBG:  R10:0000000000000008
DBG:  R11:0000000000000000
DBG:  R12:00007F48B72FC010
DBG:  R13:0000000000000000
DBG:  
DBG:  R14:00007F48C03ABFE0
DBG:  R15:00007F48C03AC014
DBG:  
DBG:  
DBG:  RIP:00007F48B71BF0C0
DBG:  Flags:00000007
DBG:  
DBG:  Dumping stack back trace:
DBG:  00007F48B71BF0C0 00000001 $adr: "/usr/lib/libvulkan.so.1" 0001:00000000000300C0
DBG:  00007F48B71BF0C0 00000001 $adr: "/usr/lib/libvulkan.so.1" 0001:00000000000300C0
DBG:  00000000025F315A 00000001 $adr: "/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos" 0001:00000000021F315A
DBG:  00000000025F8909 00000001 $adr: "/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos" 0001:00000000021F8909
DBG:  0000000001E0BC53 00000001 $adr: "/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos" 0001:0000000001A0BC53
DBG:  0000000000EB441B 00000001 $adr: "/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos" 0001:0000000000AB441B
DBG:  0000000000EB7363 00000001 $adr: "/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos" 0001:0000000000AB7363
DBG:  0000000000EB80DA 00000001 $adr: "/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos" 0001:0000000000AB80DA
DBG:  0000000001CA274A 00000001 $adr: "/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos" 0001:00000000018A274A
DBG:  00000000022DA5EE 00000001 $adr: "/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos" 0001:0000000001EDA5EE
DBG:  00000000022DA930 00000001 $adr: "/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos" 0001:0000000001EDA930
DBG:  00007F48C6AA5EE3 00000001 $adr: "/usr/lib/libc.so.6" 0001:0000000000026EE3
DBG:  0000000000E9CE57 00000001 $adr: "/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos" 0001:0000000000A9CE57
DBG:  00007F48C6AA5EE3 00000001 $adr: "/usr/lib/libc.so.6" 0001:0000000000026EE3
DBG:  
DBG:  //=====================================================
DBG:  
DBG:  
[mateusrc@delart ~]$ 
felixdoerre commented 5 years ago

Ok, so it's not the steam overlay. So next it would be really interesting, if the Application really gets this malformed VkPhysicalDevice of 0x1500000001 from Vulkan. Could you run the application with this modified version: https://github.com/felixdoerre/primus_vk/tree/print_returned_physical_devices so we can see what physical devices primus_vk returns and if 0x1500000001 is indeed among them?

Additionally, I see that you have the vulkan validation layers installed. So it could be helpful to enable them and see if they report any wrong API use by the game: VK_INSTANCE_LAYERS=VK_LAYER_PRIMUS_PrimusVK:VK_LAYER_LUNARG_standard_validation optirun ~/Games/SteamLibrary/steamapps/common/The\ Talos\ Principle/Bin/x64/Talos

MateusRodCosta commented 5 years ago

Ok, so it's not the steam overlay. So next it would be really interesting, if the Application really gets this malformed VkPhysicalDevice of 0x1500000001 from Vulkan. Could you run the application with this modified version: https://github.com/felixdoerre/primus_vk/tree/print_returned_physical_devices so we can see what physical devices primus_vk returns and if 0x1500000001 is indeed among them?

[mateusrc@delart ~]$ DISABLE_VK_LAYER_VALVE_steam_overlay_1=1 ENABLE_PRIMUS_LAYER=1 optirun ~/Games/SteamLibrary/steamapps/common/The\ Talos\ Principle/Bin/x64/Talos
INF:  CPU Power saving is enabled and performance governor is not used.
Setting breakpad minidump AppID = 257510
Steam_SetMinidumpSteamID:  Caching Steam ID:  76561198067341561 [API loaded no]
INF:  Encoded user ID = 63f8e274:1d0bc334
INF:  Executing user startup config from UserCfg.lua
libpng warning: iCCP: known incorrect sRGB profile
INF:  
INF:  * Desktop settings...
INF:  Color depth: 32-bit
INF:  Desktop resolution: 1920 x 1080
PrimusVK: Getting devices
PrimusVK: Searching for display GPU:
PrimusVK: 0x61ba5e0: 
PrimusVK: Got integrated gpu!
PrimusVK: Device: Intel(R) UHD Graphics 620 (Kabylake GT2)
PrimusVK:   Type: 1
PrimusVK: Searching for render GPU:
PrimusVK: 0x61ba5e0.
PrimusVK: 0x6237920.
PrimusVK: Got discrete gpu!
PrimusVK: Device: GeForce MX150
PrimusVK:   Type: 2
PrimusVK: Application gets device: 0x6237920
PrimusVK: Application gets device: 0x6237920
INF:  [Vulkan] Detected devices:
INF:  Crash! (Segmentation fault)
DBG:  
DBG:  //=====================================================
DBG:  Report generated at: unsupported unsupported
DBG:  Version: $Version: SE2017_PC_dev; Talos_Executables-Linux-Final; 440323 2019-06-07 00:02:59 @builderl02; Linux-x64-Static-Final-Default$
DBG:  Build type: Linux-x64-Static-Final-Default
DBG:  Dump type: Crash
DBG:  
DBG:  Received signal 11 (Segmentation fault).
DBG:  
DBG:  Dumping registers:
DBG:  RAX:00007FEF745850C0
DBG:  RBX:00000000FFFFFFFF
DBG:  RCX:000000000000AA61
DBG:  RDX:0000000000000000
DBG:  RSP:00007FFEECF9DF88
DBG:  RBP:00007FFEECF9E3B0
DBG:  
DBG:  RSI:00007FEF766A9BD0
DBG:  RDI:0000001500000001
DBG:  R08:0000001500000001
DBG:  R09:0000000000000000
DBG:  R10:0000000000000008
DBG:  R11:0000000000000000
DBG:  R12:00007FEF746C2010
DBG:  R13:0000000000000000
DBG:  
DBG:  R14:00007FEF766A9BB0
DBG:  R15:00007FEF766A9BE4
DBG:  
DBG:  
DBG:  RIP:00007FEF745850C0
DBG:  Flags:00000007
DBG:  
DBG:  Dumping stack back trace:
DBG:  00007FEF745850C0 00000001 $adr: "/usr/lib/libvulkan.so.1" 0001:00000000000300C0
DBG:  00007FEF745850C0 00000001 $adr: "/usr/lib/libvulkan.so.1" 0001:00000000000300C0
DBG:  00000000025F315A 00000001 $adr: "/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos" 0001:00000000021F315A
DBG:  00000000025F8909 00000001 $adr: "/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos" 0001:00000000021F8909
DBG:  0000000001E0BC53 00000001 $adr: "/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos" 0001:0000000001A0BC53
DBG:  0000000000EB441B 00000001 $adr: "/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos" 0001:0000000000AB441B
DBG:  0000000000EB7363 00000001 $adr: "/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos" 0001:0000000000AB7363
DBG:  0000000000EB80DA 00000001 $adr: "/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos" 0001:0000000000AB80DA
DBG:  0000000001CA274A 00000001 $adr: "/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos" 0001:00000000018A274A
DBG:  00000000022DA5EE 00000001 $adr: "/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos" 0001:0000000001EDA5EE
DBG:  00000000022DA930 00000001 $adr: "/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos" 0001:0000000001EDA930
DBG:  00007FEF7CDA2EE3 00000001 $adr: "/usr/lib/libc.so.6" 0001:0000000000026EE3
DBG:  0000000000E9CE57 00000001 $adr: "/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/Talos" 0001:0000000000A9CE57
DBG:  00007FEF7CDA2EE3 00000001 $adr: "/usr/lib/libc.so.6" 0001:0000000000026EE3
DBG:  
DBG:  //=====================================================
DBG:  
DBG:  
[mateusrc@delart ~]$ 

Additionally, I see that you have the vulkan validation layers installed. So it could be helpful to enable them and see if they report any wrong API use by the game: VK_INSTANCE_LAYERS=VK_LAYER_PRIMUS_PrimusVK:VK_LAYER_LUNARG_standard_validation optirun ~/Games/SteamLibrary/steamapps/common/The\ Talos\ Principle/Bin/x64/Talos

The first time I ran this I got a dialog saying something like "Your driver is supported and you might experience rendering problems" and asked me to accept, to which I said yes. I got a lot of console output but couldn't go back enough to copy it all.

I did reran it, this time sending output to a file. logs_validation_talos.txt

Both times I got a black screen but, after pressing Esc, heard the game noises, which might mean only rendering wasn't working.

felixdoerre commented 5 years ago

the output int "logs_validation_talos.txt" looks strange as the game seems to detect two devices to choose from (the intel an the nvidia device). PrimusVk should hide the intel device, so the application only sees the nvidia device. Was there output from PrimusVk that is just not redirected to the file? Otherwise I'd say that PrimusVK wasn't involved in that execution.

For the output from print_returned_physical_devices: the game pretty clearly only gets the render device, so I don't know where it get's the malformed PhysicalDevice from on which vkGetPhysicalDeviceProperties segfaults....

MateusRodCosta commented 5 years ago

Hi, I tried running Talos again and got errors this time as well.

Here are the logs I got: talos_logs2.txt

The output on the terminal:

[mateusrc@delart ~]$ VK_INSTANCE_LAYERS=VK_LAYER_PRIMUS_PrimusVK:VK_LAYER_LUNARG_standard_validation optirun ~/Games/SteamLibrary/steamapps/common/The\ Talos\ Principle/Bin/x64/Talos > ~/talos_logs2.txt
Setting breakpad minidump AppID = 257510
Steam_SetMinidumpSteamID:  Caching Steam ID:  76561198067341561 [API loaded no]
libpng warning: iCCP: known incorrect sRGB profile
Fossilize INFO: Overriding serialization path: "/home/mateusrc/Games/SteamLibrary/steamapps/shadercache/257510/fozpipelinesv4/steamapprun_pipeline_cache".

And the backtrace:

Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f191b52e4f2 in ?? () from /usr/lib/libnvidia-glcore.so.435.21
[Current thread is 1 (Thread 0x7f19275ef900 (LWP 15969))]
(gdb) bt
#0  0x00007f191b52e4f2 in ?? () from /usr/lib/libnvidia-glcore.so.435.21
#1  0x00007f191b553f87 in ?? () from /usr/lib/libnvidia-glcore.so.435.21
#2  0x00007f191366a16d in ?? () from /usr/lib/libVkLayer_khronos_validation.so
#3  0x000000000260a6db in ?? ()
#4  0x0000000000eb469f in ?? ()
#5  0x0000000000eb7363 in ?? ()
#6  0x0000000000eb80da in ?? ()
#7  0x0000000001ca274a in ?? ()
#8  0x00000000022da5ee in ?? ()
#9  0x00000000022da930 in ?? ()
#10 0x00007f19284b8ee3 in __libc_start_main () from /usr/lib/libc.so.6
#11 0x0000000000e9ce57 in ?? ()
(gdb) 

Do note that running Talos with ENABLE_PRIMUS_LAYER=1 optirun %command% via Steam has both resulted in this one time:

Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  vkGetPhysicalDeviceProperties (physicalDevice=0x1, pProperties=0x7f3d18f9db00) at /usr/src/debug/Vulkan-Loader-1.1.121/loader/trampoline.c:733
733 /usr/src/debug/Vulkan-Loader-1.1.121/loader/trampoline.c: No such file or directory.
[Current thread is 1 (Thread 0x7f3d1f6f22c0 (LWP 16263))]
(gdb) bt
#0  vkGetPhysicalDeviceProperties (physicalDevice=0x1, pProperties=0x7f3d18f9db00) at /usr/src/debug/Vulkan-Loader-1.1.121/loader/trampoline.c:733
#1  0x00000000025f315a in ?? ()
#2  0x00000000025f8909 in ?? ()
#3  0x0000000001e0bc53 in ?? ()
#4  0x0000000000eb441b in ?? ()
#5  0x0000000000eb7363 in ?? ()
#6  0x0000000000eb80da in ?? ()
#7  0x0000000001ca274a in ?? ()
#8  0x00000000022da5ee in ?? ()
#9  0x00000000022da930 in ?? ()
#10 0x00007f3d207bdee3 in __libc_start_main () from /usr/lib/libc.so.6
#11 0x0000000000e9ce57 in ?? ()
(gdb) 

and this on another try:

Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `/home/mateusrc/Games/SteamLibrary/steamapps/common/The Talos Principle/Bin/x64/'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f19f599cc90 in setupLoaderTermPhysDevGroups (inst=0x7f19fc038010) at /usr/src/debug/Vulkan-Loader-1.1.121/loader/loader.c:7479
7479    /usr/src/debug/Vulkan-Loader-1.1.121/loader/loader.c: No such file or directory.
[Current thread is 1 (Thread 0x7f1a053632c0 (LWP 13164))]
(gdb) bt
#0  0x00007f19f599cc90 in setupLoaderTermPhysDevGroups (inst=0x7f19fc038010) at /usr/src/debug/Vulkan-Loader-1.1.121/loader/loader.c:7479
#1  0x00007ffc86abddd0 in ?? ()
#2  0x00000000050f5620 in ?? ()
#3  0x00007ffc86abdca0 in ?? ()
#4  0x000000000500e2a8 in ?? ()
#5  0x0000000000000000 in ?? ()
(gdb) 
felixdoerre commented 5 years ago

In order to get a better understanding of this issue, I tried to reproduce it with The Talos principle, but I was unable to, the game runs flawlessly. What I did (roughly):

So my questions: does the segfault still happen? Could you also try a "clean" archlinux installation?

MateusRodCosta commented 5 years ago

The error happens even without pvkrun, as seen here: https://steamcommunity.com/app/257510/discussions/1/1607148447810987037/?tscn=1571312371

I have since migrated to the official Nvidia Prime Offrender on which the issue happens too.

Only migrating to the legacy version worked.

felixdoerre commented 5 years ago

Interesting, so we would need to search for a difference between your installation and the setup that is produced with my live-installation.

yNeo commented 4 years ago

This is issue is actually caused by a bug in Steam's Fossilize layer. Its vkGetInstanceProcAddr and vkGetDeviceProcAddr, when called on themselves like vkGetInstanceProcAddr(instance, "vkGetInstanceProcAddr") return wrong function pointers. https://github.com/ValveSoftware/Fossilize/issues/78

To workaround this issue, I suggest changing primus_vk.cpp:276 to dispatchTable.vkGetInstanceProcAddr = gpa;

and primus_vk.cpp:781 to dispatchTable.vkGetDeviceProcAddr = gdpa;

Cheers

felixdoerre commented 4 years ago

Thanks for the suggestion. This looks sound to me, I've updated master.

felixdoerre commented 4 years ago

Did anyone else of the original reporters test this workaround? Can we close the issue?

MateusRodCosta commented 4 years ago

I actually have good news.

I haven't tested the fix with Talos Principle, but there was a different game I wanted to play which had issues with choosing the GPU: Sonic Generations via Proton.

Sonic Generation has a launcher in which one of the things you can select is the graphics card. With primus_vk 1.4 it would only show the Intel iGPU, with commit 2301c15b50f8a50b6c5f335f06397d81ca3ef058 it now only shows the Nivida GPU as a choice when running with pvkrun.

Since Talos had a bult-in GPU chooser, I think both games might been hitting the same issue, which now has been fixed.