CircularBuffer: use std::list for allocations instead of a vector.

This commit is contained in:
Dr. Chat 2016-04-09 21:40:18 -05:00
parent 4811ebc2ce
commit 2bd603bf18
2 changed files with 5 additions and 6 deletions

View File

@ -211,10 +211,10 @@ void CircularBuffer::Flush(Allocation* allocation) {
}
void CircularBuffer::Clear() {
for (auto it = allocations_.begin(); it != allocations_.end();) {
delete *it;
it = allocations_.erase(it);
for (auto alloc : allocations_) {
delete alloc;
}
allocations_.clear();
write_head_ = read_head_ = 0;
}

View File

@ -10,7 +10,7 @@
#ifndef XENIA_UI_VULKAN_CIRCULAR_BUFFER_H_
#define XENIA_UI_VULKAN_CIRCULAR_BUFFER_H_
#include <unordered_map>
#include <list>
#include "xenia/ui/vulkan/vulkan.h"
#include "xenia/ui/vulkan/vulkan_device.h"
@ -77,8 +77,7 @@ class CircularBuffer {
VkDeviceSize gpu_base_ = 0;
uint8_t* host_base_ = nullptr;
std::unordered_map<uint64_t, uintptr_t> allocation_cache_;
std::vector<Allocation*> allocations_;
std::list<Allocation*> allocations_;
};
} // namespace vulkan