From 1f5d56304f51a09943e72f2b1aad0683d9220482 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 3 Feb 2016 02:50:06 -0800 Subject: [PATCH] anv/descriptor_set: Fix descriptor copies We weren't pulling the actual binding location information out of the set layout. The new code mirrors the descriptor write code. --- src/vulkan/anv_descriptor_set.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/vulkan/anv_descriptor_set.c b/src/vulkan/anv_descriptor_set.c index f93ea819b0c..0ddd4bf1bc2 100644 --- a/src/vulkan/anv_descriptor_set.c +++ b/src/vulkan/anv_descriptor_set.c @@ -584,11 +584,21 @@ void anv_UpdateDescriptorSets( for (uint32_t i = 0; i < descriptorCopyCount; i++) { const VkCopyDescriptorSet *copy = &pDescriptorCopies[i]; ANV_FROM_HANDLE(anv_descriptor_set, src, copy->dstSet); - ANV_FROM_HANDLE(anv_descriptor_set, dest, copy->dstSet); - for (uint32_t j = 0; j < copy->descriptorCount; j++) { - dest->descriptors[copy->dstBinding + j] = - src->descriptors[copy->srcBinding + j]; - } - dest->buffer_count = src->buffer_count; + ANV_FROM_HANDLE(anv_descriptor_set, dst, copy->dstSet); + + const struct anv_descriptor_set_binding_layout *src_layout = + &src->layout->binding[copy->srcBinding]; + struct anv_descriptor *src_desc = + &src->descriptors[src_layout->descriptor_index]; + src_desc += copy->srcArrayElement; + + const struct anv_descriptor_set_binding_layout *dst_layout = + &dst->layout->binding[copy->dstBinding]; + struct anv_descriptor *dst_desc = + &dst->descriptors[dst_layout->descriptor_index]; + dst_desc += copy->dstArrayElement; + + for (uint32_t j = 0; j < copy->descriptorCount; j++) + dst_desc[j] = src_desc[j]; } } -- 2.30.2