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() { void CircularBuffer::Clear() {
for (auto it = allocations_.begin(); it != allocations_.end();) { for (auto alloc : allocations_) {
delete *it; delete alloc;
it = allocations_.erase(it);
} }
allocations_.clear();
write_head_ = read_head_ = 0; write_head_ = read_head_ = 0;
} }

View File

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