vulkan/runtime: track dynamics descriptor in a set layout

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34874>
This commit is contained in:
Lionel Landwerlin
2024-08-05 23:03:46 +03:00
committed by Marge Bot
parent fead813644
commit a29d0cfaf0
3 changed files with 13 additions and 0 deletions
@@ -37,6 +37,9 @@ struct vk_descriptor_set_layout {
VkDescriptorSetLayoutCreateFlags flags;
/** Number of dynamic descriptors in this layout */
uint32_t dynamic_descriptor_count;
/* BLAKE3 hash of the descriptor set layout. This is used by the common
* pipeline code to properly cache shaders, including handling pipeline
* layouts. It must be populated by the driver or you risk pipeline cache
+3
View File
@@ -47,10 +47,12 @@ vk_pipeline_layout_init(struct vk_device *device,
layout->push_descriptor_idx = UINT32_MAX;
layout->destroy = vk_pipeline_layout_destroy;
uint32_t dynamic_descriptor_count = 0;
for (uint32_t s = 0; s < pCreateInfo->setLayoutCount; s++) {
VK_FROM_HANDLE(vk_descriptor_set_layout, set_layout,
pCreateInfo->pSetLayouts[s]);
layout->dynamic_descriptor_offset[s] = dynamic_descriptor_count;
if (set_layout != NULL) {
layout->set_layouts[s] = vk_descriptor_set_layout_ref(set_layout);
if (set_layout->flags &
@@ -58,6 +60,7 @@ vk_pipeline_layout_init(struct vk_device *device,
assert(layout->push_descriptor_idx == UINT32_MAX);
layout->push_descriptor_idx = s;
}
dynamic_descriptor_count += set_layout->dynamic_descriptor_count;
} else {
layout->set_layouts[s] = NULL;
}
+7
View File
@@ -65,6 +65,13 @@ struct vk_pipeline_layout {
/** Array of pointers to descriptor set layouts, indexed by set index */
struct vk_descriptor_set_layout *set_layouts[MESA_VK_MAX_DESCRIPTOR_SETS];
/** Dynamic descriptors offset
*
* For each descriptor set layout, this is the sum of dynamic buffers in
* each preceding descriptor set.
*/
uint32_t dynamic_descriptor_offset[MESA_VK_MAX_DESCRIPTOR_SETS];
/** Number of push constant ranges in this pipeline layout */
uint32_t push_range_count;