From bc58b34087eff0b3528f64b8325e868611a95eb1 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Fri, 8 Apr 2022 12:02:56 -0700 Subject: [PATCH] dzn: Fix loop condition in dzn_descriptor_set_copy() We need to make sure we still have descriptors to copy in the while() condition. While at it, drop the assert() checking that the number of descriptors already copied is less than the requested number. Reviewed-by: Jesse Natalie Part-of: --- src/microsoft/vulkan/dzn_descriptor_set.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/microsoft/vulkan/dzn_descriptor_set.cpp b/src/microsoft/vulkan/dzn_descriptor_set.cpp index 625682ed682..557e454db2c 100644 --- a/src/microsoft/vulkan/dzn_descriptor_set.cpp +++ b/src/microsoft/vulkan/dzn_descriptor_set.cpp @@ -1713,13 +1713,13 @@ dzn_descriptor_set_copy(const VkCopyDescriptorSet *pDescriptorCopy) uint32_t copied_count = 0; while (dzn_descriptor_set_ptr_is_valid(&src_ptr) && - dzn_descriptor_set_ptr_is_valid(&dst_ptr)) { + dzn_descriptor_set_ptr_is_valid(&dst_ptr) && + copied_count < pDescriptorCopy->descriptorCount) { VkDescriptorType src_type = dzn_descriptor_set_get_desc_vk_type(src_set, &src_ptr); VkDescriptorType dst_type = dzn_descriptor_set_get_desc_vk_type(dst_set, &dst_ptr); - assert(copied_count < pDescriptorCopy->descriptorCount); assert(src_type == dst_type); uint32_t count = MIN2(dzn_descriptor_set_remaining_descs_in_binding(src_set, &src_ptr),