In Vulkan we get to declare the specialization constants when creating a shader stage.
Looking at the GL_KHR_vulkan_glsl documentation it says :
this specific specialization constant. The API or an intermediate tool can
then change its value to another constant integer before it is fully
lowered to executable code. If it is never changed before final lowering,
it will retain the value of 12.
the SPIRV documentation says:
Specialization is intended for constant objects that will not have known constant values until after initial generation of a SPIR-V module. Such objects are called specialization constants.
In this blog (https://blogs.igalia.com/itoral/2018/03/20/improving-shader-performance-with-vulkans-specialization-constants/)
Specialization Constants are described as:
The concept behind specialization constants is very simple: they allow applications to set the value of a shader constant at run-time. At first sight, this might not look like much, but it can have very important implications for certain shaders.
I’ve talked to some people who are dabbling with Vulkan for some time now, and they say that a Specialization Constant isn’t updated at runtime, but instead when the pipeline is built. The people I asked also said they haven’t used them at all. So I wonder when are Specialization Constants updated. Before the shader stage being executed, or when the pipeline is created.