radv: Check descriptor pool entry count before allocating a new set.

It's simpler and more efficient.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17127>
This commit is contained in:
Georg Lehmann
2022-06-19 22:16:28 +02:00
committed by Marge Bot
parent ceb3ae2afb
commit 7afecd8ad8
+3 -8
View File
@@ -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. */