From d7e6541cc720a7d11d678adbeec7143b099127b0 Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Sat, 29 Jun 2019 03:07:03 +0200 Subject: [PATCH] radv: Only allocate supplied number of descriptors when variable. Fixes: b5e04e9217b "radv: Support allocating variable size descriptor sets." Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111019 Reviewed-by: Samuel Pitoiset --- src/amd/vulkan/radv_descriptor_set.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/amd/vulkan/radv_descriptor_set.c b/src/amd/vulkan/radv_descriptor_set.c index bd00f68a3cb..2891808e418 100644 --- a/src/amd/vulkan/radv_descriptor_set.c +++ b/src/amd/vulkan/radv_descriptor_set.c @@ -503,7 +503,13 @@ radv_descriptor_set_create(struct radv_device *device, } set->layout = layout; - uint32_t layout_size = align_u32(layout->size, 32); + uint32_t layout_size = layout->size; + if (variable_count) { + assert(layout->has_variable_descriptors); + layout_size = layout->binding[layout->binding_count - 1].offset + + *variable_count * layout->binding[layout->binding_count - 1].size; + } + layout_size = align_u32(layout_size, 32); if (layout_size) { set->size = layout_size; -- 2.30.2