summaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/radv_device.c
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-03-15 14:14:24 +1100
committerTimothy Arceri <[email protected]>2017-03-17 16:17:10 +1100
commit315e8a9321bbd20e35d27f443c0541411ee682c2 (patch)
tree6cad83e921c61b495b612795a7974ef5d4c106c8 /src/amd/vulkan/radv_device.c
parent4ffdab78b9a497a8b597466bb6151837f71b0c6a (diff)
radv: always create an fallback pipeline cache
This will be used as an in-memory cache when a pipeline cache is not provided by the app. Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_device.c')
-rw-r--r--src/amd/vulkan/radv_device.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index bc136e4489b..893dceae047 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -1009,6 +1009,20 @@ VkResult radv_CreateDevice(
if (device->physical_device->rad_info.chip_class >= CIK)
cik_create_gfx_config(device);
+ VkPipelineCacheCreateInfo ci;
+ ci.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO;
+ ci.pNext = NULL;
+ ci.flags = 0;
+ ci.pInitialData = NULL;
+ ci.initialDataSize = 0;
+ VkPipelineCache pc;
+ result = radv_CreatePipelineCache(radv_device_to_handle(device),
+ &ci, NULL, &pc);
+ if (result != VK_SUCCESS)
+ goto fail;
+
+ device->mem_cache = radv_pipeline_cache_from_handle(pc);
+
*pDevice = radv_device_to_handle(device);
return VK_SUCCESS;
@@ -1057,6 +1071,9 @@ void radv_DestroyDevice(
}
radv_device_finish_meta(device);
+ VkPipelineCache pc = radv_pipeline_cache_to_handle(device->mem_cache);
+ radv_DestroyPipelineCache(radv_device_to_handle(device), pc, NULL);
+
vk_free(&device->alloc, device);
}