doitsujin / dxvk

Vulkan-based implementation of D3D8, 9, 10 and 11 for Linux / Wine
zlib License
13.1k stars 841 forks source link

[d3d9] GTA IV Shader Cache Confusion #2209

Closed Sparktimus closed 3 years ago

Sparktimus commented 3 years ago

I recently installed GTA IV along with the latest version of DXVK (version 1.9.1 as of this writing) and I've run into a bit of an issue. I downgraded my game to 1.0.8.0 so that I'm able to use .Net mods and I haven't had any issues with using DXVK with it until now. Usually the game will jump and stutter upon reinstalling and using DXVK because the shader cache needs to be rebuilt, naturally. The only problem is that each new instance of the game invalidates the previous cache which means the cache is being rebuilt time and time again and stuttering in the same places each time I load the game.

After this happened initially I switched back to 1.8.1 and found that the game runs just fine with no stuttering after the shader is built even after exiting and re-entering the game. I didn't really understand what was going on or what was different and I'm still in the dark somewhat about it, Then I checked the shader cache folder for GTA IV in its Steam directory and found that the cache file was being generated for GTAIV.exe instead of PlayGTAIV.exe which is the app that's actually running the game. I tried renaming the cache file to point to PlayGTAIV and the results are too inconsistent for me to really come to a conclusion if that worked.

It's worth noting that initially the game was generating a cache file for PlayGTAIV but it doesn't seem to actually build anything. It just turns out to be a placeholder where a cache would go, but it seems like something is either overwriting it or stopping it from being used or further written. I've already tried disabling my firewall and antivirus just to make sure nothing like that was stopping it and no dice. I'm extremely novice when it comes to thing like this and I'm not a Linus user so I was hoping someone else either had this problem or has found a workaround. Lowering my graphics settings has also yielded no results.

Software information

GTA IV Complete Edition (Downgraded to 1.0.8.0)

System information

Log files

K0bin commented 3 years ago

First of all, caching actual shaders is the job of the driver. We have 0 influence on that.

DXVK does however create a different cache, that allows it to compile shaders at a more convenient time (usually during loading screens). That's called the state cache.

Your logs (which are for GTAIV.exe with DXVK 1.9.1 btw) show it working just fine: info: DXVK: Read 265 valid state cache entries. Downgrading DXVK will invalidate that state cache.

Are you sure the actual exe of the game is PlayGTAIV.exe? I think that was some kind of launcher.

There isn't really anything we can do here. As I said, the logs you posted only show it working just fine.

Sparktimus commented 3 years ago

First of all, caching actual shaders is the job of the driver. We have 0 influence on that.

DXVK does however create a different cache, that allows it to compile shaders at a more convenient time (usually during loading screens). That's called the state cache.

Your logs (which are for GTAIV.exe with DXVK 1.9.1 btw) show it working just fine: info: DXVK: Read 265 valid state cache entries. Downgrading DXVK will invalidate that state cache.

Are you sure the actual exe of the game is PlayGTAIV.exe? I think that was some kind of launcher.

There isn't really anything we can do here. As I said, the logs you posted only show it working just fine.

Actually you're right. I think I know what's happening now. Since the game isn't actually communicating with Steam itself, it's probably not actually looking in that folder for the cache at all, but instead the actual install folder. Sorry if what I posted wasn't too helpful, but I think I've figured it out now. Closing this, and thanks for your help c: