18 queue._queue = VK_NULL_HANDLE;
19 queue._queueFamily =
nullptr;
26 queue._queue = VK_NULL_HANDLE;
27 queue._queueFamily =
nullptr;
34 const std::vector<VkSemaphore>& signalSemaphores,
35 const std::vector<VkSemaphore>& waitSemaphores,
36 const std::vector<VkPipelineStageFlags>& waitDstStageMasks,
37 VkFence fence)
const {
39 LUG_ASSERT(waitSemaphores.size() == waitDstStageMasks.size(),
"waitDstStageMasks should be the same size as waitSemaphores");
41 VkCommandBuffer vkCommandBuffer =
static_cast<VkCommandBuffer
>(commandBuffer);
43 const VkSubmitInfo submitInfo{
44 VK_STRUCTURE_TYPE_SUBMIT_INFO,
46 waitSemaphores.size() > 0 ? (uint32_t)waitSemaphores.size() : 0,
47 waitSemaphores.size() > 0 ? waitSemaphores.data() :
nullptr,
48 waitDstStageMasks.size() > 0 ? waitDstStageMasks.data() :
nullptr,
51 signalSemaphores.size() > 0 ? (uint32_t)signalSemaphores.size() : 0,
52 signalSemaphores.size() > 0 ? signalSemaphores.data() :
nullptr 58 std::lock_guard<std::mutex> submitGuard(
_mutex);
59 result = vkQueueSubmit(
_queue, 1, &submitInfo, fence);
62 if (result != VK_SUCCESS) {
63 LUG_LOG.error(
"Queue::submit: Can't submit command buffer {}", result);
74 std::lock_guard<std::mutex> submitGuard(
_mutex);
75 result = vkQueueWaitIdle(
_queue);
78 if (result != VK_SUCCESS) {
79 LUG_LOG.error(
"Queue::waitIdle: Can't wait for queue work {}", result);
#define LUG_ASSERT(assertion, message)
Queue & operator=(const Queue &)=delete
const QueueFamily * _queueFamily
bool submit(const CommandBuffer &commandBuffer, const std::vector< VkSemaphore > &signalSemaphores={}, const std::vector< VkSemaphore > &waitSemaphores={}, const std::vector< VkPipelineStageFlags > &waitDstStageMasks={}, VkFence fence=VK_NULL_HANDLE) const
const QueueFamily * getQueueFamily() const
Queue(VkQueue queue=VK_NULL_HANDLE, const QueueFamily *queueFamily=nullptr)