Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GTA V using proton and DXVK does not run #7

Closed
appetterson opened this issue Oct 3, 2018 · 22 comments
Closed

GTA V using proton and DXVK does not run #7

appetterson opened this issue Oct 3, 2018 · 22 comments

Comments

@appetterson
Copy link

I have set up primus_vk on Arch Linux using the modifications discussed in this issue #5.
Arch Linux does not ship vulkan-smoketest, but I am able to run vulkan-info and vk-cube with my 960m using optirun (I have ENABLE_PRIMUS_LAYER=1 set in my profile).

optirun vulkaninfo does give an error after printing out the expected information:
/build/vulkan-tools/src/Vulkan-Tools/vulkaninfo/vulkaninfo.c:3618: failed with VK_ERROR_INITIALIZATION_FAILED
Though vkcube seems to run without any problems

Adding optirun to the games in Steam's launch options seems to have no effect however, and they act simply as they do without primus_vk. The games I have tried are No Man's Sky and Grand Theft Auto 5 (the latter using the fix described here ValveSoftware/Proton#37 (comment)). In the case of No Man's Sky the game simply does not launch, with Grand Theft Auto 5 the launcher works but complains about missing DirectX runtimes. Both games launch when using nvidia-xrun in a different tty.

My laptop has a 960m with an intel i7-6700HQ. My current versions are:
nvidia 410.57-1
dxvk 0.80-2
bumblebee 3.2.1-19
primus 20151110-7
mesa 18.2.1-2
vulkan-intel 18.2.1-2
nvidia-utils 410.57-1
lib32-nvidia-utils 410.57-1

I removed the 32 bit intel vulkan driver as this seemed to be causing some issues in vulkaninfo.

Apologies if I missed something that means this shouldn't work yet but I've reread the readme and the issues several times and found nothing.

@felixdoerre
Copy link
Owner

felixdoerre commented Oct 3, 2018

So through Steam with Proton you don't get stdout from the games? So it probably might be best if I change the tracing code to write to a file, so we get at least some debugging info.
Have you tried running primus_vk_diag.sh? This script tries different scenarios of OpenGL/Vulkan usage and tries thereby if all graphics drivers are behaving as they should. Could you run that script and attach the output?

@felixdoerre
Copy link
Owner

Additionally, you could try the trick that came up in #6 (comment), when the game creates more than one VkInstance at the same time the code currently can't cope with that. Disabling that return could be a way to get the game running.

@appetterson
Copy link
Author

appetterson commented Oct 3, 2018

Additionally, you could try the trick that came up in #6 (comment), when the game creates more than one VkInstance at the same time the code currently can't cope with that. Disabling that return could be a way to get the game running.

This seems to have done the trick! I had to use primusrun rather than optirun in both cases. Performance in GTA5 was very poor, I guess this is possibly a related issue to #6. No Man's Sky ran smooth though, maybe a slight performance hit compared to nvidia-xrun but nothing unplayable! I believe No Man's Sky uses Vulkan rather than DirectX, so there is no DXVK in the middle, so that could be the difference?

Thanks for the help and good job getting this working! :)

@felixdoerre
Copy link
Owner

The performance hit comes from games doing work in the mainloop where presenting is invoked. As I was lazy and implemented the image-transfer synchronously, this puts additional work in the mainloop which then causes the game to run slowly. So I think that its simply the way how the game was written and not directly related to DXVK.

@felixdoerre
Copy link
Owner

Hi, as mentioned in #6 I have just pushed a performance improvement, that could possibly also solve the problem you're facing. Could you also update and try again?

@appetterson
Copy link
Author

Performance has massively improved. Managed to get a 3 star wanted level and escape it in GTA5 which certainly would not have been possible before! Performance is probably on par with nvidia-xrun. Thanks for this! :)

@felixdoerre
Copy link
Owner

Great, that the games you try are now playable. I just pushed a fix to master that should address the second problem, that primus_vk cannot handle applications that request multiple VkInstance objects. So the current master should work with games, that previously required commenting out the error check (in fact there is no error check anymore).
Can you please update to master and try if that change works for you?

@appetterson
Copy link
Author

appetterson commented Oct 10, 2018

I can confirm that it works without making that change. Only changes I made to the code for this commit was the arch specific changes as mentioned in #5 (adding vk_layer_utils.h and changing the library to libGLX_nvidia.so.0). Games seem to be running at around 24-26 fps. Thanks for the update!

@minecraft2048
Copy link

minecraft2048 commented Nov 18, 2018

@appetterson @felixdoerre How do you make GTA5 run using this? I have Ni no Kuni 2 and all Naruto games working with primus_vk and dxvk and Proton using this run command PROTON_LOG=1 ENABLE_PRIMUS_LAYER=1 PRIMUS_VK_MULTITHREADING=1 DXVK_HUD=1 primusrun %command% and when I try GTA5 it goes to the launcher, then it launches, then there is a black screen, then the game crashes
Here's the 200 lines before and after Wine backtrace from the log provided from steam:
gta.log
What is interesting is this backtrace:

Backtrace:
=>0 0x00007f04a1f124b3 in libvulkan_intel.so (+0x1c94b3) (0x00007f04940c02a0)
0x00007f04a1f124b3: movl	0x000000000000005c(%rdi),%eax

Why did it call libvulkan_intel.so? Isn't it should use Nvidia card?

GTA5 runs with Proton and dxvk using nvidia-xrun though

@felixdoerre
Copy link
Owner

On: Why does primus_vk call libvuikan_intel.so:

It works as does the primus for opengl. It uses the nvidia/dedicated driver to render and the intel/integrated driver to display. So: it has to interact with both.

On: How do you make GTA5 run using this? I don't have this game, but i think you you should use optirun in your Steam launch command instead of primusrun. Did you try that?

@minecraft2048
Copy link

I give up and use nvidia-xrun instead for my primary desktop, anyway everywhere I go there's always a power outlet so battery is not a concern

@jonpas
Copy link
Contributor

jonpas commented Jan 22, 2019

Testing on "Ori and the Blind Forest: Defintive Edition" and seem to be having a similar problem. Can't get primus_vk to run on my dGPU. DXVK HUD shows iGPU (unless what is written in the HUD is not the actual renderer card?) and very low FPS confirms that.

Tried with optirun, optirun -b primus and primusrun through Steam's Proton. vkcube runs fine though, shows my dGPU as renderer and iGPU as display. I don't have other DXVK games currently installed.

I will run diag in the coming days and add that here.

Is there anything I am missing or other information I should supply to help diagnose this?

@felixdoerre
Copy link
Owner

felixdoerre commented Jan 22, 2019

Your issue probably has nothing to do with what's discussed in this issue. Ori is a 32-bit game, which means it uses a 32-bit vulkan to communicate with 32-bit drivers and a 32-bit primus-vk. The Makefile currently doesn't compile for 32 bit. So I assume you'll need to make a 32-bit wrapper, and a 32-bit layer and install them both properly. So far I have not seen any "general proton" issue of primus-vk. It was always a game-specific issue.

What I did do diagnose this (I happen to own Ori and the blind forest): run the game with VK_LOADER_DEBUG=all, use the debug-commands from proton (set steam launch options to PROTON_DUMP_DEBUG_COMMANDS=true %command% and look in /tmp/proton_$USER), modify the run script to have a gdb --args in front of the game execution, see how the game looks like when it segfaults, set breakpoints to vkCreateInstance, etc...)

@jonpas
Copy link
Contributor

jonpas commented Jan 22, 2019

Oh, I see, sorry for hijacking the issue then!

I will work on 32-bit compiling and wrapper and layer and open a PR if I make it work.

@felixdoerre felixdoerre changed the title Steam Play games using proton and DXVK do not run GTA V using proton and DXVK does not run Jan 22, 2019
@leonmaxx
Copy link

leonmaxx commented Jan 22, 2019

@jonpas Just adding -m32 flag to compile and link commands is enough, that is the way I package Primus-Vk RPMs.
You can try: CXXFLAGS=-m32 make

@jonpas
Copy link
Contributor

jonpas commented Jan 22, 2019

I got it to work, thanks @leonmaxx!

I will possibly make some PRs in the coming weeks (documentation updates, 32-bit compiling - either here or AUR package). In the meantime, is there a chat channel you use to make this discussion easier on where something should go?

@grazzolini
Copy link

@jonpas, Arch now has an official package for primus_vk: https://www.archlinux.org/packages/community/x86_64/primus_vk/

I'm using primus_vk to run GTA 5 just by using pvkrun %command% on steam, it works with good performance.

I'm now creating a lib32-primus_vk package, based on the existing one on the AUR: https://aur.archlinux.org/packages/lib32-primus-vk-git/

@jonpas
Copy link
Contributor

jonpas commented Apr 17, 2019

Yep I noticed! And that's great, thanks for doing this!

@grazzolini
Copy link

The package is up: https://www.archlinux.org/packages/multilib/x86_64/lib32-primus_vk/

@felixdoerre
Copy link
Owner

Is there anything left, that primus_vk can do here, or can we close the issue?

@Arucard1983
Copy link

Instead GTA V, Assassin's Creed III that happens to use Intel HD Vulkan driver from Debian 9.
In fact it require to build the 32-bit versions of primus_vk, using the steps at:
#7 (comment)

@felixdoerre
Copy link
Owner

So as it all works now, I close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants