Lugdunum  0.1.0
CommandPool.cpp
Go to the documentation of this file.
2 
5 
6 namespace lug {
7 namespace Graphics {
8 namespace Vulkan {
9 namespace API {
10 
11 CommandPool::CommandPool(VkCommandPool commandPool, const Device* device, const Queue* queue) : _commandPool(commandPool), _device(device), _queue(queue) {}
12 
14  _commandPool = commandPool._commandPool;
15  _device = commandPool._device;
16  _queue = commandPool._queue;
17 
18  commandPool._commandPool = VK_NULL_HANDLE;
19  commandPool._device = nullptr;
20  commandPool._queue = nullptr;
21 }
22 
24  destroy();
25 
26  _commandPool = commandPool._commandPool;
27  _device = commandPool._device;
28  _queue = commandPool._queue;
29 
30  commandPool._commandPool = VK_NULL_HANDLE;
31  commandPool._device = nullptr;
32  commandPool._queue = nullptr;
33 
34  return *this;
35 }
36 
38  destroy();
39 }
40 
41 bool CommandPool::reset(bool releaseRessources) const {
42  VkResult result = vkResetCommandPool(static_cast<VkDevice>(*_device), _commandPool, releaseRessources ? VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT : 0);
43 
44  if (result != VK_SUCCESS) {
45  LUG_LOG.error("CommandPool: Can't reset the pool: {}", result);
46  return false;
47  }
48 
49  return true;
50 }
51 
53  if (_commandPool != VK_NULL_HANDLE) {
54  vkDestroyCommandPool(static_cast<VkDevice>(*_device), _commandPool, nullptr);
55  _commandPool = VK_NULL_HANDLE;
56  }
57 
58  _device = nullptr;
59  _queue = nullptr;
60 }
61 
62 } // API
63 } // Vulkan
64 } // Graphics
65 } // lug
CommandPool & operator=(const CommandPool &)=delete
#define LUG_LOG
Definition: Logger.hpp:73
bool reset(bool releaseRessources=false) const
Definition: CommandPool.cpp:41