Mesa (main): radv: always check entry count in descriptor pool when allocating
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri May 13 15:35:59 UTC 2022
Module: Mesa
Branch: main
Commit: 580046e49faa88bb6d9c183f491f2779de1769f3
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=580046e49faa88bb6d9c183f491f2779de1769f3
Author: Victor Hermann Chiletto <v at hnn.net.br>
Date: Fri May 13 02:53:18 2022 -0300
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: 96a240e1767 ("radv: fix memory leak of descriptor set layout")
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16490>
---
src/amd/vulkan/radv_descriptor_set.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/amd/vulkan/radv_descriptor_set.c b/src/amd/vulkan/radv_descriptor_set.c
index 81df56438e7..6c167d81797 100644
--- a/src/amd/vulkan/radv_descriptor_set.c
+++ b/src/amd/vulkan/radv_descriptor_set.c
@@ -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;
}
More information about the mesa-commit
mailing list