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:
@@ -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) {
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user