Added missing move assignment and extra check for command buffer destructor

This commit is contained in:
Kah Wei 2022-10-02 01:59:56 +08:00
parent cfa07e9b3b
commit e5df98aaa6
4 changed files with 18 additions and 4 deletions

View File

@ -24,7 +24,7 @@ namespace SHADE
/***************************************************************************/ /***************************************************************************/
SHVkCommandBuffer::~SHVkCommandBuffer(void) noexcept SHVkCommandBuffer::~SHVkCommandBuffer(void) noexcept
{ {
if (vkCommandBuffer) if (vkCommandBuffer && parentPool)
parentPool->GetLogicalDevice()->GetVkLogicalDevice().freeCommandBuffers(parentPool->GetVkCommandPool(), commandBufferCount, &vkCommandBuffer); parentPool->GetLogicalDevice()->GetVkLogicalDevice().freeCommandBuffers(parentPool->GetVkCommandPool(), commandBufferCount, &vkCommandBuffer);
} }

View File

@ -102,8 +102,6 @@ namespace SHADE
logicalDeviceHdl = rhs.logicalDeviceHdl; logicalDeviceHdl = rhs.logicalDeviceHdl;
transient = rhs.transient; transient = rhs.transient;
static_cast<ISelfHandle<SHVkCommandPool>&>(*this) = static_cast<ISelfHandle<SHVkCommandPool>&>(rhs);
rhs.vkCommandPool = VK_NULL_HANDLE; rhs.vkCommandPool = VK_NULL_HANDLE;
return *this; return *this;

View File

@ -251,6 +251,22 @@ namespace SHADE
vkLogicalDevice.destroy(nullptr); vkLogicalDevice.destroy(nullptr);
} }
SHVkLogicalDevice& SHVkLogicalDevice::operator=(SHVkLogicalDevice&& rhs) noexcept
{
if (this == &rhs)
return *this;
vkLogicalDevice = std::move (rhs.vkLogicalDevice);
queueFamilyIndices = std::move (rhs.queueFamilyIndices);
vmaAllocator = rhs.vmaAllocator;
nonDedicatedBestIndex = 0;
parentPhysicalDeviceHdl = rhs.parentPhysicalDeviceHdl;
rhs.vkLogicalDevice = VK_NULL_HANDLE;
return *this;
}
/***************************************************************************/ /***************************************************************************/
/*! /*!

View File

@ -115,7 +115,7 @@ namespace SHADE
~SHVkLogicalDevice (void) noexcept; ~SHVkLogicalDevice (void) noexcept;
SHVkLogicalDevice& operator= (SHVkLogicalDevice const& rhs) noexcept = default; SHVkLogicalDevice& operator= (SHVkLogicalDevice const& rhs) noexcept = default;
SHVkLogicalDevice& operator= (SHVkLogicalDevice&& rhs) noexcept = default; SHVkLogicalDevice& operator= (SHVkLogicalDevice&& rhs) noexcept;
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
/* PUBLIC MEMBER VARIABLES */ /* PUBLIC MEMBER VARIABLES */