Skip to content

Commit

Permalink
Handle heap.size better.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans-Kristian Arntzen committed Oct 18, 2020
1 parent 01c3e55 commit 21f845b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vulkan/memory_allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,11 @@ bool DeviceAllocator::allocate(uint32_t size, uint32_t memory_type, VkDeviceMemo
{
if (table->vkMapMemory(device->get_device(), device_memory, 0, VK_WHOLE_SIZE,
0, reinterpret_cast<void **>(host_memory)) != VK_SUCCESS)
{
table->vkFreeMemory(device->get_device(), device_memory, nullptr);
heap.size -= size;
return false;
}
}

return true;
Expand Down Expand Up @@ -584,6 +588,7 @@ bool DeviceAllocator::allocate(uint32_t size, uint32_t memory_type, VkDeviceMemo
VK_SUCCESS)
{
table->vkFreeMemory(device->get_device(), device_memory, nullptr);
heap.size -= size;
return false;
}
}
Expand Down

0 comments on commit 21f845b

Please sign in to comment.