vulkan/util: Make multialloc succeed with 0 allocations.

I wanted to use it for the attachments and clear values of a
vkCmdBeginRenderPass(), but both can be 0 count.  In that case, we would
end up with vk_default_alloc(0,0) because nothing had set the alignment,
and assertion fail instead of allocating 0 bytes.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20994>
This commit is contained in:
Emma Anholt
2022-10-06 08:59:29 -07:00
committed by Marge Bot
parent d142c845d0
commit fce10ddf0f

View File

@@ -185,7 +185,7 @@ struct vk_multialloc {
};
#define VK_MULTIALLOC(_name) \
struct vk_multialloc _name = { 0, }
struct vk_multialloc _name = { .align = 1 }
static ALWAYS_INLINE void
vk_multialloc_add_size_align(struct vk_multialloc *ma,