v3dv/descriptor_set: don't free individual set if not allowed

If we have a host_memory_base pointer it means that we are handling
the pool memory as a whole, so each set is a sub-slice of the memory
pool. In this case we can't just free the individual set. In other
words, VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT is not set.

Note tha at that point we were able to sub-allocate an set, and we are
failing to sub-allocate the pool bo for the descripto bo. So
technically we could try to return that set to the pool (so undo the
change on host_memory_ptr before), that I assume was my intention when
(wrongly) calling vk_free there. But in practice, at that point we are
already on a out of descriptor pool situation, so in the end it
doesn't even matter.

This fixes a double free crash with the UE4 VehicleGame demo.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9640>
This commit is contained in:
Alejandro Piñeiro 2021-03-16 22:07:44 +00:00 committed by Marge Bot
parent aefac60741
commit c373b24369
1 changed files with 0 additions and 1 deletions

View File

@ -829,7 +829,6 @@ descriptor_set_create(struct v3dv_device *device,
sizeof(pool->entries[0]) * (pool->entry_count - index));
} else {
assert(pool->host_memory_base);
vk_object_free(&device->vk, NULL, set);
return out_of_pool_memory(device, pool);
}