RPCS3 / rpcs3

PlayStation 3 emulator and debugger
https://rpcs3.net/
GNU General Public License v2.0
15.39k stars 1.91k forks source link

[Closed] Shaders compiling, shaders compiling, ... This slowndowns the game but a second launch is better after. #4400

Closed ghost closed 6 years ago

ghost commented 6 years ago

Serious ( and probably stupid but i prefer to say it in case of ) question.

Isn't it possible for RPCS3 to compile all the needed shaders before launching the game ? ( We can see at the second launch that RPCS3 preloads the compiled shaders )

It will avoid the FPS down and the freezes of the game for all users because RPCS3 is "Compiling shaders".

tge-was-taken commented 6 years ago

No.

MSuih commented 6 years ago

There's no feasible way to know which shaders the game is going to use before it actually uses them. There are millions of possible combinations and you can't use past usage patterns to narrow the selection down either. You'd have to do AOT analysis or branch prediction on the code, and both of those are too slow to implement.

There are some ways of reducing the stutter though, such as skipping uncompiled shaders when drawing or storing the compilation input and allowing users to share it, but these solutions have their drawbacks as well.

tge-was-taken commented 6 years ago

Even doing it ahead of time isn't feasible, as it doesn't take runtime state into account. Shaders can be generated dynamically at runtime, after all.

ghost commented 6 years ago

The main problem is that we can consider that all games are not playable with the current solution of "shaders compilation". Games that are "playable" are games that can be used without freeze because of shaders compilations.

Closing ticket isn't a solution AniLeo. Isn't it possible to analyze all game datas files and know with that what shaders are necessary ?

It can be take time in the first time to detect and compile the needed shaders, but this solution will avoid all the freezes and shader compiling stutter during the first play of a game because RPCS3 will be "Compiling shaders".

The reason for this suggestion is if you look on the Web, your project RPCS3 got this main issue that downgrades major improvements that the team made in recent months

13xforever commented 6 years ago

GitHub should add :man_facepalming: as a reaction, specifically for such issues.

ghost commented 6 years ago

Maybe for you is a stupid issue, i suggest you to check Google and see the search results about "Compiling shaders slutter". I'm not the first guy to report this and i propose a solution that is the following : "Isn't it possible to analyze all game datas files and know with that what shaders are necessary ?"

It can be take time in the first time to detect and compile the needed shaders, but this solution will avoid all the freezes and shader compiling stutter during the first play of a game because RPCS3 will be "Compiling shaders".

al0xf commented 6 years ago

Nothing is impossible of course, you could give a team of 100 google engineers infinite money to come up with something worthy of a nobel prize. But there is no real solution that will be implemented now or even in the near future. Yes compiling shaders sucks. But that's how it is.

ghost commented 6 years ago

So second question : if compiling shaders sucks as you said it, are shaders necessary ? Can they be disabled ?

Mhmmm commented 6 years ago

@JackoboLeChocobo you are free to open a Pull Request which implements pre-compiling shaders, I am sure nobody will stop you.

13xforever commented 6 years ago

But first please get a basic understanding of how modern GPUs work, how modern game engines work, and then you'll be able to answer all of your current questions yourself. You can start with something like this: https://simonschreibt.de/gat/renderhell/ Also github issues is not the place for this discussion, please come to rpcs3 discord for this.

ghost commented 6 years ago

@13xforever that's why i have these questions : i'm not "Wikipedia" in this domain. Is it a crime to have questions on a specific domain in 2018 ?

@Renusek So I will fork the code database and check that.

VelocityRa commented 6 years ago

At least come on Discord and ask instead of bothering the 600 people following this repo. You said it youself that you suspected the question was stupid. If you continue posting here you'll most likely be banned from the repo.

AniLeo commented 6 years ago

Yes it's closed, you've been answered in detail already, it's also not the first time people have asked this.

You can't disable shader compilation, if you try to ignore shaders and proceed to the next frames it will just render a bunch of trash and just make you want to rip your eyes off by the words of kd-11.

henriquenj commented 6 years ago

@JackoboLeChocobo Worth pointing out that older and more mature emulators, that emulate a simpler architecture, such as dolphin, just very recently got rid of shader compilation stuttering, and it was not trivial. They have a very well detailed blog post about it here. You might give it a read to understand the problem, it's very carefully written.

ghost commented 6 years ago

@henriquenj Thanks for your answer and for the article you linked here.

torresmatt commented 5 years ago

So second question : if compiling shaders sucks as you said it, are shaders necessary ? Can they be disabled ?

Shaders are basically the backbone of 3D graphics, so no. They can't be disabled.

VelocityRa commented 5 years ago

@torresmatt Thanks for necroing a six month old question that has already been answered here many times.

torresmatt commented 5 years ago

Is this your repository? Are you an admin on it? I found the thread on google and admit I didn't look at the dates, but the thread wasn't locked. Sorry for the lack of vigilance but I'd say overall this seems like a moderation issue. Thanks for the sarcasm and hostility! Definitely not enough of that online.