Mesa (main): radv: Check descriptor pool entry count before allocating a new set.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jun 20 11:14:48 UTC 2022
Module: Mesa
Branch: main
Commit: 7afecd8ad8eb536d17679c2b19b5b645fe3115ba
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7afecd8ad8eb536d17679c2b19b5b645fe3115ba
Author: Georg Lehmann <dadschoorse at gmail.com>
Date: Sun Jun 19 22:16:28 2022 +0200
radv: Check descriptor pool entry count before allocating a new set.
It's simpler and more efficient.
Signed-off-by: Georg Lehmann <dadschoorse at gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer at gmail.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17127>
---
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. */
More information about the mesa-commit
mailing list