Vulkan: Fix Out of Resources Crash

When a descriptor pool cannot allocate a descriptor set in stead
of resulting `VK_ERROR_OUT_OF_POOL_MEMORY` it is adviced that
drivers will return `VK_ERROR_FRAGMENTED_POOL`.

Before this PR the Vulkan Backend crashed as it only checked the
out of pool memory. According to the Vulkan specification it is
adviced to driver developers to report fragmented pool.

The crash happened as no new pool was allocated and no descriptor
set could be allocated anymore.

This change improved the reliability of the vulkan backend to be
able draw an animation in the 3d viewport for half an hour without
crashing. Before this change Blender would crash in a few seconds.

Pull Request: https://projects.blender.org/blender/blender/pulls/108416
This commit is contained in:
Jeroen Bakker 2023-05-30 13:48:17 +02:00
parent a08652b56c
commit 2cc0f94d68
1 changed files with 1 additions and 1 deletions

View File

@ -91,7 +91,7 @@ std::unique_ptr<VKDescriptorSet> VKDescriptorPools::allocate(
VkDescriptorSet vk_descriptor_set = VK_NULL_HANDLE;
VkResult result = vkAllocateDescriptorSets(vk_device_, &allocate_info, &vk_descriptor_set);
if (result == VK_ERROR_OUT_OF_POOL_MEMORY) {
if (ELEM(result, VK_ERROR_OUT_OF_POOL_MEMORY, VK_ERROR_FRAGMENTED_POOL)) {
if (is_last_pool_active()) {
add_new_pool();
activate_last_pool();