mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Fix memory-scan bug in VulkanDeviceAllocator that probably causes some fragmentation.
This commit is contained in:
parent
1bf44b7ca3
commit
ac6b491287
1 changed files with 3 additions and 2 deletions
|
@ -246,15 +246,16 @@ bool VulkanDeviceAllocator::AllocateFromSlab(Slab &slab, size_t &start, size_t b
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Slow linear scan.
|
||||||
for (size_t i = 0; i < blocks; ++i) {
|
for (size_t i = 0; i < blocks; ++i) {
|
||||||
if (slab.usage[start + i]) {
|
if (slab.usage[start + i]) {
|
||||||
// If we just ran into one, there's probably an allocation size.
|
// If we just ran into one, there's probably an allocation size.
|
||||||
auto it = slab.allocSizes.find(start + i);
|
auto it = slab.allocSizes.find(start + i);
|
||||||
if (it != slab.allocSizes.end()) {
|
if (it != slab.allocSizes.end()) {
|
||||||
start += i + it->second;
|
start += it->second;
|
||||||
} else {
|
} else {
|
||||||
// We don't know how big it is, so just skip to the next one.
|
// We don't know how big it is, so just skip to the next one.
|
||||||
start += i + 1;
|
start += 1;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue