Enable asynchronous shader compilation + cache by default in GLES3

This reduces stuttering when a material is displayed for the first
time, and prevents stuttering from occurring entirely after the
project is restarted when a similar situation is encountered.
This commit is contained in:
Hugo Locurcio 2022-06-13 16:30:22 +02:00
parent a77192a5bc
commit 70d8e71b0e
No known key found for this signature in database
GPG key ID: 39E8F8BE30B0A49C
2 changed files with 2 additions and 2 deletions

View file

@ -1320,7 +1320,7 @@
An override for [code]rendering/gles3/shaders/ubershader_cache_size_mb[/code], so a smaller maximum size can be configured for mobile platforms, where storage space is more limited.
[b]Note:[/b] This setting is only meaningful if [code]rendering/gles3/shaders/shader_compilation_mode[/code] is set to [code]Asynchronous + Cache[/code].
</member>
<member name="rendering/gles3/shaders/shader_compilation_mode" type="int" setter="" getter="" default="0">
<member name="rendering/gles3/shaders/shader_compilation_mode" type="int" setter="" getter="" default="2">
If set to [code]Asynchronous[/code] and available on the target device, asynchronous compilation of shaders is enabled (in contrast to [code]Asynchronous[/code]).
That means that when a shader is first used under some new rendering situation, the game won't stall while such shader is being compiled. Instead, a fallback will be used and the real shader will be compiled in the background. Once the actual shader is compiled, it will be used the next times it's used to draw a frame.
Depending on the async mode configured for a given material/shader, the fallback will be an "ubershader" (the default) or just skip rendering any item it is applied to.

View file

@ -2734,7 +2734,7 @@ VisualServer::VisualServer() {
force_shader_fallbacks = GLOBAL_GET("rendering/gles3/shaders/debug_shader_fallbacks");
}
#endif
GLOBAL_DEF("rendering/gles3/shaders/shader_compilation_mode", 0);
GLOBAL_DEF("rendering/gles3/shaders/shader_compilation_mode", 2);
ProjectSettings::get_singleton()->set_custom_property_info("rendering/gles3/shaders/shader_compilation_mode", PropertyInfo(Variant::INT, "rendering/gles3/shaders/shader_compilation_mode", PROPERTY_HINT_ENUM, "Synchronous,Asynchronous,Asynchronous + Cache"));
GLOBAL_DEF("rendering/gles3/shaders/shader_compilation_mode.mobile", 0);
GLOBAL_DEF("rendering/gles3/shaders/max_simultaneous_compiles", 2);