More vulkan shutdown fixes

This commit is contained in:
Henrik Rydgard 2017-05-07 11:08:09 +02:00
parent ff6fcc9179
commit d4e1fc8d93
3 changed files with 17 additions and 12 deletions

View File

@ -27,6 +27,10 @@ VulkanPushBuffer::VulkanPushBuffer(VulkanContext *vulkan, size_t size) : device_
assert(res);
}
VulkanPushBuffer::~VulkanPushBuffer() {
assert(buffers_.empty());
}
bool VulkanPushBuffer::AddBuffer() {
BufInfo info;
@ -63,6 +67,15 @@ bool VulkanPushBuffer::AddBuffer() {
return true;
}
void VulkanPushBuffer::Destroy(VulkanContext *vulkan) {
for (BufInfo &info : buffers_) {
vulkan->Delete().QueueDeleteBuffer(info.buffer);
vulkan->Delete().QueueDeleteDeviceMemory(info.deviceMemory);
}
buffers_.clear();
}
void VulkanPushBuffer::NextBuffer(size_t minSize) {
// First, unmap the current memory.
Unmap();
@ -254,6 +267,7 @@ void VulkanDeviceAllocator::Free(VkDeviceMemory deviceMemory, size_t offset) {
// Okay, now enqueue. It's valid.
FreeInfo *info = new FreeInfo(this, deviceMemory, offset);
// Dispatches a call to ExecuteFree on the next delete round.
vulkan_->Delete().QueueCallback(&DispatchFree, info);
}

View File

@ -23,19 +23,9 @@ class VulkanPushBuffer {
public:
VulkanPushBuffer(VulkanContext *vulkan, size_t size);
~VulkanPushBuffer();
~VulkanPushBuffer() {
assert(buffers_.empty());
}
void Destroy(VulkanContext *vulkan) {
for (BufInfo &info : buffers_) {
vulkan->Delete().QueueDeleteBuffer(info.buffer);
vulkan->Delete().QueueDeleteDeviceMemory(info.deviceMemory);
}
buffers_.clear();
}
void Destroy(VulkanContext *vulkan);
void Reset() { offset_ = 0; }

View File

@ -162,6 +162,7 @@ GPU_Vulkan::~GPU_Vulkan() {
delete textureCacheVulkan_;
delete pipelineManager_;
delete shaderManagerVulkan_;
delete framebufferManagerVulkan_;
}
void GPU_Vulkan::CheckGPUFeatures() {