ValveSoftware / Proton

Compatibility tool for Steam Play based on Wine and additional components
Other
24.34k stars 1.06k forks source link

[Feature Request]: Gallium Nine Patches #66

Open Mushoz opened 6 years ago

Mushoz commented 6 years ago

Lots of (older) games still use dx9. Would it be feasible to use the Gallium Nine patches for Proton for the AMD and Intel GPU users to get near-native performance under Linux? I am seeing much better performance playing older games such as Assassin's Creed 1 through regular wine with Gallium Nine patches compared to Steam play with Proton.

nanonyme commented 5 years ago

The whitelist won't work if you have complicated branching of operational modes, surely

crt0mega commented 5 years ago

"Complicated"

shanefagan commented 5 years ago

The whitelist won't work if you have complicated branching of operational modes, surely

Well it could be an option that is only enabled by users themselves if they want to try it out if the game performance isn't great

crt0mega commented 5 years ago

The whitelist won't work if you have complicated branching of operational modes, surely

Well it could be an option that is only enabled by users themselves if they want to try it out if the game performance isn't great

Sounds fair enough to me.

mat8913 commented 5 years ago

I think you'll need to get libd3dadapter9-mesa into the Steam runtime first.

shanefagan commented 5 years ago

I think you'll need to get libd3dadapter9-mesa into the Steam runtime first.

Hows does libd3dadapter9 work? I know that GalliumNine is in Mesa proper and the patches to WINE point to that. I seen that it's in Ubuntu as of 18.10 but I never actually used that lib.

crt0mega commented 5 years ago

How does libd3dadapter9 work? I know that GalliumNine is in Mesa proper and the patches to WINE point to that. I seen that it's in Ubuntu as of 18.10 but I never actually used that lib.

It's just addressing Mesa's D3D9 state tracker just like Wine's opengl32.dll.so does with common OpenGL state trackers for example¹. Edit: Sorry, I confused libd3dadapter9 with the DLL built for Wine. Didn't have enough coffee that day. The library in question implements a D3D9 state tracker for Mesa. Simplified: It offers native D3D9 support without additional translation layers like WineD3D or VK9. Take a look at this presentation if you're interested.


¹: Warning: Answer might be inaccurate.

rautesamtr commented 5 years ago

I was able to build proton with nine patches as local arch linux build with --no-steam-runtime. The only game i tested so far is Valkyria Chronicles 1 and that was behaving strangely with this local build e.g. RX 480 was detected as R9 290 in the settings, controls where not working properly at times and settings set trough Valkyria Chronicles configuration tool did not get saved at all.

Although those issues may be related to proton being built with --no-steam-runtime rather then the nine patches.

The original patch from https://github.com/sarnex/wine-d3d9-patches/blob/wine-d3d9-3.16/wine-d3d9.patch only needed a fix for the context in configure.ac see https://gist.github.com/raetiacorvus/8bf19a733ac131d744030788030941c4 only line 72 and 73 where removed from the original patch.

You still need to apply https://github.com/sarnex/wine-d3d9-patches/blob/wine-d3d9-3.16/d3d9-helper.patch first and run autoreconf in wine folder after having applied both patches.

In addition i had to add -with-d3d9-nine-module=/usr/lib32/d3d/d3dadapter9.so to the wine32 configuration in the following file but that may be a result of not setting up the build environment correctly? https://github.com/ValveSoftware/Proton/blob/83871c7bf93b785b23b987956b7cc3608d6998b3/build/makefile_base.mak#L713-L726

Also don't forget that you need to enable gallium nine trough winecfg for each pfx.

rea987 commented 5 years ago

https://github.com/ValveSoftware/Proton/issues/66#issuecomment-447569917

This is great news! Despite initial setbacks, having a somewhat functional build is a significant progress. Since I am not well versed with coding, can you please elaborate, why did you build with --no-steam-runtime argument? Doesn't the Proton that you build work with Steam client? Cause, whole point of Proton is to run Steam games which requires Steam DRM with native Steam client instead of Windows version.

@raetiacorvus

I have a considerably large game collection on Steam. Please let me know, if you need to test more games, so I can try to arrange it.

jerbmega commented 5 years ago

The only game i tested so far is Valkyria Chronicles 1 and that was behaving strangely with this local build e.g. RX 480 was detected as R9 290 in the settings

This is normal Gallium Nine behavior, my RX 580 does the same thing on my wine-staging-nine builds.

rautesamtr commented 5 years ago

Seems like none of the problems i encountered are gallium nine related but either caused by --no-steam-runtime or the game itself.

@rea987 --no-steam-runtime means proton is built against local libraries instead of the patched ones from the steam runtime docker container. It still is a valid steam compatibility tool and can be used as a replacement of valve provided proton releases. One problem so far is that it lacks the patched controller mapping from the runtime resulting in the problem I had with Valkyria Chronicles. You could probably work around that by using some of the tools available for wine to map controllers correctly.

rea987 commented 5 years ago

@raetiacorvus It would be wonderful if you provide a step by step Gallium Nine for Proton compiling guide. Also, how about making a pull request so perhaps @ValveSoftware merges it with one of the branches. If that turns out to be functional build, I will seriously consider switching to AMD. @raetiacorvus My offer to provide more games for testing still stands.

popsUlfr commented 5 years ago

I made my own fork of Proton with the patches :

https://github.com/popsUlfr/Proton (checkout the branch proton_3.16_gallium_nine_extras and just follow the readme)

git clone https://github.com/popsUlfr/Proton.git
cd Proton
git checkout proton_3.16_gallium_nine_extras
git submodule update --init

It also works with the steam runtime, I had to add this slightly ugly block of mesa stuff : https://github.com/popsUlfr/Proton/commit/0397af03059c32a6ac5e0213d39769e33f2914df

I added an environment variable PROTON_USE_GALLIUM_NINE=1 which you can use to easily enable Gallium nine if your card supports it (also can be enabled via the staging tab in winecfg)

Features :

Here's a build to test : ~Proton_3.16-5_Gallium_Nine_Extras.tar.xz~ ~Proton 3.16-5 Gallium Nine Extras 0.1.0~ ~Proton 3.16-5 Gallium Nine Extras 0.1.1~ ~Proton 3.16-6 Gallium Nine Extras 0.1.1~ ~Proton 3.16-6 Gallium Nine Extras 0.1.2~ Proton 3.16-6 Gallium Nine Extras 0.1.3

$ mkdir -p ~/.steam/root/compatibilitytools.d
$ tar xf Proton_3.16-6_Gallium_Nine_Extras_0.1.3.tar.xz -C ~/.steam/root/compatibilitytools.d

In your steamplay tab it should show up as Proton 3.16-6 Gallium Nine Extras

By the way, I added this to the README, after the configure step you need to run make all dist instead of just make dist or you'll just end up with win64 wine and nothing else. So this seems to be an error in the README of the official proton or just acting like that on my own system, I'm not sure.

rea987 commented 5 years ago

Great job @popsUlfr!

Will you have generic 32 bit, 64 bit and/or multiarch releases in the GitHub page of your fork?

Thanks for the effort and fork!

popsUlfr commented 5 years ago

@rea987 Like this ? https://github.com/popsUlfr/Proton/releases/tag/proton-3.16-5-gne-0.1.0

Tell me if it works ok for you, I don't have access to an amd card to test this thoroughly :/

AndersDala commented 5 years ago

Hrm I followed the instructions but it looks like Steam is not picking up whatever is in the created dir. Compatibility tool drop-down only shows the "regular" Steam releases.

Any ideas what I might be doing wrong? I'm on KDE NEON 18.04 (basically Ubuntu) if that changes anything?

rea987 commented 5 years ago

@popsUlfr Precisely! That's more clear and explanatory way to distribute it. Yeah, I also need an AMD card to test it properly. :-/

@AndrewLoom Is your Steam installation located in ~/.local/share/Steam or ~/.steam directory? Cause I needed to use the later to make it work.

AndersDala commented 5 years ago

Thanks rea987! D'Oh, so obvious now but still didn't think of it. :-)

rea987 commented 5 years ago

@AndersDala No problem, that's an issue which confuses many people as of recently. Perhaps, @popsUlfr can edit the Install guide to point out ~/.steam directory as well?

Mastergatto commented 5 years ago

I own an AMD Radeon Vega 56. I have successfully installed it and selected it to be used with all windows games, but it seems that games like A Hat in Time or Dragon Age: Origins won't work if I enable Gallium Nine with PROTON_USE_GALLIUM_NINE=1 (with clean prefix), a window doesn't even appear. With PROTON_USE_GALLIUM_NINE=0 they run fine.

archfan commented 5 years ago

I own an AMD Radeon Vega 56. I have successfully installed it and selected it to be used with all windows games, but it seems that games like A Hat in Time or Dragon Age: Origins won't work if I enable Gallium Nine with PROTON_USE_GALLIUM_NINE=1 (with clean prefix), a window doesn't even appear. With PROTON_USE_GALLIUM_NINE=0 they run fine.

Same GPU and same result for me. The games (Dishonered, Dead Space) won't start with Gallium.

rea987 commented 5 years ago

@Mastergatto, @archfan Have you installed Gallium Nine enabled Mesa drivers?

https://launchpad.net/~oibaf/+archive/ubuntu/graphics-drivers

archfan commented 5 years ago

Yes, I'm on Arch and I've installed mesa-git from the AUR. It comes with Gallium Nine enabled.

rea987 commented 5 years ago

@archfan All right, tomorrow, I will try it on my old AMD laptop which hopefully supports Gallium Nine.

Mastergatto commented 5 years ago

Yes, as Gallium Nine is enabled by default with the mesa package, at least for AMD cards on ArchLinux. I have also wine-staging-gallium, in which Gallium Nine works as intended.

popsUlfr commented 5 years ago

Can you look at the output when it's run with gallium nine on ? So in the launch options for the game add :

PROTON_DUMP_DEBUG_COMMANDS=1 PROTON_USE_GALLIUM_NINE=1 %command%

Run the game. This will drop some proton scripts into /tmp/proton_<username> Launch ./run to the see the output.

Also just to make sure, switch to another proton, restart steam. Now switch to the gallium nine proton.

EDIT: to not pollute this thread I think it would be better to discuss it here : https://github.com/popsUlfr/Proton/issues/2

Also sorry if this got your hopes up and doesn't work out of the box. I maintained this locally, the gallium nine part was more a 'what if' in case I could test on amd. I decided to share it anyway seeing this discussion getting more prominent and it might be useful to get something going about gallium nine support in proton :) The other features baked in might also be useful so...

jerbmega commented 5 years ago

Gallium Nine works in Proton with https://github.com/dhewg/nine

Unsurprisingly, this breaks the Steam overlay, but it otherwise works fine.

tatsujb commented 5 years ago

Gallium Nine works in Proton with https://github.com/dhewg/nine

Unsurprisingly, this breaks the Steam overlay, but it otherwise works fine.

hey, nice!

could you provide a guide of what you did? I'm a little lost.

rea987 commented 5 years ago

@tatsujb

https://github.com/popsUlfr/Proton/releases

Ember2528 commented 5 years ago

Another project to be looked into as an alternative to this https://github.com/Joshua-Ashton/d9vk

tatsujb commented 5 years ago

apparently we should be using protontricks to get all those goodies?

anybody know about that?

crt0mega commented 5 years ago

apparently we should be using protontricks to get all those googdies?

anybody know about that?

Good call. I'd honestly prefer a solution without protontricks but I'm gonna try that asap.

tatsujb commented 5 years ago

I did this :

wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
chmod +x winetricks
wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks.bash-completion
sudo mv winetricks /usr/bin
sudo mv winetricks.bash-completion /usr/share/bash-completion/completions/winetricks
python3 -m pip install --user pipx
~/.local/bin/pipx ensurepath
eval "$(cat .bashrc | tail -n +10)"
pipx install protontricks
pipx upgrade protontricks
protontricks 9420 galliumnine

but now the game (that was working) gives me and error box saying : "Failed to create direct3d device"

rea987 commented 5 years ago

@tatsujb I don't think that's the correct page for this but here it goes. Are you using Ubuntu 18.04 or Mint 19? Cause oibaf's Mesa drivers for those versions of Ubuntu/Mint is broken for Gallium Nine since December/January. I had the same issue, switched to Ubuntu Mate 19.04 and now it works.

tatsujb commented 5 years ago

@rea987 I'm using ubuntu 19.04, i'll try again. EDIT nah it doesn't help. what else did you do? what run arguments do you have and what game is working for you?

rea987 commented 5 years ago

@tatsujb Honestly not much.

tatsujb commented 5 years ago

@rea987

yeah that was the trick. I'd figured it out since then, thanks!

Francesco149 commented 5 years ago

it would be nice to have both galliumnine and d9vk btw. I compared them on hat in time today and galliumnine runs much better (20% or more higher fps) and doesn't stutter the first time you visit a new area. having both would result in higher chances to run a given directx9 game with good performance as some titles might break with one or the other.

mirh commented 5 years ago

In an ideal world the renderer would gracefully fallback from native, to vulkan to opengl (or switch the priority of the first two if d9vk was eventually supposed to have some intrinsic advantage, but still). Instead Valve (and even codeweavers given all the sneer around Nine) seems focused to just create a nice "well enough" garden for the latest cards rather than having everything and the kitchen sink working. They won't even add the automatic check for cards that lack vulkan at all

Venemo commented 5 years ago

Here are my 20 cents:

Now that we have Gallium Nine standalone, it is pretty easy to use because you no longer need any patches for wine. All you need to do is: (1) install mesa-libd3d9 from your distro's package manager (2) install Nine to your wine prefix using winetricks or the installer script.

With regards to which is the "better" option: I do not intend to start a flame war here, so I'll just share what I found so far: https://github.com/Joshua-Ashton/d9vk/issues/95#issuecomment-492651741 ― that of course only means that on my system Nine was faster with the titles I tried so far, which may not be representative of how they would work on other people's computers. EDIT: I realize that Nine is currently not an option for NVidia users, but it works reasonably well with AMD (radeonsi) and Intel (iris), and will improve on NVidia once zink becomes mature enough.

mirh commented 5 years ago

Nine standalone is a cakewalk to use indeed absolutely. Somehow though, *everytime* you point this out to devs it seems to fall on deaf ears. I don't know if perhaps discussions couldn't have happened behind doors/IRC and I don't want to flame either - but I don't know what else to say to get them acknowledge the *present* state of affairs of the damn code, rather than whatever caricatural image they have in their minds about what the project was half a decade ago.

crt0mega commented 5 years ago

I realize that Nine is currently not an option for NVidia users, but it works reasonably well with AMD (radeonsi) and Intel (iris), and will improve on NVidia once zink becomes mature enough.

It also runs well on r600g. GPUs supported by r600g lack Vulkan support btw.

tatsujb commented 5 years ago

on nvidia for now I switch between an ubuntu with 418 installed and an ubuntu with Nouveau installed so that I can enable mesa and gallium nine. the performance with native linux games that can run under nouveau is acceptable and the wine-gallium-nine games run real well.

But obviously I can't wait for mesa to support Nvidia also.

shanefagan commented 5 years ago

I think this is solved by D9VK now. I tested it out with SC2 and a few other games and it works very well. Hopefully that will get integrated into DXVK in the future and the patches pushed to Proton too.

Francesco149 commented 5 years ago

d9vk still performs much worse than gallium nine, but yes even just d9vk support built in would be awesome as that's already harder than gallium nine to integrate into an existing proton install

Francesco149 commented 5 years ago

also another tricky part of shipping d9vk is that it requires latest mesa. not just the latest release, it's based on mesa-git. so to make it accessible to a wide variety of distros you might even have to ship mesa-git with it or instruct users to figure out how to get mesa-git for their distro

Venemo commented 5 years ago

@shanefagan No, d9vk is an much, much slower than nine, see my findings in my previous post.

DeathTBO commented 5 years ago

There is a standalone version that's easy to install. Maybe they can be shipped with Proton and enabled with an argument. D9VK is great, but as others have stated it's slower, and often uses bleeding edge drivers. Installing Gallium through winetricks works, but having an integrated option would be really nice.

Standalone: https://github.com/iXit/wine-nine-standalone

ghost commented 5 years ago

Hello!~ Does anyone else experience silent crashes on 4.11-6 when launching games with Gallium Nine Standalone installed?

nottux commented 5 years ago

@Bryophyllum same, game won't launch after installing galliumnine via protontricks. Worst part is that there is no easy way of telling if galliumnine is running in the first place.