I compile shaders at start of main menu. However, whole scene seems to be freezed during compilation so I'd like to overlap it with loading screen. Is there something that signalize shaders were compiled so I can hide loading screen ?
Wait for shader compilation ?
Can you compile the shader in another thread? So the main thread doesn't freeze. Maybe just send a signal when the shader compilation is done. In the mainthread, you can show a loading indicator, while the shader compiles.
I don't think you can control shader compilation at all. Maybe you could have a static loading screen, kind of like a splash screen.
Do you use this "trick" to pre-compile the shaders?
Then the shaders should be compiled after the first rendered screen. I'd put a counter in process and send a signal (or do a call) to the code/node that is handling the loadin screen on the second run of process.
The problem, though, is that everything freezes until the shaders are compiled. Nothing will run until all the shaders on the screen are compiled.
@Dschoonmaker said: The problem, though, is that everything freezes until the shaders are compiled. Nothing will run until all the shaders on the screen are compiled.
This is expected. With the workaround mentioned above, you can at least control when the freeze occurs, which is the most important thing. The alternative would be to render a partially broken scene while shaders are compiling (which is what some games do, especially some console emulators out there). I'm not sure if it's exactly better :)
That said, Godot 4.0 will be able to cache shaders to avoid freezes during gameplay.
You can control when they compile, yes, but it has to freeze, right?