Skip to content

Commit d8e5751

Browse files
committed
video: free command buffers when destroyed
Signed-off-by: Ali Cheraghi <alichraghi@proton.me>
1 parent 25ef700 commit d8e5751

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/nbl/video/CVulkanCommandBuffer.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ using namespace nbl;
99
using namespace nbl::video;
1010

1111

12+
nbl::video::CVulkanCommandBuffer::~CVulkanCommandBuffer()
13+
{
14+
const auto* vulkanDevice = static_cast<const CVulkanLogicalDevice*>(getOriginDevice());
15+
auto* vk = vulkanDevice->getFunctionTable();
16+
17+
const auto* vulkanCmdPool = IBackendObject::device_compatibility_cast<const CVulkanCommandPool*>(getPool(), getOriginDevice());
18+
assert(vulkanCmdPool);
19+
20+
vk->vk.vkFreeCommandBuffers(vulkanDevice->getInternalObject(), vulkanCmdPool->getInternalObject(), 1, &m_cmdbuf);
21+
out_of_order_dtor();
22+
}
23+
1224
const VolkDeviceTable& CVulkanCommandBuffer::getFunctionTable() const
1325
{
1426
return static_cast<const CVulkanLogicalDevice*>(getOriginDevice())->getFunctionTable()->vk;

src/nbl/video/CVulkanCommandBuffer.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,7 @@ class CVulkanCommandBuffer final : public IGPUCommandBuffer
270270
}
271271

272272
private:
273-
virtual ~CVulkanCommandBuffer() final
274-
{
275-
out_of_order_dtor();
276-
}
273+
~CVulkanCommandBuffer();
277274

278275
const VolkDeviceTable& getFunctionTable() const;
279276

0 commit comments

Comments
 (0)