MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / flush_command_buffer_impl

Method flush_command_buffer_impl

framework/core/device.h:566–600  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

564
565template <vkb::BindingType bindingType>
566inline void Device<bindingType>::flush_command_buffer_impl(
567 vk::Device device, vk::CommandBuffer command_buffer, vk::Queue queue, bool free, vk::Semaphore signal_semaphore) const
568{
569 if (command_buffer)
570 {
571 command_buffer.end();
572
573 vk::SubmitInfo submit_info{.commandBufferCount = 1, .pCommandBuffers = &command_buffer};
574 if (signal_semaphore)
575 {
576 submit_info.setSignalSemaphores(signal_semaphore);
577 }
578
579 // Create fence to ensure that the command buffer has finished executing
580 vk::Fence fence = device.createFence({});
581
582 // Submit to the queue
583 queue.submit(submit_info, fence);
584
585 // Wait for the fence to signal that command buffer has finished executing
586 vk::Result result = device.waitForFences(fence, true, DEFAULT_FENCE_TIMEOUT);
587 if (result != vk::Result::eSuccess)
588 {
589 LOGE("Detected Vulkan error: {}", vkb::to_string(result));
590 abort();
591 }
592
593 device.destroyFence(fence);
594
595 if (command_pool && free)
596 {
597 device.freeCommandBuffers(command_pool->get_handle(), command_buffer);
598 }
599 }
600}
601
602template <vkb::BindingType bindingType>
603vkb::core::HPPQueue const &Device<bindingType>::get_queue_by_flags_impl(vk::QueueFlags required_queue_flags, uint32_t queue_index) const

Callers

nothing calls this directly

Calls 4

endMethod · 0.80
to_stringFunction · 0.50
submitMethod · 0.45
get_handleMethod · 0.45

Tested by

no test coverage detected