Merging multiple pipeline cache objects
It may be a common scenario that we will have to create multiple pipelines in our application. To shorten the time needed to create them all, it may be a good idea to split the creation into multiple threads executed simultaneously. Each such thread should use a separate pipeline cache. After all the threads are finished, we would like to reuse the cache next time our application is executed. For this purpose, it is best to merge multiple cache objects into one.
How to do it...
- Store the handle of a logical device in a variable of type
VkDevice
namedlogical_device
. - Take the cache object into which other caches will be merged. Using its handle, initialize a variable of type
VkPipelineCache
namedtarget_pipeline_cache
. - Create a variable of type
std::vector<VkPipelineCache>
namedsource_pipeline_caches
. Store the handles of all pipelines caches that should be merged in thesource_pipeline_caches
vector (make sure none of the cache objects is the same...