From 70d8e71b0e1c3e0533fff700f15bf872ecb7e880 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Mon, 13 Jun 2022 16:30:22 +0200 Subject: [PATCH] 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. --- doc/classes/ProjectSettings.xml | 2 +- servers/visual_server.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 4530c6c5867..f41cc44d5a9 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -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]. - + 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. diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index affb6152111..de640bcfd35 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -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);