DXVK - Optimization for games using VULKAN

Started by Kerrar, Mar 17, 2024, 05:26 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Hi there,

As we all know, GTA IV is not the best game when it comes to running on PC.
Advances in hardware technology have made it easier for more people to get on board to play IV but they still have issues sometimes, such as heavy lagspikes or unstable fps.

Until recently I was unaware of this, but there seems to be a trick to get Direct3D calls into VULKAN, essentially running the game on VULKAN for what your graphics card is concerned.
Your graphics card however MUST support VULKAN. More on it below.
This trick is called DXVK. Originally made for use on Linux by translating Direct3D 9/10/11 calls into VULKAN which allowed 3D applications to run on Linux using Wine.

Despite the fact that DXVK was not intented for use on windows, this trick also works well on Windows.
It is not limited to Direct3D 9 games and can be used on Direct3D 10/11 games as well, hence why the post title is generic regardless of me posting this in IV:MP boards.

As I have ran DXVK myself on GTA IV, it seems to make the game run much smoother and in some occasions I get higher fps.

If you want to try it out for yourself you can download DXVK here.
When done downloading, you open the tar.gz file, browse through the x32 folder and copy d3d9.dll and dxgi.dll to your GTA IV root folder. That should be it, start the game and play around for a couple of minutes.
Lagspikes should occur as DXVK is caching data. I would call this the 'loading' phase. After a couple of minutes, the game should run smoothly.



In some cases the GTAIV.exe doesn't pick the d3d9.dll file. I don't know why that is. You can check using MSI Afterburner and Rivatuner Statistics Server (enable FPS view in overlay) which API is being used. You want to see VULKAN and NOT D3d9 in the overlay. If you see D3d9, then close the game, rename the D3D9.dll file in your GTA folder to dxvk.dll and restart game. Now it should be fixed. Usually this is not needed but if for you it is required, here is a simple fix.

Also if you are using GTA Connected and their downgrader Retail folder, drop the same files for DXVK in that Retail folder, so it work on both GTAC and in vanilla game for story mode.



If you notice that you are running on the lowest settings and you cannot change your graphics settings due to being locked to 512mb, do the following:
Create a text file named commandline.txt in GTA IV root folder. Modify the file by adding the following line:

Code (commandline.txt) Select
-norestrictions
Then start your game, set desired settings and play the game. Happy days!



If you still experience some stuttering, you could try downloading dxvk.conf and putting it in your GTA IV root folder.
Then modify the file by removing the # marks at the maxFrameLatency settings and change their values from 0 to 1. Example given below:

Code (dxvk.conf before/after) Select
# dxgi.maxFrameLatency = 0   --->   dxgi.maxFrameLatency = 1
# d3d9.maxFrameLatency = 0   --->   d3d9.maxFrameLatency = 1



Tired of GTA IV's built-in Vsync? Use DXVK's Vsync implementation as this gives less CPU overhead than the game's built-in variant, modify the following in the same dxvk.conf file:

Code (dxvk.conf before/after) Select
# d3d9.presentInterval = -1   --->   d3d9.presentInterval = 1 (This forces the use of DXVK's Vsync implementation)
# d3d9.numBackBuffers = 0     --->   d3d9.numBackBuffers = 3 (This may further improve frametime stability while on Vsync)



Sometimes the async variant of DXVK might work better for you, but it's rare. Usually works great out of the box.



Do you desire to use ENB? Then rename the d3d9.dll (from DXVK, NOT your ENB) to dxvk.dll.
This way you can use the original d3d9.dll from your respective ENB in the root folder of GTA IV together with DXVK.
Although I do not recommend running ENB on GTA Connected as of August 2023, the date I am writing this, as it seems to be a hit or miss.
It either works or you load into a blackscreen with only map and icon/blips loading. The latter occurs far more often.



Last but not least, if for any reason you are not happy with the results or want to use vanilla IV again, you can just remove the files for DXVK, including the cache file it created on it's own inside the root folder. No vanilla files will be replaced by installing DXVK so getting rid of it is that simple.

Some mention that version v1.9.4 works best on IV, others mention v2.0, but I have no issues to report running the latest version of DXVK (v2.3 as of now).



Supported Graphics Cards include:

NVIDIA Kepler or newer   (GTX 600 series+)
AMD GCN 1 or newer   (HD 7000 series+)
Intel HD 500 or newer (Skylake+)



Sources:
https://github.com/doitsujin/dxvk
https://www.reddit.com/r/pcgaming/comments/gsn6w8/dxvk_works_magic_on_gta_iv/?rdt=55028
https://www.pcgamingwiki.com/wiki/Grand_Theft_Auto_IV
https://steamcommunity.com/app/12210/discussions/0/3105766250723841082/?l=schinese&ctp=5
Signed,


- Kerrar