dxvk icon indicating copy to clipboard operation
dxvk copied to clipboard

Spoof display handle for PhysX games

Open phly95 opened this issue 7 months ago • 4 comments

When running Mirror's Edge with DXVK, if you have the AMD display as output but the Nvidia card set to physx, the game will use CPU physx. However, if you run the game with the Nvidia display as output at the start of the game, it will use the Nvidia GPU for physx, even if the rendering is being done on the AMD card.

The current trick is to start the game on the nvidia GPU with a dummy HDMI plug as the primary display, then after the game starts, remove the display, then alt tab out and back into the game, and now physx is entirely on the Nvidia card, and rendering is entirely on the AMD without bottlenecks.

I propose that there should be a way to emulate the display output in DXVK to pretend that the display output is comming from and Nvidia card. I've tried hideAmdGpu = True and customVendorId = 10de, but it seems like it's getting the output display handle and using that to decide whether to enable GPU physx. Basically, to enable hybrid physx, the game needs to see that it's being displayed on a display connected to the Nvidia card, but rendering can happen anywhere, and moving to another display is possible after the game has started works thanks to DXVK (it would crash under native DX9)

Software information

Mirror's Edge, PhysX on, rendering on AMD, PhysX on Nvidia

System information

  • GPU: AMD Radeon RX 9070 XT and NVIDIA GeForce GTX 1060 6GB
  • Driver: AMD: 25.5.1 , Nvidia: 576.28
  • Wine version: Windows 11 24H2 26100.3775
  • DXVK version: v2.6.1-1-gplasync

Log files

MirrorsEdge_d3d9.log MirrorsEdge_d3d9_amd_connected.log

phly95 avatar May 28 '25 16:05 phly95

maybe related to this? https://github.com/jp7677/dxvk-nvapi/issues/277

Zebra2711 avatar May 28 '25 16:05 Zebra2711

maybe related to this? jp7677/dxvk-nvapi#277

Not exactly. The referenced bug was with an all Nvidia setup, whereas this is a hybrid physx setup with AMD as the primary GPU. Nvidia has historically been hostile against this sort of setup, leading to needing a complex workaround that is only possible thanks to DXVK. But perhaps a solution that doesn't require inserting a dummy plug into the Nvidia card and removing it after game startup would be a much cleaner solution.

Perhaps it might be possible to use a mining card like a P106-100 to do physx on AMD in such a setup, as they are extremely cheap, but there would need to be a way to simulate an Nvidia display output to the game. Or it could be used to enable physx across all GPUs with Zluda if we're lucky.

phly95 avatar May 28 '25 16:05 phly95

If hideAmdGpu = True doesn't work, I have a feeling the game's getting its data from some nvapi endpoint, so dxvk-nvapi would be the place to address that. There's nothing I can think of that gets missed in terms of reporting in d3d9 at least and hideAmdGpu = True should convince the game that the AMD GPU you are running it on is an RTX 3060.

WinterSnowfall avatar May 28 '25 17:05 WinterSnowfall

That makes sense. I did try replacing the dll files in the system folders, but the behavior remained the same, so I reverted them. I know it's not advised on Windows, but since it's a secondary GPU anyway, not much can go wrong.

But yeah, I guess if that's the case, we'll need to wait on Zluda to avoid this convoluted workaround every time the game is started. At least it is technically possible to do hybrid physx with modern drivers this way.

phly95 avatar May 28 '25 17:05 phly95