nvk: Early-out impossible descriptor allocations
Also, return VK_ERROR_FRAGMENTED_POOL when appropriate. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28494>
This commit is contained in:
@@ -487,9 +487,14 @@ nvk_descriptor_pool_alloc(struct nvk_descriptor_pool *pool,
|
||||
uint64_t *addr_out, void **map_out)
|
||||
{
|
||||
assert(size > 0);
|
||||
assert(size % alignment == 0);
|
||||
|
||||
if (size > pool->heap.free_size)
|
||||
return VK_ERROR_OUT_OF_POOL_MEMORY;
|
||||
|
||||
uint64_t addr = util_vma_heap_alloc(&pool->heap, size, alignment);
|
||||
if (addr == 0)
|
||||
return VK_ERROR_OUT_OF_POOL_MEMORY;
|
||||
return VK_ERROR_FRAGMENTED_POOL;
|
||||
|
||||
assert(addr >= pool->bo->offset);
|
||||
assert(addr + size <= pool->bo->offset + pool->bo->size);
|
||||
|
||||
Reference in New Issue
Block a user