From 63d40ffbf91bb09b4abe933af2c922fe48869b11 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sat, 11 Jun 2022 04:45:29 +0200 Subject: [PATCH] Avoiding adding empty objects to the delete list --- .../rendering/vulkan/system/vk_commandbuffer.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/common/rendering/vulkan/system/vk_commandbuffer.h b/src/common/rendering/vulkan/system/vk_commandbuffer.h index 0b86f0cbee..635d1f27b3 100644 --- a/src/common/rendering/vulkan/system/vk_commandbuffer.h +++ b/src/common/rendering/vulkan/system/vk_commandbuffer.h @@ -39,15 +39,15 @@ public: std::vector> CommandBuffers; size_t TotalSize = 0; - void Add(std::unique_ptr obj) { TotalSize += obj->size; Buffers.push_back(std::move(obj)); } - void Add(std::unique_ptr obj) { Samplers.push_back(std::move(obj)); } - void Add(std::unique_ptr obj) { Images.push_back(std::move(obj)); } - void Add(std::unique_ptr obj) { ImageViews.push_back(std::move(obj)); } - void Add(std::unique_ptr obj) { Framebuffers.push_back(std::move(obj)); } - void Add(std::unique_ptr obj) { AccelStructs.push_back(std::move(obj)); } - void Add(std::unique_ptr obj) { DescriptorPools.push_back(std::move(obj)); } - void Add(std::unique_ptr obj) { Descriptors.push_back(std::move(obj)); } - void Add(std::unique_ptr obj) { CommandBuffers.push_back(std::move(obj)); } + void Add(std::unique_ptr obj) { if (obj) { TotalSize += obj->size; Buffers.push_back(std::move(obj)); } } + void Add(std::unique_ptr obj) { if (obj) { Samplers.push_back(std::move(obj)); } } + void Add(std::unique_ptr obj) { if (obj) { Images.push_back(std::move(obj)); } } + void Add(std::unique_ptr obj) { if (obj) { ImageViews.push_back(std::move(obj)); } } + void Add(std::unique_ptr obj) { if (obj) { Framebuffers.push_back(std::move(obj)); } } + void Add(std::unique_ptr obj) { if (obj) { AccelStructs.push_back(std::move(obj)); } } + void Add(std::unique_ptr obj) { if (obj) { DescriptorPools.push_back(std::move(obj)); } } + void Add(std::unique_ptr obj) { if (obj) { Descriptors.push_back(std::move(obj)); } } + void Add(std::unique_ptr obj) { if (obj) { CommandBuffers.push_back(std::move(obj)); } } }; std::unique_ptr TransferDeleteList = std::make_unique();