Mesa (master): radv: always create an fallback pipeline cache
Timothy Arceri
tarceri at kemper.freedesktop.org
Fri Mar 17 05:17:31 UTC 2017
Module: Mesa
Branch: master
Commit: 315e8a9321bbd20e35d27f443c0541411ee682c2
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=315e8a9321bbd20e35d27f443c0541411ee682c2
Author: Timothy Arceri <tarceri at itsqueeze.com>
Date: Wed Mar 15 14:14:24 2017 +1100
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 <bas at basnieuwenhuizen.nl>
---
src/amd/vulkan/radv_device.c | 17 +++++++++++++++++
src/amd/vulkan/radv_private.h | 3 +++
2 files changed, 20 insertions(+)
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index bc136e4489..893dceae04 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);
}
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index dce1d50878..e4654bb4d4 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -508,6 +508,9 @@ struct radv_device {
uint32_t *trace_id_ptr;
struct radv_physical_device *physical_device;
+
+ /* Backup in-memory cache to be used if the app doesn't provide one */
+ struct radv_pipeline_cache * mem_cache;
};
struct radv_device_memory {
More information about the mesa-commit
mailing list