radv: Fix interactions between variable descriptor count and inline uniform blocks.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tue, 2 Jul 2019 09:32:44 +0000 (11:32 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Wed, 3 Jul 2019 10:43:35 +0000 (10:43 +0000)
Fixes: d7e6541cc72 "radv: Only allocate supplied number of descriptors when variable."
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/vulkan/radv_descriptor_set.c

index 2891808e41876bff1ff5052b87cdf586cee18046..9a6e9cead9c51535f49d9c687cb1bcf2dacdc117 100644 (file)
@@ -506,8 +506,12 @@ radv_descriptor_set_create(struct radv_device *device,
        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)
+                       stride = 1;
+
                layout_size = layout->binding[layout->binding_count - 1].offset +
-                             *variable_count * layout->binding[layout->binding_count - 1].size;
+                             *variable_count * stride;
        }
        layout_size = align_u32(layout_size, 32);
        if (layout_size) {