mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 02:38:04 +02:00
vulkan: Add implicit pipeline caching support
This mirrors RADV's pipeline behavior (which is more performant when programs like DXVK don't use the pipeline cache functionality) Drivers need to set the implicit cache variable to use this though (the next patch will enable this for NVK) Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28851>
This commit is contained in:
parent
dae6b6a23d
commit
0f46e279ba
3 changed files with 14 additions and 2 deletions
|
|
@ -150,6 +150,7 @@ vk_device_init(struct vk_device *device,
|
|||
list_inithead(&device->queues);
|
||||
|
||||
device->drm_fd = -1;
|
||||
device->mem_cache = NULL;
|
||||
|
||||
device->timeline_mode = get_timeline_mode(physical_device);
|
||||
|
||||
|
|
|
|||
|
|
@ -195,6 +195,9 @@ struct vk_device {
|
|||
/* Set by vk_device_set_drm_fd() */
|
||||
int drm_fd;
|
||||
|
||||
/** Implicit pipeline cache, or NULL */
|
||||
struct vk_pipeline_cache *mem_cache;
|
||||
|
||||
/** An enum describing how timeline semaphores work */
|
||||
enum vk_device_timeline_mode {
|
||||
/** Timeline semaphores are not supported */
|
||||
|
|
|
|||
|
|
@ -1267,7 +1267,7 @@ vk_graphics_pipeline_compile_shaders(struct vk_device *device,
|
|||
all_cache_hits = false;
|
||||
}
|
||||
|
||||
if (all_cache_hits) {
|
||||
if (all_cache_hits && cache != device->mem_cache) {
|
||||
/* The pipeline cache only really helps if we hit for everything
|
||||
* in the partition. Otherwise, we have to go re-compile it all
|
||||
* anyway.
|
||||
|
|
@ -1798,6 +1798,10 @@ vk_common_CreateGraphicsPipelines(VkDevice _device,
|
|||
VK_FROM_HANDLE(vk_pipeline_cache, cache, pipelineCache);
|
||||
VkResult first_error_or_success = VK_SUCCESS;
|
||||
|
||||
/* Use implicit pipeline cache if there's no cache set */
|
||||
if (!cache && device->mem_cache)
|
||||
cache = device->mem_cache;
|
||||
|
||||
/* From the Vulkan 1.3.274 spec:
|
||||
*
|
||||
* "When attempting to create many pipelines in a single command, it is
|
||||
|
|
@ -2092,7 +2096,7 @@ vk_create_compute_pipeline(struct vk_device *device,
|
|||
.flags = VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT,
|
||||
.duration = pipeline_end - pipeline_start,
|
||||
};
|
||||
if (cache_hit) {
|
||||
if (cache_hit && cache != device->mem_cache) {
|
||||
pipeline_feedback.flags |=
|
||||
VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT;
|
||||
}
|
||||
|
|
@ -2128,6 +2132,10 @@ vk_common_CreateComputePipelines(VkDevice _device,
|
|||
VK_FROM_HANDLE(vk_pipeline_cache, cache, pipelineCache);
|
||||
VkResult first_error_or_success = VK_SUCCESS;
|
||||
|
||||
/* Use implicit pipeline cache if there's no cache set */
|
||||
if (!cache && device->mem_cache)
|
||||
cache = device->mem_cache;
|
||||
|
||||
/* From the Vulkan 1.3.274 spec:
|
||||
*
|
||||
* "When attempting to create many pipelines in a single command, it is
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue