mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 01:08:03 +02:00
vulkan: skip the disk cache when disableInternalCache is true
The Vulkan spec says:
"disableInternalCache can be used to disable the driver’s internal
cache, allowing an application to take full control of both memory
and disk usage."
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30812>
This commit is contained in:
parent
60474c9d69
commit
279b5ca10c
3 changed files with 17 additions and 0 deletions
|
|
@ -187,6 +187,19 @@ vk_device_init(struct vk_device *device,
|
|||
|
||||
simple_mtx_init(&device->trace_mtx, mtx_plain);
|
||||
|
||||
vk_foreach_struct_const (ext, pCreateInfo->pNext) {
|
||||
switch (ext->sType) {
|
||||
case VK_STRUCTURE_TYPE_DEVICE_PIPELINE_BINARY_INTERNAL_CACHE_CONTROL_KHR: {
|
||||
const VkDevicePipelineBinaryInternalCacheControlKHR *cache_control = (const void *)ext;
|
||||
if (cache_control->disableInternalCache)
|
||||
device->disable_internal_cache = true;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -267,6 +267,9 @@ struct vk_device {
|
|||
struct hash_table *swapchain_private;
|
||||
mtx_t swapchain_name_mtx;
|
||||
struct hash_table *swapchain_name;
|
||||
|
||||
/* For VK_KHR_pipeline_binary */
|
||||
bool disable_internal_cache;
|
||||
};
|
||||
|
||||
VK_DEFINE_HANDLE_CASTS(vk_device, base, VkDevice,
|
||||
|
|
|
|||
|
|
@ -682,6 +682,7 @@ vk_common_CreatePipelineCache(VkDevice _device,
|
|||
|
||||
struct vk_pipeline_cache_create_info info = {
|
||||
.pCreateInfo = pCreateInfo,
|
||||
.skip_disk_cache = device->disable_internal_cache,
|
||||
};
|
||||
cache = vk_pipeline_cache_create(device, &info, pAllocator);
|
||||
if (cache == NULL)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue