From 7afecd8ad8eb536d17679c2b19b5b645fe3115ba Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Sun, 19 Jun 2022 22:16:28 +0200 Subject: [PATCH] radv: Check descriptor pool entry count before allocating a new set. It's simpler and more efficient. Signed-off-by: Georg Lehmann Reviewed-by: Samuel Pitoiset Reviewed-by: Konstantin Seurer Reviewed-by: Mike Blumenkrantz Part-of: --- src/amd/vulkan/radv_descriptor_set.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/amd/vulkan/radv_descriptor_set.c b/src/amd/vulkan/radv_descriptor_set.c index ba3dc3d9b2a..46ebb53d71c 100644 --- a/src/amd/vulkan/radv_descriptor_set.c +++ b/src/amd/vulkan/radv_descriptor_set.c @@ -625,6 +625,9 @@ radv_descriptor_set_create(struct radv_device *device, struct radv_descriptor_po struct radv_descriptor_set_layout *layout, const uint32_t *variable_count, struct radv_descriptor_set **out_set) { + if (pool->entry_count == pool->max_entry_count) + return VK_ERROR_OUT_OF_POOL_MEMORY; + struct radv_descriptor_set *set; uint32_t buffer_count = layout->buffer_count; if (variable_count) { @@ -678,14 +681,6 @@ radv_descriptor_set_create(struct radv_device *device, struct radv_descriptor_po layout_size = align_u32(layout_size, 32); set->header.size = layout_size; - if (pool->entry_count == pool->max_entry_count) { - if (!pool->host_memory_base) { - vk_free2(&device->vk.alloc, NULL, set); - } - - return VK_ERROR_OUT_OF_POOL_MEMORY; - } - /* try to allocate linearly first, so that we don't spend * time looking for gaps if the app only allocates & * resets via the pool. */