Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dlssg-to-fsr3 mod with Proton #7361

Open
2 tasks done
Zenzi0 opened this issue Dec 18, 2023 · 189 comments
Open
2 tasks done

dlssg-to-fsr3 mod with Proton #7361

Zenzi0 opened this issue Dec 18, 2023 · 189 comments
Labels
Feature Request New feature or request

Comments

@Zenzi0
Copy link

Zenzi0 commented Dec 18, 2023

Feature Request

I confirm:

  • that I haven't found another request for this feature.
  • that I have checked whether there are updates for my system available that
    contain this feature already.

Description

Is it possible to use this mod with Proton? It replaces Nvidia Frame Generation with FSR3 in games like Cyberpunk 2077, The Witcher 3 and others.
https://github.com/Nukem9/dlssg-to-fsr3/releases

Justification [optional]

Risks [optional]

References [optional]

@Zenzi0
Copy link
Author

Zenzi0 commented Dec 18, 2023

A RTX graphics card is required. From what I've read one needs to place both .dll files into the folder with the game's executable (make a backup of the original dbghelp.dll). In game one needs to disable V-Sync. Another comment here recommends to enable Hardware-Accelerated GPU Scheduling (in Windows). I don't know whether that is possible in Linux.
This could be a massive improvement for Nvidia graphics cards older then 40XX gpus.

Edit: They have since changed the installation instructions and the file names. Here are the instructions at the time of writing:
dlssg-to-fsr3 has been tested in Cyberpunk 2077 and The Witcher 3 only.

dlssg-to-fsr3 may be obtained from: https://github.com/Nukem9/dlssg-to-fsr3

================================
===== Install instructions =====

  1. Right click on "DisableNvidiaSignatureChecks.reg" and select "Merge". Click "Yes" when the dialog opens.

  2. Locate your game's installation directory. For Cyberpunk 2077, this would be the folder containing Cyberpunk2077.exe.

  3. Copy "dlssg_to_fsr3_amd_is_better.dll" and the new "nvngx.dll" to your game's installation directory.

  4. Done. Launch the game. You'll see a message box on startup.

================================
==== Uninstall instructions ====

  1. Right click on "RestoreNvidiaSignatureChecks.reg" and select "Merge". Click "Yes" when the dialog opens.

  2. Delete "dlssg_to_fsr3_amd_is_better.dll" and "nvngx.dll" in your game's installation directory.

@kisak-valve kisak-valve added the Feature Request New feature or request label Dec 18, 2023
@Saancreed
Copy link
Contributor

Saancreed commented Dec 20, 2023

Wine currently does not support the APIs Streamline uses to check if Hardware Accelerated GPU Scheduling is enabled. I have a hack for this here which should apply to Wine 9.0-rc2 and some flavors of it.

Warning though, some assembly is required; you will need to compile your own Wine to use this (don't forget to run tools/make_specfiles before building, otherwise linking will fail). It seems to be working for me in Cyberpunk 2077 (you will need to export WINEHAGS=1 environment variable to enable it).

@Zenzi0
Copy link
Author

Zenzi0 commented Dec 20, 2023

Maybe it is time to learn how to build packages and include patches then.
But isn't something like this what a project like GloriousEggroll's proton-ge-custom would be willing to include? At least until a non-hacky alternative presents itself. I don't possess the knowledge to judge this accurately.

@Gravechapa
Copy link

Gravechapa commented Dec 21, 2023

Replying to #7361 (comment)

Thanks, it works. But I actually had to patch gpu detection to get dlss to work.

@WildNightFoxy
Copy link

Replying to #7361 (comment)

Thanks, it works. But I actually had to patch gpu detection to get dlss to work.

Could u say how to do it step by step :3 ?

@MrDuartePT
Copy link

MrDuartePT commented Dec 21, 2023

Replying to #7361 (comment)

Thanks, it works. But I actually had to patch gpu detection to get dlss to work.

Well I gonna try both patches on my machine and report back.
Just need to wait for the compile to end, the patches applied to wine-proton-9999 without problems:
image

@Saancreed
Copy link
Contributor

Don't forget to also apply the second patch from my gist, the hags-0002.patch one.

@MrDuartePT
Copy link

Well after adding the missing path and editing the ebuild to add tools/make_specfiles now should work.

@MrDuartePT
Copy link

MrDuartePT commented Dec 21, 2023

@Saancreed it work but create graphical corruption:
image

Edit: Turnning off dlss frame generation the bug disappear.

Pausing the game or staying still the color return to normal:
image

I gonna try removing some env to see if solves it:
image

Ok didnt solve. Can be a bug with wine since is a rc version

@FakeMichau
Copy link

This is the same result people got on Windows on GTX cards when using my nvapi-dummy (based on dxvk-nvapi) to spoof the GPU arch.

@FakeMichau
Copy link

@MrDuartePT Would you mind sharing your dxvk-nvapi log?

@MrDuartePT
Copy link

MrDuartePT commented Dec 21, 2023

@MrDuartePT Would you mind sharing your dxvk-nvapi log?

Well I only could generate the VKD3D logs lets see if this helps:
cyberpunk-vkd3d.txt

And I using a RTX 3070 Mobile (laptop) is very strange this is happening

@RyanKelly-DC
Copy link

A RTX graphics card is required. From what I've read one needs to place both .dll files into the folder with the game's executable (make a backup of the original dbghelp.dll). In game one needs to disable V-Sync. Another comment here recommends to enable Hardware-Accelerated GPU Scheduling (in Windows). I don't know whether that is possible in Linux. This could be a massive improvement for Nvidia graphics cards older then 40XX gpus.

Why is an Nvidia GPU required, when FSR is explicitly designed by AMD to be largely hardware agnostic?

@dlove67
Copy link

dlove67 commented Dec 21, 2023

Replying to #7361 (comment)

Because it uses DLSS, which is Nvidia only. It only uses the Frame gen component from FSR3.

@MrDuartePT
Copy link

MrDuartePT commented Dec 21, 2023

Replying to #7361 (comment)

Even if you can spoof wine to think you have a Nvidia card it probably will not work very well since DLSS use Tensor Cores. AMD card could use the computer core but I think it will be very slow.
Also FSR3 SDK is open source and work on every Directx12 it possible one day to update FSR hack to use FSR3. Or the games just implement FSR3.

@Saancreed
Copy link
Contributor

Replying to #7361 (comment)

I'm unable to reproduce this issue. I can notice ghosting in Cyberpunk 2077 with the mod installed (or maybe it's more like frames being presented out of order sometimes?) but colors seem to be fine. Here's a quick comparison, FG disabled vs FG enabled:

Expand for some screenshots…

Screenshot_20231222_025742
Screenshot_20231222_025759

No such issue in Path Tracing SDK sample either. I don't really have too many FG games outside Steam I could test this with and I'd rather avoid angering online games like Diablo IV by loading unsigned binaries that install detours in other code segments, sorry 😅

There might be a bug somewhere else in the stack that I somehow avoid on my own builds/hardware. But it's highly unlikely that my HAGS patch caused it.

@MrDuartePT
Copy link

MrDuartePT commented Dec 22, 2023

Replying to #7361 (comment)

Probably my problem was that I use the latest commit of wine instead of the tagged 9.0-rc2 version. I gonna recompile wine and report back.

MrDuartePT added a commit to MrDuartePT/mrduarte-ebuilds that referenced this issue Dec 22, 2023
MrDuartePT added a commit to MrDuartePT/mrduarte-ebuilds that referenced this issue Dec 22, 2023
@MrDuartePT
Copy link

Lol nice catch github :)

@MrDuartePT
Copy link

MrDuartePT commented Dec 22, 2023

It happening again even with the tagged 9.0-rc2 wine version:
image

I gonna try reinstall the mod again
Edit: With gamescope and even reinstalling the mod still happening
Very strange you can reproduce it @Saancreed
Probably because you have a 4000 series card?

@Saancreed
Copy link
Contributor

If anything, it's the version of vkd3d-proton used here that has the greatest chance of affecting this and not Wine. And for that I'm using 2.11.1 patched with Nvidia Reflex support (PR 1739 but rebased to latest vkd3d-proton and Vulkan-Headers), my own patches adding support for Opacity Micromaps and pull request 1806 (because I've heard it needs some testing).

But this is strange enough that I feel like someone would need to point NSight/Renderdoc at this thing to figure it out.

@MrDuartePT
Copy link

MrDuartePT commented Dec 22, 2023

If anything, it's the version of vkd3d-proton used here that has the greatest chance of affecting this and not Wine. And for that I'm using 2.11.1 patched with Nvidia Reflex support (PR 1739 but rebased to latest vkd3d-proton and Vulkan-Headers), my own patches adding support for Opacity Micromaps and pull request 1806 (because I've heard it needs some testing).

But this is strange enough that I feel like someone would need to point NSight/Renderdoc at this thing to figure it out.

I can try that version of vkd3d-proton and see if solve it. You would mind sharing your patches and the NVIDIA reflex rebase one.
Since vkd3d-proton 2.11.1 is avaiable as gentoo ebuild I can just add the patch and rebuilding it.

edit: After testing vkd3d-proton withouth patches the problem remains.

@MrDuartePT
Copy link

MrDuartePT commented Dec 22, 2023

By the way one off my friend on gentoo also confirm it happen on The Witcher 3. Using the patched wine-staging 9.0-rc2.
But the fps is good.

@MrDuartePT
Copy link

MrDuartePT commented Dec 22, 2023

@Saancreed try the SDK and unfortunately need Nvidia Reflex to enable DLSS-G i will try to rebase the patches later

@Saancreed
Copy link
Contributor

You would mind sharing your patches and the NVIDIA reflex rebase one.

I can do that in a few hours from now, plus I'll attach the exact config I'm using to build my Wine (using wine-tkg-git).

@Saancreed
Copy link
Contributor

Saancreed commented Dec 22, 2023

Okay, so starting with Wine, I'm building wine-tkg-git using a config like this:

wine-tkg.conf

_NOCCACHE="true"
_NOINITIALPROMPT="true"
_LOCAL_PRESET="none"
_PKGNAME_OVERRIDE="none"

#_GCC_FLAGS+=" -march=x86-64-v3"
#_CROSS_FLAGS+=" -march=x86-64-v3" # problematic, needs a workaround for gcc bug this runs into, otherwise will break 32-bit applications

_user_deps+=" libgcrypt lib32-libgcrypt"
_user_deps+=" pcsclite lib32-pcsclite"
_user_deps+=" libdrm lib32-libdrm"
_user_deps+=" libxkbcommon lib32-libxkbcommon"
_user_deps+=" wayland lib32-wayland"
_user_makedeps+=" wayland-protocols"
_user_makedeps+=" winesync-header"
_staging_commit='#tag=v9.0-rc2'
_use_fastsync="true"
_use_vkd3dlib="true"
_proton_fs_hack="false"
_win10_default="true"
_protonify="true"
_proton_battleye_support="true"
_proton_eac_support="true"
_user_patches_no_confirm="true"
_hotfixes_no_confirm="false"
_allow_server_rt_prio="true"
_allow_wine_net_raw="true"

Of all these, probably the only only relevant settings are using the Staging (default) and Protonify patches.

Then, using the userpatches system I'm reverting Wine commit 354a8bb1f4a65bdec052606f2799db9e2907b5b1 (for other reasons, most likely unrelated to this), adding f6d04e332309159de4dc3aab219aafa838a0a3c0 ("win32u: Don't deactivate the target thread when setting the foreground window." because I'm experimenting with winewayland), adding my HAGS patches, updating Ubisoft Connect hack to append --use-angle=vulkan instead as Proton does, extending AC Odyssey hack for Immortals Fenyx Rising as well, and hacking WS_EX_TOPMOST in winex11 to not be so annoying when combined with fullscreen windows on KWin. Only the HAGS patch is important here, I think. Notably, the "GPU detection" patch shouldn't be needed because something like that is already included in Protonify patchset.

Since this project targets Arch users, you might have a hard time using it on Gentoo. Either try included non-makepkg-build.sh script or manually borrow all the patches it applies to your own ebuild (good luck!).

For the remaining projects, my versions of patches are here.

Moving on to dxvk-nvapi, I'm applying PR 147 as is then my OMM patches hacked rebased on top of Reflex. They are probably of little use to you on Ampere but if you wish to try anyway, they are in the dxvk-nvapi-reflex-omm.diff file in the Gist linked above.

Then, when building vkd3d-proton, checkout tag 2.11.1, forcufully update Vulkan-Headers submodule at khronos/Vulkan-Headers to latest (v1.3.274 but any version equal to v1.3.271 or newer should work), apply my modified Reflex patch (vkd3d-proton-reflex.patch file from the Gist) and optionally apply OMM patches (vkd3d-proton-reflex-omm.diff file from the Gist) and/or PR 1806.

Finally, there is dxvk-reflex.patch file that can be used with DXVK if you wish to use Reflex in D3D11 titles, which again requires updating included Vulkan-Headers submodule at include/vulkan just like vkd3d-proton did.

Oh, and make sure you don't have LatencyFleX available because it has higher priority but it doesn't fully implement all APIs Reflex requires. At worst, use WINEDLLOVERRIDES=latencyflex_layer,latencyflex_wine= to disable loading it.

With all this (and Nvidia's nvngx.dll and _nvngx.dll installed into the prefix, and DXVK_ENABLE_NVAPI=1 in the environment) you should have DLSS Super Resolution and Reflex exposed and working correctly, and with WINEHAGS=1 plus the mod, Frame Generation should also become usable. Try this with Path Tracing SDK and let me know how it went.

MrDuartePT added a commit to MrDuartePT/mrduarte-ebuilds that referenced this issue Dec 22, 2023
@SheMelody
Copy link

SheMelody commented Dec 1, 2024

Replying to #7361 (comment)

Did you also disable Reflex?

@Milor123
Copy link

Milor123 commented Dec 1, 2024

Replying to #7361 (comment)

According to understand when you set VKD3D_DISABLE_EXTENSIONS=VK_NV_low_latency2, the reflex is disable, sure some developer here could explain it us. My game dont detect reflex when use it.

@SheMelody
Copy link

SheMelody commented Dec 1, 2024

Replying to #7361 (comment)

I guess it makes sense then. Unfortunately, the implementation with nvofapi is still stutter-ish, and I think it's mostly because of the reflex implementation.

@shelterx
Copy link

shelterx commented Dec 3, 2024

I'm no developer but i think DLSS-FG depends on VK_NV_low_latency2.
I did test Ghost of Tsushima with DLSS-FG when the PR was about to be merged in Dxvk-nvapi, for me it seemed to work fine.
GoT did/do (?) have issues with Reflex on Ada GPUs so there was a workaround in Dxvk-nvapi for that, that workaround was removed when DLSS-FG got merged.

In general, I experience stutter with DLSS-FG in other games to.

@Milor123
Copy link

Milor123 commented Dec 10, 2024

Game tested with NVIDIA DLSS FG [12/12/24]

  • Indiana Jones [CRASH in proton GE or Disabled FG in Proton Experimental ❌ ]
  • Hitman III [Stutter cyclical ⚠️ - Cant be disabled the VK_NV_low_latency2 or FG dont work]
  • Dragons Dogma II [Stutter cyclical ⚠️- Can be played very good using VKD3D_DISABLE_EXTENSIONS=VK_NV_low_latency2 ✅]
  • Ghost Of Tsushima [Stutter cyclical is uncomfortably unplayable because of the game mechanics. ⚠️⚠️, use VKD3D_DISABLE_EXTENSIONS=VK_NV_low_latency2 and enable DLSS + FSR3 works nice ✔️]
  • Hogwarts Legacy [I am not sure this game have poor performance in general for me, let me know you if works nice with NVIDIA DLSS+FG after 2 hours of play]

@that404nerd
Copy link

So now, how do I really enable the frame gen? Does this method #7361 (comment) still work? I am using lutris.

@MrDuartePT
Copy link

MrDuartePT commented Jan 23, 2025

So now, how do I really enable the frame gen? Does this method #7361 (comment) still work? I am using lutris.

You can also use proton experimental/9.0 on lutris and it should just work.

Also Proton-GE or wine-tkg provided by lutris, (you can download wine version on settings) should also work, no need to manually build it from source the support was merge in master.

@that404nerd
Copy link

So now, how do I really enable the frame gen? Does this method #7361 (comment) still work? I am using lutris.

You can also use proton experimental on lutris and it should just work.

Thanks for responding quickly. I do have one question and that is do i need to use the universal download of the mod or is it fine to use the normal version?

@MrDuartePT
Copy link

MrDuartePT commented Jan 23, 2025

Any version of the mod should work. Don’t forget to apply the reg file in the prefix

@that404nerd
Copy link

Any DLL overrides required?

@MrDuartePT
Copy link

MrDuartePT commented Jan 23, 2025

Any DLL overrides required?

I don’t think it needed for what I remeber you can add it anyway is just one line

@that404nerd
Copy link

Alright, thanks for the response. I am testing it rn.

@MrDuartePT
Copy link

Dont forget this envs:
DXVK_ENABLE_NVAPI=1
PROTON_ENABLE_NVAPI=1
WINEHAGS=1

@that404nerd
Copy link

that404nerd commented Jan 23, 2025

Dont forget this envs: DXVK_ENABLE_NVAPI=1 PROTON_ENABLE_NVAPI=1 WINEHAGS=1

Can you please explain why I need these? Thanks!

Also the framerate is really bad compared to windows. Stutters like crazy. I am using a RTX 3050

@SheMelody
Copy link

SheMelody commented Jan 23, 2025

All you need to do to use DLSSFG to FSR3 is use the DLSS Tweaks version, then use DLSS Tweaks by renaming it to winmm.dll, then simply override it (WINEDLLOVERRIDES=winmm=n,b), set DLSS Tweaks's configuration so that it loads the FSR3 wrapper. It works in Proton Experimental (Bleeding Edge). You don't really need any registry tweak.

Please note that you need to provide the full path to the wrapper DLL in Windows format, in my case it would be Z:\home\melody\.local\share\Steam\blah blah, it depends on where it's located. Steam usually assigns Z:\ as the root of your system, but it can very rarely differ.

@that404nerd
Copy link

All you need to do to use DLSSFG to FSR3 is use the DLSS Tweaks version, then use DLSS Tweaks by renaming it to winmm.dll, then simply override it (WINEDLLOVERRIDES=winmm=n,b), set DLSS Tweaks's configuration so that it loads the FSR3 wrapper. It works in Proton Experimental (Bleeding Edge). You don't really need any registry tweak.

Ok, thanks for that. Will that improve my performance and fix the stuttering issue?

@SheMelody
Copy link

All you need to do to use DLSSFG to FSR3 is use the DLSS Tweaks version, then use DLSS Tweaks by renaming it to winmm.dll, then simply override it (WINEDLLOVERRIDES=winmm=n,b), set DLSS Tweaks's configuration so that it loads the FSR3 wrapper. It works in Proton Experimental (Bleeding Edge). You don't really need any registry tweak.

Ok, thanks for that. Will that improve my performance and fix the stuttering issue?

I've never had any stuttering except with nvofapi (it's pretty much fixed now). If you're using a userspace priority kernel such as linux-zen that might be the reason why you're stuttering. Also make sure your split lock mitigations are completely disabled. Other than that, I've never owned a 3050 so I can't help very much with it.

@that404nerd
Copy link

that404nerd commented Jan 23, 2025

Replying to #7361 (comment)

As I mentioned above, it works fine on windows but I would rather prefer using Linux instead of using windows just for cyberpunk. And yes I am using the linux-zen kernel. Not sure how that affects the performance but I will try to use the standard Linux kernel. I will look into it soon. Thanks.

@that404nerd
Copy link

that404nerd commented Jan 23, 2025

Replying to #7361 (comment)

What GPU are you using and how much fps are you getting BTW? Still need to install the standard Linux kernel. I also installed the DLSS tweaks as you mentioned and I am able to enable the DLSS FG but again the stuttering is horrible.

@SheMelody
Copy link

SheMelody commented Jan 23, 2025

Replying to #7361 (comment)

I'm on a RTX 4070 SUPER in 1080p, ultra settings without ray tracing, getting 220-ish fps, no stutters.

edit: I mistyped my gpu name cause my old PC had a 2070 lol.

@that404nerd
Copy link

that404nerd commented Jan 23, 2025

Replying to #7361 (comment)

Hmm. Is it really required to download the Linux kernel instead of the Zen kernel? In empty spaces I get like 90+ fps no stutters but a few people and then it stutters like hell.

@shelterx
Copy link

@SheMelody
"set DLSS Tweaks's configuration so that it loads the FSR3 wrapper"
Where? Not following here...

And where do the config file go?

I assume doing this also disables the "proton" framegen implementation? I mean, how can one know what's being used?

@SheMelody
Copy link

@SheMelody "set DLSS Tweaks's configuration so that it loads the FSR3 wrapper" Where? Not following here...

And where do the config file go?

I assume doing this also disables the "proton" framegen implementation? I mean, how can one know what's being used?

The config file for DLSS Tweaks goes in the same directory where the main executable of the game is located (NOT where game launchers are located, if any).

DLSS Tweaks's ReadMe file explains how to use it pretty much, where to put it and how hook it, but I highly suggest using the winmm method since it seems to always work for me. You do not need the signature thingy on Linux so you can skip that part.

You need the dlssg to fsr3 (DLSSTweaks version) one of course, extract in the same exact location and point to the wrapper in DLSS Tweaks's config file using the absolute path in Windows path syntax (see above). You need to override the dlssg library.

You know which one is working because dlss to fsr3 generates a log file in the same folder.

@shelterx
Copy link

FYI, this workaround pretty much fixed the stuttering in CP2077 with the current Nvidia DLSS-FG implementation.
HansKristian-Work/vkd3d-proton#2317

@that404nerd
Copy link

FYI, this workaround pretty much fixed the stuttering in CP2077 with the current Nvidia DLSS-FG implementation.
HansKristian-Work/vkd3d-proton#2317

So the DLSS Tweaks Mod that @SheMelody mentioned pretty much fixes the stuttering issue with the new change in vkd3d?

@shelterx
Copy link

@that404nerd sorry for being vague, it's the PR from doitsujin in the issue i mentioned that fixed the stuttering...

@that404nerd
Copy link

@that404nerd sorry for being vague, it's the PR from doitsujin in the issue i mentioned that fixed the stuttering...

Thanks for the clarification! Also will the new DLSS 4 transformer model work on Linux?

@shelterx
Copy link

Also will the new DLSS 4 transformer model work on Linux?

https://www.reddit.com/r/linux_gaming/comments/1ibenz7/dlss_4s_new_transformer_upscaling_model_does_work/

It will probably end up working properly later on too without using hacks.

@SheMelody
Copy link

FYI, this workaround pretty much fixed the stuttering in CP2077 with the current Nvidia DLSS-FG implementation.
HansKristian-Work/vkd3d-proton#2317

So the DLSS Tweaks Mod that @SheMelody mentioned pretty much fixes the stuttering issue with the new change in vkd3d?

@that404nerd That merge basically just fixes the nvofapi one (native dlss framegen on Linux). DLSSFG to FSR3 mod shouldn't stutter in any case. I'm guessing that, in your case, the mod is somehow not loading (maybe) or there are some other factors at play.

@that404nerd
Copy link

that404nerd commented Jan 30, 2025

Replying to #7361 (comment)

Thanks for the info and about the frame gen mod, I'll test it this weekend to see if I can fix it myself or is there some problem with the dll's. Again, thanks for helping me out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request New feature or request
Projects
None yet
Development

No branches or pull requests