From fd89690795ad6457ab6058c11f03a98c47d09849 Mon Sep 17 00:00:00 2001 From: SoroushIMG Date: Thu, 13 Oct 2022 22:48:44 +0100 Subject: [PATCH] zink: add pushconst only pipeline layout Now that all gfx pipelines share the same push constant layout, create a screen wide push const only layout that is compatible with all future programs. This layout will be used to update push constant values, so that the update can happen at any point before draw call. Part-of: --- src/gallium/drivers/zink/zink_program.c | 2 +- src/gallium/drivers/zink/zink_screen.c | 6 ++++++ src/gallium/drivers/zink/zink_types.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c index e696346f34a..a54d1d29588 100644 --- a/src/gallium/drivers/zink/zink_program.c +++ b/src/gallium/drivers/zink/zink_program.c @@ -807,7 +807,7 @@ zink_pipeline_layout_create(struct zink_screen *screen, VkDescriptorSetLayout *d pcr[1].size = sizeof(float) * 6; plci.pushConstantRangeCount = 2; } - plci.pPushConstantRanges = &pcr[0]; + plci.pPushConstantRanges = pcr; VkPipelineLayout layout; VkResult result = VKSCR(CreatePipelineLayout)(screen->dev, &plci, NULL, &layout); diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index a3b811e643b..57596ec32b1 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -1338,6 +1338,8 @@ zink_destroy_screen(struct pipe_screen *pscreen) util_vertex_state_cache_deinit(&screen->vertex_state_cache); + VKSCR(DestroyPipelineLayout)(screen->dev, screen->gfx_push_constant_layout, NULL); + u_transfer_helper_destroy(pscreen->transfer_helper); util_queue_finish(&screen->cache_get_thread); util_queue_destroy(&screen->cache_get_thread); @@ -2604,6 +2606,10 @@ zink_internal_create_screen(const struct pipe_screen_config *config) screen->buffer_barrier = zink_resource_buffer_barrier; } + screen->gfx_push_constant_layout = zink_pipeline_layout_create(screen, NULL, 0, false); + if (screen->gfx_push_constant_layout == VK_NULL_HANDLE) + goto fail; + if (!zink_descriptor_layouts_init(screen)) goto fail; diff --git a/src/gallium/drivers/zink/zink_types.h b/src/gallium/drivers/zink/zink_types.h index 9ec56649948..3653f42204e 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -1273,6 +1273,7 @@ struct zink_screen { struct zink_modifier_prop modifier_props[PIPE_FORMAT_COUNT]; VkExtent2D maxSampleLocationGridSize[5]; + VkPipelineLayout gfx_push_constant_layout; struct { bool broken_l4a4;