Description
Describe the project you are working on
The Godot engine
Describe the problem or limitation you are having in your project
Despite making massive strides to reduce shader/pipeline compilation times, some users still experience pipeline compilation stutters at run time. Pipeline compilation stutters are tricky to work around and currently, Godot doesn't offer any tools to fully avoid them.
We are doing work towards compiling pipelines in the background so that we reduce stutters as much as possible, but it is unclear whether that will be enough to fully eliminate them.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
This would move the cost of compiling pipelines to load time, so there are no stutters at runtime.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
This feature would add an toggle to the ProjectSettings named "force_pipeline_compilation_on_load". When enabled, all pipelines will be compiled when the shader is loaded (same time the shader is compiled). This will substantially increase load times as even pipelines that never get used will be compiled. But it will move the entire cost to load time, so that developers can avoid pipeline compilation stutters at run time completely.
Basically, what is needed is a check during the pipeline assembly step (in shader_set_code), if enabled, the pipeline will be compiled right away instead of waiting to be used.
If this enhancement will not be used often, can it be worked around with a few lines of script?
There is no workaround
Is there a reason why this should be core and not an add-on in the asset library?
It is part of the core rendering code.