From ff264efe7efab3a9f070f0f7b41c5b2c5f90ceae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 3 Dec 2017 10:35:34 +0100 Subject: [PATCH] Change some Crash() to asserts in VulkanDeviceAllocator --- Common/Vulkan/VulkanMemory.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Common/Vulkan/VulkanMemory.cpp b/Common/Vulkan/VulkanMemory.cpp index c46195db30..dad507d1e9 100644 --- a/Common/Vulkan/VulkanMemory.cpp +++ b/Common/Vulkan/VulkanMemory.cpp @@ -287,14 +287,9 @@ void VulkanDeviceAllocator::Free(VkDeviceMemory deviceMemory, size_t offset) { } auto it = slab.allocSizes.find(start); - if (it == slab.allocSizes.end()) { - // Ack, a double free? - Crash(); - } - if (slab.usage[start] != 1) { - // This means a double free, while queued to actually free. - Crash(); - } + _assert_msg_(G3D, it != slab.allocSizes.end(), "Double free?"); + // This means a double free, while queued to actually free. + _assert_msg_(G3D, slab.usage[start] == 1, "Double free when queued to free!"); // Mark it as "free in progress". slab.usage[start] = 2; @@ -303,9 +298,7 @@ void VulkanDeviceAllocator::Free(VkDeviceMemory deviceMemory, size_t offset) { } // Wrong deviceMemory even? Maybe it was already decimated, but that means a double-free. - if (!found) { - Crash(); - } + _assert_msg_(G3D, found, "Failed to find allocation to free! Double-freed?"); // Okay, now enqueue. It's valid. FreeInfo *info = new FreeInfo(this, deviceMemory, offset);