radv: always check entry count in descriptor pool when allocating

Previously this check was skipped for pools with
VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT unset, but after
96a240e1 we need to check this otherwise we risk overflowing
radv_descriptor_pool::entries into the host memory base

This fixes a crash to desktop when launching Dota 2, which overallocates
descriptor sets and expects an error to allocate another descriptor pool

Fixes: 96a240e176 ("radv: fix memory leak of descriptor set layout")

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16490>
This commit is contained in:
Victor Hermann Chiletto 2022-05-13 02:53:18 -03:00 committed by Marge Bot
parent 622e2ae08a
commit 580046e49f
1 changed files with 5 additions and 2 deletions

View File

@ -679,8 +679,11 @@ 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->host_memory_base && pool->entry_count == pool->max_entry_count) {
vk_free2(&device->vk.alloc, NULL, set);
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;
}