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>
(cherry picked from commit 580046e49f)
This commit is contained in:
Victor Hermann Chiletto 2022-05-13 02:53:18 -03:00 committed by Dylan Baker
parent 2cca7dce1e
commit 28264dd5c9
2 changed files with 6 additions and 3 deletions

View file

@ -22,7 +22,7 @@
"description": "radv: always check entry count in descriptor pool when allocating",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "96a240e176701f9b305c4bd273da9a8aee78e280"
},

View file

@ -652,8 +652,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;
}