Merge branch 'vulkan' of github.com:benvanik/xenia into spv_translator

This commit is contained in:
Dr. Chat 2016-02-21 12:47:02 -06:00
commit a7880645be
2 changed files with 19 additions and 12 deletions

View File

@ -53,6 +53,7 @@ CommandBufferPool::CommandBufferPool(VkDevice device,
} }
CommandBufferPool::~CommandBufferPool() { CommandBufferPool::~CommandBufferPool() {
FreeAllEntries();
vkDestroyCommandPool(device_, command_pool_, nullptr); vkDestroyCommandPool(device_, command_pool_, nullptr);
command_pool_ = nullptr; command_pool_ = nullptr;
} }

View File

@ -33,18 +33,9 @@ class BaseFencedPool {
// TODO(benvanik): wait on fence until done. // TODO(benvanik): wait on fence until done.
assert_null(pending_batch_list_head_); assert_null(pending_batch_list_head_);
// Run down free lists. // Subclasses must call FreeAllEntries() to properly clean up things.
while (free_batch_list_head_) { assert_null(free_batch_list_head_);
auto batch = free_batch_list_head_; assert_null(free_entry_list_head_);
free_batch_list_head_ = batch->next;
delete batch;
}
while (free_entry_list_head_) {
auto entry = free_entry_list_head_;
free_entry_list_head_ = entry->next;
static_cast<T*>(this)->FreeEntry(entry->handle);
delete entry;
}
} }
// True if one or more batches are still pending on the GPU. // True if one or more batches are still pending on the GPU.
@ -159,6 +150,21 @@ class BaseFencedPool {
free_entry_list_head_ = entry; free_entry_list_head_ = entry;
} }
void FreeAllEntries() {
// Run down free lists.
while (free_batch_list_head_) {
auto batch = free_batch_list_head_;
free_batch_list_head_ = batch->next;
delete batch;
}
while (free_entry_list_head_) {
auto entry = free_entry_list_head_;
free_entry_list_head_ = entry->next;
static_cast<T*>(this)->FreeEntry(entry->handle);
delete entry;
}
}
VkDevice device_ = nullptr; VkDevice device_ = nullptr;
private: private: