ValveSoftware / Proton

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

Physx support in general #3786

Open Loacoon1 opened 4 years ago

Loacoon1 commented 4 years ago

Feature Request

I confirm:

Description

It seems pretty clear that Physx is not supported by Proton. Why not add the wine-staging patch for Physx support to Proton? The patch works pretty well.

Justification [optional]

It is in wine-staging.

Risks [optional]

Maybe there is a reason it's not in Wine vanilla, but couldn't find it.

References [optional]

shoober420 commented 4 years ago

Honestly, for the sake of the latest game fixes, Proton should build from wine-staging in general.

aeikum commented 4 years ago

Which patch is that? What specifically does it fix? Please name a game that you think would be improved by this.

Loacoon1 commented 4 years ago

Well I don't have the knowledge to tell you what is the patch itself, but here are some infos : https://wiki.winehq.org/Wine-Staging_PhysX https://www.phoronix.com/scan.php?page=news_item&px=Wine-CUDA-PhysX-Staging

I've tried with Nvidia's Physx benchmark Fluidmark, it works very well with Wine-staging. Actually almost as well as on Windows. Much better than Wine vanilla (which probably uses the CPU). So, to what it does fix, well, it probably uses the GPU (as should) instead of the CPU for Physx simulations, hugely improving the performances. As for the games well, all the games using Physx : Mirror's Edge, Batman Arkham series, Borderlands 2... etc. As an example, on Batman Arkham City's benchmark, I'm at 144fps constant (with vsync) without Physx. But between 16 to 45 with Physx, and GPU fans don't start anymore, which means it's most likely CPU limited.

shoober420 commented 4 years ago

@Loacoon1 Ironically, I installed GloriousEggrolls custom Proton last night.

https://github.com/GloriousEggroll https://github.com/GloriousEggroll/proton-ge-custom

It has Wine patches from all across the board. It’s perfect.

Depending on your distro and if you like to tweak, you can install and use this version of Proton instead.

https://aur.archlinux.org/packages/proton-ge-custom-bin/

Here’s a good analogy. Valves version of Proton is like the stable Debian build, and GloriousEggrolls version is like the bleeding edge and latest Arch build.

You can even install the latest DXVK builds and add them to Proton-GE as well.

https://aur.archlinux.org/packages/dxvk-bin/

aeikum commented 4 years ago

@Loacoon1 Thanks for explaining. It's a little more complicated than just adding a patch, as it depends on the nvapi and nvidia CUDA stuff as well. Those have impacts beyond just PhysX support (the nvapi patches are known to be buggy), and it's also unclear how we'd support them within the Steam Runtime. Needs some more thought.

Loacoon1 commented 4 years ago

so, to summarize, if I get it well, it's much more work than a single patch, and if we ever see this, it won't be anytime soon right? Just to know if I should forget about it and play other games instead, for now anyway.

aeikum commented 4 years ago

Pretty much. You're welcome to try out other Proton builds that might include the patch though, like @shoober420 suggested.

Loacoon1 commented 4 years ago

I'll try that, thanks. Do we leave this open for future discussions about this?

aeikum commented 4 years ago

I think it's fine to leave it open. It's a good request, just tricky to implement. Maybe someone will pick it up or at least find the discussion useful.

kakra commented 4 years ago

You should also consider the many work-arounds DXVK takes because different games seem to vastly change behavior if they detect NVAPI. So integrating NVAPI may have a big impact because it changes how DXVK treats some games, and may open a big box of new bugs and regressions. So if added to Proton, it should be opt-in per game probably as a first step.

Also, I cannot confirm that it greatly increases game performance... Even with CUDA, NVAPI seems to do a lot of PhysX calculations still in the CPU (this is also documented at different Internet locations back when I did my research). Only some highly parallel stuff is really done on the GPU. Also, for me, enabling NVAPI in Mirror's Edge caused the game to run very laggy in some scenes due to heavy PhysX effects, although I could confirm with a test program in the same prefix that PhysX would run on GPU. This was pre-DX9 support in DXVK so the situation may have changed now. Also, some bugs in NVAPI and related APIs may have been fixed since then.

Also, not all games automatically install PhysX so Proton needs to provide a function to install it on prefix creation when a supported game and/or GPU is found.

mirh commented 4 years ago

Not all games that use physx install the redist.. but I'm relatively sure this is the case for those using hardware effects (or to the very least shipped the libraries straight inside the game). I don't see why you would need to leapfrog what the normal installscript says.

If really any, problems may happen (and this is possibly even more true on windows!) when for whatever reason the game ships a very old version, and you need the latest one (9.19.0218 or the legacy 9.13.0604)

p.s. performance should be greatly increased over the cpu-that-runs-gpu scenario, not against the disabled effects ones

Loacoon1 commented 4 years ago

Kakra : What I can say by trying proton-ge-custom is that it does greatly improve performances. On Arkham City I have between 3 and 4 times more FPS with Physx enabled. BUT, you are right that (related to what you say or not, I cannot say), I'm having stability issues I didn't have with Proton vanilla. And framerate is still low compared to Physx completely disabled.

howdev commented 4 years ago

PhyX is CPU and is integrated into game engines. So Proton or not PhysX works.

Loacoon1 commented 4 years ago

If Physx is integrated to the game engine why do we have to install it ? And why Nvidia driver asks us which GPU should be used for Physx ? And most obvious, why did I have 4 times more FPS with a custom Proton using wine-staging which have patches for Physx ? What you say doesn't make sense.

howdev commented 4 years ago

Nvidia has moved PhysX to CPU and opensource so that any game developer can use it, it is GPU indepedent. The driver is for GPU PhysX if the games are developed to use GPU PhysX, otherwise generally now is CPU. Unreal Engine 4 already has PhysX integrated in it, that works on Radeon too. If you haven't played Borderlands 3, you should give it a go, it has PhysX even in Proton.

Edit: you ask why doesnt make sense, is because you haven't known that PhysX is CPU now.

mirh commented 4 years ago

The driver is also needed for cpu-only games. It's just that after version 2.8.4 you could ship the required dlls inside your game already IIRC.

You'd still be pretty recommended to update the system software, especially so if needing the gpu effects. Which are still being used to this day, see Metro Exodus.

Loacoon1 commented 4 years ago

Howdev : Still, many games are using the GPU Physx API. I was requesting this feature for these games. Your message sounded like EVERY game ever made were using the CPU and didn't need Physx support...

howdev commented 4 years ago

API is not SDK !

You cannot run Metro Exodus GPU PhysX on Proton when the game is not native for Linux. It has to be specifically developed using the PhysX SDK for Linux

you can only translate API. PhysX is not API ! You can only translate DX or Opengl.

There wasn't much PhysX games before and AMD hardware could not use it. So now, CPU will be used much more in games, since if GPU were used then cannot used on any other hardware. PhysX is using CUDA and AMD has to develop their own hardware acceleration using Open Source code.

mirh commented 4 years ago

You cannot run Metro Exodus GPU PhysX on Proton when the game is not native for Linux.

Mhh yes, you can, that's the whole point of this issue. (or well, I didn't hear about exodus specifically, but at least with older titles you could) https://github.com/wine-compholio/wine-staging/wiki/PhysX

howdev commented 4 years ago

@mirh that is CPU PhysX. Metro Exodus uses CPU PhysX too, I sure it does, otherwise how does Radeon have any PhysX?

Loacoon1 commented 4 years ago

You cannot run Metro Exodus GPU PhysX on Proton when the game is not native for Linux. It has to be specifically developed using the PhysX SDK for Linux

What would be the point of running it on Proton?!

you can only translate API. PhysX is not API ! You can only translate DX or Opengl.

If it was true I guess Wine wouldn't exist...

that is CPU PhysX. Metro Exodus uses CPU PhysX too, I sure it does, otherwise how does Radeon have any PhysX?

I don't know about Metro, but the game for which I requested this : Batman Arkham City, uses GPU Physx, and yes it can be translated since, again, Wine-staging has patches for that. Nvidia even has a benchmark for GPU Physx...

howdev commented 4 years ago

Well AMD has released its own FEMFX which only uses CPU and will be included in PhysX 5.0 https://news.developer.nvidia.com/announcing-nvidia-physx-sdk-5-0/ The development shows will be CPU based PhysX

romulasry commented 3 years ago

Wine 6.4 has a fix for the Physx installer.

SveSop commented 2 years ago

If anyone does find this useful, GPU based PhysX on NVIDIA adapters work with the following additions: DXVK-NVAPI from https://github.com/jp7677/dxvk-nvapi/commit/04b9dbdc3492ebba37b612374d499ab023a0d89a and the staging implementation of NVCUDA https://github.com/wine-staging/wine-staging/tree/master/patches/nvcuda-CUDA_Support - with the little addition of changing loading of libcuda.so -> libcuda.so.1 due to steam soldier/pressure-vessel.

This works with games like Batman Arkham Knight if you install PhysX software using protontricks(winetricks) into the prefix, and gives the ability to enable PhysX based fog and debris in the game.

@aeikum Not sure who keep tabs on issues like this and can consider fixing it? Building nvcuda instead of the stub-dll https://github.com/ValveSoftware/wine/commit/40f1e76d56ca8ddaec73c3abd32c7cfa7d4452a8 should be a relatively easy thing..

I have only tested this with Batman Arkham Knight, so it could be implementations of PhysX for other games needing new/other NVAPI calls tho.

weter11 commented 2 years ago

Hi! Why on main page is absent information about PhysX and how to turn on this feature? Also from my testing results current version of Proton & Proton experimental is not always provide hardware acceletation. For example all games require to install PhysX using protontricks & PROTON_ENABLE_NVAPI=1 %command% in options. To play Mirro's edge also needed to replace PhysXCore.dll & PhysXDevice.dll in a game folder, I exchanged that files with ones from Fluidmark folder. After that game is always locked at 62fps with all PhysX effects compared to 7-25fps in software mode. Batman: Arkham Origins, Fluidmark & Deus Ex: Mankind Divided need only to install PhysX using protontricks. And in my system all is working only with tkg-proton-7.6. IDK but newer versions of tkg have a bug with access denied. Also all versions of Proton-GE don't provide hardware acceleration in Batman: Arkham Origins, Fluidmark. Only in Deus Ex: Mankind Divided all proton tools working and all when PROTON_ENABLE_NVAPI=1 have bigger fps and 10-15% more GPU load with VKD3D backend: 88-89fps in benchmark without NVAPI and 95-97fps with it; all min, avg and max fps was increased. In Batman: Arkham Origins with SW decoder in prison corridor 35-80fps, with HW - 110-135fps. Fluidmark is not correctly working in Steam, so I test it in Lutris, PhysX SPS=37 (CPU load 92%) in software mode and SPS=89 in HW (CPU load 9%). All tests was done on RTX3070, 5800H, Ubuntu 22.04, 1080p resolution.

SveSop commented 2 years ago

@weter11 Hi You posted a lot of information about several games i have not played, or have no chance to test + the formatting was somewhat cluttered.

What is posted on "the main page" i have no idea about, and do not know who maintains that.

That said, when it comes to PhysX, it is not necessarily always done in hardware. I know some games uses NVIDIA PhysX with zero GPU usage (eg. Witcher 3), so it just may be some of the games you are talking about here do not intend to use hardware accelerated PhysX, and by replacing game .dll's you somewhat mess that up (just a theory without any huge knowledge of the games you talk about).

I have a .zip file with a installscript that works for newer GE-Proton versions here: https://github.com/SveSop/nvidia-libs/releases/ Disclaimer: Using that archive is not supported by Steam/Valve or GE in ANY way - i just provide that as a (imo) easy-to-use drop in replacement for said Proton versions.

mirh commented 2 years ago

To play Mirror's edge also needed to replace PhysXCore.dll & PhysXDevice.dll in a game folder

That sounds like you neglecting some issues that what also happen in Windows. I doubt that you were having the dreaded EpicLocalDLLHack issue (every proton container is independent from other games), so the problem is just that you'd need to update the system driver. Protontricks should support the procedure.

Cederick commented 1 year ago

I'd also argue that the Half-Life 2 games are using physix as far as I know.

weter11 commented 1 year ago

@SveSop thanks for providing support and update libs. Now Fluidmark show SPS=104 in HW mode. But even with updating to 23.04, Steam for some reason still don't show particle effects in Fluidmark and as I compare to videos on YT in Mirror's Edge effects also absent (previously I played this game using Lutris app). Batman: Arkham Origins for some reason show effects, but IDK all or only some effects in Steam. Also now TKG devs also delete nvidia libs from their Proton, so user need to manually return libs. By Main page I mean README.md, but according to https://list.fandom.com/wiki/List_of_games_with_hardware-accelerated_PhysX_support there only 40 games with HW support for PhysX and maybe this is the reason why this info absent and afterall readme hugely outdated. Also now there no reason for hardware effects because modern desktop CPUs outperform in raw power even the best GPUs up to 2010 plus software improvements during the last decade. So it would be nice that companies which create this games someday update their to modern versions of PhysX or remake that. PS: whats wrong with my Steam, sadly log do not show where the problem coming from.

SveSop commented 1 year ago

@weter11 Afaik i think the reason GE and others have dropped nvapi/nvcuda support with their custom wine/proton versions is that staging has disabled this a while back: Staging

So for now, i would think the "most complete" solution would be my "nvidia libs" stuff that i try to keep up to date for nvapi and such. I would love to improve nvcuda further but i have come to an impass where i am unable to complete support for cuda 1.8 or newer. (This should not be an issue when talking PhysX games tho)

mirh commented 1 year ago

For the love of god, if you just keep playing with ancient dlls (instead of installing the latest official physx redist, or at least the dlls inside) even in Windows you would have problems with any remotely recent gpu/driver.

weter11 commented 1 year ago

PhysX was installed using Lutris, because I don't find a way to install it in Steam or protontricks, in Fluidmark I changed exe from FluidMark.exe to PhysX_9.21.0713_SystemSoftware.exe, but this method is not working with Mirror's Edge, because you can't change game executable and there are still no any interface to install mods in Steam. About enableLocalPhysXCore and EpicLocalDLLHack: there wasn't such settings in regedit. Also I delete Mirror's Edge pfx folder and when it ask I cancel installation of outdated software and instead install Nvidia blobs (w/o that game won't start). So effects working now, I'll create a post on protondb for other gamers. PS: what is the reason that Steam cli do not install Nvidia blobs on its way? I understand, that there still some users, who have 9800 GT or AGEIA PhysX PPU for example, so why not installing old and new versions of PhysX at the same time or based on user GPUs only one variant? Thanks for support.

Cederick commented 1 year ago

Well I just downloaded the latest Proton GE 8-2 and PhysX works out of the box with it on Steam Deck.

mirh commented 1 year ago

This is about physx hardware support, and no physx wasn't even a thing when HL2 released.


Protontricks should be just be a wrapper for winetricks, so I don't see why it shouldn't be available. And putting aside I'd expect the usual exe swapping to work, there's nothing that you couldn't solve with SME. Also last but not least, I clearly remember that some old physx version had troubles installing (or maybe it was just with cleanly exiting in case you were trying to update an already newer version?) so that could be the issue maybe. Or god knows what msi trickery older WISE versions couldn't be shipping with.

so why not installing old and new versions of PhysX at the same time or based on user GPUs only one variant?

Because Valve doesn't manage individual games... let alone EA (and god forbid they did, since I cannot remember a single time that they didn't ruin even more games every time they woke up after years that an old game was in need of care). Anyway there's really nothing to gain from older redistributable versions (even if PPUs worked natively on linux, they aren't really useful nowadays). I'm not sure if G80 support was eventually retired at some point, but unless you are using nvidia-340xx from the AUR it's not like any of those cards could even run on a system new enough to worry about this question.