Tuesday, May 11, 2021

ENB with DXVK for GTA IV

What GTA IV version to use for ENB

Version 1.0.4.0

·        Better performance, better look

·        CONS: on some GPUs/drivers may initialize graphics and load game very slowly, no FusionFix

Version 1.0.6.0+ or EFLC

·        Has more robust video initialization routine. May work better than 1.0.4.0 for some GPUs/drivers.

·        New shadows implementation, better look but GPU-demanding.

·        FusionFix v1.10 works

In general you may use any GTA IV version. The guide was successfully tested on:

·        GTA IV 2020 Complete Edition properly downgraded* to 1.0.4.0 and 1.0.7.0. *Vanilla 2020CE 1.2.0.X without downgrade may also be used but for AMD GPU make sure that enbseries.ini has ForceNVidiaCard=false or else ENB won't be able to initialize display.

·        GTA IV Razor1911 original release upgraded to 1.0.4.0 and 1.0.7.0

Disclaimer: author does not take responsibility if your modified game does not work. Before doing any modifications DO make a backup of your game folder (the one that contains GTAIV.exe).

 

ENB installation

·        d3d9.dll from DXVK or SweetFX must be renamed or else it will be overwritten by d3d9.dll from ENB. Any unique file name will do, I will use d3d9_dxvk.dll for this guide. If you have d3d9.dll from SweetFX installed rename it as d3d9_sweetfx.dll.

·        Read mod description (usually readme.txt), select correct source folder for your game version and copy mod’s files to game folder

·        (For 1.0.6.0+ only) install or reinstall  FusionFix . This should be done last as copied ENB files may contain bugged gta_emissivestrong.fxc shader file

Examples below are for iCEnhancer 3.0 Natural as it is most popular one. They are identical for all other ENBs I tried (Simple ENB, Excellent ENB, Masterpiece ENB, Zimmer’s Z_Graphics).

ENB configuration for DXVK

Check [PROXY] section in enbseries.ini and make sure it is set as follows:

EnableProxyLibrary=true

InitProxyFunctions=true

Next select DXVK chainloading method for your game version.

DXVK chainloading for 1.0.4.0

In [PROXY] section in enbseries.ini set

ProxyLibrary=d3d9_dxvk.dll

If ProxyLibrary in enbseries.ini is already set to dax.dll do not modify this and read below.

 

DXVK chainloading for 1.0.6.0+ or EFLC

ATTENTION: ENBs for 1.0.6.0+ have ProxyLibrary in enbseries.ini set to dax.dll. This is helper dll by Dax1 which adds custom shaders to 1.0.7.0/EFLC 1.1.2.0. Do NOT modify this setting. If you replace dax.dll with DXVK’s dll all in-game shadows will disappear!

Dax.dll has its own chainloading configuration in file DX9Settings.ini (you must create this file if it is absent. Easiest way is to save file from Notepad as DX9Settings and then change .txt extension to .ini in Explorer). Put the following into DX9Settings.ini:

[General]

DumpAll = false

ProxyLib = d3d9_dxvk.dll

OverrideMethod = 0

 

Launch the game.

 

Using SweetFX with ENB and DXVK

SweetFX may be used in conjunction with ENB for antialiasing and other custom shader effects. This multilevel chainloading is not recommended though as ENB has its own built-in antialiasing and custom shader effects.

·        To disable built-in ENB antialiasing you must set EnableEdgeAA=false in enbseries.ini

·        SweetFX’s d3d9.dll must be renamed as d3d9_sweetfx.dll

Set up chainloading for 1.0.4.0

Enbseries.ini (ProxyLibrary=d3d9_sweetfx.dll)  -> 
  SweetFX_settings.txt (// external_d3d9_wrapper = d3d9_dxvk.dll)

If the above scheme doesn't work then remove or move away SweetFX's dxgi.dll if you have it. If it still doesn't work then rename ENB's d3d9.dll as d3d9_enb.dll and SweetFX's as d3d9.dll and try

SweetFX_settings.txt (// external_d3d9_wrapper = d3d9_enb.dll) -> 
  Enbseries.ini (ProxyLibrary=d3d9_dxvk.dll)  

Set up chainloading for 1.0.6.0+

Enbseries.ini (ProxyLibrary=dax.dll)  ->  
  DX9Settings.ini (ProxyLib = d3d9_sweetfx.dll) ->
     SweetFX_settings.txt (// external_d3d9_wrapper = d3d9_dxvk.dll)

21 comments:

  1. So, it's me again with a new question.
    There's an ENB I wanted to use, which only came with two files: enbseries.ini and d3d9.dll, nothing else. I installed the two files and before that renamed DXVK's dll to d3d9_dxvk.dll. As this was on patch 7, only editing enbseries.ini like this:
    EnableProxyLibrary=true
    InitProxyFunctions=true
    ProxyLibrary=d3d9_dxvk.dll

    -> didn't work, the ENB loaded, VULKAN didn't.


    So I took dax.dll and DX9Settings.ini from CryENB V3, edited my enbseries.ini to:
    EnableProxyLibrary=true
    InitProxyFunctions=true
    ProxyLibrary=dax.dll

    and DX9Settings.ini to:
    [General]
    DumpAll = false
    ProxyLib = d3d9_dxvk.dll
    OverrideMethod = 0

    -> with this method it actually worked, ENB and VULKAN loaded. But would you recommend this? Taking files from a different ENB?

    Also I wanted to do this with the Complete Edition, but here my game crashed: "GTAIV.EXE stopped working". How do I chainload in CE? Only with sweetFX maybe? I'm hesitating because you wrote "multilevel chainloading" is not recommended.

    ReplyDelete
    Replies
    1. Hi. There are lots of ENBs with their peculiarities. I can say that if what you are doing is working for you by all means keep doing it. My multilevel chainloading remark was just to warn about potential incompatibilities and unstabilities of that convoluted setup with too many moving parts. There is a programming saying that goes something like "if the solution is not elegant it is probably not the right one". But in case of GTA IV anything goes and if it is stable and works for you then it is OK. 2020CE is a bad version for modding and I really don't know what can be done about it.

      Delete
  2. Приветствую, Антон!
    Не могу разобраться в чём дело. Ставлю чистую GTA IV 1.0.0.0 + патч + XlivelessAddon (пробовал обычный Xliveless + razor1911 crack тоже).
    Игра работает.
    Затем ставлю iCEnhancer 3.0 Natural, всё работает.
    Как только пытаюсь запустить игру с iCEnhancer 3.0 Natural через DXVK получаю загрузку игры чёрный экран 2-3 секунды и вылет на рабочий стол (всё делал по инструкции к моду, переименовывал d3d9.dll в dxvk.dll и кидал в папку игры вместе с dxgi.dll и dxvk.conf
    в enbseries.ini прописано:
    [PROXY]
    EnableProxyLibrary=true
    InitProxyFunctions=true
    ProxyLibrary=dxvk.dll).

    И что самое странное игра без мода отлично работает через DXVK/

    ReplyDelete
    Replies
    1. Привет, Эдди! Возможно, нужно попробовать без dxgi.dll и dxvk.conf. Это явно проблема при загрузке библиотеки и инициализации графики. Также можно попробовать другую версию DXVK и драйвера. На старых драйверах когда-то давно я пробовал и игра либо не стартовала совсем либо работала, но после нажатия Esc меню и карты не было. На Rx580 с последними драйверами описанная связка ENB и DXVK у меня работает нормально.

      Delete
    2. Спасибо, это сработало. Скопировал только dxvk.dll.

      Delete
  3. Hi. Kudos for your work on all the stuff.
    I received a report that using DXVK with ENB causes an issue when certain shaders are prevented from caching (like ambient occlusion) resulting in missing effects. Can you confirm it, or maybe it's bound to specific ENB versions, or ENB/game settings/patch?

    ReplyDelete
    Replies
    1. Hello, thanks. I tried Icenhancer ENB for 1.0.4.0, drove around and did several missions to see what the fuss is all about and I don't use it any more. I did have AO so maybe it is driver/DXVK/game specific.
      There has been some talks about DXVK needing d3d9.supportDFFormats = True in dxvk.conf to display some effects. I don't really know as I am yet to see a definitive set of before/after or on/off screenshots that clearly show the issue.

      Delete
    2. Can confirm something similar happened to me on 1.0.7.0 more akin to shader corruption. DayL's Natural, dxvk - it happened, I believe, as a result of using dxvf and trying to tweak the nvidia profiler? the program graphics selection section for GTAIV.exe *Was not alt-tabbing. I think I had AO on then turned it off and also set a clamp on the Negative LODBias. For me the fix was replacing all DayL's files including the Shaders and never using the Nvidia Program Profiler again *also deleted all dxvk cache files and scheduled all .exe's for restart. Also yes right around that time I was tweaking my dxvk.conf file to include support for all graphic image formats. If it happens again will screenshot.

      Delete
  4. I followed the ENB configuration for DXVK for Icenhancer 3.0 1.0.7.0 and my shadow is gone. I didnt touch the Dax.dll

    ReplyDelete
  5. This used to work for me until recently. Now if I try to use SweetFX and DXVK at once it won't recognize DXVK as an external wrapper. Game lags again like it used to. Forces me to choose between good performance with DXVK or antialiasing with SweetFX.

    ReplyDelete
    Replies
    1. I wonder if it's due to updated GPU drivers or DXVK. The latter just received v. 2.3

      Delete
    2. I think it happened after certain W10 update in the last few months. FusionFix does have the option to enable FXAA but it's not as effective IMHO. I was using DXVK 2.1, then updated to 2.2 but hasn't solved it. Is there a 2.3 already?

      Delete
    3. Yes, it came out yesterday.

      Delete
    4. This article is about ENB+DXVK, 3 tier chainloading ENB+SweetFX+DXVK may work but it's too complex. I checked SweetFX+DXVK 2.3 and it works OK on latest Win11 22h2 cumulative update and latest nVidia drivers, MSI Afterburner shows Vulkan and Insert key toggles AA, game is smooth. Update your OS, debloat it, DDU and manually reinstall latest GPU driver. It may be a problem with Vulkan libraries on your system.

      Delete
  6. Didnt understood a thing
    Can i get step by step guide?
    I just want to use enb with dxdv

    ReplyDelete
    Replies
    1. 1. Download DXVK 2.0 (this version was claimed to work better by some people, eventually 2.1).
      2. Go to x32 folder and rename d3d9.dll to dxvk.dll
      3. Paste it to GTA IV folder
      4. Open DX9Settings.ini from ENB inside GTA IV folder
      5. Set ProxyLib = dxvk.dll
      6. Profit

      Delete
  7. What are the steps if I want to use DxWrapper with ENB?

    ReplyDelete
    Replies
    1. I don't use dxwrapper or Enb any more so I can't tell you anything about those. Feel free to experiment and share your findings although I don't think you'll get any performance boost from that combo.

      Delete
    2. I used dxwrapper long time ago, but probably you should be able to do it by providing LoadCustomDllPath = in configuration files, where you should paste there e.g. enb.dll instead of default d3d9.dll, so rename it, and use d3d9.dll from dxwrapper, and paste ENB with its renamed library nearby. Good luck.

      Delete
  8. I installed vulcan with cryenb 3.0 but every time I enter the game the screen only looks black and I see the huds

    ReplyDelete
    Replies
    1. It may be incompatible with DXVK or GPU driver. The thing you described was common on older AMD drivers until they fixed it. Firthermore, some Enbs are broken and won't work even in default d3d9 mode on certain hardware/OS/driver combos. Try another.

      Delete