diff --git a/src/gallium/drivers/zink/zink_pipeline.c b/src/gallium/drivers/zink/zink_pipeline.c index 15cc7065111..c95def406a8 100644 --- a/src/gallium/drivers/zink/zink_pipeline.c +++ b/src/gallium/drivers/zink/zink_pipeline.c @@ -181,7 +181,7 @@ zink_create_gfx_pipeline(struct zink_screen *screen, pci.stageCount = num_stages; VkPipeline pipeline; - if (vkCreateGraphicsPipelines(screen->dev, VK_NULL_HANDLE, 1, &pci, + if (vkCreateGraphicsPipelines(screen->dev, screen->pipeline_cache, 1, &pci, NULL, &pipeline) != VK_SUCCESS) { debug_printf("vkCreateGraphicsPipelines failed\n"); return VK_NULL_HANDLE; @@ -207,7 +207,7 @@ zink_create_compute_pipeline(struct zink_screen *screen, struct zink_compute_pro pci.stage = stage; VkPipeline pipeline; - if (vkCreateComputePipelines(screen->dev, VK_NULL_HANDLE, 1, &pci, + if (vkCreateComputePipelines(screen->dev, screen->pipeline_cache, 1, &pci, NULL, &pipeline) != VK_SUCCESS) { debug_printf("vkCreateComputePipelines failed\n"); return VK_NULL_HANDLE; diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index 5f064d7a830..b88d1a2c502 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -772,6 +772,7 @@ zink_destroy_screen(struct pipe_screen *pscreen) } u_transfer_helper_destroy(pscreen->transfer_helper); + vkDestroyPipelineCache(screen->dev, screen->pipeline_cache, NULL); vkDestroyDevice(screen->dev, NULL); vkDestroyInstance(screen->instance, NULL); @@ -1230,6 +1231,15 @@ zink_internal_create_screen(const struct pipe_screen_config *config) zink_screen_init_compiler(screen); + VkPipelineCacheCreateInfo pcci; + pcci.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO; + pcci.pNext = NULL; + /* we're single-threaded now, so we don't need synchronization */ + pcci.flags = screen->info.have_EXT_pipeline_creation_cache_control ? VK_PIPELINE_CACHE_CREATE_EXTERNALLY_SYNCHRONIZED_BIT_EXT : 0; + pcci.initialDataSize = 0; + pcci.pInitialData = NULL; + vkCreatePipelineCache(screen->dev, &pcci, NULL, &screen->pipeline_cache); + slab_create_parent(&screen->transfer_pool, sizeof(struct zink_transfer), 16); return screen; diff --git a/src/gallium/drivers/zink/zink_screen.h b/src/gallium/drivers/zink/zink_screen.h index fac576352c1..5f19c9be8bf 100644 --- a/src/gallium/drivers/zink/zink_screen.h +++ b/src/gallium/drivers/zink/zink_screen.h @@ -51,6 +51,7 @@ struct zink_screen { struct sw_winsys *winsys; struct slab_parent_pool transfer_pool; + VkPipelineCache pipeline_cache; unsigned shader_id;