From 93cdea62f6d386fb64473a105ef44bd18b2ad598 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Fri, 10 Oct 2025 15:19:43 +0200 Subject: [PATCH] Fix #146560: Vulkan: Improve multires out of memory issue This seems like an out of memory issue where the storage buffer could not be allocated but still used as a destination for a copy. After an out of memory issue memory can be fragmented and any allocation can still fail. On `AMD Radeon(TM) 890M Graphics Advanced Micro Devices AMD` `24.30.58` I got to multires subdivision level 2+6 using the steps described in the report. 2+7 is failing for me. 2+6 already requires 16GB of memory using large chunks. OpenGL and Vulkan work with other limits and memory models and can have different behavior. This PR only improves the mentioned issue, but can still fail in other areas. Pull Request: https://projects.blender.org/blender/blender/pulls/147713 --- source/blender/gpu/vulkan/vk_storage_buffer.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/blender/gpu/vulkan/vk_storage_buffer.cc b/source/blender/gpu/vulkan/vk_storage_buffer.cc index ba19bb19137..4130db6f357 100644 --- a/source/blender/gpu/vulkan/vk_storage_buffer.cc +++ b/source/blender/gpu/vulkan/vk_storage_buffer.cc @@ -36,6 +36,12 @@ void VKStorageBuffer::update(const void *data) { VKContext &context = *VKContext::get(); ensure_allocated(); + if (!buffer_.is_allocated()) { + CLOG_WARN(&LOG, + "Unable to upload data to storage buffer as the storage buffer could not be " + "allocated on GPU."); + return; + } if (usage_ == GPU_USAGE_STREAM) { const VKDevice &device = VKBackend::get().device; @@ -81,8 +87,9 @@ void VKStorageBuffer::allocate() VkMemoryPropertyFlags(0), VmaAllocationCreateFlags(0), 0.8f); - BLI_assert(buffer_.is_allocated()); - debug::object_label(buffer_.vk_handle(), name_); + if (buffer_.is_allocated()) { + debug::object_label(buffer_.vk_handle(), name_); + } } void VKStorageBuffer::bind(int slot)