jpd002 / Play-

Play! - PlayStation2 Emulator
http://purei.org
Other
2.16k stars 263 forks source link

Add game shader(?) cache / Fix new effects lag? #1115

Open FatheredPuma81 opened 3 years ago

FatheredPuma81 commented 3 years ago

No clue if this is feasible, worth implementing, or if there is a better way of solving this issue, but some games such as Kingdom Hearts 2 would benefit greatly from some sort of shader/effects cache that persists through emulator restarts. Would help alleviate the very poor performance on game start. See 0:40 in video if you don't understand what I'm talking about. Game lags heavily when new effects are used.

W10 Ryzen 5 3600 GTX 1080

https://www.youtube.com/watch?v=FCyWqgxBL-I

jpd002 commented 3 years ago

Yep, this is something very annoying that needs fixing. I think it's the JIT that's taking a noticeable amount of time to compile code blocks that are encountered when new enemies/areas/effects are being shown.

There's lots of space for improvement in the JIT, I did a first pass last month or so that cut the compile time by at least an half and I'm pretty sure it could be reduced even further.

Shader compilation could also be causing some lag, but I really think the JIT is the main culprit here.

FatheredPuma81 commented 3 years ago

I'm completely out of my depth, so bear with me I'm just throwing out "ideas". If it's only tied to visuals couldn't it be asynchronous? Kind of like what RPCS3 did with their shaders? https://www.youtube.com/watch?v=s7nFjhEf55U

Also. Play! seems to be improving quite a lot. Great work!

rcaridade145 commented 3 years ago

Sorry to hijack the thread. Looking at the following code

https://github.com/jpd002/Play--CodeGen/blob/master/src/Jitter_Optimize.cpp#L830

I have a few questions @jpd002 :