From 4f959e368cfea073a459a7d18337c2c55fd958ae Mon Sep 17 00:00:00 2001 From: Ishi Tatsuyuki Date: Thu, 24 Jun 2021 21:12:48 +0900 Subject: [PATCH] radv: ignore redundant variable descriptor counts (v2) The Vulkan specification says: "If VkDescriptorSetAllocateInfo::pSetLayouts[i] does not include a variable count descriptor binding, then pDescriptorCounts[i] is ignored". The previous code triggered an assertion in such cases, and this patch fixes it. v2: removed the offending assertion that is now always satisfied and reworded the commit message with a reference to Vulkan spec. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4992 Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_descriptor_set.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/amd/vulkan/radv_descriptor_set.c b/src/amd/vulkan/radv_descriptor_set.c index f2a999d..409145e 100644 --- a/src/amd/vulkan/radv_descriptor_set.c +++ b/src/amd/vulkan/radv_descriptor_set.c @@ -578,7 +578,6 @@ radv_descriptor_set_create(struct radv_device *device, struct radv_descriptor_po set->header.buffer_count = buffer_count; uint32_t layout_size = layout->size; if (variable_count) { - assert(layout->has_variable_descriptors); uint32_t stride = layout->binding[layout->binding_count - 1].size; if (layout->binding[layout->binding_count - 1].type == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT) @@ -885,7 +884,7 @@ radv_AllocateDescriptorSets(VkDevice _device, const VkDescriptorSetAllocateInfo RADV_FROM_HANDLE(radv_descriptor_set_layout, layout, pAllocateInfo->pSetLayouts[i]); const uint32_t *variable_count = NULL; - if (variable_counts) { + if (layout->has_variable_descriptors && variable_counts) { if (i < variable_counts->descriptorSetCount) variable_count = variable_counts->pDescriptorCounts + i; else -- 2.7.4