Mesa (main): dzn: Fix loop condition in dzn_descriptor_set_copy()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Apr 11 07:25:08 UTC 2022


Module: Mesa
Branch: main
Commit: bc58b34087eff0b3528f64b8325e868611a95eb1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bc58b34087eff0b3528f64b8325e868611a95eb1

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Fri Apr  8 12:02:56 2022 -0700

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 <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15828>

---

 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),



More information about the mesa-commit mailing list