radv: fix vkUpdateDescriptorSets with inline uniform blocks
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 21 Oct 2019 11:32:05 +0000 (13:32 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 23 Oct 2019 07:59:22 +0000 (09:59 +0200)
descriptorCount is the number of bytes into the descriptor, so
it shouldn't be used as an index. srcArrayElement/dstArrayElement
specify the starting byte offset within the binding to copy from/to.

This fixes new CTS tests:
dEQP-VK.binding_model.descriptor_copy.*.inline_uniform_block_*
dEQP-VK.binding_model.descriptor_copy.*.mix_3
dEQP-VK.binding_model.descriptor_copy.*.mix_array1

Fixes: 8d2654a4197 ("radv: Support VK_EXT_inline_uniform_block.")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_descriptor_set.c

index 6f999a4595b27dca7f631c827c2db81507e3575b..57dfd2232b9147a962432fdad755301a4e4be2ed 100644 (file)
@@ -1076,6 +1076,14 @@ void radv_update_descriptor_sets(
                src_ptr += src_binding_layout->offset / 4;
                dst_ptr += dst_binding_layout->offset / 4;
 
+               if (src_binding_layout->type == VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT) {
+                       src_ptr += copyset->srcArrayElement / 4;
+                       dst_ptr += copyset->dstArrayElement / 4;
+
+                       memcpy(dst_ptr, src_ptr, copyset->descriptorCount);
+                       continue;
+               }
+
                src_ptr += src_binding_layout->size * copyset->srcArrayElement / 4;
                dst_ptr += dst_binding_layout->size * copyset->dstArrayElement / 4;