In my Vulkan code, I use spir-v reflection (spirv-reflect) to construct a compatible VkPipeline
object for a combination of shader modules (VkShaderModule
).
Once a VkPipeline
object is created for a specific combination, it is cached so it won't have to be recreated once the same combination is requested.
Given a list of shader blobs, I can deduce the descriptor sets used and their bindings to construct an appropriate VkDecriptorSetLayout
.
However, given that I already created many pipelines with similar shaders before, I probably already created a compatible VkDecriptorSetLayout
, which I can potentially reuse.
- Generally speaking, is it a beneficial to reuse
VkDecriptorSetLayout
objects across multiple VkPipeline objects? - If it is beneficial, is there a mechanism which will allow me to identify compatible sets? (for instance, a set 'tag' attribute in hlsl / glsl) which can be used for caching.