diff --git a/SHADE_Engine/src/Graphics/Commands/SHVkCommandBuffer.cpp b/SHADE_Engine/src/Graphics/Commands/SHVkCommandBuffer.cpp index eb65598c..9ebbd227 100644 --- a/SHADE_Engine/src/Graphics/Commands/SHVkCommandBuffer.cpp +++ b/SHADE_Engine/src/Graphics/Commands/SHVkCommandBuffer.cpp @@ -24,7 +24,7 @@ namespace SHADE /***************************************************************************/ SHVkCommandBuffer::~SHVkCommandBuffer(void) noexcept { - if (vkCommandBuffer) + if (vkCommandBuffer && parentPool) parentPool->GetLogicalDevice()->GetVkLogicalDevice().freeCommandBuffers(parentPool->GetVkCommandPool(), commandBufferCount, &vkCommandBuffer); } diff --git a/SHADE_Engine/src/Graphics/Commands/SHVkCommandPool.cpp b/SHADE_Engine/src/Graphics/Commands/SHVkCommandPool.cpp index 881ee998..e1470898 100644 --- a/SHADE_Engine/src/Graphics/Commands/SHVkCommandPool.cpp +++ b/SHADE_Engine/src/Graphics/Commands/SHVkCommandPool.cpp @@ -102,8 +102,6 @@ namespace SHADE logicalDeviceHdl = rhs.logicalDeviceHdl; transient = rhs.transient; - static_cast&>(*this) = static_cast&>(rhs); - rhs.vkCommandPool = VK_NULL_HANDLE; return *this; diff --git a/SHADE_Engine/src/Graphics/Devices/SHVkLogicalDevice.cpp b/SHADE_Engine/src/Graphics/Devices/SHVkLogicalDevice.cpp index 766a27c6..3f8aa239 100644 --- a/SHADE_Engine/src/Graphics/Devices/SHVkLogicalDevice.cpp +++ b/SHADE_Engine/src/Graphics/Devices/SHVkLogicalDevice.cpp @@ -251,6 +251,22 @@ namespace SHADE 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; + } + /***************************************************************************/ /*! diff --git a/SHADE_Engine/src/Graphics/Devices/SHVkLogicalDevice.h b/SHADE_Engine/src/Graphics/Devices/SHVkLogicalDevice.h index 1272f68f..5c400e02 100644 --- a/SHADE_Engine/src/Graphics/Devices/SHVkLogicalDevice.h +++ b/SHADE_Engine/src/Graphics/Devices/SHVkLogicalDevice.h @@ -115,7 +115,7 @@ namespace SHADE ~SHVkLogicalDevice (void) noexcept; SHVkLogicalDevice& operator= (SHVkLogicalDevice const& rhs) noexcept = default; - SHVkLogicalDevice& operator= (SHVkLogicalDevice&& rhs) noexcept = default; + SHVkLogicalDevice& operator= (SHVkLogicalDevice&& rhs) noexcept; /*-----------------------------------------------------------------------*/ /* PUBLIC MEMBER VARIABLES */