Permalink
Browse files

Fix memory-scan bug in VulkanDeviceAllocator that probably causes som…

…e fragmentation.
  • Loading branch information...
hrydgard committed Dec 3, 2017
1 parent 1bf44b7 commit ac6b4912870ab381619bf0ffa8cdc12766adf54d
Showing with 3 additions and 2 deletions.
  1. +3 −2 Common/Vulkan/VulkanMemory.cpp
@@ -246,15 +246,16 @@ bool VulkanDeviceAllocator::AllocateFromSlab(Slab &slab, size_t &start, size_t b
return false;
}
// Slow linear scan.
for (size_t i = 0; i < blocks; ++i) {
if (slab.usage[start + i]) {
// If we just ran into one, there's probably an allocation size.
auto it = slab.allocSizes.find(start + i);
if (it != slab.allocSizes.end()) {
start += i + it->second;
start += it->second;
} else {
// We don't know how big it is, so just skip to the next one.
start += i + 1;
start += 1;
}
return false;
}

0 comments on commit ac6b491

Please sign in to comment.