34736384 / genshin-fps-unlock

unlocks the 60 fps cap
MIT License
2.71k stars 211 forks source link

GUI itself causing extreme system slowdown on new Ryzen processor with iGPU prior to game launch #267

Closed elbadcode closed 9 months ago

elbadcode commented 9 months ago

Before I get into the main topic let me just state that my game works great and once I get into the game everything is smooth sailing with high framerates and low input lag even while using 3dMigoto and gshade with depth. I see lots of complaints about inconsistent frame times or poor GPU util which I think is largely user error/ignorance to the point I'm tempted to briefly write up some tips on how to make the game run well that I could pull request on the readme or as a new document. I don't think either of us are looking to provide basic IT for people who don't know how to tweak settings and this might only invite more of it and wouldn't be valid for every system, but I've gotten lots of good use from this mod and don't mind giving back if that's helpful. Biggest thing imo is to run windows 11 with optimizations for windowed games enabled for anyone who doesn't use exclusive fullscreen option in your mod and to set global low latency options in the GPU driver.

With that out of the way I'm investigating some issues solely with the launcher that began after upgrading from a 5800x with DDR4 to a 7900x with 48 GB DDR5 a couple weeks ago which has been great except for issues centered around the new iGPU included with ryzen 7000. These issues have been ongoing and are not limited to genshin but rather seem to occur when any window requests some GPU render time but doesn't meet the criteria to use my Nvidia 3060 TI. Anything chromium or webview based falls into that category and even windows explorer and task manager fall into this category. Most issues can be addressed by installing AMD GPU drivers and adjusting to prefer high perf/low power when it does get used, Its also possible to disable the device in BIOS but windows still attempts to run applications on it even if the device is absent, and keeping it disabled means fighting a constant battle against windows and my mobo utils attempts to install the device. And very fittingly as I typed this in chrome with the iGPU supposedly disabled in BIOS I opened the GUI and immediately my system froze. Somehow with my frantic clicking I posted this incomplete message which was fortunate as I had a BSOD stating driver power failure. Usually I don't get a BSOD and opt to manually shut off the PC when it hangs as otherwise I wait for 10 or more minutes for it to resolve.

There is definitely lots of stuff that needs to be done on my end and I'm not expecting you to troubleshoot AMD's buggy HW with me, just hoping for some insight about the GUI and I will attempt to modify it myself if needed. Honestly if I can just run it as a full cli that would probably solve the issue for me but AFAIK the current version only supports taking command-line options to define the settings and still has to launch. As stated I do use this alongside 3dmigoto and gshade which is accomplished by first launching 3dmigoto and then launching the unlocker with gshade installed to the 3dmigoto directory and injected to genshin via the unlocker as that setup ensures I get depth buffer access for mods and reshade shaders. Injecting 3dmigoto d3d11 via the unlocker causes an instant crash but I may look into the differences in how they hook to see if I can simplify that part. It may be a simple matter of order or timing or perhaps the injection this way doesn't preserve paths to 3dmigoto's shaderfixes and mods. The slowdowns are also greatest after I manage to click launch, perhaps due to 3dmigoto's initialization attempting to cache shaders on the iGPU. I do use the autostart and start minimized settings in the unlocker as the only issue is when its rendering onscreen, but mistiming any of these steps can cause one or both hooks to fail and leave me with mods in 60 fps and then I usually have to kill the app with taskmanager which itself is affected. I don't use the autoclose upon launch option as it can lead to gshade or 3dmigoto not hooking and background services can cause the 60 fps cap to remain.

So in summary I experience issues with the GUI itself due to improper GPU assignment that occurs only at launch and doesnt affect the game. I would like to make or request a build that avoids or addresses the issue by reverting to a no-GUI cli while maintaining the current feature set and changes since it was a cli only app or otherwise modify the GUI to use software rendering only or handle multigpu setups to only use dedicated GPU. Additional lower priority goal is to improve/automate interop with other libraries like 3dmigoto and gshade. I will attempt to build the app myself regardless and do not want or expect high priority support and mainly made this long post for documentation, but any support is welcome!

elbadcode commented 9 months ago

Not fully resolved but manually assigning 4gb system ram as VRAM to the iGPU in BIOS has made the tool usable. Installing AMD drivers and software makes the issue return. Uninstalling the software and device through Windows resolves it again. Rather not have to do this back and forth and still intend to try fixing the build but for now any ryzen 7000 owners having trouble try those steps

elbadcode commented 9 months ago

Had several conflicting issues. Allocating some sysmem to the iGPU alleviated some of the slowdowns and unresponsive behavior with this app, but the core issue seems to be updated detection methods for gshade/reshade that prevent the game from launching when injecting through this app onto either the main game or 3dmigoto. My current working process is to install gshade to 3dmigoto, inject the dxgi dll in this app, move the dll out of the folder and launch 3dmigoto and unlockfps at the same time, and then move dxgi back into my 3dmigoto folder immediately after 3dmigoto hooks genshin. So not exactly an issue with this program but worth noting that injection currently does not work without extra steps. If I install gshade to 3dmigoto and don't inject through here I can't get depth access. If I only inject through here I don't get a gshade UI

I will write a script to automate this launch process and upload to my own repo rather than continuing to leave notes here. Just wanted to clear up the source of the issue for any google searchers