Commit 7e0a0360 by Ben Clayton

VkQueue: Destruct the object.

We were never destructing VkQueues, but were freeing the underlying memory. Bug: b/133127573 Change-Id: Id6d9f615428073adad7267dd1bd48ced17f1b433 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/31592Tested-by: 's avatarBen Clayton <bclayton@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent 8546d4e7
...@@ -79,7 +79,7 @@ void Device::destroy(const VkAllocationCallbacks* pAllocator) ...@@ -79,7 +79,7 @@ void Device::destroy(const VkAllocationCallbacks* pAllocator)
{ {
for(uint32_t i = 0; i < queueCount; i++) for(uint32_t i = 0; i < queueCount; i++)
{ {
queues[i].destroy(); queues[i].~Queue();
} }
vk::deallocate(queues, pAllocator); vk::deallocate(queues, pAllocator);
......
...@@ -81,7 +81,7 @@ Queue::Queue() ...@@ -81,7 +81,7 @@ Queue::Queue()
queueThread = std::thread(TaskLoop, this); queueThread = std::thread(TaskLoop, this);
} }
void Queue::destroy() Queue::~Queue()
{ {
Task task; Task task;
task.type = Task::KILL_THREAD; task.type = Task::KILL_THREAD;
...@@ -91,8 +91,6 @@ void Queue::destroy() ...@@ -91,8 +91,6 @@ void Queue::destroy()
ASSERT_MSG(pending.count() == 0, "queue has work after worker thread shutdown"); ASSERT_MSG(pending.count() == 0, "queue has work after worker thread shutdown");
garbageCollect(); garbageCollect();
renderer.reset(nullptr);
} }
VkResult Queue::submit(uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence) VkResult Queue::submit(uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence)
......
...@@ -37,14 +37,13 @@ class Queue ...@@ -37,14 +37,13 @@ class Queue
public: public:
Queue(); Queue();
~Queue() = delete; ~Queue();
operator VkQueue() operator VkQueue()
{ {
return reinterpret_cast<VkQueue>(this); return reinterpret_cast<VkQueue>(this);
} }
void destroy();
VkResult submit(uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence); VkResult submit(uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence);
VkResult waitIdle(); VkResult waitIdle();
#ifndef __ANDROID__ #ifndef __ANDROID__
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment