Vulkan: Make CommandPool a wrapped type.
This faciliatates an upcoming change to treat all handle types
uniformly with respect to releasing.
BUG=angleproject:1684
Change-Id: I632262a57b3a447cf4999c28ab359fe931549576
Reviewed-on: https://chromium-review.googlesource.com/442674
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/RendererVk.cpp b/src/libANGLE/renderer/vulkan/RendererVk.cpp
index e57514f..97cd393 100644
--- a/src/libANGLE/renderer/vulkan/RendererVk.cpp
+++ b/src/libANGLE/renderer/vulkan/RendererVk.cpp
@@ -93,7 +93,6 @@
mQueue(VK_NULL_HANDLE),
mCurrentQueueFamilyIndex(std::numeric_limits<uint32_t>::max()),
mDevice(VK_NULL_HANDLE),
- mCommandPool(VK_NULL_HANDLE),
mHostVisibleMemoryIndex(std::numeric_limits<uint32_t>::max()),
mGlslangWrapper(nullptr)
{
@@ -108,12 +107,7 @@
}
mCommandBuffer.reset(nullptr);
-
- if (mCommandPool)
- {
- vkDestroyCommandPool(mDevice, mCommandPool, nullptr);
- mCommandPool = VK_NULL_HANDLE;
- }
+ mCommandPool.reset(nullptr);
if (mDevice)
{
@@ -423,9 +417,10 @@
commandPoolInfo.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
commandPoolInfo.queueFamilyIndex = mCurrentQueueFamilyIndex;
- ANGLE_VK_TRY(vkCreateCommandPool(mDevice, &commandPoolInfo, nullptr, &mCommandPool));
+ mCommandPool.reset(new vk::CommandPool(mDevice));
+ ANGLE_TRY(mCommandPool->init(commandPoolInfo));
- mCommandBuffer.reset(new vk::CommandBuffer(mDevice, mCommandPool));
+ mCommandBuffer.reset(new vk::CommandBuffer(mDevice, mCommandPool.get()));
return vk::NoError();
}