Fix #141628: Vulkan: Crash when index buffer could not be allocated

Added an early exit when the index buffer could not be allocated. Most
likely when there is an out of memory issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/141653
This commit is contained in:
Jeroen Bakker
2025-07-09 08:57:57 +02:00
parent 0d944c16c6
commit 2170739ba3
3 changed files with 15 additions and 0 deletions

View File

@@ -27,6 +27,10 @@ void VKIndexBuffer::ensure_updated()
if (!buffer_.is_allocated()) {
allocate();
if (!buffer_.is_allocated()) {
CLOG_ERROR(&LOG, "Unable to allocate index buffer. Most likely an out of memory issue.");
return;
}
}
if (data_ == nullptr) {

View File

@@ -13,6 +13,10 @@
#include "vk_staging_buffer.hh"
#include "vk_state_manager.hh"
#include "CLG_log.h"
static CLG_LogRef LOG = {"gpu.vulkan"};
namespace blender::gpu {
void VKUniformBuffer::update(const void *data)
@@ -55,6 +59,12 @@ void VKUniformBuffer::ensure_updated()
{
if (!buffer_.is_allocated()) {
allocate();
if (!buffer_.is_allocated()) {
CLOG_ERROR(&LOG,
"Unable to allocate uniform buffer [%s]. Most likely an out of memory issue.",
name_);
return;
}
}
/* Upload attached data, during bind time. */

View File

@@ -169,6 +169,7 @@ void VKVertexBuffer::upload_data()
allocate();
/* If allocation fails, don't upload.*/
if (!buffer_.is_allocated()) {
CLOG_ERROR(&LOG, "Unable to allocate vertex buffer. Most likely an out of memory issue.");
return;
}
}