Retrieving data from a pipeline cache
A cache allows us to improve the performance of creating multiple pipeline objects. But for us to be able to use the cache each time we execute our application, we need a way to store the contents of the cache and reuse it any time we want. To do that, we can retrieve the data gathered in a cache.
How to do it...
- Take the handle of a logical device and use it to initialize a variable of type
VkDevice
namedlogical_device
. - Store the handle of a pipeline cache, from which data should be retrieved, in a variable of type
VkPipelineCache
namedpipeline_cache
.
- Prepare a variable of type
size_t
nameddata_size
. - Call
vkGetPipelineCacheData( logical_device, pipeline_cache, &data_size, nullptr )
providing thelogical_device
andpipeline_cache
variables, a pointer to thedata_size
variable, and anullptr
value. - If a function call was successful (a
VK_SUCCESS
value was returned), the size of memory that can hold the cache contents is stored in thedata_size
variable...