From fead813644eea3e990a8b0dc41973c901624ec16 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Mon, 5 Aug 2024 21:43:05 +0300 Subject: [PATCH] vulkan/runtime: store index of the push descriptor in pipeline layout Signed-off-by: Lionel Landwerlin Reviewed-by: Faith Ekstrand Part-of: --- src/vulkan/runtime/vk_pipeline_layout.c | 11 +++++++++-- src/vulkan/runtime/vk_pipeline_layout.h | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/vulkan/runtime/vk_pipeline_layout.c b/src/vulkan/runtime/vk_pipeline_layout.c index 77653464835..d4374e943ca 100644 --- a/src/vulkan/runtime/vk_pipeline_layout.c +++ b/src/vulkan/runtime/vk_pipeline_layout.c @@ -44,16 +44,23 @@ vk_pipeline_layout_init(struct vk_device *device, layout->ref_cnt = 1; layout->create_flags = pCreateInfo->flags; layout->set_count = pCreateInfo->setLayoutCount; + layout->push_descriptor_idx = UINT32_MAX; layout->destroy = vk_pipeline_layout_destroy; for (uint32_t s = 0; s < pCreateInfo->setLayoutCount; s++) { VK_FROM_HANDLE(vk_descriptor_set_layout, set_layout, pCreateInfo->pSetLayouts[s]); - if (set_layout != NULL) + if (set_layout != NULL) { layout->set_layouts[s] = vk_descriptor_set_layout_ref(set_layout); - else + if (set_layout->flags & + VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR) { + assert(layout->push_descriptor_idx == UINT32_MAX); + layout->push_descriptor_idx = s; + } + } else { layout->set_layouts[s] = NULL; + } } assert(pCreateInfo->pushConstantRangeCount < diff --git a/src/vulkan/runtime/vk_pipeline_layout.h b/src/vulkan/runtime/vk_pipeline_layout.h index f71110c20a5..2cc8acf2a74 100644 --- a/src/vulkan/runtime/vk_pipeline_layout.h +++ b/src/vulkan/runtime/vk_pipeline_layout.h @@ -59,6 +59,9 @@ struct vk_pipeline_layout { /** Number of descriptor set layouts in this pipeline layout */ uint32_t set_count; + /** Push descriptor index or UINT32_MAX if not present */ + uint32_t push_descriptor_idx; + /** Array of pointers to descriptor set layouts, indexed by set index */ struct vk_descriptor_set_layout *set_layouts[MESA_VK_MAX_DESCRIPTOR_SETS];